Fab
          Lab LogoFletch's Fab Academy 2014 Blog


15. Interface and Application Programming

This weeks task was, "write an application that interfaces with an input &/or output device".  For my final project I'm planning on a group / swarm of mini robots that can be used to investigate group or co-operative behaviours.  The PC control application for this needs to be able to do the following:
I'm confident with a few programming languages, but I've never used 'Processing' as a language.  So for this weeks task I decided to investigate Processing by using it for a simple UI to control the movement of a single robot.  I also used this week as a opportunity to investigate the robot hardware side of my final project slightly more.

15.01 The Hardware

After investigation from last week I've decided to use micro servo's modified for 360 degree rotation to drive the wheels of my robots.  So I modified two servos (see link here for details of the modification) and built a simple two wheeled robot to test with.  The robot is a simple PCB with two H-Bridge motor drivers for the modified servos, LED's to show the motor states and 5v serial interface for communications with the PC.

Simple Test Robot

The wheels are actually gears that I laser cut for last weeks mechanics tests.  I simply expanded the hole in the center with an 8mm drill to make a nice press fit over the servo spindle.

The H-Bridge is the ZXMHC3A01T8 from the old Fab Lab inventory.  I've created an Eagle part for this that would be nice to share, but there isn't currently an agreed method to do this.

Eagle design files here sch, brd.

15.02 The Application UI

I designed a very simple UI to control the robot.  I used the ControlP5 library for processing to implement simple controls for me.  These controls a visually a bit rectangular and basic compared to those available in other widget sets, but they are functional.

Processing UIProcessing code

In the UI above you can use the mouse to drag the cross hair around and control the direction of the robot. 
I would like to add some sensors and display the sensor states on the robot image, but this would require another board revision and I'm out of time.

Processing UI code here.  AVR code is here.

15.03 Do it in another Language

I'd like to re-implement this in python using wxWidgets.  Also in OpenFrameworks
TBC.

15.04 Other Conclusions

I'd like to add simple position sensing to the wheels on my robot.
I'd like to add motor speed control so that the robot can make a larger variety of turns.
Don't underestimate the time required to make your UI nice.


ToDo:
Re-implement in Python and wxWidgets to improve my understanding of wxWidgets
Add robot reporting actual motor states.
Add sensors that the robot can report.