I want to reprogram a robot D2-2 which is really cheap (see Banggood for example). The µcontroller supplied is an AT89C2051, and I don't have the IDE, the programmer and the time to learn, so I decided to remove the AT89C2051 and to try using a PIC.
I have chosen a 16F690 because I have plenty but you can try with another one as long as it has the same pin diagram (for example the 16F1507 is nice).
It is very easy and simple to do! You only need the microcontroller (and a PICKit).
Step 1: Understanding the Schematic
The principle is quite simple :
there are 2 inputs : the 2 photodetectors connected to a double comparator.
there are 4 outputs : 2 motors and 2 LEDS.
The program is also very simple : If a photodetector senses a white portion then the corresponding motor is ON.
On the schematic XTAL Y1 is missing. It is located between pins 4 and 5 of the AT89C2051.
Step 2: Installing the PIC16F690 Socket
You have to solder the kit without the following parts :
R1 and C4 : it is the reset circuit
C6, C7 and Y1 : it is the oscillator
The following modifications have to be done carefully :
R10 should be connected on the negative pin of C4
The 20 pins IC socket has to be soldered REVERSED, the pin 1 is toward the center of the robot.
The pin 1 of the 16F690 (marked as P3.7) must be soldered with the next Vcc.
Step 3: Results
Note how R10 is installed.
Step 4: Connector for the PICKit 2 or 3
To easily connect a PICKit, I am using 5 Male To Male Jumper Cable Dupont Wire.
They are soldered according to the color code.
The first wire (the brown wire has to be soldered instead of the R10 pin.
The connections to the PICKit is done according to the color code...
Step 5: Conclusion
That little hack is very simple and works straight away !
The Excel file supplied contains the list of instructions, registers and pin-out of the 16F690.
Here is the result of the programmed robot on Youtube.
But now you can program a smarter robot...