A basic kit from Maplin (requires Soldering)
Random Movement Bug
Controlled by an 8-pin PIC PIC12F629 microcontroller (click here) that is programmed to randomly move about, turning left, right or moving forwards.
Unfortunately this kit comes with minimal information, no circuit diagram or explanation just a part layout and some notes on how to recognize the various components.
It uses the PIC micro-controller to turn two motors on and off in a pseudo random sequence.
Explanation
The Battery is turned on and off from the switch(S1), this supply is protected from surges from the motors with an electrolytic storage Capacitor(C1), Make sure that the capacitor is inserted the right way around (negative pin is clearly marked)
When the power is turned on the resonator(Q5) connected to the PIC micro-controller starts to oscillate this in turn enables the PIC micro-controller to run a simple pre-programmed set of "firmware"(fixed)* instructions.
Each motor is driven when the PIC program sets the respective output pin to a high voltage; that then passes via current limiting base resistor(R1,R2) to a "Darlington pair" (See below) that enables the respective motor to run, and then to stop when the program resets the pin back to a low voltage output. The program will keep running in a loop turning on and off the motors until the power is switched off.
* Note: As the program used in the PIC 12F629 is contained in reprogrammable memory called EEPROM by using a programming device the programs "software" inside the controller could be changed.
Other components
A small capacitor has been placed in parallel with each motor to help absorb unwanted electrical "noise" also including an additional capacitor(C2) across the power near the PIC to avoid the micro controller from resetting from any power surges.
Darlington pair
The kit uses 2 pairs of transistors for each motor to form a darling-ton pair, this combination enables high gain(hfe) and current(Ic) to be used from two small transistors.
TR1 = BC548 NPN Signal transistor - good gain(hfe=amplification)
TR2 = BC639 NPN 1A Drive transistor-less gain but higher current
Transistor Data
Note it is vital that the transistors are connected correctly the right way around and in the right locations on the circuit board.
Q1 and Q2 = BC548
Q3 and Q4 = BC639
hfe=600 Vce=30V Ic=100mA
hfe=160 Vce=80V Ic=1A
The BC639 can handle 1 Amp (10 times the current than the BC548) when turned full on with the BC548 transistor aided by its 600 hfe(gain) in the Darlington pair configuration to drive it.
Resistors
Both the resistors R1 and R2 used to limit the current from the micro-controller outputs are 1K ohms (1K=1000)
Resisters work the same either way around.
R1 and R2 1k ohm Resistor
1k is colour coded onto the resistors with four bands brown (1) black (0) and red(x100) 10x100=1k the final gold band is the tolerance of +-5%
(Note some resistors can have a 5 band system)
Capacitors
Capacitor C1 is know as an electrolytic Capacitor and has a value of 100uF
and a voltage rating of 16V NOTE this capacitor is voltage polarised and must be connected the correct way around, there is a + (plus sign) marked on the circuit board.
The negative lead is clearly marked on the outside of the capacitor.
The C2,C3 and C4 capacitors are all the same value 104(100nF) and as they are ceramic they work just as well either way around.
C1 100uF 16V
C2,C3 and C4 100nF Ceramic Capacitor
nF = nano Farad (10-9 Farad)
Resonator
This component (Q5) can be fitted either way around.
This part defines how quickly the program inside the PIC controller will execute each instruction better known as the "Clock speed".
The resonator contains a crystal and two capacitors
Q5 4 MHz Ceramic Resonator
Connects to the PIC pin 2 and pin 3
Note: The PIC12F629 microcontroller has its own 4MHz crystal built into it that could be used if you wanted to try your hand at reprogramming the controller yourself, this would then free up two extra inputs/outputs pin 2 (GP5) and pin 3 (GP4) to use.
Maybe to make it move backwards as well using an H-Bridge bidirectional Motor Drive Circuit.
Happy Robot Building