Wednesday, September 29, 2010

Lemons v1.3, now Bluetooth enabled and with a horn!

I decided to bump up the version number by 0.2. 0.1 for adding remote control via Bluetooth, and 0.1 for having a kick ass horn! I added a Bluetooth serial modem to Lemons that can be purchased at SparkFun. Getting it to pair with my laptop was no problem, and I was quickly able to add code to Lemons that can listen for commands via serial. This resulted in a simple but fun start to remote control where I would type a key like 'w', and Lemons would move forward for one second. My goal was to have something more responsive however, and I wanted to have it on my Droid. So, I wrote my first Android application. I found this link to be quite helpful in setting Bluetooth up on the Android side. I wanted to have a touch screen interface that reminded me of the old remote controls I used to use for my RC cars when I was a kid. My plan was to simulate those vertical and horizontal joysticks using sliding seekbars, one horizontal and one vertical. Unfortunately, the Android SDK does not come with a vertical seekbar, but I found one on Google Groups that worked nicely. I also added buttons to toggle the lights on and off and to beep the newly added piezo buzzer I mounted towards the front of Lemons. My next step is to add a camera to Lemons and have the video feed back to my Droid.

Wednesday, September 22, 2010

Lemons v1.1, now with photocells

Erin has named the robot "Lemons". I think it is a fine name for him. For version 1.1, I moved the 4 AA batteries up to the front and placed them horizontally. This looks much nicer and puts some much needed weight on the tires to give them more traction (thanks for the idea Ed!). It was still veering to the right, so the only solution I could come up with for now was to simply give a bit more power to the right motor to compensate. I have also added two photocell antennae to the front. A photocell is a resistor that changes its resistance based on the amount of light it is receiving. So now, Lemons is able to sense light. Using this new found sense, I created an "autonomous mode" for him. If the Wii nunchuck is disconnected for a certain number of seconds, Lemons will switch to autonomous mode and read in the current light levels of his surroundings. He will then move forward until the light levels change. If it gets significantly darker or brighter, he will back up and turn left or right based on which of his antennae sensed the light change.

Tuesday, September 21, 2010

My First Robot, v1.0!

I read up on H-bridge ICs and controlling DC motors all last week and finally decided it was time to order the parts for my first robot. It's one of those things where I was nervous the whole time thinking "did I forget something?". Cus if I did, it would mean I would have to make a second order, pay a second shipping fee, and wait a second time for the parts. I didn't want to just buy a kit and build it. I really wanted to build something I feel I could call my own. Not that it's original at all, but it's my first and it works!

The robot uses a twin motor gear box to achieve differential drive, using an H-bridge IC to control the motors from an Arduino. The first version is controlled with the Wii nunchuck, since I've already interfaced with it previously and makes a handy controller. The cool thing is, I can use this robot as a base to continue building more advanced and interesting ones. My next project is an autonomous bot that will either run from darkness or run from light.

Here are some pics of the development process:

Here I'm testing the wiring for the H-bridge IC.

Here's the twin motor gearbox, disassembled.  Instructions in Japanese!

And here's the assembled gearbox.

After some programming, I got it running fairly well.  The biggest problem I see with it is that its alignment is off, veering to the right, and the friction for the wheels ain't so great.  Overall a success however!

As a reference for myself and for anyone else interested in building something similar, here's the parts list I ordered (I ended up not using the diodes since I didn't have room for them on my board and the H-bridge has them internally already anyways):

From SparkFun

Battery Holder - 4xAA Cube $1.95 1 $1.95
H-Bridge Motor Driver 1A $2.35 3 $7.05
Capacitor Ceramic 0.1uF $0.23 10 $2.30
Diode Rectifier - 1A 50V $0.14 20 $2.80
Toy Tires - Off Road $3.95 1 $3.95
Universal Plate Set $6.95 1 $6.95
Electrolytic Decoupling Capacitors - 10uF/25V $0.45 5 $2.25
Dual Motor GearBox $10.95 1 $10.95
Mini Photocell $1.50 4 $6.00
Ball Caster Metal - 3/8" $2.95 1 $2.95

Sunday, September 12, 2010

My First Arduino Projects

I decided to take a break from working on the game to mix things up and learn some about microcontrollers, electronics, robotics, and the like. My ultimate goal is to create some kind of robot I can control with my Droid phone remotely using touch screen controls. I just think that'd be cool. But I'm totally new to this hobby, and as always it's baby steps first, so here are a series of little projects I've already done to learn some of the basics.

The neatest and hardest one is the Wii nunchuck mouse.

Before I got there, I had the Wii nunchuck controlling a servo motor and some LEDs.

This is a simple one using an RFID reader. This is the technology used when you see people hold a card or key fob up to a door to open it or when you tap your credit card on a sensor to make a purchase.

This project uses a photocell to sense how much light there is. The darker it is, the brighter the LED will be.

Pretty lights!

Saturday, September 11, 2010

New blog

I decided to start over on this blog and focus on whatever hobbies/projects I got going on at the time. It's basically an online journal for me to document and share what I've learned and the progress I've made. I've got another similar joint blog I share with my friend Chris for the project we've been working on; a 2d side scroller xbox indie game I am developing in XNA and Chris is making the art for. That's over at