Part 3: Alarmduino

Oliver Higgins

Issue 5, November 2017

This article includes additional downloadable resources.
Please log in to access.

Log in

We take the alarm system that we developed earlier, and put it to practical use.

In Issues 2 and 3 we developed a basic alarm using an Arduino Mega 2560. Built on a breadboard, we were able to interface with both passive and active sensors, add relays to switch sirens and activate via RFID swipe cards. Now it’s one thing to have the unit on a test bench, running on a breadboard, but what if we were to put it into a working installation?

We experimented with various 3D printed design and parametric cases. While good, none seemed to fit the bill when it came to the hardware’s additional requirements. Enter the Altronics Megabox. We were impressed from the start with this offering, and felt that this was the perfect opportunity to put it to good use!

The Megabox provides a fantastic method for turning our prototype into an installable item. Out of the box, it's ALMOST what we want, but we've made one major improvement. We created a custom 3D backing panel to accommodate the terminal strips for our alarm panel. This replaces the factory-cut face, and since it's 3D printed, you can easily add your own customisations for more flexibility before printing too!

We could just modify the factory panel, but if you're anything like us you're better with CAD than a Dremel any day...

Note: A rotary encoder is included which we don't use. We decided to install it rather than printing an entire new front panel.

Parts Required:Jaycar Altronics
1 x Altronics Megabox - K9670
1 x Arduino Mega 2560 XC4420 Z6241
1 x Arduino Ethernet Shield XC4412 Z6242
2 x 8-way Angle Headers HM3428 P5518
2 x 8-way Plugs HM3408 P5478
1 x Cat5 Cable (stranded),distance as required WB2020 W2752
2 x 6-way Screw Terminal Connectors HM3164 P2078A
1 x 10k Resistors, as required for hook up RR0596 R7782
1 x Arduino RFID Scanner *XC4506 Z6356
1+ Compatible FOBS *XC4506 S5376
1 x PIR Scanner XC4444 Z6382
1 x Reed Switches LA5072 S5153
1 x Relay Module XC4419 Z6325
1 x Piezo Module AB3462 S6109
1 x 9 to 12V DC, 250mA or more, 2.1mm plug, centre pin positive
1 x 3D Printed Custom Megabox Back Panel
1 x 3D Printed RFID Wallplate

*XC4506 - is a kit which includes both scanner and fob.

You may also like to add sirens, strobes, and other alarm hardware, as you deem suitable for your particular installation.


To assemble the Megabox, we start with the Arduino Mega 2560 pins first. Be mindful of cutting off the correct number of pins, and be sure to take some care when cutting the headers. You may find it easier to use an alligator clip to hold a single pin on the solder side, to make it easier to get the first solder joint in place. We also found that it was somewhat easier to cut all the headers first, then use the Mega 2560 itself as guide to placing it on the board. Continue placing the header pins for the shield; and remember to put the ICSP connector in the middle. Next, put the jumper pin connections in place around the board. Finally, add the connector headers: the GND, 5V, 3.3V, and various connections for the relays, LED and the LCD.

Next, we assemble the board itself. Start with the simple discretes, such as the resistors and diodes before heading the LEDs, switches, capacitors and the two relays. We will not be using all of the green screw terminals provided; just attach the two required for the relays.

Before moving on, take the time to check your connections for short circuits and continuity. Altronics have done a fantastic job in the development and production on the board, but it never hurts to check at this stage. One clumsy solder joint can be hard to find later!


This is one of simplest 16x2 LCD connections you will ever do, but be mindful that in the previous versions, we used VCC to pin 1, and GND to pin 2. The supplied board is the opposite, but they have already done the hard work, and so we only need to use six pins to get it working. Solder the single row right angle header into place on the board, before soldering the single row header onto the LCD itself. This is a simple yet clever way to attach the LCD at a right angle to the case.


The RFID scanner code remains the same, but to make the system useful it needs to be located some distance from the alarm box. For this we needed an 8-core cable to carry all the connections required by the RFID unit. The simplest choice for this was Cat5. Now there may be some individuals who would argue this, but you can easily get 15-20m run in, before needing to shield the cable, which you can easily buy. With this in mind, you could simply use a Cat5 connector or breakout board, and run it through a patch network; however, in the spirit of simplicity we used some 8-way connections, which are easily sourced and soldered. Connect one of the 8-way right angle adaptors to the RFID unit, and the other to the backside of the Megabox board. Leave enough room exposed on the pins to make it easily accessible. We have made a custom-fit back case for this project, and it leaves plenty of space.

back case
We have provided a split back case file for those with only a small printer.

Solder in an 8-way header, four rows back from the 8-way angled header, before using some solid jumper wire to connect the header to the socket. Remember to bridge the solder joints on the back, and take the time to not only check the continuity between the headers and the socket, but also to make sure the adjacent pins are not shorting out on each other.

To make the connecting cable, take the 8-way plugs and connect them as per their instructions. In this case, the plugs we used had small metal inserts. Take your time and solder these in place. As far as the wiring is concerned you could make simple straight through cable, however as we are using Cat5 cabling, we used the standard Cat5 colour coding. This may seem a little over the top, but if you do decide to go down the path of using Cat5 breakouts, it will make life easier.

learning mode
SDA Orange Stripe 53
SCK Orange 52
MOSI Green Stripe 51
MISO Blue 50
IRQ Blue Stripe NC
RST Brown Stripe 49
3.3V Brown 3.3

Put the Arduino Mega 2560 in the Megabox with the ethernet shield and power up. You should see the power light up on both units. If this checks out fine, then proceed to connect the LCD. The circuit diagram is the same as before; however, the LCD connection has changed. The Megabox now does all power and grounding; however, if you connect as per the last circuit diagram, it will not work. You only need to connect:

1 RS A8
2 E A9
3 D4 A10
4 D5 A11
5 D6 A12
6 D7 A13

Do not connect the power as per our previous circuit diagrams, as it will result in the LCD not functioning. Instead, connect the RFID unit via the 8-way cable we have made. You can then connect the onboard LED to the piezo pin (29); this will flash when you swipe your card to register the event.

zone wiring
Zone wiring uses common 5V and GND.

The final part is to wire the outputs and inputs. We have provided 2 x 6-way screw terminals on the back. If you are building this unit as a permanent installation, then we would advise that you consider what sensors and zones you will be using. This will eliminate the need for the 10k resistors on the unused zones, as you can remove the monitoring from the code entirely. When this is done, the zones are entirely ignored and no resistors are required at all.

The simplest wiring choice to cover both active and passive setups are to wire 5V and GND to 2 of the terminals, leaving 4 points to run your zones out off. This way you could accommodate up to 8 zones.


If you have previously built this circuit, then the code remains the same. This is a hardware task rather than a software upgrade. It is still important to ensure you have matched zones with the coded zones, and grounded any systems you haven’t used. The current code is still included in the resources for convenience.


RFID LED OR BUZZ OR BOTH?: The one thing this circuit lacks is that the RFID unit does not have any indication that it has read your card. In our sketch, the IRQ line is not utilised, and we already have GND out there. You could run pin 29 to the IRQ (blue core) on the RFID, and wire in an LED with 330ohm resistor to ground, or wire the piezo board and connect IRQ to the input signal pin.

POWER: As with many Arduino driven projects, we still have various power requirements to fully run the system. 12V, 5V, and 3.3V. It would be sensible to create a power supply to serve all there.

Part One

Part Two