Archive for May, 2010

Circuit Board Design

Over this week I’ve been working on designing PCB’s for my robot based on the arduino. the three boards i’m working on are a expansion shield to fit directly on top of the arduino, a 9 degree of freedom IMU board this a three axis manometer(HMC 5843), accelerometer(BMA 180), and gyroscope(ITG 3200), and finally an circuit to clean up the signal from ether a hall effect sensor or a photo transistor so we can use the interrupts for an odometer.

I’ve decided to use surface mount components for these circuits to minimize the space they take up and to make my self learn how to solder components this small. the arduino shield has quite a few features. it has a 16 bit multiple er with 12 of the pins directly accessible with each pin having a power and ground pin right beside it. Six of the pin’s power pins are connected to a jumper to allow for you to choose between 3.3 and 5 volts power incase you have sensors that need it(pins 10-15). Pins 6-9 of the multiplexer are connected to voltage dividers to allow you to have battery monitors for voltages up to 10 volts(you could allows change the the resistors to allow for deferent voltages). The two interrupt pins are broken out and I plan to have use them for odometers on both of the back wheels but they always could be use for one digital pin and one PWM pin. I have three digital I/O pins with corresponding power and ground ready to use for simple sensor though in future designs they may be used for more status LED’s. I have not suppled power to the PWM pin’s because the ESC of the RC car I’m using supplies it’s own voltage from two 8.4 volt Ni/Cd and can power the servo motors but will short the circuit if it is directly connected voltage  to the arduino’s power.  I have pin 10 connected to two pins to control the two steering servos on the E-maxx.  I also have an I2C  outlet with 3.3though it uses 5 volt logic.  On the shield there is also a reset button a power indicating led and an led connected to pin 13.

The IMU board is a simple board with the required capacitors for three triple axis I2C sensors.  this pard will be interesting to make because the sensors all come in QFN packages and there fore require reflow soldering. From by research this will be doable with a toaster oven or and embossing tool to apply heat with warm air. This requires the most expensive components but if it works it will dramatically reduce the foot print and cost of these sensors.  I have separated this from the arduino shield (it initially was at the bottom of the sheild) for two reasons. Firstly we where uncertain if the proximity to the circuitry would through off the compass and more importantly if wee where going to place the arduino near the motors it would definatly have incorect readings.  Also we probably wouldn’t want all of the board having there sensors on them and so it would be wasted space on the circuit board.

The final board that I made was to clean up a signal and turn it into a clean digital signal for the arduino’s interrupts to use. wee need to do this because the high of some of the sensor we are using can be as low as 1 volt. to do this I have a LM311 voltage comparator set up to compare the sensor voltage to a voltage divider.  this allow us to switch between a hall effect sensor and a photo transistor just by using different Resistors. The out put of the voltage comparator is connected to ground with a capacitor to clean up the signal and stop a problem with large fluctuations of the voltage as the signal goes from high to low.

I will most likely be ordering these next week along with the components to populate then. And if this goes well I may well go ahead and design my own arduino with all of these board in a signal small package.

Jarek I.M.

contact at for more info


Serial Communication

I’ve been busy working on getting serial communication up and running for my arduino. I’ve had to learn about the termios C library with allmost all Unix C and C++ programs have to use when they communicate over a serial port. I was able to to find a lot of example codes online to help me.  What termios really does is define a structure of variables that define how the serial comunication  works. once this is defined you use the C library unistd witch has the functions open, read and write.  They are fairly self explanatory but they do almost all of the work.

When sending the data you can only send bytes and strings of bytes.  While this may make it seem like you have to send character  stings but you can just use bitwise operatoes to break your vareables into bytes and patch them back to gether when you on the other end.  This both reduces the computation needed on both ends but also reduces the amount of information being sent trough the serial connection.

I am currently running a test to see if any information is lost over a long period of time sending this information I have the baud rate set at 38400 and have the information being sent at 100Hz. So far it seems that this is working quite well and I will have nothing to worry about.


Simple Protoshield

I’ve taken the large expanse of of wires on the bread boards I had been using and condensed then down into a more usable protoshield for the Arduino.

When I had first been putting the circuit together on the bread board I had the ESC’s power wire connected to the 5v line of the Arduino.  This had 17 volts running into the Arduino the power was so great that it light up both the RX and LX lines on the Serial interface and crashed my laptop connected to the Arduino.  after that I learned to have the power line from the ESC going to ground through the two servo motors.

With the protoshield all soldered up I was able to run some simple programs to verify the function of the arduino the ESC and the servo motors. I’m know working on a very basic IR based navigation programme that should be able to navigate through a hallway.

Optical Flow


Compared to other optical flow projects on Youtube, this sample image is just child-play. This link can inspire you more, my friend Optical Flow Exercise.

So what have I been doing?
I put together what looks like an approaching stop sign. The vectorMap (middle) is generated by a combination of GoodFeatureToTrack, FindCornerSubPix and CalcOpticalFlowLK. Refer to the OpenCV Documentation manual and the OpenCV Book if you’d love to get started with optical flow. Find me on facebook if you want to track down the source code / need help write your own : )

further inspirations:
get good frame rate with FPGA.
dense optical flow (this is spare optical flow)


Connecting the Chassis

I’ve been working on conecting the new chassis up to the Arduino.  I quickly learned that the torce on the wheels alone was enufe to make the chary do a back flip so for safe testing I removed all the wheels.  this allows me to have the motors spinning at top speed with out risking the robot escaping.

I found that for me to use the E-Maxx’s ESC all I had to do was to treat it like a servo motor.  As well there is a safety feature witch makes me have to have the initial command for the motors to not be moving be for the ESC will respond.  Now that I have all of this working I will solder up a shield so I don’t have to have a huge bread board for testing.

Simple Colour Isolation

Well, here is an entry level algorithm for colour isolation. Do some pixel-wise comparison in RGB (BGR in the case of opencv) format, and write the comparison result to a RGB format IplImage. Set to go.
Comments anyone?

New Toys

This week we got a new chassis for our robot, the Traxxas E-Maxx an over powered RC monster truck.

Of course after getting a new chassis we had to test it to see how it would perform.  testing showed us how powerful this beast truly was with it flipping on its back multiple times when accelerating and breaking.  I was disappointed though that it couldn’t climb stair it’s underbelly being to low and getting stuck on the edge.  The most successful part of the test was when the steepest hill we could find could barely slow it down.

Optical Encoder

We have been working on getting a new encoder this year for our robots after last years hall-efect ones started breaking through out the year.  The new odometer will have have a resolution that will have more than one tick per revolution of the wheel so we no longer have to worry about are odometer not working at low speeds.

The basic priceable is that we have photo transistor to see the difference between white and black and send ether a high or low signal to our micro controller.  The LED is used to show what the out put is to avoid having to have a programme running to do basic circuit debugging.

Starting the Blog

My name is Jarek and I am part of a UBC student team called SnowBots. We are a Team that is competing in the Robot racing competition Hosted in Windsor Ontario.  We will have three robots competing this year.  This blog will document the last few months leading up to this competition.