This page is solely dedicated to making the electronics to build and run your basic bug robot.
If
you already have the controller board for the $50 robot built, then you
can just use that in stead of completing this section.
Luckily
the electronics are quite simple, its basically just an interface to
break into the mcu to allow us to connect servos and sensors to it
easily with a built in power bus system. Lets get stuck in and see the
easy to understand schematic:
Description / About the schematic
Parts Breakdown
<
This is the power input area. The two pins on the left are where you connect the battery or power source, red to + black to -.
The
black/grey part at the top is the 5v regulator, provided that the input
source on pin1 is greater than 6 - 7v it will produce an even +5v
output on pin 3. The middle pin is for the common ground. So input goes
to pin 1(+) and pin 2(-). The output is pin3(+5v) and pin 2(gnd).
The
blue cans are the electrolytic capacitors, the one on the left
goes between input voltage and ground, this is there to provide a backup
of power incase your battery need help. The one on the right helps the
voltage regulator by smoothing the signal, The voltage regulator gets
hot when it is used, because your circuit will be drawing different
amounts of amperage at different times, the voltage regulator has to
work harder shifting between the powers and getting even hotter, The
right capacitor goes between the output voltage and ground It provides
additional power in case of excessive current draw, and also helps the
voltage regulator by handling a lot of the current changes and keeping
the regulator cool.
Note: I used this setup
for 2 hours with the servos and circuit running through the voltage
regulator, and it didnt reach above 50 degrees C.
This
is the PIC18f452 mcu. When soldering the board, dont solder the mcu in.
You should solder in the DIP socket that was on the electronics list,
the PIC mcu will then slot into that dip socket later, so you dont
damage it when soldering, and it is removable for other projects and
programming if you dont have an in circuit programmer.
Notice the pins are numbered, The picture below show what the pins actually are.
This
is the PORTA bus, the bottom set of pins are connected individually to
the porta pins on the pic18f452. This port has 5 a/d converter pins on
it so we can use it for sensor input later.
The middle set of pins are all connected together, and then connected to +5v to make part of the power bus.
The Top set of pins are all connected together, and then connected to GND to make the other part of the power bus.
When
soldering these, the pins all want to be next to each other, so the gnd
pins go in, then the +5v pins go in the holes directly next to them.
You should end up with 3 rows of 6.
This
is the port D bus. PortD is a general i/o port, there are no special
features attatched to it apart from its ability to be an 8 bit paralel
output which we probably wont be using on a robot.
This port is ideal for controlling devices such as servos.
The
bottom set of pins are connected individually to the portD pins on the
pic18f452(port d is scattered about 3 different location on the pic).
The middle set of pins are all soldered together and then connected to +5v.
The top set of pins are all soldered together and then connected to GND.
As with the above these sets of pins want to be placed right up next to each other to make 3 rows of 8 pins.
This is the serial interface, The pins are arranged to connect directly to the rs-232 shifter board from sparkfun electronics.
The right pin is +5v
The 2nd in from the right is GND
The 2nd in from the left goes to the TX pin on the pic18f452
The left pin goes to the RX pin on the pic18f452
This is the JDM ICSP programming header, compatable with a JDM style programmer.
The pin n the right is connected directly to the MCLR pin on the pic18f452.
The 2nd pin from the right is connected to +5v.
The middle pin is connected to GND
The 2nd pin from the left is connected to PGC (programming clock) on the 18f452
The left pin is connected to PGD (programming data)on the 18f452
This is the reset header, the left pin is connected to the MCLR of the 18f452
The right pin is connected to a resistor, which is then connected to +5v.
When
you h333ave your pic programmed and runnin, use a pin jumper to connect
the 2 pins together, to do a soft reset on you program, remove the
jumper and put it back in.
When using a jdm
style programmer, you will need to remove the jumper when programming.
The mclr pin must be brought to around 12/13 v to enter programming mode
and so we need to isolate this from the main circuit by removing the
jumper.
Finally,
this is the oscillator crystal set up. The silver can is the
oscillator, one leg wants to connect to the OSC1 pin on the 18f452, the
other leg to OSC2.
Each leg should also be
connected to a small ceramic capacitor usually between 22 and 35 pf, I
am using 33pf capacitors (the datasheet says 30pf)and it works just
fine. The capacitors want to be connected between each oscillator leg,
and also to GND.
Here
is my completed board, notice that I decided to cut my board and shape
it to fit over most of the back section and to go around the servo.
Unfortunately
I didnt plan it very well meaning that there are connecting wires
everywhere. I did leave enough space to connect up the other ports on
the 18f452 later if i ever need to, There are another 3 a/d converter
ports on porte and another 14 i/o ports which most have other possible
functions such as i2c control, and interrupt pins
Unfortunately
I didnt add in any way of testing the circuit to see if it works, you
could use a multimeter to make sure that there are no shorts anywhere.
Remember do not put the Pic18f452 into the socket until you are
completely sure that the circuit is correct. An easy tester for this
would be just an led with a 330ohm resistor connected to the cathode
leg, then plug in the circuit to a battery pack or a power pack and
connect the led annode to one of the +5v power bus lines and the free
resistor leg to one of the Gnd power bus line. If the led lights up,
your circuit is fine from the power front whcih is good news.