Building My Own Driving Simulator- Research

in STEMGeeks3 years ago

The first step towards completing this project is researching so I don't spend extra money on stuff I won't use. The car, and shifter and PC I'm not too worried about, but what I am worried about is getting the pedals and wheel to work.

For the pedals, I've thought of two ways I can get this to work, using either a pressure sensor connected to an arduino or a pi or a gyroscope connected to an arduino or a pi. I believe that using a PI might be more expensive but easier while the arduino is the exact opposite, harder but cheaper.

A pressure sensor might be easier, but I think that most are going to be too sensitive for my need. I'd need one that I can tune to accept a lot of pressure and that might get hard. Plus as they get pushed around a lot, they might slowly degrade. I also wasn't able to find them easily online so I stopped looking into this option too much for the time being and decided to focus my attention on the gyroscope plan.

Screen Shot 2021-04-11 at 12.36.44 AM.png
Picture from amazon

I was able to easily find some gyroscopes for the pi and arduino: https://www.amazon.com/Aokin-Accelerometer-Gyroscope-Converter-Raspberry/dp/B07PSCB75V/ref=sr_1_4?dchild=1&keywords=MPU+6050&qid=1618117255&sr=8-4. I do like how its cheap and I get multiple of them so if I break one I'm not in too much trouble. I also ran into a few guides on how to use them on the internet for the pi, and the arduino. What I wasn't able to easily find was if I could plug multiple of one into a single pi/arduino or if each would need its own individual one. Cost is a big thing here and if I need to buy 4 total devices, that can get a bit preventative(1 for gas, 1 for break, possibly 1 for clutch if I find a car with one, and 1 for steering wheel). I'll possibly order one of these soon since they are cheap enough that I'm cool getting them even if I don't do anything with them.

My plan with them for the pedals is to set them up, and whenever they first turn on each time, set that as the 0 point. As the driver presses the pedal in, they will start reporting different numbers. I might need to have the driver do a calibration at the start each time(or do it once and save those numbers, but I'm kind of worried they might get shifted with since they are so small) to find the 0 point and the max point. From there, I can calculate how much the driver is pressing on the pedal, and send that data to the game, ignoring super tiny amounts from 0 to account for regular vibration of a person's foot or just the car shaking because of stuff happening around it.

As for the steering wheel I really have no idea on how to tackle it. I do think that I can use the gyro here too, and use the starting point as 0, and somehow figure out how much the driver has turned it. Because I want to preserve full range of motion for the wheel(3 complete turns from one side to another on most cars) it's going to be harder than if I limited the amount the wheel could be turned like a lot of sims do right now(the last one I used only let you turn so much in each direction, not even a full turn). This definitely seems like its going to be the hardest part of what I've got to do, especially since its the part with the most free range of motion of all of them and that means keeping the wires nice and tidy too. But for now, we can assume I'll figure out a way because I will no matter how jenky it is. Worst case, we limit the range of motion and it'll be like the sims I know and hate.

I already own a pi(though its being used so I might have to move some of the more important stuff on it over onto a VPS) so testing stuff out for that won't bee too hard, but I'd need to purchase an arduino soon in order to experiment with that. The starter pack is quite pricy at $75(I got my pi 4 8 gb kit for about $100), unless I get an off brand one like the ELEGOO UNO which costs about $40 for a starter kit. I might just go with the actual one just because its more widely known and probably has better support.

I also did run into the arduino nano and need to figure out the difference between them as well. A smaller device could be the saving grace here since I do have limited space to work with, and since people's legs are going to be down there, I don't wan them to have to worry about hitting stuff. I also wonder if I could do this stuff on the pi pico. It might be worth it to order one of that as well, as its just $4 for one(though a search on Amazon showed they were selling for $10, and its not in stock at my local Microcenter).

Check out the rest of this series here(linked in reverse chronological order):

https://hivel.ink/hive-163521/@rishi556/building-my-own-driving-simulator