Let's Make Robots!

General Blackbeard

Like so many other posts, I'll start this one off with the worn out statement: This is my first robot. I have some past programming experience in a few languages and some soldering experience, but never the two together in one project. I blame my 8 year old son for this one. He got interested in the robots a year ago and while researching Chrstimas gifts for him I discovered the world of DIY robot kits and got intrigued. I'm an engineer at heart that likes to build things so building a robot really interested me as a knew hobby. Like most people I can't spend much money on a hobby, so we'll see how far I can take this. So far I've been pleasantly surprised by how inexpensive a lot of the parts can be.  

After some researching I settled on the Mr. General kit as a basis for my first robot. It sounded challenging enough, yet not too much so and looked to provide a good base to add to and experiment with, both in coding and with new gadgets and sensor add-ons.  Among the ideas I have I would like to add an LCD display for feedback,  a focus light source that will beam on the moving object he tracks, additional LED's (because blinky things are cool, and an Ultrasonic sensor to complement the IR sensors in object detection and navigation. I purchased a Picaxe 40x2 for the brain of Blackbeard, but also a 28x1 to experiment with on a standalone breadboard.

I bought the  the kit, cable and 28x1 off Ebay from Dicksonhamshop and the 40x2 from Peter Anderson.

Wish me luck! 


Jan 31, 2011

Here are the results of steps 1 and 2:

1) Not so good. The USB to Serial cable did not work for me. Or, more accurately I should say the Driver for the cable didn't work for me. I tried it on three different systems: Windows 7, Vista and XP. None worked. I rebuilt the circuit twice so I'm pretty sure it's the cable/driver.  So much for going cheap. I'm about to submit my order to Peter Anderson to the USB to Stereo cable.

2) Pretty Good. I only had time to build the Compound IR eye. Here is a picture of it:

Compound IR Eye

I did have one question while building the Eye and that was which way the 7 pin header should be oriented. I decided in the end it probably didn't matter so I picked a direction and went with. The alligator clamps on my board holder scratched up the paint some, even though I wrapped them in tape. The transistor was a little tricky for me since the holes are so close together. I had to wick out my first solder attempt and do it again. You can see the results in this picture.

Orientation of 7 Pin header

Hopefully this week I'll get a chance to build the main PCB. I'll post a picture of it when I do.


Feb 2, 2011

Slow Progress

Had a little bit of time this evening to solder on most of the resistors and the diodes.



Feb 2, 2011

Had a few minutes to fire up the iron and add the last 6 resistors (the 6 slots missing the bottom left of the picture above). Hope to have time to finish the board this weekend.


 Feb 3, 2011

Got my new AXE27 Picaxe USB cable in the mail! Assembled the little AXE29 breadboard adapter for the stereo connector and downloaded and installld the driver.  It works! My little blinking LED circuit worked! Also connected up the  Compound IR Eye and wrote the program to callibrate it. It worked! They eye works and is ready to go.

BTW - I have a trivia question for you - in my picture above the assembled Eye, can you spot anything missing? I did after my first attempt of connected it up. :) Oops.


Feb 6, 2011

Completed more of the main board over the weekend, but didn't have time to finish it. My soldering skills must be rusty.  I found soldering the transistors and the headers a little difficult and spent some time cleaning up solder that accidently crossed contacts a few times. I need to add the headers for the other power rail, the corner IR sensors and the recharge jack. Here's a picture of where I'm at now:



Feb 10, 2011

 Finally made time to finish the board for General B. For my first modification I decided to simply add a few more LEDs that would be triggered by pan and tilt movements and IR activity in the eye. I also added another IR LED/phototransistor pair looking forward since I decided to use the corner sensors for edge detection.  I started to put the standoffs on for the the wheel servos, but found that one of the four screws supplied is different. It's the right length, so I know it's the one meant to be used, but the head and threads are different. The nylon nut doesn't engage on to it. I circled the head of the incorrect screw in the picture. It's not a self tapping and there are no more in the kids this long. Guess I'll have to figure out a work around (aka hot glue).


Feb12, 2011

General Blackbeard (GB1) has been assembled. See picture below. The only change I made as to make use of a single 4-AA battery holder instead of the two separately mounted holders in the kit.  It doesn't look very tidy right now, but I hope to work on that.

Next step is to wire up the servos and sensors. I plan to set it up first with the 28x1 processor before rewiring and modifying the code for the 40x2.  Decided not to change too many variables all at once. I want to verify that the basic Mr. General is working correctly first. Once I verify that I'll do the mods for the 40x2 and also wire up the additional LEDs. After that I'll mod the code for using the additional IR sensor I mounted on the front.


Feb 13, 2011

I'll have to get to pictures/video monday or tuesday, but here is where I'm at. GB1 has been wired and programmed using the 28x1 processor but the initial results of execution not very good. Here is what I see when I turn him on:

1) The power-on LED doesn't light.

 2) Corner green LEDs light and the IR Eye goes fully to the right and twitches like mad for a few seconds then stops while the speaker plays happy B-day

3) Once the song ends he does one of two things:

     If the background light is low he will twitch about once a second with the eye turned fully to the right. Corner LEDs blink

     If the bacground light is high the eye will twitch like mad (instead of once a second) while turned fully to the right. Corner LEDs chase (or seem to).

4) With hand movement in front of him he occasionally will move the eye slightly up ro down, but only a little and not consistently.

5) Wheel servos don't move at all.

When I get some time I plan to recheck the wiring of the servos and IR LEDs to the breadboard, map out what voltages are going to the servos and eye and take some video. I'll also reinspect all my solder joints as best I can. My chief concern is the transistors- they're tricky things to solder with the leads placed so close together.


Feb 14, 2011

As promised, here are a couple pictures, but video will have to wait until tomorrow. The edge sensors are detecting the edge (all 4 work), but the head only twitches and the wheels only turn on short impulses.

Feb 20, 2011

Getting closer, but still some curious behavior going on here that I haven't had time to completely troubshoot.

Here are some screenshots of the Debug Screen and a video so you can see what I'm looking at. The IR values are way too hight and the servo control is either going batty because of it or something squirly is going on there too. I added the two LEDs on the breadboard to confirm signals being sent to the servos and the IR LEDs.

The video for some reason is being inserted at the top of blog, but the link is also below.



Feb 21, 2011
Ran some tests on the eye and took pictures.
The values bounce around a little, but re-using the eye calibration code I got the following:
No obstruction:
~170, ~150, ~85, ~130
With Obstruction:
~130, ~120, ~65, ~90
Pointed directly at LED desk lamp, distance about 8 inches:
~300, ~300, ~170, ~350
It's possible I overheated them and thier sensitivities were signifcantly reduced as a result.
I would recommend for beginners that the eye should be done last since it has the more sensitive Phototransistors so close to the board. I probably would have done better after all the practice on the main board.
The batteries are NiMH, Sanyo eneloop rechargiables.
Here are the pictures:
Finally ordered the new compound eye from Robotshop. Also ordered a SRF04 Ultrasonic ranger finder to play with. Can't wait!
Now all I need is the time to experiment with the changes I wanted to make....
FINALLY! I got the new compound eye a while ago but never had time to install it. Tonight I finally did it. I've been passing my workdesk for weeks wishing I had time to play and tonight I finally made some time for it.  I finally got Mr. General working! While I've already designed 2 more robot projects I'm anxious to work on, I still want to try some of the things I had planned for ol' General Blackbeard- add the SRF04 sensor and a navigation routine and ad the display. Pictures and video to follow.
5/18/11 Here is the video!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I took another look at the video, your IR LEDs on the eye are on dimly which is a good sign. At least they are being switched on and off. The music was at the speed I would expect for 16MHz clock frequency so that is good.

At this point I would suspect the eye connections or assembly. If you write a simple program to just read the analog inputs of the eye with the IR LEDs on and run debug you should get readings around 900-1023 when your hand is very close and maybe 100-200 when nothing is within range.

Show us a close up photo of your eye from the front.


What type of batteries are you using? NiMh?

Thanks for the assessment of my situation. I added the results of the test and the pictures. I want to compare the values coming from the corner phototransistors. Like I said, my theory is that I may have overheated the phototransistors and reduced thier sensitivies. Other theory is that they were bad to begin with.


I would say you have fried the phototransistors.
As you are in America you can buy another eye, pre-assembled and tested from here:



Yeah, I was thinking the same thing. Unfortunately Robotshop wants $12 to ship me the $9 eye. Maybe someone on Ebay will have it. I'll see how much I can get the IR phototransistors from radioshack and I'll try to replace them. Hopefully I don't ruin the board in the process.  The set underneath the 7pin header will be tricky. Might be a good idea in the future to mount the about a millimeter off of the board to give space to clip a heatsink on to the leads while soldering.

Normally during mass production we have them all flat against the PCB for alignment. If you have sensors or LEDs at an angle then it can affect the readings. Even if you get them straight, a collision can knock them out of alignment.

I know what you mean about the price. If you bought one directly from us then the shipping cost would be the killer.

Tweaked the servo stops so that there isn't any movement anymore before the music plays.Commented out the code that refers to any function of the eye in order to see if I could atleast verify the edge detection code and avoidance code. No luck. The green LEDs go solid when the corner or end hits the end of the table, but the robot keeps moving - right off the edge. <sigh> More troubleshooting to do tomorrow; all I have time for tonight. 

You need to be careful what you rem out.
In the main loop just rem out "gosub IR follow".

Then put


This should get both motors going forward.

Then you will have"gosub EdgeDetection"
This routine should set the left and/or right motorspeed back to stop if an edge is detected.

Note: I have not been able to test this and have not worked with the picaxe code since it was written. You may have to change the leftspeed and right speed values other wise the robot might go backwards or turn on the spot.

Ok. First off, wheels turning before the music is played indicates that the  leftmotorstop and rightmotorstop values at the start of the program need adjustment. These vary from servo to servo and will need tweaking if the temperature changes a lot eg. between summer and winter.

I had a look at the video and your debug screens.Your eye is a big problem. The code works by subtracting a small number (reading with IR LEDs off) from a large number (reading with IR LEDs on). If the LEDs are not being switched on or the phototransistors are damaged (or put in wrong) then both readings will be the same with some electrical noise thrown in. This causes some negative numbers which on a picaxe show as really big numbers (65535-X).

Right now I would say your eye is either not assembled correctly or not connected properly. Hopefully the second option.


From the sound of your problems and the photos I am guessing your resonator is too far away from the processor or else you do not have the frequency set to 16MHz.

The servo command for picaxe only works properly at 4MHz and 16Mhz. The long jumper wires to the resonator could be throwing out the frequency.

I often had this problem and the best solution was soldering pins onto the resonator so it plugged directly into the breadboard as close as possible to pins 8,9 and 10.