This is only a preview of the December 2019 issue of Silicon Chip. You can view 46 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. Items relevant to "Have you got a dumb battery charger in your garage?":
Items relevant to "Altronics New MegaBox V2 Arduino prototyping system":
Items relevant to "The Super-9 FM Radio Receiver, Part 2":
Items relevant to "High performance linear power supply – part three":
Purchase a printed copy of this issue for $10.00. |
Altronics M
Article by Tim Blythman
W
e described the original Mega
Box Arduino Prototyping System in our December 2017 issue
(siliconchip.com.au/Article/10902).
Then later, in February 2018, we used
it to create an improved version of our
Arduino Music Player (siliconchip.
com.au/Article/10976).
In case you missed those articles, the
Mega Box allows you to plug in an Arduino board and up to two shields. It
provides many extra useful functions
like an LCD screen, illuminated pushbuttons, a rotary encoder, relays etc
and it all fits into a plastic ‘half rack’
instrument case which comes pre-cut
with all the holes needed in the front
and rear panels.
The result is a very neat package
which can be programmed in the same
way as any other Arduino device. It
saves you a lot of effort in putting together the parts you need to make a
slick Arduino project.
It solves a big problem that Arduino
has; while you can easily build a project by stacking an Arduino board with
some shields, then running jumper
wires to other modules and parts, the
result is an unholy, tangled mess which
looks very unprofessional.
But you can build the same project
38
Silicon Chip
just as easily (if not more so) using the
Mega Box, and the result is neat, slick
and professional looking. So what’s
not to like? This updated version adds
several useful new features, which
we’ll describe shortly.
The front panel of the case carries
Altronics’ “Inventa” branding, which
is their home brand for Arduino-related products. You might have seen
the article we published in October on
Home Automation using two Arduino
wallplates, also from the Inventa range
(siliconchip.com.au/Article/12023).
As well as describing the new Mega
Box V2 (also referred to as the Mega
Box Mark II in some places), we’re also
going to provide full instructions for
building it. Our instructions expand
on those provided with the kit, which
should make construction easier, and
also help you figure out how to use it.
For example, the Altronics instructions we received did not provide a
list of parts supplied in the kit (which
should be rectified in later versions), so
we’re publishing a full parts list at the
end of the article in case you need it.
Once you’ve built the Mega Box V2,
you will need the Arduino IDE (integrated development environment)
software to program it. The latest verAustralia’s electronics magazine
sion can be downloaded for free from:
http://siliconchip.com.au/link/aatq
We’re currently using version 1.8.5.
While the Mega Box will work with
an Arduino Uno or similar form factor
board, to take full advantage of its capabilities, you really need an Arduino
Mega or similar.
Mega Box V2 features
From the outside, the Mega Box V2
looks almost the same as the original;
it’s built into the same case (Altronics
Cat H4996), so it’s the same size when
finished, although the front panel has
been rearranged. There are also some
new connections at the rear of the case.
Inside is where most of the changes
have occurred. The biggest of these is
the addition of a second set of shield
headers, meaning that a second shield
can now be fitted. You could fit more
than one shield with the original Mega
Box, but only if you left the lid off! That
sort of defeats the purpose of using a
nice case like this.
There are now five relays instead
of two. These are rated at 2A/30V DC,
and a ULN2003 Darlington transistor
array now controls all the relays. They
are Altronics Cat S4128C double-pole
relays, but only one set of contacts is
siliconchip.com.au
Mega Box V2
An Arduino Prototyping System
Movie sequels are rarely as good as the original, but that is not the
case here. The Altronics Mega Box V2 has more of everything you
might need to prototype your next Arduino project.
Features
• Five 2A/30V DC relays
controlled by a ULN2003
Darlington transistor array
• A rotary encoder
• 160-pad prototyping area
• Eight opto-isolated digital
input signals rated up to
±24V
• An IR receiver for use with
a remote control
• Fits two Arduino shields
minimum, or however many
you can stack.
• Four illuminated
momentary pushbuttons
• 16 x 2 character LCD with
PWM backlight
• Uses an Arduino Mega,
Uno, or similar
broken out from each to a set of pluggable terminal blocks.
Apart from the relay contacts, the
extra connections on the rear of the
case are for up to eight opto-isolated
digital input signals. These feed into a
pair of LTV-847 quad opto-isolators before being buffered by a pair of 74HC14
quad Schmitt trigger inverters. These
could be useful to interface with external circuitry running from a different
(and possibly isolated) power supply.
As for the original Mega Box, all the
peripheral connections are brought out
to header sockets on the PCB. Nothing
is committed to any pins on the main
processor board, giving complete flexibility in the way everything is wired.
This is apparent in the Mega Box
V2 circuit diagram, which is shown
in Figs.1 & 2. Note the extensive use
of headers for connecting the various
optional sections of the circuit back to
the Arduino’s I/O pins.
The Mega Box V2 also includes better support for 3.3V Arduino boards
and more flexible front panel button
wiring options. But it’s the extra shield
slot, added relays and isolated inputs
that really set it apart.
The only reduction in features with
the newer board is the prototyping
siliconchip.com.au
area, which has dropped from 210
pads down to 160 pads, although this
could easily be compensated for by
fitting a prototyping shield in the extra shield slot.
On the front panel, it has four illuminated momentary pushbuttons, an IR
receiver, a rotary encoder and a 16x2
character LCD. Inside the case are a
pair of user-defined LEDs which can
also be connected by jumper wires to
any I/O pin. LED3 inside the case is
connected to D13 of the Arduino module header, as is common these days.
Jumper JP1 is provided to allow one
pin of each front panel switch to be
connected to GND, so that you only
need to run a single jumper wire back
to an Arduino pin to sense presses of
that button. JP2 (shown in Fig.2) allows
each end of the eight opto-isolated inputs to be connected or disconnected
from the external terminal blocks.
Note how many of the components
are powered from the Arduino module’s IOREF pin. This means that they
are powered from 5V if it’s a 5V micro,
or 3.3V if it’s a 3.3V micro, so their inputs and outputs can be connected directly to Arduino I/O pins. Four fiveway headers are provided to make it
easy for you to tap into the 3.3V, 5V,
Australia’s electronics magazine
GND and Vin (external DC input) rails.
Because the reset button on the Arduino processor board is covered up
when the board is installed, a separate
tactile switch is provided (S1).
The LCD module itself plugs into
CON5, with all of its pins brought out
to CON4, so that they can be connected to the Arduino (or elsewhere) as
needed. Trimpot VR1 provides display
contrast adjustment while CON19 and
the first inverter in IC8 give the option
for software backlight control.
Construction
As mentioned above, instructions
are provided with the kit, and these
are certainly sufficient for building it,
which is not an overly difficult task.
However, we thought that beginners
would appreciate a bit more detail, so
we’ve prepared a PCB overlay diagram
to guide you, shown in Fig.3.
Keep in mind that the following instructions, along with those supplied
by Altronics, are for building the Mega
Box V2 as a prototyping platform. But
if you have a particular task in mind,
you could consider eliminating some
or all of the sockets and soldering
hookup wires directly to the pads on
the board.
December 2019 39
40
Silicon Chip
Australia’s electronics magazine
siliconchip.com.au
Fig.1: this diagram shows most of the circuitry in the Mega Box V2; the rest (for the new opto-isolated inputs) is in Fig.2. It
is dominated by the connections between the main Arduino module (MODULE 1) and the two shield sockets. There is also
an extra set of sockets for all the Arduino pins, including the Arduino Mega-specific pins, so that you can connect them to
other components such as LEDs, buttons etc via jumper leads.
siliconchip.com.au
Australia’s electronics magazine
December 2019 41
Fig.2: the eight opto-isolated inputs are between pin pairs on pluggable terminal blocks CON1 and CON2. These can
withstand up to ±24V, with +1.5-24V corresponding to ‘on’. The outputs at the collector pins of IC1 and IC2 are inverted,
and these are then buffered and re-inverted by hex inverters IC3 & IC4. The eight single-ended isolated signals are
available for sensing at CON6.
This could give a neater end result,
as you could cut the wires to the minimum lengths required, rather than
using fixed-length jumper leads. We
won’t describe that approach in detail,
but it’s worth keeping in mind.
There is also less hassle in not
needing to fit as many headers. Obviously, this is a much more permanent
and less easily changed approach. So
we only suggest it for confident constructors.
If you’re doing that, you could also
save time by leaving off any components you won’t be using.
By the way, the kit doesn’t come
with any jumper wires. It’s designed
mainly with male-male jumpers in
mind. So you might want to pick up a
pack of these when you purchase the
kit, such as Altronics Cat P1016 (65
pieces, each approximately 160mm
long).
You might also find Altronics Cat
P1017 handy, as it includes 30 male/
female and 30 female/female jumpers,
some of which may be required (depending on your application).
If you are going to use the Mega Box
as a prototyping platform, we suggest
fitting all the components, as it will
42
Silicon Chip
be much harder to do this later. This
is mainly because some components,
particularly the headers, can be difficult to hold in place while soldering
if added after taller components have
already been mounted on the board.
To make it easier to solder the components to the PCB, the instructions
generally proceed in order of lowest to
highest profile components, meaning
that when the board is inverted, the
components you are fitting are held in
place by your bench surface.
The right-angle header socket for
the LCD is the lowest-profile part, so
we recommend fitting it first. But it’s
best to solder the LCD's header on first,
so that you can plug this into the PCB
socket before soldering it. This allows
you to check that the LCD will sit perpendicular to the main PCB before fixing the header socket in place.
Note that the PCB silkscreen shows
trimpot VR3 overlapping with the LCD
header, but in reality, VR3 is much
smaller than indicated, so there is no
collision.
Proceed now by fitting the resistors,
followed by diodes D1-D8, the IC sockets, pushbutton S1, the relays and the
single trimpot VR1. Rather than trying
Australia’s electronics magazine
to place many parts on the PCB and
then solder them all at once, we suggest that you just fit a few at a time (or
one at a time).
When it comes to fitting the resistors, note that the 330W resistor on the
PCB shown in the Altronics instructions has been replaced with a wire
link here. That’s because the 330W
value results in a very dim LCD backlight. A wire link (one is supplied) is
acceptable but may severely shorten
the backlight lifespan due to high current, meaning a lower-value resistor
like 33-47W would be better. Later versions of the kit will probably be supplied with such a resistor.
Also, note that some 1kW resistors
on the board need a 0.25W rating while
some have a 0.6W rating. All the 0.6W
resistors are mounted next to JP2, and
they are marked as being 0.6W types
in Fig.3. This allows up to 24V to be
applied to the opto-isolated inputs.
The next job is probably the most
time-consuming: fitting all the headers. Some of them are supplied in long
strips and will need to be snapped or
cut to length. For the regular pin headers, usually you can snap these easily
by holding one side with pliers and
siliconchip.com.au
This is how the completed Mega Box V2 PCB looks. We have fitted all the jumper shunts as most user applications will
also need to do so. The manual also suggests using some short lengths of wire to brace the LCD in position, which we
haven’t done (yet).
then using a second pair of pliers, or
your other hand, to snap off the unwanted length.
But for the header sockets, it’s a
more involved process as you will
need to use side cutters or similar to
cut down the middle of one pin (sacrificing it), then clean up the remaining plastic housing of that pin with
a small file to give you a neat socket
of the right length. Luckily, this is
not required for the 6-way, 8-way or
10-way sockets as these are supplied
ready to install.
When it comes to installation, if you
have an Arduino and some shields
(which surely you do, if you’re building the Mega Box V2), you can use
them as jigs to plug the headers/sockets into before feeding them all into
the board and soldering them all at
once. This helps keep everything nice
and square, and prevents the headers
from moving about as you’re mounting them.
But that only works for the headers
for the Arduino and its shields. The
remainder will need to be installed
one at a time. Check Fig.3, the photo
above and the Altronics instruction
sheet to see which headers should be
male and which female.
If you want to do a neat job, it’s best
to solder just one pin of each header
first, then flip the board over and check
that it’s straight before soldering the
siliconchip.com.au
other(s). If it isn’t correctly aligned,
you can re-heat the solder joint and
carefully nudge it into position.
Many of the female sockets scattered around the board are designed
so that you can use a male-male jumper leads to connect the two points. So
if you know what you’re doing and
have plenty of female-female jumper
leads on hand, you could substitute
regular pin headers there. But if you
aren’t sure, we suggest fitting them as
Altronics have indicated, and as we
have shown here.
Once the headers are in place, it’s a
good time to fit the single electrolytic
capacitor and the three LEDs. These
are all polarised; the capacitor’s longer lead goes towards the + sign on the
PCB, while the stripe on its can indi-
cates the negative side. Similarly, the
LEDs have a longer lead which goes
into the pad marked “A” in Fig.3,
while the flat on the lens indicates the
negative lead (cathode).
While Altronics suggest that LED1
should be green and LED2 plus LED3
be red, we fitted the green LED for
LED3 and red for LED1 and LED2. Ultimately, it’s up to you. These LEDs
are not visible with the lid on the case
anyway, so they are most useful for
debugging.
Now attach the four pushbuttons
(S2-S5), the rotary encoder and the
IR receiver along the front edge of the
PCB. Take a moment to ensure that
they are square and straight before soldering; these are some of the few components visible from outside the case.
The Mega Box V2 does well to hide its Arduino interior. Only those in the know
would suspect that the DC jack and USB socket are part of an Arduino Mega
board. The knockout panels above the screw terminals can be used to make
connections to either or both of the shields fitted, if required.
Australia’s electronics magazine
December 2019 43
Now plug the five ICs into their
sockets. Their footprints are marked
with their designations, so it is easy to
check that the correct IC is being installed in the correct socket. As usual, make sure that their pin 1 dot or
notch goes towards the notched end
of the socket.
This is also a good time to plug the
LCD screen into CON4. It sits on top
of the PCB, at right-angles. Four solder pads are provided in front of and
behind the LCD.
You can solder tinned copper wire
‘hoops’ between these pads (along
the dashed red lines) to help hold
the LCD firmly in place, although we
didn’t bother, as the socket seemed
to do a reasonable job holding it to
our unit.
Final assembly
Fig.3: this diagram shows the recommended location and type of all components
on the board. As mentioned in the text, depending on how you plan to use it,
some components could be left off, and some connections could be made via
wires soldered directly to pads on the board rather than via headers.
You should also fit the 16 jumper
shunts to the optoisolator headers
(near the rear of the PCB) and four
jumper shunts to the pushbutton headers (near the front).
We can’t see any reason for not fit44
Silicon Chip
ting the former from the start, and
you’ll most likely want the latter in
place too, to make it easier to detect a
button press from a micro pin (in combination with an internal pin pull-up
current).
Australia’s electronics magazine
Before testing our newly assembled
Mega Box V2, we decided to mount it
in the supplied enclosure. Although
not mentioned in the instructions, we
fitted the supplied rubber feet to the
enclosure first. They prevent the unit
from sliding around on the bench.
The supplied instructions also suggest fitting the front of the case now,
but we found it easier to leave it off
initially, as it gets in the way of plugging jumper leads into the sockets near the front of the PCB.
In this state, the unit is well
set up for testing and prototyping. To
complete the assembly (as you would
do after finalising your software and
internal wiring), the front and rear case
parts are fitted and secured with the
included countersunk screws. Once
the front panel is in place, you can attach RE1’s knob.
You might find it easier to screw in
the countersunk screws before installing the panels. This ensures that the
threads cut in the plastic by the screws
are tapped straight and square. Also
be aware that you need to unplug the
pluggable terminal blocks from the
rear of the unit before attaching the
rear panel. You can plug them back
in once you’ve done that.
The partial knock-outs in the rear
panel are optional and need only be removed if you are using a shield which
is too long to fit inside the enclosure,
or needs extra wire connections to go
to the outside world. For example,
these could be used to feed through
an Ethernet cable to plug into an Ethernet shield.
siliconchip.com.au
Naturally, the final step is to fit the
top panel. For subsequent testing and
debugging, simply remove this panel
to gain access to the Mega Box internals. We found this case very easy to
work with.
Testing it and trying it out
The sample sketch can be downloaded from: siliconchip.com.au/
link/aauv
It requires two external libraries to
work; a third library (for the LCD) is
included with recent versions of the
Arduino IDE. So make sure yours is
up-to-date (see the link in the intro).
As the Mega Box V2 instructions
note, practically all the remaining
functions provided by the board can
be accessed by reading from and writing to digital pins, with simple calls to
digitalRead() and digitalWrite().
The two libraries used by the sample code are for infrared reception
and decoding the pulses from the rotary encoder. These can be installed
using the IDE’s Library Manager. They
can be found using the search terms
“irremote” and “encoder”.
To use this sample sketch, you
need an Arduino Mega and 14 malemale jumper leads. You will find
that you have to push pretty hard to
plug in the Mega; there are around
80 pins that you need to force into
their sockets.
To test the infrared receiver, you’ll
also need an Altronics A1012 universal remote control programmed to code
089, or another universal remote using
a similar Philips TV profile.
The demo sketch describes the wiring connections that are assumed in
the code; see the comments at the top
of the sketch. If you only have an Arduino Uno or similar, substitute pins
A0-A5 for pins D14-D19.
It may even be possible to use other boards like the Leonardo, but you
will have to figure out the differing pin
mapping. It may be easiest (and possibly necessary) to change the pin assignments near the start of the sketch
to suit the board you are using.
Open the sketch, ensure that the
correct board (Uno or Mega) and serial
port are selected in the Tools → Board
and Tools → Port menus respectively, then click Upload. If you can’t see
anything on the LCD, you may need
to adjust contrast potentiometer VR1.
If you see solid dark blocks on the
LCD, try rotating VR1 clockwise; othsiliconchip.com.au
Parts List – Altronics Mega Box V2
1 plastic half-rack case with custom cut front and rear panels, feet and
screws [H4996]
1 double-sided PCB, coded K9670A, 198 x 115mm
1 16x2 alphanumeric LCD [Z7013]
3 40-way female header sockets [P5390]
1 20-way right-angle female header socket [P5392]
1 2x40-way female header socket [P5394]
2 40-pin male headers [P5430]
2 2x40-pin male headers [P5410]
2 6-way female headers [P5374]
10 8-way female headers [P5375]
3 10-way female headers [P5376]
20 jumper shunts/shorting blocks (for JP1 & JP2) [P5450]
2 8-way right-angle pluggable terminal blocks (CON1,CON2) [P2678, P2658]
1 9-way right-angle pluggable terminal block (CON3) [P2679, P2659]
1 6-way right-angle pluggable terminal block (CON7) [P2676, P2656]
1 4.3mm vertical tactile pushbutton switch (S1) [S1120]
4 PCB-mount right-angle pushbutton switches with integral LEDs (S2-S5)
[S1190 (red) or S1192 (green)]
5 5V DC coil, 2A DPDT telecom relays (RLY1-RLY5) [S4128C]
1 PCB-mount right-angle rotary encoder switch (grey code) (RE1) [S3350]
1 47uF 16V electrolytic capacitor [R5102]
5 M3 x 6mm plastic tapping screws (for mounting PCB in case)
1 10.5mm diameter, 12mm long black aluminium 18T spline knob (for RE1)
3 16-pin dual-wipe IC sockets (for IC1, IC2 & IC8) [P0565]
2 14-pin dual-wipe IC sockets (for IC3, IC4) [P0560]
1 length of tinned copper wire
1 length of solder
Semiconductors
2 LTV-847 quad transistor output optocouplers, DIP-16 (IC1,IC2)
2 74HC14 hex inverters, DIP-14 (IC3,IC4) [Z8514]
1 ULN2003 Darlington array IC, DIP-16 (IC8) [Z3000]
1 3-pin 3.3V/5V infrared receiver/decoder (IRD1) [Z1611A]
1 green 5mm LED (LED1) [Z0801]
2 red 5mm LEDs (LED2,LED3) [Z0800]
8 1N4004 400V 1A diodes (D1-D8) [Z0109]
Resistors (all 1/4W, 1% metal film)
12 10kW
7 1kW
8 1kW 0.6W
1 330W*not used, see text
1 47W
1 0W (link)
1 10kW mini horizontal trimpot [R2480B]
1 Universal remote control [Altronics A1012 or similar] is recommended.
erwise, turn VR1 anti-clockwise.
The demo is quite basic. Buttons
on the remote will toggle the LEDs
on the pushbuttons on the Mega Box.
The rotary encoder will change the
displayed number of the LCD and
change the backlight brightness. To
do much more, you will have to write
your own code.
Summary
The Mega Box V2 does everything
the original Mega Box could do and
more. It now supports two shields,
has five relays and eight opto-isolated
inputs too. And most importantly, as
Australia’s electronics magazine
we said in the intro, it turns a messy
prototype into a slick, professionallooking unit.
One minor quibble we have with the
Mega Box V2 design is that we would
have preferred to have the pushbuttons and rotary encoder on the right
and the LCD on the left. This would
make the unit more ergonomic for
right-handed individuals; after all, the
majority of people are right-handed or
ambidextrous.
The full kit is available from Altronics (K9670A) for $120, including GST,
or $210 for two at: siliconchip.com.
au/link/aaxp
SC
December 2019 45
|