Pages: [1]   Go Down
Author Topic: Gyro readings  (Read 801 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys, I'm building a self balancing unicycle, and I'm using Arduino as the brain smiley.
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/)
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25898
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code and a schematic would help us to help you...
Logged

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset



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  :-/
« Last Edit: December 08, 2009, 02:38:38 pm by Ramen » Logged

Waterloo, Canada
Offline Offline
Full Member
***
Karma: 1
Posts: 242
Engineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Where's your inline resistor for the LED?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Waterloo, Canada
Offline Offline
Full Member
***
Karma: 1
Posts: 242
Engineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

« Last Edit: December 10, 2009, 01:06:30 pm by retrolefty » Logged

Waterloo, Canada
Offline Offline
Full Member
***
Karma: 1
Posts: 242
Engineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: