Thursday, December 27, 2012
For Christmas, I got an Getting Started with Arduino Kit. You write software in the C/C++ (a language I know well) to program the Arduino Micro Controller.
My first project extended from Blink. It was basically a binary clock using six LEDs to show the time (in binary). The clock had three display modes: Hours, Minutes and Seconds. You control the display mode by clicking the first button to cycle through each mode. You can also hold down both buttons to set the clock. That zeros the seconds. By depressing button two, you advance the hours. Pressing button one again takes you to minutes, which you advance again using button two. Finally, you return it to the running mode by pressing the first button again. It's an interesting experience, and I went through several different gyrations on how to use the buttons to set the clock, and to use the LEDs to indicate which mode you were in before I arrived on the ones I used.
I had an Erector Spykee - Micro Robot that is operated by remote control that I got a few years back for Christmas that I wasn't using. I decided to take it apart to and learned how to connect up the IR receiver inside it. After a bit of playing I figured out that the red wire goes to +5V, the yellow to Ground, and the green wire has the signal. I tried to read the signal using the analog input, not realizing how the IR worked. I managed to read it anyway, and figured out to some degree how to decode the signals. After a while, I looked around and found this library, which I then augmented to read the IR signals generated by the silly little remote. That gives me two continuous buttons and four toggle buttons which I can now use to control my Arduino remotely. I may have to work that into my first useful project to give me some override controls. The robot also had a few LEDs, a small motor with a forward and reverse drive, and an 8ohm speaker that I will be using with my new toy. I can use the motor later when I need to make a mobile robot.
Now I'm planning my first "useful" project. My plan is to create a device that, upon sensing the remote control signal that turns the TV on, will tell my children to finish their homework. It can use the IR sensor to detect the "power on signal" for the TV. Once that is detected, I'll send a WAV file to the speaker. After an hour, it will send out another signal to turn the TV off again.
To do that requires a bit of finagling. The Arduino has a Pulse Width Modulated signal that gives be eight bits of signal control, but I have to add a low-pass filter to the circuit to turn that into a voltage to control the speaker. This web-site helped me to figure out what resistor/capacitor combination to work with during my last shopping trip at Radio Shack While I was there, I picked up a $14.00 SD Card Shield so I could store the audio of me telling my kids to finish their homework first on an SD card. That way, I didn't have to encode it all, but could read it off the card, and use different audio messages as I needed.
One other thing that I'll need for this project is an IR transmitter, so I can send the Power Off signal to the TV after an hour, and tell my kids to go outside and play. This should be a hoot. I stopped by Best Buy to purchase a cheap SD card, and found a $5 calculator that I'm going to take apart for the LCD display. I'll probably need a controller for that display. I think that will be used in my second project. The cool thing about this first project is that I can build it in pieces. I first did the IR stuff. Next I'll build the speaker/filter circuit and play with that. Then I'll play around with the SD card reader. And finally, I'll put it all together.
What a cool toy.