Either of these could be used to drive the twin-motor robot
chassis back in Figure 1, using all four of the PICAXE 08M2
outputs. One limiting factor is that only pin C. 2 can use the
do: sertxd(#pinc.3, 13,10): loop
‘‘‘ display pin c.3 value
PICAXE’s PWM function to automatically control motor
speed. If you need more PWM channels, you can move up
to a 14M2 or 20M2 — both of which have more GPIO pins
and can plug directly into this breadboard.
Now we have just enough knowledge to be dangerous.
All four of the PICAXE 08M2’s output pins will be used
to control four inputs on a dual H-bridge to drive two motors.
We still have input-only pin C. 3, to which we have previously
attached an IR receiver to read IR remote signals. We can
certainly put that sensor here again and control a robot with
an IR remote.
A better alternative is to use an IR obstacle sensor
module which will let a robot avoid obstacles and drive
around autonomously. This ~$2 module emits an IR signal
which gets reflected by nearby objects and sensed by a
built-in 38 kHz IR receiver. As a bonus, we can still use this
sensor to receive IR remote control codes, albeit at a
reduced range. Be sure to get the right four-pin sensor
shown in Figure 6. Search your favorite sellers for “IR
infrared obstacle sensor module Arduino smart car.” Order
a few; they are handy and the range varies between
modules.
We could round up all the parts mentioned and make a
traditional differential steering 2WD robot chassis, but let’s
go for instant gratification. Instead of tracking down the
parts and waiting a week or more for shipping, let’s just
hack a common RC toy. The same principles of interfacing
H-bridges apply. I selected a $10 RC car at Walmart which
should be universally easy to find. Ordinarily, it would not
be my first choice, but the price was right and (provided
you can find the same car) it will be a simple matter to
follow along and make the mods shown here. You won’t
win any DARPA Challenges, but you’ll have some fun and
learn a lot of fundamentals for this car’s $10 asking price:
Pros: Cheap, widely available, and mechanically
complete. Uses 3xAA batteries, which will also power the
breadboard. Drives like a car, so it’s easy to go straight.
Fairly durable, large rubber tires can be used outdoors.
Quick hack; no mechanical building, just disassembly.
I haven’t found much hard info on this module, but it
has a 555 timer generating pulses sent to an IR LED. I was
expecting to see 38 kHz, but I saw closer to 42 kHz on the
modules I tested. We won’t use the
Simple soldering, uses existing H-bridges, only requires four
220 ohm resistors to connect to PICAXE. RoboCar excels at
running fast simple geometric patterns like this star:
www.youtube.com/watch?v=_gbU_iMH388.
ENable pin, just the GND, +, and
Cons: Sloppy steering linkage
won’t turn very sharply forward.
OUT pins. I used a servo extension
cable to connect to the sensor. The
sensor’s output goes to input pin
C. 3. The pot closest to the removable
(but don’t!) jumper works best
turned fully clockwise (frequency
adjust), and the other pot controls
sensitivity (clockwise = more
sensitivity). We’ll use the sensitivity
pot to adjust our triggering distance
which will vary greatly based on the
color, reflectivity, size, and geometry
of the obstacle.
There are two LEDs on this
sensor; the one marked ‘Pled’ is a
power on indicator, and the other
‘Sled’ is the sense indicator for when
reflected IR is sensed. This is an
Sharper turns in reverse. Won’t turn
in place like a differentially-steered
robot. The steering is not
proportional; an ungeared motor
slams steering full left or right and
stalls. Under-geared drive motor
drives car too fast for precise motion,
no braking; car coasts a bit after
turning the motor off. “Shoot
through” is possible, where you can
destroy H-bridges from a
programming error! Traction grip
varies between carpet and tile floors;
you may get different steering results
on different surfaces. Speed and path
repeatability are dependent on
battery condition.
“active low” device, so its output pin
is normally high (logic 1) and goes
low (logic 0) when triggered. There’s
a small transition range where the
The Walmart car is a New Bright
“RC Sport” 1/24 scale, “Full Function
Radio Control,” No. 2423, SKU#
50211 02423 as shown in Figure 7.
LED and output signal flickers
between 0s and 1s. Your PICAXE can
display sensor readings from pin C. 3
with this short code:
Figure 7.
There are various body styles and two
frequencies: 27 and 49 MHz. You
can use any model. I verified that all
cars use the same chassis and PCB
SERVO 12.2015 47