Robo Ashley
My friend Ashley Shannon spent the Fall 2007 semester in Cordoba, Argentina. I though it would be fun to ‘have her to dinner’ with some friends and I. I wanted to make it more interactive than just setting a laptop with Skype on the table. So I set about building a mechanism by which she could control a web cam while she was connected to via Skype.
User Interface
Ashley had no knowledge of this project and I wanted to keep it a surprise so I set about creating an interface that would require minimal set-up on her end. I decided to to make the web cam controllable via a simple web interface which could be used from any of the major browsers. As you can see by looking at this page, I’ve done some web design before. However, the component that was missing was how to link a web page with my Freescale HC12 microcontroller. I accomplished this with the PHP Serial class (note: for a later project I found the PHP Serial Extension by TheByteWorks. This was more responsive than the PHP Serial Class). See the interface here. Obviously this is not hooked up to anything, but useful as a reference to see how I designed the web interface.
Once I was able to output data from the serial port by calling a php file, I set about creating the rest of the interface. I used a Javascript class called jQuery to allow the website to call the php file without having to reload the page for every command. I was able to call the php script using jQuery’s $.get() function. The rest of the interface was pretty standard HTML / CSS with a sweet image I made in Photoshop.
Lego Turret
For the mechanical part of the project, I decided to use Legos. I built a turret using the design I had used as a kid. This was largely borrowed from the Lego Technic Space Shuttle. The Turret allowed the webcam to turn right/left/up/down using two Lego 9V DC Motors. I borrowed my friend’s iSight webcam and built a Lego structure around it so that I could mount it to the turret.
DC Motor Controller
With the user interface and turret mechanism made, I needed to create a link between the two. I used my handy Freescale HC12 Development Board. We use this kit for school so I was already very familiar with it. I wrote some software in C which would take in a command from the serial port of the microcontroller and then switch four GPIO pins for a certain period of time according to the command received. I opted for the serial command to include the amount of time the motor was to move. It would have been better to have some kind of rotational sensor so that you could pass in the amount the motor should turn in degrees, but I didn’t have the parts necessary.
Since my microcontroller can only provide ~20mA of current, I needed a way to drive the 9V DC Lego motors. I asked my microcontrollers professor about the best way to do this. He told me about TI’s L293 chip which implements an H-Bridge on a chip (schematic below). I only had an L293 and not an L293D chip so I had to add a few diodes to the circuit to allow me to change the polarity of the motors.
Putting it all Together
The night for dinner came and RoboAshley worked well. The interface came up with no problems on Ashley’s end and she was able to quickly get a hang of controlling the webcam (see video).
Future Improvements
There are a few ways I would improve this in the future.
- Use an L293D chip chip instead of an L293 chip to simplify the circuit design
- Rotational sensors on the motors to have more precise/consistent control over motor motion
- Streaming audio/video straight into the web interface

Write a comment