Let's Make Robots!

Mr. General

  • Component category:
Mr._General_4.bas16.45 KB
Tone.zip9.68 KB
Mr__General_ATmega8_Edge_Detect.zip3.23 KB
Mr__General_ATmega8_Object_Detect.zip3.25 KB
Mr_General_Nano.zip3.21 KB
Vendor's Description: 

Video: http://www.youtube.com/watch?v=7Ve318yVUdU

DAGU products support site: https://sites.google.com/site/daguproducts/

This kit has recently been upgraded to include a USB interface, programming cable and the ATmega8A processor with the Arduino bootloader. The Manual has been updated with wiring instructions and diagram as well as USB driver instructions and trouble shooting section.

An improved "Tone" library is included on the CD as well as being available here that allows the Tone command to function on the ATmega8 processors (thanks to Robot Freak and Brett Hagman).

Based on Bot 08M, Mr. General is designed around a breadboard and includes the universal sensor brackets designed here at LMR as well as my IR object tracker in the form of a compound eye.

The Picaxe code was written for the picaxe 28X1 processor. The first Arduino code was written for an Arduino Nano which has 8 analog inputs. The second Arduino code is for an Arduino with only 6 analog inputs. This version uses digital inputs for the corner sensors which gives them slightly less range.

An IR LED and phototransistor is mounted on each corner and can be used for edge detection or object detection depending on how you choose to mount them. When mounted for object detection they can also be used for swarm communication. These sensors have an analog output but can also be used with digital inputs.

Here are some videos using a picaxe 28X1 and here is a video from GuangZhou University using the compound eye and an arduino to solve a maze.

The compound eye allows your robot to track a moving object but can also be used for IR communication between two robots. Other range sensors could also be fitted to the sensor bracket.

2 factory modified, continuous rotation servos allow speed and direction of each wheel to be controlled by a single digital output.

The kit does not include a micro-controller as the breadboard allows a wide variety of processors to be used. A generous 140 piece cable pack allows easy connection between the breadboard and sensors.

2 individual voltage busses allow for up to 3 different voltages plus ground to be used. Ideal for 3.3V devices and op-amps. A basic recharge circuit allows NiMh or NiCd batteries to be charged from a 9V DC source without being removed from the robot.

All spare room on the main PCB is configured as prototype board as show in the picture below. This allows additional sensors and circuitry such as voltage regulators to be easily added.


Of course being designed with parts from LMR it is only fitting that we have the LMR logo on the box.

 Click on the photo for a bigger picture.





More information can be found here: http://letsmakerobots.com/node/24348



Comment viewing options

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

I've ordered a Mr. General and dying to get started on it, but while I'm waiting I had a few questions I may need help with to prepare for the project. I'm pretty knew to robotics but do have a background in simple electronics, soldering and programming in a few languages.  I bought a picaxe40x2 processor for the general's brain hoping that would provide lots of room for experimentation and expandibility. Any advice on adapting your code for that processor? Also, I wanted to add an ultrasonic sensor (like the SR04) to improve range obstacle detection in order to help with navigation.  One question occurred to me - did you consider using ultrasonic sensors for the motion detection vs the infrared?


The Picaxe code was written for the 28X1 but should not need too much modification to work with the 40X2.

In the picaxe program editor open the Mr.General 4.bas and go to PICAXE--> Wizards--> X2 conversion. Convert for 40X2.

After that you may need to make some other small adjustments. I cannot tell you what exactly as I do not have a 40X2 to experiment with.

The reason Mr. General uses all IR sensors was the price. I like ultrasonic but it cost about 30-50 times as much and cannot track movement unless you have multiple sensors which would then cost more again.

The Pan/tilt bracket was designed here on LMR and will accept almost any of the commonly available ultrasonic and infrared range finders on the market.

Thanks for the quick reply! I'll let you know how it goes. Another random question - why are the two battery packs separate and in different locations? Do they feed separate power busses? I thought of replacing them with a single 4-AA holder that stacks then 2x2 and mounting it on the back in place of the 2-AA pack to save space on the bottom of the board.

I've got several more ideas I want to experiement with once I have the basic robot built and working.  1) I like your coding that introduces a 'boredom' counter - adds a little personality I think.  Is that in the latest version of the Mr. General 4.bas code? 2) Adding a modified mini-flashlight or LED to the pan/tilt bracket so that when he tracks motion the spotlight turns on and illuminates the moving object and then turns off when the motion stops. 3) A small LCD display to give feedback.  Who knows if I'll get all those mods working, but it will be fun to try. My kids will get a kick out of this too!

Thanks Again!

The 2 battery packs are wire in series to make a single battery pack. We used 2 packs of 2 because it was easier to mount on the PCB. The 4x AA battery packs that are 2x2 are difficult to mount on a PCB neatly and the 4x1 layout would have increased the length.

I think you can add a lot more personality with the 40X2. I never had time to really get into that. I wanted to have a counter for the number of times the robot encounted an object within a period of about 1 minute. If the robot gets stuck in a corner or something where he keeps encountering objects then he should get frustrated. If it continues to 2 minutes then he gets angry. Perhaps use some Bi-coloured LEDs for eyes that change from green to orange to red as his frustration and anger grows. Perhaps make his movements faster and jerkier as he tries to escape the corner.


I have a Mr. General and Arduino Uno that I'm helping my son build out for his science fair project. We've downloaded your program for the ATMega328 and for the most part, everything seems to work, except the servos. I've double checked all the connections, and the servos "pulse" or move briefly when the power to Mr General is switched on. 

Would appreciate any troubleshooting advice you can give.


Ok, if the servo only pulses briefly when power comes on then it is not getting a signal or the cable is in back to front. Here is a photo showing how the wires should look. Note that the ground wires for all servos are to the outer edge of the PCB. The orange wire connects from the servos signal wire (white) to the processor pin. You can also see a red wire connectting +5V from the PCB to the breadboard. The ground is connected in a similar manner on the other side.

If this still doesn't solve your problem then I would suspect that you are using a different I/O pin to that in the code.

Another possibility is that your corner sensors are activated. When a sensor is activated it stops the servo going in a certain direction so that the robot won't crash into an object. If both front and rear sensors are activated then the servo won't rotate.

You can tell if the sensor is active because the corner LED will be constantly lit rather than flashing.By adjusting the IR LED and phototransistors position relative to eachother you can adjust the sensitivity of the sensors. They should be parallel to each other for best results but if they are too close together then you may get a false reading.

If you have chosen to aim your sensors downward to stop the robot falling off the edge of a table then you will need to modify the code as the sensor will be working in reverse - stopping the motor when nothing is there rather than something.

Note there are two Arduino versions of the code, The ATmega8A version will work with any Arduino but uses digital inputs for the corner sensors. The other version was written for Arduinos such as the Nano or Mini which have 8 analog inputs because they use a SMD processor with extra pins.

Hope this helps.


Fixed the servo issue, I had the signal wire going to Vcc instead of the servo's signal input. Now we're just spinning in one place. I suspect the problem lies with my son's choice of aiming the sensors down to avoid falling off an edge since both servos spin when the robot is picked up. 

What code needs to be changed? C++ Programming was a while ago for me.


before you change any code you might first need to adjust the stop position for the continuous rotation servos. At the very start of the code where the global variables are defined you will see leftmotorstop and rightmotorstop. These need to be adjusted so that the robot is motionless when there is nothing in front of it. Temperature can affect these settings so what works well on a hot day may need adjusting on a cold night.

If you want to aim the corner sensors down then you need to change the ObjectDetection() code. This is where it reads the corner sensors and drives the indication LEDs.

// turn on indicator LED if object closer than safe distance otherwise chase LEDs
  digitalWrite(leftfrontLED,(lightchase==1 || leftfrontsen==1));
  digitalWrite(leftrearLED,(lightchase==2 || leftrearsen==1));
  digitalWrite(rightrearLED,(lightchase==3 || rightrearsen==1));
  digitalWrite(rightfrontLED,(lightchase==4 || rightfrontsen==1));

  // Adjust motor speeds to avoid collision
  if (leftfrontsen==1 && leftspeed<leftmotorstop) leftspeed=leftmotorstop;
  if (leftrearsen==1 && leftspeed>leftmotorstop) leftspeed=leftmotorstop;
  if (rightrearsen==1 && rightspeed<rightmotorstop) rightspeed=rightmotorstop;
  if (rightfrontsen==1 && rightspeed>rightmotorstop) rightspeed=rightmotorstop;

In the code, 1 indicates something is within range and thus the robot should stop and the LED should come on. Now you are pointing the sensors down 0 indicates nothing is there so the robot should stop and the LED should come on. In the code I have marked in bold. Change the 1's to 0's.

Now the robot should light up a corner LED when that sensor doesn't detect anything and prevent the robot driving off of the edge of the table.

Hi Odd

I'm new in LMR and am i  trying to mount Mr. General....

I'm using the Arduino Duemilanove (bought the kit).

I would like you to explain how I can implement the use of LM35, explaining step by step the assembly of the circuit and providing the code.

Thank you for your excellent robot and for your help.
Sorry my english (I'm using google translators)


Ok. I'm a bit confused. Which kit did you buy? I assume you mean a Mr. General kit with an ATmega8A. You need to download the LM35 datasheet. Read it. The schematic is on the first page, it is super simple.

The code is just a matter of reading an analog pin.