Go Down

Topic: Gyro readings (Read 987 times) previous topic - next topic

Ramen

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...

Thanks

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

AWOL

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.

Ramen

#2
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  :-/

Mitch_CA

Where's your inline resistor for the LED?

Ramen

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

Mitch_CA

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.

Ramen

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...

retrolefty

#7
Dec 10, 2009, 07:04 pm Last Edit: Dec 10, 2009, 07:06 pm by retrolefty Reason: 1
Quote
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.

Lefty


Mitch_CA

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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy