Hi! I am developing a project where there is a game and it is controlled by the real bike through the use of sensors. I am using a potentiometer for the handlebar but when turning the handlebar, the output in the game is not exact on the turn in the bike's handlebar.
I don't know if the sensor I used is the problem or the code below. Please help.
Is there any other sensor as alternative to this?
Hi,
Is the pot linear or log?? in other words does it show even resistance along all the track?, if the pot wiper is in the centre postion then does that equal 1/2 the resistance? If it's log as used for volume control then the track will not be at all even, the first half of the turn may show little resistance where as the last quarter will show most!!
You can easy test this with a DMM... or a simple bit of code to sent pot_val to serial monitor, etc. Just check the reading for centre position, it should be about 5K, most pots rotate about 270 deg.
I don't know what is the range of rotation when turning the potentio.
But I think it is 270deg.
When testing the potentiometer. I got an output value ranging from -7 deg to +7 deg which is right for controlling the game.
When attaching the pot to the bike. I calibrate it and get the center.
But when testing it, I cannot properly control the game. Maybe the problem is when attaching it to the bike. It is not properly attached.
But when testing it, I cannot properly control the game. Maybe the problem is when attaching it to the bike. It is not properly attached.
Have you made close observations to see if there is a difference of how the pot is rotated on the bike vs during your off bike testing? How do the on bike and off bike pot outputs differ?
Hi, how have you got the pot connected to the handle bars?
It looks like a belt, is it a toothed belt to keep in sync.
After you have turned the bars from straight to left and back, is the program still showing straight ahead after you return to straight?
The other thing is, has the program got the speed to keep up with the movements?
When you turn from centre to say left quickly, does the program follow as quickly?
Move the bars very slowly and see if it keeps up.
The pot may also be noisy, is it a new pot, you may need to put a 0.1uF capacitor from the centre wiper of the pot to the neg or gnd end of the pot.
Yes, I am planning to use more accurate sensor than potentiometer.
BTW, thanks for your suggestion.
Please explain further information about you're saying.
To compute for the heading using those sensors, you need to use some trigonometry. The output from the accelerometer is always based on earth's gravitational pull.