By: Lasse Jespersen
A nice and comfortable way to child proof your home using micro linear actuators and keypads involves nothing more than membrane switch keypads of the generic variant and a Morai Motion Inline Nexus micro linear actuator. Google for “4×3 membrane switch keypad” and you will not want for results. Unless mounted inside a
waterproof case, their application is solely in-house.
Most families are very much unprepared for their young childrens’ talent or sabotage. If you are fortunate, your toddler will only focus their attention on your refrigerator — but as he or she grows, and their increasing intellectual capacity compels them to explore their environment more thoroughly, your kitchen cupboards will be emptied, Dad’s tool cabinet will be emptied out onto the floor, and no one will ever find the expensive Black & Decker drill Mom got him for Christmas. Children who find excellent toys find excellent hiding places for them. I certainly did.
A greater cause for concern than an emptied refrigerator and a child with a bad case of constipation – or even a child with a powerful drill – is the smattering of chemicals used for house cleaning. I cannot name one that is not medium to highly poisonous, and they are all held in containers which look inviting and cheer-inducing — after all, that is marketing, and that is why Mom got the pretty bottle of drain cleaner, and not the dull-looking one. This applies even to the wrappings on dish-washer tablets, rather like the bon-bons of yore. It is all terribly delicious looking, and your child does not need to eat or drink more than a mouthful to end up in a trauma center – or worse.
Child Proofing Your Home Using Micro Linear Actuators and Keypads
Of course, in the darkness of our modernity, there is a light which cannot be put out. And it is a super simple access control system for cupboards, cabinets, refrigerators and whatever else that opens outward and closes inward. This is a much more user friendly solution to keeping toddlers and young children safe. It is also highly suited for the application.
Using a 4×3 membrane switch keypad, an Arduino Nano clone and a linear actuator from Morai Motion, everything dangerous to the health of babies and young children can be secreted away into single place in every room where there is something that could harm it.
The closet where Mom keeps her delicious looking (but dangerous) cleaning chemicals? Simple.
The refrigerator, which a child might empty silently but destructively in order to get at the good things quickly? Simple.
The medicine cabinet in your bathroom which you may want to keep private, also from guests in the house? Simple.
By driving a discreet bolt system, each thing which opens and closes can be set to do so only after a PIN entry on a keypad. This is not Orwellian control, it is common sense. Your children are, per definition, your future. It is no moral failure to do something which increases child safety without decreasing over-all family liberty — to paraphrase Franklin’s famous quote. There is no reason to think he would not do the same in his own home.
You will need only a few parts:
- Micro linear actuator, 12V
- 4 220 ohm resistors
- Dual-channel relay ( 230VAC/30VDC/10A, 5V control )
- Arduino Nano V3 clone + USB mini data cable
- 4×3 membrane switch keypad
- Jumper wire bundle ( M-F, M-M, F-F, 10 of each type )
- 1 RGB LED ( Common anode type )
- 12V/0.5-1A switching power supply
- USB switching power supply at 1A
- Breadboard with two power rails, one for 5V, one for 12V
If you don’t have the Arduino program installed, go to https://www.arduino.cc/en/Main/Software and click on your desired platform. It is available for Linux ( 32/64/ARM ), Mac OS X ( >=10.7 ) and Windows – the latter does not require administrative privileges to install, though it is more convenient if you have them.
Choose ‘Windows Installer’ if you can install programs on your computer, or ‘Windows Zip file for non admin install’ if you either don’t wish to clutter up your Program directories or do not have the necessary privilege.
The keypad library is available from https://github.com/Chris–A/Keypad
Once you have downloaded it, open it with your archive manager and extract its contents a folder named “Keypad” in your libraries folder. The contents of the Keypad-master.zip must be placed in that folder, do not extract it all into the libraries folder without creating the “Keypad” folder. If the Arduino program is open, close it and start it up again. I have tested this with Arduino 1.6.11 and 1.0.5. I highly recommend Arduino 1.6.11. You can see which version you have installed by under “Help->About Arduino”.
Wiring the System Together:
First insert the Arduino Nano into the breadboard, making sure that the two rows of pins are on either side of the furrow in the middle. Also make sure that the USB mini port faces outward from the breadboard, so you do not clutter up your wiring by having a USB cable running through everything.
The 4×3 keypad module I use is fairly straightforward. There are 7 female pin sockets, all of which must be wired to your Arduino.
It uses 1, 2, 3, 4, for ROW0, ROW1, ROW2, ROW3, and pins 5, 6, 7 for COL0, COL1, COL2
Don’t worry if it doesn’t make sense, you only need to follow instructions. I can’t say that I personally can account for every detail of charlieplexing, it’s a bit perplexing. If you are interested, observe the table, if not proceed to the wiring guide below the table.
X denotes COL(UMNS), Y denotes ROW(S), so to simplify (although sinus and cosinus values are inverted for convenience ).
You may find the table below useful, unless you like using a multimeter (set it to <= 200 Ohm if it isn’t the autorange kind).
If you _must_ find the connections yourself, first attach one probe to pin 1, and the second to pin 2, then 3, et cetera, and subsequently attach one probe to pin 2, and the second to pin 3, then 4, et cetera.
While doing so, press all the buttons in sequence, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ‘*’, 0 and ‘#’ – eventually you will have a table similar to this:
Table 1, Keypad Mapping:
| X1, Y1 = ‘1’ | Pins 1 & 5 |
| X2, Y1 = ‘2’ | Pins 1 & 6 |
| X3, Y1 = ‘3’ | Pins 1 & 7 |
| X1, Y2 = ‘4’ | Pins 2 & 5 |
| X2, Y2 = ‘5’ | Pins 2 & 6 |
| X3, Y2 = ‘6’ | Pins 2 & 7 |
| X1, Y3 = ‘7’ | Pins 3 & 5 |
| X2, Y3 = ‘8’ | Pins 3 & 6 |
| X3, Y3 = ‘9’ | Pins 3 & 7 |
| X1, Y4 = ‘*’ | Pins 4 & 5 |
| X2, Y4 = ‘0’ | Pins 4 & 6 |
| X3, Y4 = ‘#’ | Pins 4 & 7 |
Pins range from 1 to 7, with the keypad’s buttons facing toward you, from left to right. Wire the Arduino Nano to the keypad in the following order.
Arduino D5 -> keypad pin 1
Arduino D4 -> keypad pin 2
Arduino D3 -> keypad pin 3
Arduino D2 -> keypad pin 4
Arduino D8 -> keypad pin 5
Arduino D7 -> keypad pin 6
Arduino D6 -> keypad pin 7
Next wire up the RGB LED. We only need to display two colours; red and blue. From left to right (the LED has a flat side on its head ) the pinout is RED, GND, GREEN and BLUE. Wire 5V to GND (Common anode) and set a 220 ohm resistor in series from pin 1 to D9 on your Arduino. Next, set a 220 ohm resistor in series from pin 4 to D8 on your Arduino.
Now, take the dual channel mechanical relay, and look at it carefully. On the relay channels, there is text like ‘NO1’, ‘COM1’, ‘NC1’ et cetera.
- NO means Normal-open (but don’t say that to a girl you are dating )
- COM stands for common
- NC stands for Normal-closed
It helps to understand what the effect of wiring to these terminals is. Normal-open is the port to insert a wire into if you want it to be ON when you activate that relay channel. When it is activated, you continue the circuit via the COM port, and from there to your motor, or whatever you need to power. NC is similar to NO, it just completes a connection when the relay is OFF instead of ON.
Again, we are going to do something slightly unusual with this relay. Usually H-bridges and motor shields are reserved for super-fast operation, but since we just need to switch polarity based on a condition (a successful PIN entry), we can use this relay as an H-bridge.
Wire it up as follows:
- Arduino 5V to relay VCC pin
- Arduino GND to relay GND pin
- Arduino D7 to relay S1 pin across a 220 ohm resistor
- Arduino D6 to relay S2 pin across a 220 ohm resistor
- 12V GND to NO1
- 12V GND to NO2
- 12V VCC to NC1
- 12V VCC to NC2
- 12V VIN/VOUT from COM1/COM2, alternating, but never both ON or OFF
When it is all correctly wired up – refer to the instructions above if you have any problems – you will have a simple way to child-proof your home. Refer to the comments in the code if you need to expand or customize it to fit your own design. For example, it is quite intentional that I did not add a timeout, after which the actuator locks again. Nobody likes that kind of inconvenience, especially a hardworking parent who is in the middle of dinner, doing some home improvement, or cleaning the house.
To operate the keypad, hold “*” a short moment to enter PIN entry mode. Your RGB LED will blink violet three times – then enter your custom PIN.
For each digit entered, you should see one violet blink. When you have entered the PIN, hold “#” a short moment, and the LED will blink blue if your entry is correct, or red if it is incorrect. If it is correct, your Morai actuator will engage or disengage, depending on its current state.
The PIN can be changed in the program’s source code, which can be downloaded here:
Now you have built a better tomorrow for you and your young ones. Congratulations!