Steering Wheel with McroBit?

Hi! So I’ve been thinking about something. I recently made a replica of a f1 steering wheel! And I know the microBit can connect to the phone and has a tilt sensor! So I was asking if it was possible to put it on the steering wheel, connect it to the phone and use the tilt sensor as input for racing games aswell as the 2 buttons (For gas, brake, nitrous,…)Any suggestions?

@DahbixLP, well you could use the accelerometer for sure, maybe hotwire some plastic pads to buttons connected to the microbit to act as pedals (maybe buttons A and B?). For nitro maybe push the microbit forward when a meter is full. Hope this helps.

Well idk if it is possible to give the phone inputs with it… Thats my main question.

Well I don’t really know about that, especially considering that I’ve never connected a mobile device to a Micro:bit, but how about using something like a KITRONIK GAME or GAME 64, since they have a bigger potential for controls and the GAME 64 has an 8x8 ZIP LED matrix, meaning that you can add some differentiation to your game. Connecting a microcontroller such as the Micro:bit is probably going to be a very inefficient process and it would be better if you just used hardware to run the code more smoothly and with more versatility, like many of us on the forum do with Arcade and the Meowbit, Pygame and so on.

The micro:bit can “speak bluetooth”, so it could act as a keyboard, gamepad, etc. I’m in the process of developing an extension for the V2 micro:bit that can do some of this type of stuff, but it won’t be complete for some time.

As I was working on it I found existing extensions (for the V1) that appeared to do this too. It doesn’t look like they’ve been updated to work with the newest version of MakeCode and I don’t think they work now, but they are:

I suspect they didn’t work on all devices either. For example, I think iOS security requirements prevent Apple devices from working with some things like this).

Bill

The existing Bluetooth extensions didn’t work anymore, so I created a new one.
Here’s a demo showing several ways it can be used: https://youtu.be/n4J5GN72N_4

The extension only works with micro:bit v2. You can see details about the extension here: https://makecode.microbit.org/pkg/bsiever/microbit-pxt-blehid

It may be able work with games using the keyboard and mouse emulation. It also has gamepad emulation, but many games don’t support the specific gamepad it emulates. iOS doesn’t recognize the gamepad at all, but it works for some Android games.

Actually nevermind! I can just lay the microbit ontop and it should work! Would still be cool if you/anyone could make it by turning

Thanks a lot! Could you send me the code of the mouse one? (The first one) And if you have any spare time maybe make it instead of leaning into turning! That would help a lot! Take your time I dont need it right now!
(I made a Steering Wheel and I want to play games that control via mouse control! The max turn angle of the thing should be 90° in each direction (maybe 100-120) )
Anyway thank you very much!
Regards Dahbix

I might have a little game for my comeback (; (I had a quite long break but I wont be back to coding everyday but I might help with some stuff)

Hi @DahbixLP ,

If the micro:bit is going to be placed on the middle of the steering wheel, you can use the atan2 function with the accelerometer x and y to determine how much it’s rotated.

Here’s an example that shows the angle of rotation (in degrees) on the screen: https://makecode.microbit.org/_HWJ4Fr5qVebU . When you hold the micro:bit in front of you with the USB connector pointed straight up, it’s at 0 degrees. If you rotate it so the USB connector is straight to the right, that’s 90 degrees. Pointing the USB connector straight to the left is -90 degrees.

I’m not sure how your game works. You may want to try to see if changing just the mouse x with the blocks I created allows you to steer. You can probably get it to do something with just two of the new blocks: the bluetooth mouse service block in start and the move mouse x by _ and y by _ blocks, with the x controlled by the angle. (You may have to multiply or divide the angle a bit to get an x value that’ll work).

I probably won’t be able to figure out how to get your game to work for you. If you want to get it to work, you’ll have to do a little experimentation.

Good luck! If you make any progress, make a post and let people know!

Hello! This one works so great with my microbit! I have a little question though… When I use the exact same code on my meowbit (Makecode Arcade) it does not say 0 when centered and it makes no sense because the rotating does something but not in the way you want… Heres what I made code wise also theres x,y and z so idk what to do… (I tried around with the x,y and z a bit so dont wonder why its all weird!)
image

First, make sure you know which combo of x, y, and z you need. Try x and y, x and z, and y and z until you’re sure which two are for the way you are turning it. (It’s probably x and y)

It may depend on how the accelerometer sensor is installed on the Meowbit. I’d suggest either:

  1. Subtract something from the result to correct it. (For example, if it’s showing 10 degrees, just subtract 10 from the result of the 57.29x block.
  2. If you know which value is different from the way they behave on the microbit (x or y), you could add/subtract to correct that before it is given to atan2

I hope that helps!
Bill

Hello! I have fixed this in my new topic called “Meowbit Tilt Control” take a look at it as I need help with making a tachometer that displays a fictional speed!