Sunday, September 19, 2010

Four-Dollar Gyroscope

I got an Arduino and after tinkering a bit, I thought that I would make a Segway-type balancing thing. My first thought was to use a WiiMote, but I found out that it only had accelerometers and no gyro. Not wanting to spend $100 on a gyro shield, I thought up a low-cost version using a $4 slotted optical switch (in my case, a OBP804), a weighted wheel (which will always be weighted-side down, thanks to gravity), and a grey-scale color-wheel attached to the weighted wheel.
The gray-scale wheel was supposed to be printed on transparency (clear) paper, but I did not have it available. However, the results are spectacular! Reading the analog output, I get 3 with black, 70 at white, and linear readings throughout the gray-scale! I am sure the resolution will be much better if printed on clear plastic and resolution will be improved if a larger gray-scale range is used. (I photo-shopped three gray lines of incrementing darkness).
The optical switch has a NPN phototransistor built-in (the ones with the photodiodes probably won't work) and an infrared LED. Make sure you use a resistor on the LED, as I blew my first one (making this an $8 gyro). I will try to get the video online shortly.

 [Wiring info: I used an OPB804. The dot is on pin3! I connected pin1 to Vcc, pin2 to a resistor (I use 500 ohms to be safe), and then to ground. Pin3 I connect to Vcc via an LED (as an indicator). Pin 4 goes to my Arduino's Analog In and also to a resistor (3000 ohms) to ground. ]





1 comment:

  1. When you say "Pin 1 to Vcc" do you mean pin 1 to the 5volt pin on the Arduino? By the way, your blog is hte only reference I could find to someone using an OP's is the only reference I could find to someone using an OPB804 with an Arduino. Did you finish the project? I am curious if the Arduino/OPB804 was fast enough to keep your object upright.

    ReplyDelete