Go Down

Topic: Gyro readings (Read 1 time) previous topic - next topic


Hi guys, I'm building a self balancing unicycle, and I'm using Arduino as the brain :).
I'm having a problem with the gyro reading.
I'm getting good reads until I turn a led on with pwm (pin 5), when I do that, the gyro start sending a value that is different than the normal resting value. This should have something to do with the current drop, but I have no idea how to solve this...


PS: I'll post some pics and vids after it's done...(you can see the project @ sites.google.com/site/ptunicycle/)


Code and a schematic would help us to help you...
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.


Dec 08, 2009, 07:47 pm Last Edit: Dec 08, 2009, 08:38 pm by Ramen Reason: 1

Here it is an image.
The schematic is very simple

The code is just an analogRead(0) and analogWrite(5,x)

Another thing, I tried it with digitalWrite, and it doesn't affect the gyro readings  :-/


Where's your inline resistor for the LED?


Hummm, i forgot that, how many ohms should be the resistor??


I'm trying to point you at a good source at arduino.cc but surprisingly it's not as easy to find as I first thought.

220 Ohm is a common value.

You can calculate it based on max current the Arduino can source: 40 mA.  @ 5V = 125 Ohm <- this is the resistor value for which you'd expect Arduino the output to burn out.

Hope you haven't damaged your Arduino by running this thing without a resistor up to now.


Thanks, after you point me out to the resistor i tried it, but it keeps affecting my gyro readings, maybe my ground value is not 0v when i turn on the led or something like that...


Dec 10, 2009, 07:04 pm Last Edit: Dec 10, 2009, 07:06 pm by retrolefty Reason: 1
how many ohms should be the resistor??

Not too critical. anything from 200 to 1,000 ohms will let you see a red LED pretty much and still not stress the Arduino output pin. Different color or higher power LED's are a different situation.



Try it with the LED ground pin floating (no current draw), but keep the PWM code in place.  Might help you understand if the problem is rooted in h/w or s/w.

Go Up