This is only a preview of the October 2019 issue of Silicon Chip. You can view 39 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 "45V, 8A Bench Power Supply to build":
Items relevant to "High resolution Audio Millivoltmeter/Voltmeter":
Items relevant to "Precision Audio Signal Amplifier":
Purchase a printed copy of this issue for $10.00. |
Home Automation
Home Automation has been the “next big thing” for quite a while now. But –
with not too many exceptions – it remains the next big thing! Sure, there are
people who have adopted Home Automation to some degree. And there are
quite a few Home Automation specialist businesses set up to drag customers
into the 21st century (kicking and screaming, we ask?). Well, with the new
“Inventa” Home Automation Maker Plates from Altronics, that just might be
about to take that giant leap forward for all mankind!
L
et’s face it: despite all of its
promise, Home Automation
hasn’t exactly set the world
on fire – yet! Yes, we’ve all heard of
the family whose house “does everything”, whether they’re home or not,
but that’s the exception.
Despite the obvious advantages of
returning home to a beautifully cool
(or warm) house, with the dinner in
the oven ready to serve, the security
system going on standby after protecting the home all day . . . you get the
picture, we’re sure.
We believe that a major, perhaps the
major reason for Home Automation’s
lack of penetration is that unless you
are building a new home and can accommodate the extra cabling, extra
sensors and control circuitry, it’s all
just too hard for the average person
to get their mind around, let alone
actually do.
We’re also pretty sure that there
would be a fair number of people,
especially hobbyists and even more
especially SILICON CHIP readers, who
would like to have a go at Home Automation – if only it could be made
simpler.
Enter Altronics . . .
and their “Inventa” range
professionals will even want to use
them! In addition to looking good,
they’re quite powerful too.
The two we’re describing in this
article (of the three they offer) are
designed to fit into a standard Australian electrical wallplate, as might
be used for a power outlet or light
switch.
They are the K9660 Inventa 2.8in
TFT Touchscreen Maker Plate and
the K9655 Inventa 16x2 LCD Shield
Maker Plate.
Both come with a pair of wallplate
covers (two different styles) and standard mounting hardware. They also
have headers at the back of the wallplate which can accept standard Arduino shields.
Incidentally, if all this is new to you,
‘shield’ is Arduino terminology for an
add-on board with a specific pinout
What to use them for?
The most obvious use for these Maker Plates is to create a user interface for
a home automation system, allowing
information to be displayed on their
screens as well as accepting input via
either the keypad or touch panel.
As mentioned above, “Home automation” refers to systems that control
home lighting, blinds and shutters, air
conditioning/ventilation appliances
and so on – anything electrical that’s
found in the home.
Features & Specifications
Model:
TFT Touchscreen
Maker Plate (K9660)
LCD Shield
Maker Plate (K9655)
User Interface:
2.8in colour LCD
touchscreen
16x2 character LCD
with 9-key keypad
Processor:
SAM3X8E
(ARM Cortex M3)
ATmega328P
Due
Duemilanove
Arduino compatibility:
The Inventa series is a range of
Arduino-compatible “Maker Plates”
which make an easy way of adding a
slick-looking user interface to a DIY
home automation project. They have
been designed and produced in Australia by Altronics.
We reckon they look so good that
that allows it to directly piggy-back
onto a main controller board, or even
another shield underneath it.
It’s actually the Arduino which does
all the sensing, controlling and actuating and communicating –these Maker
Plates are the information “interface”
between the Arduino and you!
Flash memory:
512kB
RAM:
30kB
(2kB reserved for bootloader)
96kB
2kB
32-bit, 84MHz
8-bit, 16MHz
I/O pin voltage:
3.3V
5V
Other features:
Switchmode DC regulator
Buzzer, two relays
Processor speed:
Review/Tutorial by Tim Blythman
76
Silicon Chip
Australia’s electronics magazine
siliconchip.com.au
Made Easy(ish!)
(Left): The Inventa Touchscreen
Maker Plate (K9660) is supplied
mostly pre-assembled. The pre-loaded
demo sketch for the TFT Touchscreen
Maker Plate shows a splash screen
with the Altronics logo. Such
graphics are well suited to the colour
screen and the powerful SAM3X8E
microcontroller, which has 512kB of
flash memory, useful for storing icons
and other graphics.
(Right): Conversely, the Inventa
LCD Shield Maker Plate (K9655)
must be assembled. It is based on an
ATmega328P processor and has a 16x2
display with nine pushbuttons for user
control (yes, believe us – there are
nine!). The interface for the LCD Shield
Maker Plate reminds us of a home
security alarm panel, and it would be
well suited to such a role. The demo
sketch shows off most of the hardware
features that are built into the board.
(See the panel at the end of this article, Just what does “Home Automation” mean?).
The use of standard wallplate hardware means installing them on a wall or
cabinet is very easy. These Maker Plates
could also be used to add a user interface panel to an equipment enclosure,
without having to worry about custom
bezels and mounting.
They are also both fully-fledged microcontroller systems; both are fully
compatible with the Arduino IDE (integrated development environment), and
both are capable of being programmed
to perform a variety of tasks.
Many standard shield-format boards
can be plugged directly into the PCB
to add extra functions. This could be
as simple as putting some relays on
a shield breakout board to automate
light switching (but you’d need to be
very careful to ensure safe isolation
and spacing if those relays are going
to switch mains!).
Or you could plug in a digital radio
transmitter, Bluetooth or WiFi shield
to communicate with and interface to
remote devices. That would be safer as
it would allow you to keep full mains
isolation.
siliconchip.com.au
An Ethernet shield which supports
power-over-Ethernet (PoE) would also
be a useful addition, providing a connection into a LAN as well as power.
We’ll look at the K9660 first.
It also has a SAM3X8E 32-bit microcontroller, which can run at up to
84MHz. That makes it substantially
more potent than your typical Arduino.
It’s compatible with the Arduino Due.
Kit #1: Touchscreen
Maker Plate (K9660)
Circuit description
While pitched as a kit, this Maker
Plate does not require much assembly.
In fact, by merely connecting the LCD
to the main PCB, you’re already in a
position to load and test the supplied
demonstration code.
The reason that the TFT Touchscreen
Maker Plate does not require much assembly is that most of the components
are SMDs and they come pre-soldered.
There are a handful of through-hole
parts that need to be fitted, but the bulk
of the assembly is actually fitting the
mechanical parts of the plate together.
There are several photos, circuit diagrams and overlays provided in the kit
to assist construction, but in this article,
we’ll describe what you need to know
to get it up and running.
The K9660 has a 2.8in touchscreen
LCD (very similar to the 2.8in LCDs that
we use on our Micromite projects) with
an ILI9341 controller.
Australia’s electronics magazine
The circuit of the K9660 main board
is shown overleaf in Fig.1. You will
notice that it’s dominated by the 144pin microcontroller (IC1) and the 2.8inch LCD touchscreen, which attaches
via a 50-pin ‘flat flexible’ cable. PWM
backlighting control is enabled by NPN
transistor Q1.
This micro has an internal USB interface, and this is wired up to CON2,
a micro-USB (Type B) socket. In addition to two 39Ω impedance-matching
resistors for the D- and D+ lines, there
are three varistors to protect the micro
from static electricity, on the D-, D+
and USBID lines (V1-V3).
Power is fed in either via USB socket
CON2 (through diode D1 and jumper
JP1) or via terminal block CON3 and
reverse polarity protection diode D4.
The 5V rail powers the touchscreen
backlight and also goes to the 5V pin
on the shield connector. 5V is also fed
to the 3.3V regulator, REG2, which
October 2019 77
D3 SS14
A
K
CON3
1
+
VIN
K
A
REG2
MC 33375ST-3.3
REG1 R-78E5.0-0.5
D4 SS14
+5V
OUT
IN
1
2
–
2
47 F
10 F
GND
35V
10V
10 F
10V
IN
OUT
+3.3V
3
ON
/OFF GND
10 F
10V
4
JP1
0
D1
SS14
A
D2
SS14
100nF
K
L3 25 H
56
5x100nF
61
10V
0.5A
10
45
10 F
100nF
PS1
104
124
34
AREF
75
CON2
USB MICRO-B
39
1
2
3
X
4
38
39
V1
5V
6.8k
IOREF
43
37
39
22pF
V2
5V
SHLD B
42
40
50
100k
53
13
RST
14
3.3V
129
5V
ERASE
V3
5V
GND
GND
10 F 100nF
100nF
A
K
VIN
16
130
JP3
NRST
69
47
78
SHLD A
79
A0
80
A1
81
A2
82
A3
83
A4
49
A5
48
35
RST
S1
100nF
X1 12MHz
22pF 22pF
36
100nF
A
10V
LED1
57
VDD
IN
41
VDD
UTMI
VDDOUT
100nF
100
10 F
10V
73
VDDANA
100nF
L1 25 H
100nF
L2 25 H
100nF
100nF
+3.3V
USB IN
11
VDD
IO
62
VDD
IO
105
VDD
IO
125
VDD
IO
52
VDD
BU
1
PB26
3
PA10
4
PA11
5
PA12
6
PA13
7
PA14
8
PA15
23
PA0
24
PA1
55
PC1
108
PA25/MISO
109
PA26/MOSI
64
PC6
110
PA27
63
PC5
VDDCORE
VDDCORE
VDDCORE
VDDCORE
VDDCORE
VDDPLL
ADVREF
VBUS
DHSDM
DFSDM
DHSDP
DFSDP
VBG
IC1
ATSAM3X8EA-AU
SHDN
FWUP
PC7
PD0
PC8
(MANY UNUSED PINS
NOT SHOWN)
PD1
PB11
PA18
PA17
PD3
PB27
PC0
PD8
NRST
PD7
NRSTB
PA28
PA16
PC21
PA24
PC22
PA23
PC4
PA22
PC23
PA6
PC24
PA4
PC25
XOUT32
PC26
XIN32
PC27
XOUT
PA25
PA9
XIN
JTAGSEL
46
TST
51
GND
12
GND
58
GND
106
GND
126
GND
PLL
GND
UTMI
GND
BU
GND
ANA
33
44
54
74
PA8
K
65
66
70
9
68
21
20
111
132
133
116
134
135
136
137
139
144
2
27
1k
SC
20 1 9
78
ALTRONICS K9660 ARDUINO (ARM) TOUCHSCREEN WALLPLATE
Silicon Chip
Australia’s electronics magazine
siliconchip.com.au
2.8-INCH TOUCHSCREEN LCD PANEL WITH LED BACKLIGHTING, ILI9341 CONTROLLER
+5V
4x
15
R-78E 5.0-0.5
IN
OUT
GND
+3.3V
TAB (GND)
Y+
X–
Y–
GND
GND
GND
IN
OUT
ON/OFF
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 33
44
45 35
46
47 37
48
49 39
50
1
2
LEDK
LEDA1
LEDA2
LEDA3
LEDA4
IM0
IM1
IM2
IM3
RESET
VSYNC
HSYNC
DOTCLK
DE
DB17
DB16
DB15
DB14
DB13
DB12
DB11
DB10
DB9
DB8
DB7
DB6
DB5
DB4
DB3
DB2
DB1
DB0
SDO
SDI
RD
WR
RS
CS
TE
VCC
VCC
VCC
GND
X+
MC33375
SS14
K
A
+3.3V
470
Q1
BC817 C
DNP
B
E
NRST
1
2
3
4
5
6
BC817
C
+5V
B
MISO
E
LED
CATHODE
BAND
MOSI
K
A
SHLD D
SCL1
SDA1
AREF
AREF
GND
PWM13
PWM12
PWM11
PWM10
PWM9
PWM8
SHLD C
PWM7
PWM6
PWM5
PWM4
PWM3
PWM2
TX
RX
1
2
3
4
5
SERIAL
CON8
Fig.1: the Altronics Touchscreen Maker Plate is based around a 32-bit ARM Cortex processor (IC1) and a 2.8-inch
touchscreen which connects via a 50-pin flat flex cable. Most of the remaining circuitry is the power supply and
bypassing for IC1, components related to the USB interface plus a set of five standard Arduino R3 headers for
attaching shields. This design is software-compatible with the Arduino Due.
siliconchip.com.au
Australia’s electronics magazine
October 2019 79
100nF
22pF
R-78E5.0-0.5
TX
RX
47 F
D4
SS14
P3
0
SCL1
SDA1
AREF
GND
PWM12
PWM13
PWM11
PWM10
PWM9
PWM8
PWM7
PWM6
PWM5
PWM4
PWM3
PWM2
RX
TX
Q1 DNP
C12
10 F
REG2
15
10 F
22pF 10 F
100nF
X1
10 F
12MHz
15
JP3
1k
22pF
22pF
39
100nF
L3
VIN GND
ERASE
100nF 6.8k 100k
100nF
100nF
100nF
39
L1
100nF
100nF
100nF
100nF 100nF
D3
15
15
100nF
RESET
37
1
CABLE
TO LCD
10 F
+
IC1
SAM3X8EA-AU
10 F
D1
REG1
73
K9660
D2
JP1
100nF 100nF
S1
1
PS1
V1
109
6
GND
V2
L2
www.altronics.com.au
P8
CON2
10 F
NC
RST
IOREF
5V
3V3
GND
VIN
GND
A0
A3
A1
A2
A4
A5
V3
100
A
LED1
470
Fig.2: the Touchscreen Maker Plate board uses mostly surfacemounting parts due to the limited space, all of which come presoldered. You only need to fit the connectors, switchmode regulator
module (REG1), reset pushbutton (S1), jumpers and terminal block.
The whole thing fits neatly in a standard wallplate.
provides the logic supply for the
touchscreen as well as running microcontroller IC1. It’s also fed to the
IOREF and 3.3V pins on the shield
headers.
Two of the micro’s supply pins have
LC low-pass filters to reduce noise, specifically pin 73 (the analog supply) and
pin 41 (powering the USB transceiver).
A third LC filter from the VDDOUT pin (pin 56) to VDDPLL (pin 34)
smooths the internally generated supply voltage for the chip’s phase-locked
loop, which derives its 84MHz master
clock from the 12MHz crystal oscillator based around X1.
Construction
Fig.2 shows the PCB overlay diagram
for this project. As mentioned earlier,
most of the parts come already soldered
to the board. All you really need to add
is regulator REG1, the headers, jumpers, screw terminals and reset pushbutton (S1).
The manual for this board explains
that the standard Arduino header spacing is too wide to allow the Maker Plate
to fit into a standard wall box, so two
sets of headers are provided. The first
is at the standard shield spacing, the
second at a narrower spacing.
You can use the standard headers
for prototyping but you would need
to wire up the shield using jumper
leads, or make an adaptor so that it
can remain attached when the unit is
mounted on the wall.
We suggest that you fit both sets of
headers, as a mounted LCD will need
to be removed to allow access for sol80
Silicon Chip
dering. Since the LCD is fixed with
double-sided tape, it could be difficult
to remove.
It’s best to use a spare shield as a jig
to ensure that the shield headers are
square and straight. Fitting the shield
also gives you a chance to see what the
clearances are like around the board.
It’s very tight, with a typical shield only
barely fitting lengthwise between the
mounting screw-holes in the wallplate.
A typical shield will also cover the
reset pushbutton, although it is not entirely inaccessible. Many shields have
their own reset buttons for this reason.
An attached shield would also foul
the DC input screw terminals. As such,
we elected not to fit the screw terminals. You can solder wires to its pads
instead. Alternatively, you could use
a lower-profile screw terminal.
After fitting the through-hole components, trim their pins to be as short
as possible. This is necessary as the
LCD is mounted on the back of the PCB
with double-sided tape, and we need
to avoid shorting out any pins on the
LCD’s metal shell.
Fitting the LCD is a bit fiddly, so
we recommend test-fitting it without
any tape to get a feel for how it all
comes together. Once we were happy,
we placed the double-sided tape over
any exposed pins to ensure they were
covered as much as possible and attached the LCD.
There is some wiggle room in the
PCB’s mounting holes, allowing the LCD
to be centred in the bezel. Naturally, it
helps to mount the LCD squarely and
correctly within the marked outline.
Australia’s electronics magazine
The USB socket is accessed through
a slot in the side of the wallplate; the
wallplate will only attach to the PCB
with one orientation because of this.
We found that the thickness of the
wallplate prevented some USB cables from plugging in completely, but
the USB cable included with the kit
worked fine.
The slot for the USB socket is covered by the decorative facia cover that
is provided, so this will need to be removed to access the USB port (eg, for
programming). It is possible to notch
out the wallplate further if regular access is needed to the USB port.
All in all, the final product is quite
tidy, but necessarily cramped. In just
about all cases, a cavity in the wall or
spacer block will be needed, as many of
the components and headers protrude
past the back of the mounting plane.
Software
The kit comes pre-loaded with a
demonstration sketch programmed
into the firmware, but you will need
the Arduino IDE (integrated development environment) to make it do anything beyond this.
The IDE is free and can be downloaded from siliconchip.com.au/link/
aatq
We recommend using a recent version, especially as versions after 1.6.4
include support for the automatic installation of add-on boards and libraries. We used version 1.8.5.
The Due board profile (compatible
with this micro) is not installed by default, so after installing the IDE, you
siliconchip.com.au
will need to use the Board Manager
utility to do this. Select the Tools ->
Board -> Board Manager menu option,
and search for “Due”. Fig.3 shows how
the result should look.
Click the Due entry and then click
“Install”. The install process will take a
few moments as the toolchain components (compiler etc) are installed, after
which two new entries will appear in
the Tools -> Board menu.
They are “Arduino Due (Programming Port)” and “Arduino Due (Native USB Port)”.
How do you power them?
Powering these Touchscreen Plates
on the workbench is one thing but more
than once, the question arose, “how do
you power them when they’re mounted
in/on a wall?”
It’s a fair enough question, too.
But we figured that in the vast majority of circumstances, the devices being
controlled or linked to would have the appropriate power supply available – 3.3V
or 5V DC as the case may be . . and it
Fig.3: this shows the results of searching for “Due” in the Arduino IDE Boards
manager. You need to install this Boards package to be able to program the
SAM3X8E microcontroller on the Touchscreen Maker Plate board. Once you’ve
found it, simply click on the Boards package and then click the “Install” button
(not present here because we’ve already installed it).
Fig.4: note the search term we’ve entered in the box at upper-right. The first result
is one of the libraries required to compile the demo code for the Touchscreen Maker
Plate. Like with the Boards files, click on the entry once located and then click the
“Install” button.
Fig.5: the second of three libraries you need to compile and upload the demo code.
The third one must be downloaded separately and installed from the .ZIP file (see
text for details).
siliconchip.com.au
Australia’s electronics magazine
should be a simple matter to tap off the
power required.
Power requirements for the Plates
themselves are very modest.
In the unlikely event that this was not
possible, it may be necessary to arrange
an external supply (eg, a plugpack).
Working with an existing building might
be problematic, but installing them in a
new building should not cause significant dramas.
While official Due boards have two
USB sockets corresponding to these
two entries, the Touchscreen Maker
Plate only has the native USB port.
This option should be selected to allow programming to occur. The correct serial port needs to be selected too
(in Windows, check Device Manager).
The programming port is presumably omitted due to space constraints.
The native USB port can be used
for programming, but is about 30%
slower.
The official Arduino advice is that
the programming port is preferred, not
just for speed, but because it’s possible for a bug in the loaded sketch to
make the native port unavailable, thus
leaving you with no easy way to reprogram the chip.
Also note that the native port corresponds to the “SerialUSB” object,
while the programming port corresponds to the “Serial” object, meaning that existing sketches that use the
“Serial” object may need to be modified to communicate with a USB host
with this board.
To compile the example sketch
(downloadable from siliconchip.com.
au/link/aato), you need three extra
software libraries. Two of these can
be installed by the Library Manager
but the third needs to be installed
manually.
The Library Manager can be found
under the Sketch -> Include Library ->
Manage Libraries menu. The required
libraries can be found in this dialog,
as shown in Figs.4 & 5. Like the Board
Manager, once you’ve found the library, simply click on it and then click
the install button.
You can download a ZIP of the third
required library from: siliconchip.com.
au/link/aatp
Once you have the file, use the
Sketch → Include Library → Add
.ZIP library menu item, then with the
October 2019 81
file dialog box opens, browse to the
downloaded file and click “Open”. If
all is well, you should see a message
that the library was installed correctly.
The example sketch can now be compiled and uploaded to the board. Note
that the “AltImg.h” file needs to be in
the same folder as the sketch file. Uploading this sketch takes around two
minutes. Most of the sketch size (and
upload time) is due to the embedded
graphics.
The demo sketch shows a splash
screen, followed by a set of text instructions which explain the calibration process which follows. After calibration, a
simple ‘paint’ type program allows the
touch panel and display to be tested.
Hardware
Arduino pin PWM6 (physical pin
135) of the Due controller is used to
control the touchscreen backlight. It
can be switched on and off or dimmed.
This is the only pin on the shield headers which is used for other purposes.
While the Arduino version of the Due
has 54 I/O pins, all of its PWM pins are
already shared with the shield headers,
so this was unavoidable.
Note that as the SAM3X8E microcontroller runs from 3.3V, you may find
that some shields which are designed
expecting a 5V microcontroller will not
function properly with it.
Further software development
The TFT display library includes
some more code examples. But note
that those which incorporate touch
sensing use a different touch library
than the one which Altronics recommends, so they may need to be modified.
For the others, all you need to do to
get them to work is to find their control
pin definitions and change them to suit
the pinout on this board, ie:
#define TFT_RST 33
#define TFT_DC 37
#define TFT_CS 38
You may also need to add some commands to the setup() function to turn
the backlight on, like this:
pinMode(6,OUTPUT);
digitalWrite(6,HIGH);
The examples we tried were quite
quick at updating the display, as the
library uses the SAM3X8E’s DMA peripheral to pass data to the screen efficiently.
82
Silicon Chip
The sample sketches by default do
not use the native USB port for outputting their debugging data. So you
should change references to the “Serial” object to read “SerialUSB” instead.
A ‘quick and dirty’ way to achieve this
is to add the following line near the top
of the sketch:
#define Serial SerialUSB
For developing your own programs,
we suggest using Altronics’ demonstration sketch as a starting point, along
with sample code from the TFT library.
Kit #2: LCD Shield Maker
Plate (K9655)
The second kit is the K9655 Inventa 16x2 LCD Shield Maker Plate. It is
based on an ATmega328P processor,
the same one used in the Uno, although
this particular design is more like the
Arduino Duemilanove in operation.
It also has a 16x2 character LCD for
display and a nine-button membrane
keypad for input.
While it might appear from the photos that there are only five buttons, the
remaining four buttons are unmarked.
Along with the five marked buttons,
they make up a 3x3 button grid.
The circuit for this kit is shown in
Fig.6. It uses an MCP23S17 I/O expander IC to interface the ATmega328P micro to the LCD, keypad, buzzer and relays. That means that most of the regular Arduino pins are still available for
use by shields.
The MCP23S17 is the SPI version of
the I2C-based MCP23017.
The circuitry at the bottom is similar
to that of an Arduino Uno board, with
the ATmega328P micro wired up to the
usual headers, clocked from a 16MHz
crystal and with a basic 5V power supply delivered by a 7805 linear regulator.
There’s also a 3.3V regulator in case a
connected shield needs to draw power
from that pin, but it doesn’t run anything else on the board.
I/O expander IC2 drives the 16x2 alphanumeric LCD module from seven
of its GPA pins, configured as digital
outputs. GPA6 (pin 27) drives the base
of NPN transistor Q1 which connects
the backlight cathode to ground, giving on/off control. Its anode is permanently connected to the +5V rail via a
200Ω current-limiting resistor.
Similarly, GPA7 drives the base of
NPN transistor Q3, and this controls
auxiliary SPDT relay RLY1, with its
three contacts wired to terminal block
Australia’s electronics magazine
CON7. So you can use it for whatever
purpose you desire.
The I/O expander GPB ports are used
to sense button presses on the keypad,
which is arranged in a 3x3 matrix,
and its six pins connect back to GPB2GPB7 via header CON2. GPB1 drives
the piezo buzzer directly while GPB0
controls another NPN transistor (Q4)
which in turn switches another relay,
RLY2, which has its contacts wired to
terminal block CON8, again for general
purpose use.
The I/O expander SPI bus is connected to the usual Arduino pins of D11-13.
Other devices can share this bus. Its CS
line connects to either Arduino pins D9
or D10, depending on the position of
JP3. This can be used to prevent conflicts with any shields used (assuming
they don’t use both D9 and D10).
NPN transistor Q2 is connected to
the SCK pin (D13) so that LED3 lights
up when there is activity on the SPI
bus. LED1 is connected across the 5V
supply, so it lights up when power is
applied.
The dotted red lines shown from the
INTA and INTB pins of IC2 back to D2
and D3 on the Arduino via jumpers
were not present on the version of the
kit we received, but will be added to future kits. With the jumpers fitted, these
will allow you to trigger an interrupt
routine on the microcontroller if a specific button on the keypad is pressed,
without having to actively ‘poll’ the
keypad periodically.
The board
Unlike the K9660 Touchscreen Maker Plate, this one does need to be assembled. But it’s virtually all throughhole components, and not that many
of them, so it isn’t a big job. The PCB
overlay diagram, Fig.7, shows the
board layout.
The bulk of the components mount
on the back of the plate. There is a
Fig.6 (opposite): the circuit for the
LCD Shield Maker Plate, which
is based around an ATmega328P
microcontroller, the same one used in
the popular Arduino Uno. I/O expander
IC2 is used to interface with the LCD
and keypad, so that most of IC1’s pins
are still available for other purposes,
including connecting to one or more
shields. IC2 also controls the piezo
buzzer and the coils of two small relays
which you can use for various purposes.
siliconchip.com.au
+5V
+5V
A
LED3
K
200
100nF
9
18
1k
C
Q2
BC337
Vdd
RST
GPA0
GPA1
1k
GPA2
B
GPA3
E
14
13
12
11
D10
GPA4
MISO
GPA5
MOSI
GPA6
SCK
GPA7
CS
IC2
MCP23S17
D9
20
JP3
19
17
16
15
GPB7
GPB6
INTA
GPB5
INTB
GPB 4
GPB3
GPB2
A2
A1
GPB1
A0
GPB0
Vss
15
2
4
21
22
6
23
24
Vdd
RS
BLA
16 x 2
LCD MODULE
EN
D7 D6 D5 D4 D3 D2 D1 D0
25
14 13 12 11 10 9
CONTRAST
GND BLK R/W
7
8
1
27
C
1k
28
B
8
E
7
3x3 KEYPAD
1
6
2
5
3
4
4
3
5
2
6
1
R1
R2
R3
7
+
PIEZO
SOUNDER
C1
K
A
LED1
1
B
Q4
BC337
B
E
E
BC 33 7
RST
C
1k
Q3
BC337
COM2
3
NO2
CON7
1
B
E
NC2
2
A
C
1k
1k
C3
CON8
D4
1N5819
A
MOSI
SCK
RLY1
C2
RLY2
K
D3
1N5819
K
+5V
+5V
MISO
Q1
BC337
CON2
+5V
SHLDE
ICSP
5
16
26
10
D3
D2
VR1
10k
3
NC1
2
C
COM1
3
NO1
SHLDD
D1
CON1 1N5819
K
1 A
+
VIN
2
–
SCL
REG1 7805
47 F
25V
GND
SDA
+5V
OUT
IN
100nF
AREF
100 F
16V
100nF
100nF
SHLDB
1
+5V
+5V
RESET
+5V
+5V
GND
23
24
GND
1 F
27
VIN
28
SHLDA
9
A0
A1
1M
X1
A2
A3
A4
16MHz
22pF
A5
A
20 1 9
K
LEDS
K
A
SCLK/PB5
RESET/PC6
MISO/PB4
ADC 0/PC 0
PB1
ADC 1/PC 1
PB0
22pF
LP2950
PD6
ADC4/PC4/SDA
PD5
ADC5/PC5/SCL
PD4
XTAL1/PB 6
PD3
RXD/PD0
GND
8
IN
14
Australia’s electronics magazine
RESET
D7
D6
D5
D4
5
D3
4
D2
3
TXD
2
RXD
2x
1k
D2
1N5819
10k
S1
SHLDC
6
+5V
OUT
D9
D8
15
GND
22
GND
D10
17
11
TXD/PD1
XTAL2/PB 7
D11
12
PD2
10
MOSI
18
13
PD7
ADC3/PC3
19
D13
D12
16
PB2
ALTRONICS 9-BUTTON WALLPLATE With LCD
siliconchip.com.au
SCK
MISO
IC1
ADC 2/PC 2 ATMEGA
26
3 2 8P
328P
25
GND
1N5819
7
Vcc
20
AVcc
MOSI/PB3
REG2
LP2950-3.3
OUT IN
+3.3V
+3.3V
SC
21
Aref
GND
K
D1
D0
CON4
1
GND
2
A
GND
3
+5V
4
100nF
RXI
5
TXO
6
DTR
FTDI
October 2019 83
Silicon Chip
1k
+
10k
200
S1
100nF
100nF
+
100nF
GND
DTR TX RX 5V
CTS
1k
B1
SHLDE
IC1 ATMEGA328P
9 JP2
22pF
1M
X1
22pF
NC1
NO1
NC2
1k
IC2 MCP23S17
CON2
1k
COM1
R3
LED3
Q2
VR1
COMMON
10
VIN
NO2
COMMON
LCD1
1k
1k
A0
A1
A2
A3
A4
A5
1k
RLY2
Q1
GND
IOREF
RST
3V3
5V
GND
GND
VIN
1 F
47F
LED1
REG2
100nF
D1
COIL
COIL
RLY1
COM2
100F
100nF
Q4
Q3
D4
D3
REG1
NC
84
Programming
connection
1k
NO
Jumper JP3 for IC2’s CS connection
is actually just three sets of closely
spaced pads. These are hard to get at
once the rest of the components have
been fitted, so at this point, you should
figure out which pin to use (see Altronics’ instructions for more details) and
bridge the two appropriate pads. We
used D9 as that is the one used in the
example code.
The next job is to fit the SMD IC.
Make sure its orientation is correct,
tack it down and then solder the pins.
Clean up any bridges with flux paste
and solder wick.
Then fit the remaining top-side
components, starting with the shorter
ones and working your way up to the
taller ones.
We used an Arduino shield that we
had lying around as a jig to ensure
that the shield headers were mounted
square and straight. Check that IC1,
the diodes and electrolytic capacitors
are orientated correctly, as per Fig.7.
Note the three resistors and one diode (D2) which need to be laid over to
avoid fouling the wallplate surround
later. REG1 and the electros also need
to be mounted flush with the board.
Make sure the component leads
around crystal X1’s mounting position
on the underside of the board have
been cut as short as possible, then solder X1 in place, ensuring enough space
between it and the component leads
that it won’t short. Adding some insulation under the crystal body is a good
idea; the Altronics instructions say to
use some of the supplied double-sided
tape in this role, so we did so.
Their instructions also note that
the pins for the LCD header are quite
ALTRONICS
K9655
INVENTA
NC
Assembly
close together, so make sure you
don’t bridge any of these during
soldering. If you do, use some
flux paste and solder wick (and
possibly also a solder sucker)
to fix it.
Before fitting the PCB into
the wallplate, we test-fitted the
LCD and membrane pad to see
that everything was working as
expected. The connections for
these parts are a little bit awkward, in that the sockets for both
are very close. Note that the LCD
connection is not keyed, so this
should be checked carefully
against the construction photos
to ensure you plug it in the right
way around.
Once the LCD is correctly
connected, apply power and
the demo software should start
up. You can then check that the
keypad buttons all work. Each
press on the keypad triggers
an action on the board, such as
a relay toggling or the buzzer
sounding.
NO
standard Arduino R3 set of headers,
including dedicated pins for I2C and
SPI. There is no USB/serial converter,
so serial communication and programming require a separate module. The
serial header pinout matches many
so-called ‘FTDI’ type USB-serial‑ converters, such as Altronics Cat Z6225.
It’s quite a packed board, so much
that the crystal oscillator for IC1 (an
ATmega328P) is mounted on the back
of the PCB. The only SMD part is IC2,
and it’s quite large, so not difficult to
solder.
There are screw terminals for DC
power in (up to 15V) and the two sets
of SPDT relay contacts (for low voltage
only – definitely not mains!).
SCL
SDA
AREF
GND
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
FTDI
D2
Fig.7: the LCD Shield Maker Plate comes as a
While Altronics Cat Z6225 bare PCB and a selection of parts. All the parts
FTDI USB to serial TTL adapt- but one are through-hole types, so assembly is
straightforward. CON2 is used to connect to
er module could be used to the nine-button matrix keypad while LCD1 is
program the LCD Shield Maker a flat flex cable connector for the 16x2 LCD.
Plate, we tried using a CP2102- The relays are not suitable for switching mains
based module instead, as we voltages as the tracks and pins are too close
stock these in the SILICON CHIP together, and too close to other components.
ONLINE SHOP (siliconchip.com.
au/Shop/7/3543). The required wiring no IDE, instead of the Uno. Otherwise,
you can treat this board like the Uno.
is shown in Fig.8.
It may be possible to change a
While the CP2102 uses 3.3V logic
levels, the ATmega328P can accept Duemilanove to the Uno by merely re3.3V digital signal levels even when placing the bootloader, which can be
running from a 5V supply. The 1kΩ done from the IDE, but you need an
series resistors on the wallplate board in-circuit serial programmer (‘ICSP’).
limit the current flowing into the se- We haven’t tried this, but in theory,
rial converter RX pin to a safe level, it should provide 1.5kB more of flash
even though the Arduino’s output pin programming space. It should also
speed up sketch uploads. However, we
swings up to +5V.
have heard reports that it may not work
Software
reliably, so we recommend caution.
There are no extra libraries needed
The Duemilanove processor is the
same ATmega328P as used in the to program the demo sketch into this
Arduino Uno. The main difference board (you can get it from siliconchip.
is that they use different bootloader com.au/link/aatr). Just make sure to
firmware. The bootloader is a small extract all the files in this package to
piece of software that runs every time a folder named “K9655DemoCode”.
the processor starts up, to allow new There are two extra files which prosketches to be sent from the Arduino vide functions to control the LCD, detect presses on the keypad and so on.
IDE to the chip.
The Duemilanove board profile is
This means that you need to select
the Duemilanove board in the Ardui- built into the Arduino IDE, so after
Australia’s electronics magazine
siliconchip.com.au
SHLD
SH
LDE
E
block will be needed, as several components protrude past
the back of the plate.
GND
GN
D
selecting this and the correct serial
port, we were able to compile and upload the demo sketch.
A good way to write your own code
for this board is to make a copy of the
demo code by using the File -> Save
As menu option. This will make a copy
of the K9655.cpp and K9655.h files as
well as the main sketch file.
As mentioned earlier, the MCP23S17
requires a dedicated CS (chip select)
pin, which can be set to either D9 or
D10 using the supplied solder jumper.
If your intended application requires
both of these, it may be possible to
solder a wire directly from the middle pad of the jumper to an alternative
pin, and modify the Altronics code to
use that pin instead.
100nFF
100n
FTDI
1k
DTR
DT
R TX RX 5V
These two Maker Plates fit
a lot into a small space. The
SAM3X8E processor on the
TFT Touchscreen Maker Plate
(K9660) is well-suited to the
producing colour graphics
for display on the LCD, with
a faster processor and more
RAM and flash memory than
most Arduinos. All these features make the TFT Touchscreen Maker Plate versatile
and, we think, professional
looking.
However, it is significantly
more expensive than the LCD
Shield Maker Plate (K9655),
which is better suited to more
basic tasks. The more limited
RAM and flash memory do
limit its capabilities somewhat, but it’s powerful enough
for many basic applications.
To purchase, visit your local
Altronics shop or order from
D2
CTS
CT
S
1k
A2
A3
A4
A5
Conclusion
10k
Fig.8: here’s how to
connect one of the
ubiquitous CP2102 USB/serial adaptors,
available from the SILICON CHIP ONLINE
SHOP (siliconchip.com.au/Shop/7/3543)
to the serial header on the Touchscreen
Maker Plate. This provides both serial
communication between the computer
and microcontroller, and allows you to
upload freshly compiled sketches.
their website at the following links
(which also have more information
on both products):
TFT Touchscreen Maker Plate
($175): www.altronics.com.au/p/
k9660
LCD Shield Maker Plate ($84.95):
www.altronics.com.au/p/k9655
Final assembly
As you might expect, the board is
a very snug fit for the wallplate, and
we found that we had to tweak the
mounting bolts slightly to get them
to fit the holes in the PCB, as well as
allow the PCB to fit. The two flexible
cables (for the LCD and keypad) are
also a bit awkward to fit. But it makes
a neat package when you manage to
put it all together.
Like the TFT Touchscreen Maker
Plate, either a wall cavity or spacer
siliconchip.com.au
Here an
assembled K9655
plate is shown
with a motor driver
Arduino shield
plugged in. There’s a
huge variety of shields
on the market to
accomplish just about
any task you can think
of!
Australia’s electronics magazine
October 2019 85
Just what does “Home Automation” mean?
It’s sometimes called
a “Smart Home” but either term basically means
engaging technology to
make the decisions required to control any, or
as many of, the devices
in and around a home
which you normally make
the decisions to control
yourself.
Some of those decisions are made completely autonomously according to parameters you (or someone else) have set up. Others may require your input, either at home via some form of keypad or
screen – or if you’re not home, via information sent direct to
your smartphone (and your decisions sent back the same way
and acted upon).
Some of those “smart home” decisions, the ones often mentioned, include:
• Climate control: turning on air conditioning or ventilation to
maintain a comfortable temperature – eg, heating the home
when it’s cold or cooling it when it’s hot.
• Lighting control: turning lights on and off as required – for
example, sensing whether someone is in a room and turning lights off when they’re not – but also setting the lighting
level you prefer.
• Blind and shutter control: you select the time or lighting conditions when you want them open or closed.
• Entertainment control: Selecting what your hifi/TV/etc system
plays for you – and the level it plays at – possibly by learning what your preferences are according to the time of day.
• Security: maintaining a protection system in and around your
home and reacting to any triggering it detects.
• Access control: allowing access (even unlocking and opening doors) to your home for persons who have access rights
and denying it for those who don’t – then choosing an appropriate course of action.
• Appliance control: turning appliances on or off according to
demand, to take advantage of lower tariffs, etc.
But there are many other “things” which home automation
can play a part in, such as
• Building sensors – reacting to anything outside the “norm”
such as fire, flooding, gas build-up, power outages, etc.
• Personal health and safety – keeping tabs on who is at
home, their health, medication reminders, baby monitors, etc.
• Pool and spa pumps and automatic chlorinators.
• Remembering – to lock the front door or close the garage
when you forget (and just as importantly, NOT closing the
garage door when something is in the way!).
• And even to make your home look “lived in” while you are
away – and reporting to your smartphone if something is
not quite right!
• Charging control: got a storage battery or maybe an electric car? You can choose when to turn chargers on, again
by determining when tariffs are cheapest.
And we’ve really only looked at the home here – but already,
“farm automation” is making huge inroads into properties,
86
Silicon Chip
managing water resources,
stock levels and locations,
even farm gates and so on.
These are just some of
the tasks that home automation either undertakes
now or promises to undertake. (Obviously there are
many more).
But just how does it/can it?
The interfaces
The big sticking point, for the “average” person, is the interface between the computers or microcontrollers that are programmed to make the smart home smart . . . and the devices
which switch, or measure, or adjust, or warn, or otherwise “do”
the smart tasks.
Of course, control circuitry is myriad. If you Google “home
automation” or “smart home” on the net, you’ll get millions, perhaps billions of hits. It might take you a while to sort the treasure from the trash but it’s highly likely you’ll find something to
do what YOU want to do (or very close to it).
That’s fine – but once again, how does the “average” person actually do it?
One of the “biggies” is that a large proportion of the home
equipment lending itself to Home Automation is not only mains
powered, it’s hard-wired (especially in existing buildings). Think
lighting, for example. And in many countries, Australia included, working on mains wiring is illegal if you don’t have the appropriate licence.
Where mains devices are plug-in, it’s less of a problem –
though in some jurisdictions, even interfacing with those can
be illegal.
This has been overcome to at least some degree by many
electricians “going back to school” and learning all about smart
homes and their control.
That’s fine – but still leaves the hobbyist out of the loop, so
to speak.
The big “IF” is that IF electrical wiring has been modified illegally and IF there is a problem (fire, for instance) not only is
the hobbyist liable to be prosecuted but insurance companies
may refuse to pay for any loss or damage.
The software
This is perhaps the easiest part of the whole smart home
equation.
With the proliferation of microcontrollers and similar devices,
there is almost certain to be software out there to do whatever
you want with home automation and the smart home – or at
least close to it.
Again, Google is your friend!
Even many of the projects published in SILICON CHIP in recent years have code which, when you think about it, could be
part of a Home Automation control system.
We’re not going to dwell on the fact that you might not speak
Arduino or Pi or Micromite or …...... – but it’s not hard to find
someone who does (especially in online forums).
Or perhaps it’s time to dip your toe into the micro pool and
learn what it’s all about?
SC
Australia’s electronics magazine
siliconchip.com.au
|