Monday, 23 April 2012

It's Alive!

After a good few hours spent bringing the bits together yesterday MmBot took her (yes - it's a girl robot - will be pink) first steps. Today I hooked up the motors at full power and got blue tooth working again, and it was a big day!

I got to work and turned things on. Yesterday night I'd actually wired up the motors on full power but hadn't really had to test them yet as they were too uncontrollable! Today though I started work on getting the blue tooth back online. First task was to wire the modem to the prototype board:

Blue Tooth modem on MmBot

Now I did have this working, but unfortunately the blue tooth modem had stopped responding. It was powered and connected to the pc, but nothing was receiving or transmitting over the serial port. Thankfully though my multimetre is working again. After much fiddling I discovered and fixed...
  • Serial transmit wire had disconnected inside the robot
  • I had the wrong pins connected on the Arduino
  • Transmit and receive were the wrong way round
  • The ready-to-send and ready-to-receive weren't connected together
Apparently when you unplug the Arduino from USB, something resets somewhere and you stop being able to transmit back to pc. This might have been Arduino side, or it might have been hyper terminal, or the blue tooth dongle drivers. Turning it off and on again solves the issue though so I guess I'll never know the root cause :)

Anyway, after an hours fiddling the blue tooth is working again and I write the code to allow me to turn the motors on and off using the keyboard. Sending '1' or '2' turns left motor on/off. Sending '3' or '4' turns right motor on/off. It works like a crazy crazy dream:

Pretty crazy. Unfortunately I also manage to blow 3 transistors in the process. I decide that until I have my proper motor controller, and generally have better control over the robot itself, I'll switch down to half power. 12V down to 6V later and my transistors are no longer blowing, and MmBot moves at a more controllable speed. One of the wheels keeps coming off though, as the screw keeps coming out for some reason. I fix it back on a couple of times, then get bored and glue it on with epoxy resin instead!

At this point I made some tweaks to the Arduino code. First up, I change the interface to be 'forwards', 'left' or 'right', rather than direct control over the motors. This makes it much easier to steer. Then I make it that getting a signal just prolongs how long a motor stays active, meaning that as soon as I stop telling it to move, MmBot stops moving and is less likely to endanger itself or others.

Time to attach some sensors. The sensor platform I built earlier still works, so I use a bit of glue to get it a little more solid, then tape it onto the top of the robot. It's easy to wire in as the prototype board gives access to all the pins. Here's MmBot showing off her sensors:

MmBot showing off her sensors
As things were so easy to wire up, very soon I have the ability to control the platform using my key board, and request a ping or motion sensor reading, which gets sent as text back to hyper terminal. Now I have total control over MmBot using my keyboard and can get all the sensor data it has available. Time for a test drive...

And there you have it - MmBot is alive! I'm not sure what to do next, although it depends partially on when things arrive in the post. The obvious next step is to get her more automated - start to build up a brain on the PC that controls the robot and can wonder around and be cute all by itself. The big question is whether that's really possible before I connect up eyes (aka LinkSprite VGA cameras with JPEG compression), so they may take priority fairly soon. On top of that is building the proper sensor platform which we intend to model in 3dsmax and send it off to get 3d printed! Or maybe it'll be something else by tomorrow morning...


No comments:

Post a Comment