2. The electronics.
Let's take a look at the schematic:
The main part (IC1)is the Nemesis microcontroller, the robot's brain. As you can see, it has 15 general I/O pins, 7 of which are connected to the internal Analog to Digital converter and 2 are connected to the built in UART (serial) interface and a Reset pin (Attn). It runs at 8MHz and it has 1024 bytes of memory for user programs. It also has a timer that can be used to generate PWM signal on pin 6.
IC2 part is the SN754410E Quad Half H-Bridge, which is the motor driver. This IC can drive 2 DC motors or one step by step motor. It provides currents of up to 1 amp per motor (or winding). The IC has 2 Direction pins and an Enable pin for each motor. If the Enable pin is set to high, the motors are powered, otherwise they can spin freely. If pin A is high (1) and pin B is low (0), the motor spins clockwise, if the pin A is low and B is high, the motor spins counterclockwise. If both pins are either high or low, the motor is braked (the output pins connected to the motors are short-circuited - if the power is cut when the motor is spinning, the motor becomes a generator, but the generated current will go back to the motor and make the motor spin in the opposite direction, slowing it down fast and after a complete stop, it makes the motor resist spinning). This H bridge IC has internal clamp diodes to protect the circuit from the back generated currents. The IC is powered from regulated 5V but motors are powered directly from the battery. This way they can get bigger voltages and current than the rest of the circuit.The U1 part is a PNA4613 Photo IC. This IC is an infra red photo transistor with an internal filter that allows only 40 kHz modulatedsignal to pass. It has an internal pull up resistor, so in the absence of a signal the output pin is always high. This IC is regularly found in TVs and VCRs as the remote IR signal receiver. We can use this IC to remote control the robot using a Sony TV remote, or as a proximity sensor, to detect objects in the robot’s path from a certain distance, together with the 2 IR LEDs (IRLED-LEFT and IRLED-RIGHT) flanking U1. The proximity sensor works like this: the microcontroller generates a 40 kHz PWM pulse one of the LEDs for a short time, then it turns is off and checks the sensor pin 5. If there is an object in front of the LED, some of the signal will be reflected back to the sensor and the pin 5 will get low. Then it will flash the other LED and check the sensor again. This way the robot can “see” an object to the left, right or both (center). But there is only one pin that can generate a PWM signal, how can we control 2 LEDs? We connect the anodes together to the pin 6 and each cathode to a separate pin of the microcontroller. We set those pins to output and we set them high. The LEDs will be lit only if we set those pins to low. So, when we want to flash the left LED, we turn his output pin to low and then generate the signal. After we check the sensor we turn the left LED’s output pin back high and turn the right LED’s output pin low and generate the signal. And so on. But what is the R3 adjustable resistor for? We use it to adjust the sensibility of the proximity sensor.
There are 3 pairs of IR LEDs – IR Photo Transistors, that form 3 IR reflective sensors, used to follow a black line on a white floor or to detect the edge of a sumo ring. They work like this: the IR LEDs are lit at power on and the microcontroller checks the IR Transistor pins. Because of the 10 kOhm resistor pull ups, the pins are high if there is no light reflected and they are low if there is a reflection. So we will get a 1 if there is black or a 0 if there is white underneath the sensor. We can adjust the sensibility of the sensor from the R6 adjustable resistor.
The circuit is powered from a 6V battery pack (4 AA alkaline batteries). After the power on switch, there is a 5V 1A Low Drop-Out voltage regulator, LM2940. I chose this regulator because the regular 7805 needs an input voltage of minimum 7.2V. C3 and C4 compensate for voltage drops when motors are powered up or switch directions and R1 and LED1 are used as a power on indicator.
The serial connector is used to program the microcontroller and debugging. R1 is used to pull up the reset pin and C1 and C2 are used to filter out any noise and power sags on the microcontroller.
Here is the schematic of the serial adapter:
And for those who want to cut the price in half, here is the schematic using AVR ATtiny26:
Now let's see how to build the Mechanics...