3. Using the PICAXE Microcontroller
This presentation will show you:
How to connect the PICAXE on breadboard
How to hook up sensors
How to wire up drive motors
How to download a program
4. We will be using the PICAXE 20-X2, however there
are many kinds of PICAXE microcontrollers. They
start as small as 8 pin and all the way to 40 pins.
5. PICAXE 20-X2
Made by Revolution Education and uses Microchip PICs
Has a program loaded on the chip that allows the program
to be written in a form of BASIC and can be downloaded
using a serial port and three wires.
Each pin can be set up to perform several tasks.
Can run over a voltage range 2.1V to 5.5V
6. The Breadboard
Hook up power and ground.
Hook up serial port circuit.
Hook up line following circuit. Hook up servo motor.
Hook up motor driving circuit.
7. Sensors
The line following sensors
(OPB703WZ) works by
detecting infra-red light.
The diode emits IR light
which bounces off the
surface. The reflected
light then turns on the
photo transistor relative to
the amount of light
reflected. The circuit then
provides an analog value
which is then read by the
microcontroller and
converted into a digital
value.
8. Sensor on White Surface
If the surface the
light is reflecting off
of is white, more IR
light is reflected thus
turning the transistor
on fully. This will
bring the output
close to 0V. (So the
theory goes…)
9. Sensor on Black Surface
However, if the IR light is
being reflected of a dark
surface, the amount of IR
reaching the photo
transistor will be greatly
diminished resulting in the
transistor being almost
off and the output from
the circuit being close to
5V.
10. Motor Control with L293D Half-H Driver
Make an H-Bridge with
the two drivers.
External diodes not
required with L293D.
Ground pins: 4, 5, 12 &
13.
Pins 1, 8, 9 & 16 to +5V.
Pins 1 & 7 control motor
connected to pins 3 & 6.
Pins 10 & 15 control
motor connected to pins
11 & 14.
Motor should have a
0.1uF capacitor across the
terminals (not shown here).
Pin 2 or
15
Pin 7 or
10
Motor
Direction
L L Stop
L H CW
H L CCW
11. Servo
Servos is a three wire DC motor that can be
directed to a specific position by sending a
specific pulse width. The standard servo
can travel a max of 180°, whereas a
modified servo can continuously move in a
direction of CW or CCW depending on the
pulse width sent.
PICAXE has a special command that will let
you set the position of the servo.
Servo has three wires: Black – negative,
Red – positive and White – signal.
For sample commands see page 19 of
PICAXE Manual 3. Also page 30 for the
thermistor.
12. Writing the Program
There are two
methods of writing
a program.
1) The flowchart
method
and
2) the program
language method.
14. Downloading the Program.
Make sure:
Code is written without any syntax errors.
Power is on.
Cable is connected to the serial port and the
PICAXE.
Correct PICAXE is selected.
Correct com port (serial port) is selected.