Remote Controlled Eight-Relay Board
PART I
- Analogue Keypad as Input Device
Introduction
I
am making a remote control device. It allows me to independently switch
eight relays and control various items. When I press buttons on a
small keypad, instructions will be decoded and transmitted via a
microwave RF packet transceiver (@868 MHz). At the other end (up to 100m away!) another transceiver decodes the message and switches the relays ON or OFF.
The remote control incorporates a small inexpensive analogue keypad, connected to an Arduino Uno. The Arduino handles the scanning and decoding of the keys pressed on the pad.
Note how the keypad pins are wired to the Arduino. Details of how to work this out can be found here:
keypad datasheet and here: using the Arduino keypad library, but it can be tricky.
If you are using the Sparkfun or RVFM keypad it should work using the wiring diagram above and the code below. Note I may change around some of the pins in later posts if I need them for other things. For instance arduino Pin 2 is can be used for interrupts, which are required by some devices.
There are some web pages that show external pull-up resistors in the wiring diagram. These are not necessary if you use the latest version of the Keypad library.
Making the Code
I don't want to write all the code for scanning the keypad and decoding the inputs from scratch. I can use the Arduino keypad library instead and some sample code they provide. See this link: using the Arduino keypad library.
See code here: Keypad.txt
Keypad available here: Rapid Electronics
Disclaimer
I will not be posting how it is possible to link relays to AC mains devices. I will be using low power DC examples. If you go ahead yourself and try mains stuff, remember I told you it can be very dangerous. Playing with mains power can kill you, and the people around you, not just by electrocution but also by starting a fire.
keypad datasheet and here: using the Arduino keypad library, but it can be tricky.
If you are using the Sparkfun or RVFM keypad it should work using the wiring diagram above and the code below. Note I may change around some of the pins in later posts if I need them for other things. For instance arduino Pin 2 is can be used for interrupts, which are required by some devices.
There are some web pages that show external pull-up resistors in the wiring diagram. These are not necessary if you use the latest version of the Keypad library.
Making the Code
I don't want to write all the code for scanning the keypad and decoding the inputs from scratch. I can use the Arduino keypad library instead and some sample code they provide. See this link: using the Arduino keypad library.
See code here: Keypad.txt
Keypad available here: Rapid Electronics
Disclaimer
I will not be posting how it is possible to link relays to AC mains devices. I will be using low power DC examples. If you go ahead yourself and try mains stuff, remember I told you it can be very dangerous. Playing with mains power can kill you, and the people around you, not just by electrocution but also by starting a fire.
I have decided what do with this device in the first instance. I'm going to use it to set off some fireworks on my Birthday. I'm 50 on the 12th of December, but I nearly didn't make it, because I had a heart attack in the Summer.
ReplyDelete