This is only a preview of the December 2017 issue of Silicon Chip. You can view 38 of the 104 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 "Touchscreen Altimeter and Weather station":
Items relevant to "The Arduino MegaBox from Altronics":
Items relevant to "Build your own Super-7 AM Radio Receiver – Part 2":
Items relevant to "El Cheapo Modules 11: Pressure/Temperature Sensors":
Items relevant to "Part 3: Finishing our new 6GHz+ Digital Frequency Meter":
Purchase a printed copy of this issue for $10.00. |
The Altronics Mega Box
Article by
Bao Smith
T
Make your
Arduino projects
easier to build and look much
more professional with this kit from
Altronics. It includes a pre-cut plastic instrument
case, 16x2 alphanumeric LCD, four illuminated pushbuttons,
two relays, an infrared receiver, rotary encoder and pluggable terminal
blocks. This makes building your Arduino Uno or Mega project a breeze.
he Altronics MegaBox kit (Cat
K9670; www.altronics.com.
au/p/k9670-inventa-mega-box-forarduino/) is a clever Arduino prototyping system developed by Altronics.
It comes with a large PCB measuring
197 x 115mm and the Arduino module and optional shield board plug into
this. The PCB then neatly fits into the
supplied case with the controls accessible through holes cut into the front.
It’s easy to build since all the components are through-hole types. While
we describe it as a prototyping system,
it’s quite possible to build a finished
project using it; something that would
come in handy everyday.
As well as the extra components
mentioned above which you can use
to build your project, the PCB has a
210-pin prototyping area which lets
you fit the extra components you need
which are not already provided by the
MegaBox or fitted to the Arduino or
shield boards.
All the connections from the main
Arduino board and the other hardware in the box are broken out into
female headers so that you can easily
make connections between them using jumper wires.
The MegaBox also has a lot of extra power supply connection points,
which you will often find you need.
For example, near where the Arduino
module is mounted, there are four sets
42
Silicon Chip
of five sockets giving you additional
3.3V, 5V, GND and VIN connections.
Similarly, there are two 14-pin headers
near the prototyping area, one giving
you access points to the 5V rail and
the other GND.
Due to the way the boards are
mounted they provide a separate 6-pin
in-circuit serial programming (ICSP)
connector. Then you have connection
points to attach wires for interfacing
with other components like the illuminated pushbuttons, relays, LCD, LEDs,
rotary encoder and infrared receiver.
Note that to take full advantage of
all the features in the MegaBox, you
really need to use an Arduino Mega to
have enough I/O pins. But you certainly can use it with an Uno for some applications and this is how we tested it.
What can it be used for
When you plug a shield board into
an Arduino, you can play around a bit
but all you’re really left with is a bit of
a curiosity. To turn it into something
truly useful, you need a user interface
for your device, some kind of enclosure and so on. The MegaBox gives
you all that.
For example, you may recall the article in our July 2017 issue on building
the Arduino Music Player (See www.
siliconchip.com.au/Article/10722).
We plugged an MP3 player shield
into an Arduino Uno but to make it
Celebrating 30 Years
truly useful, we had to add a keypad
and an LCD so you could control it.
And while that worked well, all you
ended up with was three separate modules connected by flying leads; hardly
a “finished product”.
If we had the MegaBox, we could
have easily built that finished product
and with a lot less hassle. In fact, you
could take our Arduino Music Player
code and adapt it to the MegaBox, giving quite a nice little package.
It already has an LCD module onboard and since it has a remote control
receiver too, you could use a universal
remote to control it. That’s even more
convenient than the numeric keypad
we used at the time.
You could also use the four illuminated pushbuttons to provide standard functions such as play, stop, pause
and next/previous track, and the rotary encoder to scroll through menu
items. The more we think about it,
the more we realise that adapting the
code in this manner would be a really
fun project!
You may also remember our Arduino-based Digital Inductance and Capacitance Meter from the June 2017
issue (see www.siliconchip.com.au/
Article/1067). Guess what – Altronics
have actually designed a shield board
for that project and it integrates perfectly with the MegaBox.
We don’t have space to describe it
siliconchip.com.au
The Altronics MegaBox connected and running the provided example program. The illuminated pushbuttons are
controlled via an IR remote control, and the LCD backlight brightness is adjusted by the rotary encoder, with an integer
value displayed on the screen indicating the number of units away from the rest position of the rotary encoder.
fully in this article but we’ll show how
to build it and integrate it with the
MegaBox (or separately) next month.
Those are just two examples of what
you can do with the MegaBox. Given
the plethora of Arduino shields, the
hardware provided by the MegaBox
itself and the ability to add extra components in the prototyping area, it’s a
really flexible system that would be
suitable for a lot of different purposes.
Circuit description
The MegaBox circuit is shown in
Fig.1. Much of this is taken up by the
Arduino module, the optional shield
and the wiring between them.
The headers where the shield can
be plugged in are wired directly to
the corresponding pins on the Arduino, which is also plugged into a set of
headers. So the shield works as if it’s
plugged on top of the Arduino board,
even though the two are mounted
side-by-side.
A third set of headers, shown next
to the ones the Arduino is plugged
into, are provided so that it’s easy to
wire up any free Arduino pins to other
parts of the board.
Most of the rest of the circuitry is in
separate blocks with headers for the
inputs and/or outputs of each block.
So to use one of these sub-circuits, all
you have to do is run jumper wires
between the Arduino headers and the
headers for that sub-circuit.
One of the few portions of circuitry
already wired to the Arduino itself
surrounds LED3, which lights up
when the SCK pin is high, indicatsiliconchip.com.au
ing that SPI serial communication is
in process.
LED3 is driven by NPN transistor
Q4 which is in turn driven by pin 13
(the SCK pin on the Arduino Uno)
via a 10kW current-limiting resistor. A
second 10kW base pull-down resistors
shunts any leakage current to ground.
There’s also a reset pushbutton (S5)
on the MegaBox board because the
button on the Arduino itself is inaccessible due to being mounted upsidedown. This is simply wired between
the Arduino reset pin and ground.
Headers CON3-CON6 provide an
easy way to access the 3.3V, 5V and
VIN (DC input) supply rails and make
ground connections. Each provides
five sockets to make connections to
one of these rails.
Separate sub-circuit blocks
Pushbuttons S1-S4 are illuminated
momentary types; the illumination
is provided by a built-in LED. Three
headers are provided to make connections to these buttons.
One 8-way header (CON2) gives
access to the LED anodes via 1kW current-limiting resistors; the cathodes
are connected to ground. That same
8-way header also gives access to the
switch common terminals.
Two additional four-way headers
This is what the PCB should look like after all the soldering has been completed.
Three of the 3-way screw terminals do not have a matching relay, so you will
need to solder wires to the adjacent pins to utilise them. Also, you can see that
digital pin 3 of the Arduino main board is mislabelled on the PCB.
Celebrating 30 Years
December 2017 43
Fig.1: complete circuit diagram for the Arduino MegaBox.
(CON17 & CON18) are provided to
connect to the normally open and normally closed contacts plus there are
four jumpers (JP1) to short the normally-open contacts to ground.
This makes it easy to sense when a
44
Silicon Chip
button is pressed since all you need
to do is fit the shorting block on the
jumper for a button and then wire the
same button’s common terminal to an
Arduino digital pin. Set that pin as a
digital input with internal pull-up and
Celebrating 30 Years
the pin will be high normally and is
pulled low when the button is pressed.
Two extra general purpose LEDs,
LED1 and LED2, are provided and
would be most useful for debugging
purposes since they are mounted insiliconchip.com.au
lows you to wire these relays up to
Arduino pins.
There are also three extra 3-way
pluggable terminal blocks at the back
of the unit which are wired to solder
pads on the board and you could potentially wire these up to extra circuitry fitted to the prototyping area.
An infrared receiver is mounted at the front of the unit and it is
powered from the 5V supply, with a
47W/47µF RC filter to prevent supply noise from affecting its operation. Its output is available on a
1-pin header (IR interface) and the
signal can be decoded using the
Arduino IRLib or other library.
There is provision for mounting a
16x2 LCD panel on the front of the unit
and its 16 pins are wired directly to
a 16-pin female header (CON9). The
power supply (+5V and GND) pins are
pre-wired for you along with contrast
adjustment trimpot VR1.
Transistor Q3 allows PWM control
and dimming of the backlight and it
has a 1kW base current-limiting resistor and a 10kW resistor to ensure it
stays off when not driven.
A rotary encoder (similar to a potentiometer but with a digital output) is
provided for user input and is wired
to a 2-way header (Encoder interface)
with 10kW pull-ups to 5V on its two
output terminals. It provides a “graycode” output.
When rotated in one direction, the
binary output at terminals A & B will
have the following sequence: 00, 01,
11, 10, 00, 01, 11, … while rotation in
the other direction will give: 00, 10,
11, 01, 00, 10, 11, … There are various Arduino libraries to help you decode this, including one called (predictably) “Encoder”.
Construction
side the case. These are also provided with 1kW current-limiting resistors
and have their cathodes connected
to ground and their anode connections made via a 2-way header (LED
interface).
There are also two on-board DPDT
relays. One set of contacts for each
siliconchip.com.au
relay is wired to a 3-way pluggable
terminal block at the back of the unit.
Each relay has a back-EMF quenching diode across its coil and a BC548
transistor to drive that coil, along
with 1kW base current-limiting resistors and 10kW pull-down resistors. A
two-way header (Relay interface) alCelebrating 30 Years
The main task when building the
MegaBox is soldering all the components onto the main PCB. Fig.2 shows
the overlay diagram which indicates
where all the components go. Many of
them are headers (mostly female but
some male too).
Our sample MegaBox didn’t come
with much in the way of instructions
and if yours doesn’t either then this
article should be a useful guide. You
can also refer to our photos to see how
the finished board should look.
Start by soldering all the low-profile
components first (eg, resistors and diodes) then move on to the relays, semiDecember 2017 45
Fig.2: exact-size PCB overlay for the Altronics MegaBox, which shows the
locations of the various headers and other components.
conductors and capacitor. Some components, such as the diodes, capacitor
and relays, need to be fitted the right
way around. For the diodes and relays, match up the stripe/line on the
component to the one shown in Fig.2
or on the PCB.
For the three LEDs, the cathode
(shorter lead) is on the same side as
the flat portion of the plastic lens and
should be matched up with what is
shown in Fig.2 and the PCB silkscreen.
On the single 47µF electrolytic capacitor, the stripe down its side indicates the negative lead while the positive lead will be longer. The longer
(positive) lead goes to the pad marked
with the “+” symbol.
We found it easier to fit the switches, terminal blocks and infrared sensor
before the headers and left the rotary
encoder for last.
Note that the headers supplied may
be longer than needed and you will
have to cut the female headers to length
and snap the male headers apart.
The various different header lengths
required are listed in the parts list
46
Silicon Chip
while the headers supplied are likely
to be 40 pins long and so you can cut
these up to form several of the smaller headers. You will be left with some
spare headers at the end.
To snap the male headers, grab either
side of the location where you want to
snap them with two pairs of pliers (or
just one pair) and then apply force to
bend the header until it snaps. Doublecheck you will get the right number of
pins before snapping.
The female headers are a little more
tricky because you need to cut them
apart using side cutters. This almost
always destroys one pin so you should
make the cut in the middle of the pin
past the end of the last one you want
to keep.
You can then remove the pin at the
cut (if it didn’t already fall out) and
file any jagged plastic edges smooth.
Three dual-row female headers are
required and while Altronics do provide a long dual-row header to cut
apart, doing so is quite tricky; you really need a large pair of side-cutters.
Instead you can cut and fit two singleCelebrating 30 Years
row headers side-by-side.
Soldering the pin headers so they're
straight can be tricky. Our tip is to
solder one pin, then visually check it
is flush and straight and re-melt the
joints if it isn’t, while applying a small
amount of pressure.
Once it’s straight, you can solder the
other pins. You may also find that it
helps to use a small flat piece of wood
or similar material to support the header during soldering.
The right-angle female header is
used as the socket for the LCD but note
that you will have to solder a 16-pin
male header to the back of the LCD
panel to plug into this.
When soldering the rotary encoder,
be sure to solder the two support pins
on either side to prevent it from being
ripped off the board.
An example program
Altronics provides a small example
program on their website that showcases the LCD screen, rotary encoder,
IR sensor and four illuminated pushbutton switches. You can download it
siliconchip.com.au
from http://download.altronics.com.
au/files/software_K9670.zip
This program assumes you're using
an Arduino Mega for the pin layout;
you can use an Arduino Uno, like we
did, but some of the I/O pin numbers
will need to be changed. Here are the
pin numbers we used with their software to work with the Uno:
• Encoder interface: pin A → D2,
pin B → D3 (line 35)
• LCD screen: RS → D4, E → D5,
DB4 → D6, DB5 → D7, DB6 → D8,
DB7 → D9
• Backlight interface → D10 (line 46)
• IRD1 → D11 (line 53)
• SW1 LED → A3, SW2 LED → A2,
SW3 LED → A1, SW4 LED → A0
(lines 60-63)
Before you can compile and upload
the software in the Arduino IDE, you
will need to install third-party libraries from the following sources:
https://www.pjrc.com/teensy/td_
libs_Encoder.html
https://www.pjrc.com/teensy/td_
libs_IRremote.html
You might run into conflicting
names for the IRremote library as the
header file shares the same name as
the RobotIRremote library.
The easiest way to solve this problem without renaming one of the
libraries is to just remove the RobotIRremote library from "C:\Program Files\
Arduino\libraries" (or wherever the
Arduino IDE is installed) temporarily. That’s assuming it was already installed. Otherwise, it won’t be an issue.
With the libraries loaded, you can
upload the program to your Arduino
board using a type-B USB cable and
then make the various pin connections
using male-male flying jumper leads
(not included in the kit but see parts
list for a suitable set from Altronics).
It helps to have a variety of lead
lengths for tidiness but you will at
least need a few that are more than
100mm long, if not 200mm to match
the width of the PCB.
To figure out where the wires go, first
refer to the list of connections above
in reference to changes to the software
(which is a complete list) but you can
also refer to the photos in this article
as a guide.
Note that when you run the software, you will need to adjust contrast
trimpot VR1 for text to be visible on the
LCD. We found that we had to wind
it almost fully anti-clockwise for the
text to be visible.
siliconchip.com.au
Parts List
1 double-sided PCB, coded K9670, 196.5 x 115mm
1 quarter-rack plastic instrument case with pre-cut holes
1 16x2 alphanumeric backlit LCD screen (LCD1)
1 infrared receiver (IRD1)
4 right-angle illuminated momentary pushbutton switches (S1-S4)
1 4-pin PCB-mount vertical tactile switch (S5)
1 10kW horizontal trimpot (VR1)
2 2A 5V mini DIL DPDT relays (RLY1,RLY2)
5 3-way PCB-mount right-angle pluggable terminal blocks (CON8,CON12)
1 rotary encoder with nut, washer and knob (S6)
1 2x18 pin dual-row female header
1 2x14 pin dual-row female header
2 2x3 pin dual-row female headers
1 16-pin right-angle female header (CON9)
1 16-pin female header (CON16)
2 10-pin female headers
8 8-pin female headers (including CON2)
1 6-pin female header
4 5-pin female headers
2 4-pin female headers
3 2-pin female headers (including CON7)
2 1-pin female headers
1 2x18 pin dual-row male header
1 2x4 pin dual-row male header (JP1)
1 2x3 pin dual-row male header
1 16-pin male header (for LCD1)
1 10-pin male header
5 8-pin male headers
solder
plus mounting screws and rubber pads for the case.
recommended: Arduino Uno or Mega; set of various male-to-male single
jumper wires (try Altronics P1016); universal infrared remote control (eg,
Altronics A1012); 4 shorting blocks (for JP1). All not included in the kit.
Semiconductors
4 BC548 NPN transistors (Q1-Q4)
2 5mm red LEDs (LED1,LED3)
1 5mm green LED (LED2)
2 1N4004 1A diodes (D1,D2)
Also, note that their software doesn’t
adjust the LCD backlight until you turn
the rotary encoder. You could connect
the backlight control pin directly to
5V so that the backlight runs at full
brightness all the time (as long as the
unit is powered).
Or you can remedy this by adding
the line "analogWrite(BL, 255);" after
the line 69, which reads "lcd.begin(16,
2);". This will cause the backlight to
start out at its highest brightness (if
you haven’t wired it directly to 5V, as
suggested above).
The data sheet for the LCD screen
used in this project is available from:
siliconchip.com.au/link/aahx
The sample software will detect
rotation of the front-panel encoder
and display the rotation amount on
the screen.
It will also pick up and display some
infrared remote control codes, specifically, RC5 codes 0x001 - 0x004 and
0x801 – 0x804. These correspond to
the buttons 1-4 on a universal remote
Celebrating 30 Years
Capacitors
47µF 16V electrolytic
Resistors (all 1/4W, 1% metal film)
7 10kW (brown black black red brown)
10 1kW (brown black black brown brown)
set on one of the more common Philips
TV codes.
When these buttons are pressed
and are generating the correct codes,
it will toggle on/off the corresponding LED in one of the four pushbutton switches.
Conclusion
The Altronics MegaBox is a very
flexible system and can be used with
virtually any Arduino shield (apart
from a few that are too tall to fit in
the case). Altronics supply a range of
shields but it can be used with shields
from other sources, too.
Building the MegaBox is not difficult so it’s suitable for relative beginners. You can purchase the MegaBox
kit (K9670) for $80 plus postage, or
$75 each if you're buying two or more.
It is available from the Altronics
website at www.altronics.com.au/p/
k9670-inventa-mega-box-for-arduino
or you could pick the kit up from one
SC
of their retail stores.
December 2017 47
|