This is only a preview of the February 2006 issue of Silicon Chip. You can view 41 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "PC-Controlled Burglar Alarm System":
Items relevant to "Build A Charger For iPods & MP3 players":
Items relevant to "PICAXE-Powered Thermostat & Temperature Display":
Articles in this series:
Items relevant to "Build A MIDI Drum Kit; Pt.4":
Items relevant to "Building The Ultimate Jukebox; Pt.3":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
ADDING
INFRARED
TO YOUR
In the December issue we had our first look at the Viper robot from
Microbric – a new concept in project building that can turn a beginner
into an expert in seconds! Now we’re going to start adding more
functionality to the Viper by giving it some infrared control capability
O
ne of the difficulties new or
would-be electronics enthusiasts Part 2 – by
have is the (perceived?) difficulty of soldering, component identification and actual
construction.
While those more experienced in the art would say “just
get in and learn it!” there is arguably nothing more disconcerting to a beginner than building a project and finding it
doesn’t work, or work as intended, often due to a simple
error that, with just a little bit more knowledge, would be
easy to spot and fix.
Many’s the project that has been thrown into a cupboard
(or even bin!) for this reason.
That was one of the stumbling blocks that Microbric
wanted to avoid. And with their unique “bric” concept,
they’ve succeeded very well! Soldering has been completely
eliminated. If you can fasten a nut on a screw, you can
build with Microbric.
Component identification has been eliminated, again
due to brics. Now it’s modular – some modules contain
individual components, others a complete circuit element.
But when you connect them together, they simply work!
And the parts are reusable – you can dismantle and
rebuild as many times as you like.
With Microbric, you can build complex electronic devices
with little or no prior electronics knowledge. You will learn
as you go – that’s another one of the strong points. And that
74 Silicon Chip
knowledge is not limited to electronics – other concepts will be covered
along the way such as mechanics,
programming and even designing your own projects.
Incidentally, if you missed our Microbric introduction in
December, we strongly suggest you read that before reading
on. It covers the concepts and the fundamentals which are
necessary background to building more complex robots
(Back issues are available for $8.80 each including p&p).
Ross Tester
Minimum hardware requirements
Before we get down to the nitty gritty, we should cover
what you need in the way of a computer.
Virtually anything from PII 233 up (Pentium II, 233MHz)
will be fine. It would be hard to imagine one of those
machines not running Windows 98, Me or XP – but that’s
what is required.
You’ll need a minimum 32MB of RAM (again, hard to
imagine anything less) and at least 120MB of free hard disk
space. As far as sound and graphics are concerned, any
Windows-compatible sound card will be fine and 800 x
600SVGA with 4MB RAM will be required. As the manual
comes on a CD, a CD-ROM (minimum 8x) is essential.
The one area you might have problems with is an RS232C
port. That’s required for data transfer to and from the Viper
and regrettably, many modern computers don’t have one,
using USB ports instead (here’s where older computers
siliconchip.com.au
will come into their own!). If your computer doesn’t have
RS232C, a USB-to-RS232C converter/adaptor may be the
answer (they’re cheap enough!) But note that we have
NOT tried programming the Viper using this method so
cannot guarantee it.
The Viper kit
When you open up the Viper kit (Dick Smith Electronics, K-1800, $199.00) you might think that you’ve been
shortchanged because only about half the box is populated
with bits.
That’s deliberate – the kit contains all you need to put
together the Infrared Controlled Viper with:
• A motherboard (contains the microcontroller “brains”
of the robot along with batteries and programming port
• Two micromotor modules (each houses a high quality
motor and metal gearbox plus the electronics to run
them) along with two wheels;
• The infrared receiver module (receives the output from
the infrared remote controller, also included);
• A buzzer, (plays notes and beeps; even has a volume
control)
• Two LED modules (with driver circuitry built in);
• A button (to start and stop your program);
• A switch sets the different modes of operation in your
program input);
• A bump sensor (detects obstacles in the robot’s path)
• Plus an RS232 cable, software on CD-ROM and screw
driver
• And, of course, the connecting pieces to allow you to
put it all together.
The blank areas in the box are for supplementary or
expansion kits, available separately, which you can then
keep with the the main Viper kit. These includes Wheel
Packs, Line Tracker modules, Sumo (robot wars) modules
and even advanced projects such as the Spiderbot and
Dragster.
Giving the Viper Infrared Control
We’re assuming that you have built the Microbric Viper
(as per December 2005 issue) and have had a lot of fun
playing with it. Now that fun is going to be magnified a
whole lot because adding infrared control opens up whole
new horizons.
The infrared transmitter
When you look at the hand-held infrared transmitter,
you’ll probably think that it is just about the same as all
of those infrareds you already have for the TV, VCR, DVD,
set-top box, home theatre system, air conditioner . . . and
you wouldn’t be far wrong.
Most infrared remote controls work in very similar
ways. They simply impress a digital code of pulses onto
an infrared beam. Needless to say, because it’s infrared,
you cannot see the beam. But most video cameras can,
especially the cheaper ones such as webcams and security
cams because, for the most part, they don’t have any filtering to “keep out” infrared.
But even many stock-standard camcorders can “see”
infared. If you aim the camera at someone holding the
infrared remote across a room, then get them to push buttons, you’re likely to see a continuous bright white light
in the viewfinder (assuming it’s working as a camera, not
siliconchip.com.au
a video player!). Connect to a TV set
or monitor for a better view.
Incidentally, this is a good way
to check that the infrared remote
control (for anything!) is working
before you change the batteries.
Many a perfectly good battery
has been thrown out when it has
been something else that hasn’t
worked (eg, the loose nut on the
keyboard . . .).
It’s all in the timing
The particular remote control supplied uses the 12bit Sony InfraRed Control
(SIRCS) protocol – if you
want to, you’ll find plenty
more information about
this protocol on the web
(Google SIRCS).
Each of the buttons
on the remote control
puts out a slightly different digital code.
These codes are in the
form of pulses which
are far too fast for us to
see, even when looking
at them via a camera. Pressing
different buttons results in very small differences between
each pulse train.
The receiver which we are about to fit to the Viper detects
this pulse train, regardless of which button is pressed and
translates it into language (actually electrical levels) the
microprocessor can not only understand, but act upon
and send the appropriate command. So it is actually the
microprocessor which works out which button is pressed,
not the receiver itself.
One button might tell the microprocessor to apply power
to both motors equally and move the Viper forward.
Another button, for example, might be interpreted as
applying power to one motor and applying reverse power
to the other motor – which, fairly obviously, will turn the
Viper in the direction of the wheel rotating backwards.
Naturally, not all the buttons on the remote control will
do anything (at least, not at the moment). Later on, as you
become more adept at BASIC ATOM programming, you
might be able to put some of the other buttons to use to get
your Viper to do some really kinky things!
But let’s get back to the task in hand: getting the Viper
to work with the infrared remote.
Modifying your Viper
First of all, attach the Infrared Receiver module to Pin
6 on the Microbric motherboard. That’s the simplest part!
In order to use the remote control with the microcontroller, you will need to follow a sequence of steps to preset
the remote to work with the microcontroller.
a. Put two AAA batteries into the remote control unit.
b. Simultaneously hold down the S button (in the middle
of the arrows) and the B button on the remote (a red light
will go on in the top left hand corner of the remote.
February 2006 75
c. Press the number sequence 0 1 3 on the remote
buttons.
d. Press the red power button on the remote.
e. The remote is now configured to work with your
microcontroller.
Note that buttons A, C, D, E, F and G are for setting the
remote control into different modes which are not required
for this project. Avoid pressing these buttons as this will
inadvertently set your remote into another mode.
You can always return to the ‘B’ mode by pressing the
B button.
Entering the BASIC program
Open a new file on your computer and call it IRProgram.bas
You could type in the program as listed but it is fairly
long and complex, so the chances are you will make a
mistake. And one mistake could stop your project from
working. It’s much simpler (and safer!) to load this program
from the supplied CD (phew! Saves a lot of typing!). Save
it (File/Save As…) to a location on you hard drive before
programming it into the microcontroller.
In this program you will be using the PULSIN command.
This is a command that tells the microcontroller to wait
for a pulse signal. You will note that it specifies the Pin
for the input and then states what to do in the 0 state and
the 1 state.
Some things to note about the program:
• This program will accept a signal from the remote
control, analyse it, and then, according to the binary 16
bit number received, will either run the motor forwards,
backwards, turn the LED on or play a tune.
• The ‘pulse’ sequence is necessary to check all the possible incoming combinations. It is tedious to type in, but
gives this program its flexibility to use multiple buttons
to drive it.
• Each of the buttons on your remote control has a specific 16 bit binary number (referred to as a 16 bit ‘word’).
You can see four of them represented in the TESTIRDATA
subroutine.
The 16 bit numbers for each of the buttons on your remote
control are written in the table below. You can use them
to program 14 separate functions.
SC
Flowchart for infrared control of the Viper. When the
signal is received by the infrared receiver and passed
on to the microcontroller, it is looking for one of the
valid codes from the table below.
Remote Control Button 16 bit
Button
1 button
0
0
0
0
2 button
1
0
0
0
3 button
0
1
0
0
4 button
1
1
0
0
5 button
0
0
1
0
6 button
1
0
1
0
7 button
0
1
1
0
8 button
1
1
1
0
9 button
0
0
0
1
0 button
1
0
0
1
button
1
1
0
0
button
0
1
0
0
button
0
0
0
0
button
1
0
0
0
76 Silicon Chip
‘words’
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
siliconchip.com.au
|