3 - Software

Here is a load of software the EZ-CD. For each example I have included, wherever possible, various attachments. These will take the form:

nnnnn-c-src.zip      For the C source code

nnnnn-cpp-src.zip.  For the C++ source code to use with my C++ tutorial

 

nnnnn-ATxxx-yy.hex         Pre-compiled hex files that you can just upload straight to your controller without any compiler stage

 

Where:-

nnnnn - The name of the project

xxx     - The AVR processor eg Mega8, Mega168

yy      - The processor speed where 01=1MHz, 08=8MHz.

 

If you are having trouble with the servos then it may that your servos aren't quite centered in the same way as mine. For the C++ source code you change the wat the servos are centered as follows:-

1. Locate the line that creates the servo. e.g. something like: SERVO  g_servoLeft( &g_servoLeftOut , true , 1500, 300);

2. The last 2 parameters specify the 'center point' and the amount of 'swing' either side of 'center'. So if you change the last value to zero as follows: SERVO  g_servoLeft( &g_servoLeftOut , true , 1500, 0) then the servo will always try to center itself. Change the '1500' value until the servo stops spinning - this parameter is now correct. Now play with the last value to get the maximum amount of swing out of your servo - this should be somewhere in the range 300 to 700.

 

 

So here are the examples:-

 

1 - Bumper

Very simple robot. Just drives forward until one of the microswitch closes. It will then reverse, then spin, then go forward again.

The robot is not very good when it runs straight into something as there is no bumper switch at the front. Trying adding one yourself and changing the code.

 

 

 

Connect the left drive servo to  D2

Connect the right drive servo to D3

These should be powered from the unregulated supply

 

Connect the left microswitch to C2, and the right one to C3.

These should be powered from the regulated 5V supply

 

The C++ source code can be downloaded here. You may need to change the makefile so that 'MCU_TARGET' is for your cpu, and 'F_CPU' is the speed of your cpu. You will also need to rebuild the C++ library by changing the makefile in the root folder of the library to have the same settings.

 

 

 

2 - BumperIR

Builds on the previous example by mounting Sharp IR detectors at the front of the robot to try to steer away from objects. If it hits something then it works like before.

 

 

Sharp IR detectors send out a narrow beam and so aren't good at seeing small objects like chair legs.

 

As a result - I quickly came to the conclusion that this wasn't much better than the BumperBot. If anyone is interested I could be up the code.

 

The next example gives a far superior solution.

3 - SRF05

Here we abandon all the infra red sensors in favour of a single Devantech SRF-05 sonar mounted on the front servo so that it can pan left and right. Much better result !!

 

 

Connect the sonar to pin C0 - using the +5v regulated supply

 

The servos should be connected to the un-regulated supply as follows:-

Connect the servo that moves the sonar to D4

Connect the left drive servo to  D2

Connect the right drive servo to D3

 

If you want to use the micro-switches then connect the left one to C2, and the right one to C3.

 

The C++ source code can be downloaded here. You may need to change the makefile so that 'MCU_TARGET' is for your cpu, and 'F_CPU' is the speed of your cpu. You will also need to rebuild the C++ library by changing the makefile in the root folder of the library to have the same settings.