This is only a preview of the July 2020 issue of Practical Electronics. You can view 0 of the 72 pages in the full issue. Articles in this series:
|
Make it with Micromite
Phil Boyce – hands on with the mighty PIC-powered, BASIC microcontroller
Part 18: Animated eyes for the Micromite Robot Buggy
Fig.25. Adding a pair of animated eyes (8x8 LED matrix modules) and an IR receiver to the front of the MRB’s daughterboard.
I
n the previous two articles we
explained how to assemble and test the
chassis for the Micromite Robot Buggy
(MRB). This month, we will begin to add
some personality to the robot by attaching
a pair of animated eyes. This will involve
adding two LED 8×8 matrix modules (and
some wire links) to the front of the existing
daughterboard. While we are making the
necessary modifications we will also add
an IR receiver to provide another method
of controlling the robot. The end result of
these two modifications is shown in Fig.25.
Circuit diagram
Now examine Fig.26, which shows the
schematic, comprising two blocks:
1. IR receiver
2. Two LED matrix modules (eyes).
Micromite code
The code in this article is available
for download from the PE website.
Practical Electronics | July | 2020
Assembly is just a matter of connecting
these additional hardware items to the
correct Micromite pins (and power).
The IR receiver is the standard TSOP
device that we have used in previous
articles throughout this series. It only
requires a 5V/0V supply, and a connection
to Pin 16 – the Micromite’s IR input pin.
Each of the animated eyes is based on
an SPI LED matrix module, similar to the
one we explored back in Part 12 (January
2020). Fig.27 shows the front and the
back of the LED modules we are using.
These two modules are daisy-chained
to each other, meaning that the DOUT
pin on the first LED module (left eye) is
connected to the DIN pin on the second
module. All other pins on each matrix
module are effectively paralleled together.
The left eye’s data input pin (DIN) is fed
from the Micromite’s SPI data out pin (pin
3), with enough data-bits sent from the
program code to fill two matrix modules
(because they are daisy-chained). The
CLK pins are fed from the Micromite’s
SPI CLK pin (pin 25).
For SPI data to be received by the matrix
modules, the CS pin must be at a logic
low level. The CS pin from each module
is therefore connected to an available I/O
pin to allow this software control – here
we have used pin 21.
The LED matrix modules could be
soldered directly to the stripboard;
however, we have used two 5-way
sockets (JS6 and JS7) making it easy
to replace them should the need arise
(for example, to swap them out for a
different LED colour).
Note that the DOUT pin is not present
on the module’s row of five pins; it is
presented in a socket on the top edge of
the matrix module. Instead, however,
we will attach a wire link to the DOUT
solder position mid-way on the back of
the module (this can be seen in Fig.27).
To assist with assembly, the other end
of the DOUT wire link is soldered to a
51
IC1
TSOP
IR receive r
Testing
R ig ht eye
DISP2
8 x8 L E D matrix
MA X 7 2 19
Lef t eye
DISP1
8 x8 L E D matrix
MA X 7 2 19
DOUT
JP 10
16
5V
0V
+ V
DIN
CL K
CS
0V
+ V
DIN
CL K
CS
0V
JS 7
JS 6
Fig.26. The circuit diagram
for the IR receiver and the
animated eyes. The two
LED matrix modules are
daisy-chained together
(see text).
0V
3
5V
21
25
modified 2-way header pin (JP10).
The LED matrix modules can operate
from either 3.3V or 5V. We have used 5V
since it allows for ‘brighter eyes’.
Stripboard modifications
Fig.28 shows the modifications (in red)
required to your existing daughterboard.
There are 10 track cuts, 14 wire links,
two 5-way sockets, one 2-way pin header,
and one TSOP IR receiver to be installed.
To begin with, you will need to partially
disassemble your MRB – this is just a
matter of unplugging any connected
modules (including the MKC (Micromite
Keyring Computer) and BT (BlueTooth)
module from the underside). Then
remove the four M3 nuts that secure
the daughterboard to the chassis. Next,
separate (unplug) the daughterboard from
the two motor connectors.
Once the daughterboard has been
removed, mark out the ten required
track cuts shown in Fig.28. After doublechecking you have the correct positions,
make the cuts – ensuring the cuts are the
full width of the track and that you have
left no copper burrs that could short tracks.
Next, mark out, check and install the 14
wire links. All but one of these links are
towards the front of the robot, so be careful
not to omit the single wire link between
the MKC pins/sockets (NN14-NN35).
The IR receiver (IC1) has to be inserted
with the correct orientation. The rounded
part of the IR body faces the front of the
robot (as can be seen in Fig.28, and also
the photos of Fig.29 and Fig.30).
The two 5-way sockets (JS6 and JS7)
are next. These are mounted at a shallow
angle to allow for the eyes to face slightly
upwards rather than directly forward
(see Fig.29). Be sure to get their positions
exactly as shown in Fig.28.
The two-way header pin (JP10) is
installed (facing upwards) in the relevant
position in track 32. Its purpose is to
make it easier to solder the wire link that
is used to connect to the DOUT point
on the back of the left eye. JP10’s pin at
position I32 is cut flush after soldering
(see Fig.30), leaving a single pin onto
which to solder the DOUT wire link. The
final connection to install is the actual
DOUT wire link. First, insert an LED
matrix module into JS6 (the left eye) and
then solder one end of a short length of
wire to the DOUT point on the back of
the matrix. Finally, solder the other end
of the wire link to JP10 (refer to Fig.30).
Connect
wire here
Fig.27. The front and back of the LED matrix modules that we are using for the
animated eyes. Note the position of the DOUT pin which will be used on the left eye.
52
Begin by doing a thorough visual check
of the daughterboard before re-mounting
it back onto the chassis. Ensure that you
secure it with the four M3 nuts, and then
insert your MKC and BT modules from
the underside. Next, insert the other
LED matrix module (right eye) into JS7.
Carefully insert the LiPo battery and power
up the MRB. Then make a connection to
your terminal app (such as TeraTerm).
With an established connection you can
install this month’s demonstration program
onto your MKC. The file you require for
this test is: AnimatedEyesTestCode.txt,
which can be downloaded from the July
2020 page of the PE website.
Once installed, RUN the program and
you should see an animated affect appear
on the two LED matrix modules. If not, then
you will need to recheck the modifications
you made on the daughterboard. If the left
eye shows animation, but not the right,
then check the DOUT wire link, because
this will be the likely issue.
Now grab a remote control transmitter,
point it towards the front of the MRB and
press any button. You should see two
numbers appear on the terminal screen
– these represent the IR device code,
and the IR keycode (as discussed in a
previous article). If you don’t see any
numbers, first try some other remotes;
and only then if you’re still not seeing
anything, check the three connections
relevant to the IR TSOP receiver (IC1).
Notes about the demo program
It is worth taking a quick look at the
demo code, but do not worry if you
don’t fully understand it. It comprises
two main parts. One section is a single
interrupt routine that deals with the IR
remote control – you should recognise
it easily enough (and it is commented
too). The other part of the code will
look more complex, but it is essentially
a DO…LOOP that sends the required data
to the LED matrix modules using the
SPI communication protocol. There is
an initial setup for the LED modules,
which sets certain parameters, and then
it is just a matter of sending the required
LED ‘pattern’ data (this method was
discussed in Part 12). As previously
mentioned, if you don’t fully understand
the code, simply use it for now to check
that the animated eyes (and IR receiver)
are functioning correctly.
Next month
The whole idea behind the MRB is to bring
together many of the individual lessons
learnt so far throughout the Make it with
Micromite series, and combine them into
a fun, yet highly customisable project.
Our robot buggy currently implements
a useful collection of hardware features
Practical Electronics | July | 2020
G
A
B
C
D
E
F
H
K
J
1 2
3 4 5 6
7
8
9 10 11 12 13 14 15 16 17 18 19 2 0 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 30 31 32 33 34 35 36
B
JS7
IC1
X X
W W
VV
UU
TT
SS
R R
Q Q
PP
OO
NN
MM
L L
K K
J
II
H H
G G
FF
E E
DD
CC
B B
A A
Z
Y
X
W
V
U
T
S
R
Q
P
O
N
M
L
K
J
I
H
G
F
E
D
C
B
A
C
D
JS6
E
F
G
H
JP10
I
L
M
JP1, JP2, JP5 and
N
JP6 marked in blue
are downward facing O
pins (inserted from P
above).
Q
R
S
T
U
V
W
X
Y
Z
A A
B B
CC
DD
E E
FF
G G
H H
II
J
K K
L L
MM
NN
OO
PP
Two track cuts Q Q
carefully made R R
with scalpel or SS
Stanley knife
TT
UU
VV
W W
X X
A
I
J
K
L
JP1
M
N
O
P
JP2
Q
R
JP3
S
T
U
V
MOD1
W
X
JP9
JP4
Y
Z
A A
MOD3
JP5
JS3
R1
B B
CC
DD
E E
FF
G G
H H
II
J
K K
L L
MM
NN
OO
PP
Q Q
R R
SS
TT
UU
VV
W W
X X
JS4
JP8
JP6
JS5
MOD2
S1
1 2
3 4 5 6
7
8
9 10 11 12 13 14 15 16 17 18 19 2 0 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 30 31 32 33 34 35 36
Fig.29. Two 5-way sockets (JS6 and JS7)
are soldered into place at a slight angle to
make the eyes face upwards a little.
that provide the potential for it to behave
in many different ways. Ultimately, the
robot’s behaviour is all down to the
program code running on the Micromite
(here the MKC), so next month we will
have some fun with MMBASIC and explore
ideas for controlling your robot buggy.
In the meantime, why not modify
this month’s demonstration code to
allow your robot to be moved by an IR
remote control.
Have fun, and do stay safe!
X X
W W
VV
UU
TT
SS
R R
Q Q
PP
OO
NN
MM
L L
K K
J
II
H H
G G
FF
E E
DD
CC
B B
A A
Z
Y
X
W
V
U
T
S
R
Q
P
O
N
M
L
K
J
I
Fig.30. A 2-way pin header (JP10) is
used to solder a wire link to the DOUT
point on the back of the left eye. Looks
fiddly, but it’s actually straightforward.
Sourcing the MRB chassis
The MRB we have described uses
an acrylic chassis, but the current
pandemic means we don’t have
access to our usual laser cutter. So,
we are now offering an equally good
CNC-milled version made from 2mmthick PCB material available from:
micromite.org
Questions? Please email Phil at:
contactus<at>micromite.org
H
G
F
E
D
C
B
A
1 2
3 4 5 6
7
8
9 10 11 12 13 14 15 16 17 18 19 2 0 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 30 31 32 33 34 35 36
Practical Electronics | July | 2020
Fig.28. (left) The existing daughterboard
needs to be modified with the items
shown highlighted in red. (Note that the
two track cuts marked in red at NN-OO
1 and SS-TT 2 are not new – you should
have added them last month.)
53
|