These are the basic ingredients you will need to construct a relay driven by Arduino.
- Large hobby box
- Arduino chip of your choice (R3 knockoff in my case)
- Blank PCB
- Automotive 14VDC 60A relay
- 3x4 Matrix keypad (I know the pictured one is not a matrix, but the one used is.)
- Cat 5e ethernet cables and sockets
All additional parts used are as follows:
- Rubber vacuum line for mounting chips (pictured)
- Various screws and nuts to mount everything (use 4-40 and smaller)
- Wire connectors and heat shrink tubing
- Various components for power supply board (see pictures)
- Lots of Patience!
- Drill and drill bits
- Utility knife
- Small saw blade
- Soldering Iron
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Make the Box
Please excuse my hack job on the ethernet jacks, but the important thing here is to make sure everything fits comfortably and that you will have enough room to work if a wire, connection or component needs to be fixed/moved/replaced after everything is assembled. Then mark and drill the mounting holes.
Step 2: Programming the Arduino
This is perhaps the most difficult part of the whole process if you are new to Arduino. The 3x4 Matrix keypad used has a total of 9 pin holes, however the first and last are not connected to anything and so can be ignored. Thus, the numbering of the pins are from left to right, 0-6 for a total of 7 pins. On the Arduino board, we start at the number 2 pin and go to number 8. The sketch should be attached so just download and use!
The connections are as follows:
Matrix Pin: 0 Arduino Pin: 7
1 , 5
2 , 8
3 , 2
4 , 6
5 , 3
6 , 4
The Arduino pin 12 is the output to the relay driving circuit.
Step 3: Building the Power Supply and Driver Circuit
This system is going to be installed in my car, and so must be protected against voltage spikes caused by things like the wiper motors. Also, it is desired to keep the voltage to a maximum of 12 volts. To satisfy these requirements, a simple linear circuit was constructed as follows:
The hot wire is brought in from a switched tap on the fuse block. The first component is a 15 volt reverse biased Zener diode used to drain any voltage greater than 15 volts. Then, there are four 0.7 volt forward biased diodes to drop the running voltage of the car (typically 14.2 - 14.5 volts) by an approximate 2.8 volts. This ensures the voltage at most will be +- 12 volts, however, the next component is a 12 volt reverse biased Zener that drains anything greater than 12 volts, guaranteeing a maximum of 12 volts. Following that is a 330 uH inductor for filtering and then a MOV as last resort for a major voltage spike. Finally, a 104 ceramic capacitor and 220 uF electrolytic for normal filtering and smoothing. At last, the current is allowed to be applied to the Arduino board.
On the other side of the chip is the relay driving circuit as shown in the picture where the Arduino pin 12 is connected through a resistor to the base of the NPN 2N2222 transistor.
Step 4: Putting It All Together
I decided it would be best to hard wire everything so to begin, I de-soldered the Vin jack, USB type B female connector and the headers on the right side of the board. Then, I converted everything to Cat 5e Ethernet for ease of connections and a level of security if for some reason someone wanted to try to change my password. To convert the Cat 5e back to USB, a special patch cable was made as the "key" to get into the system. In the picture, all of the appropriate connections have been made and tested.
Step 5: Final Assembly
Here everything is in place and mounted. If I were to do this again, I would have made it more modular and easy to switch out components (mainly Arduino board) if need be.
Step 6: Installation
FInally comes the fun part. The installation went well thanks to a nice little pocket of space behind the main gauge cluster, however a bracket had to be made and attached to the box using a liberal application of epoxy. Then, to establish a connection between the keypad and Arduino, a cat5e ethernet cable was run behind the dash, up the driver side pillar and under the headliner to the middle to mate with the keypad. To mount the keypad, the profile of the pad was sketched out in pencil and then a hole cut to accommodate the keypad with some small machine screws to secure everything. Then, the trim piece was put back into place. The final challenge came in the form of powering the Arduino. I needed a switched power source and the most convienient tap was from the 12v socket, so a quick splice and everything was good to go. Or so I thought. Upon reinstalling all of the gauges and trim pieces, I wanted to change the password so I plugged my laptop into the box via the usb to cat5e patch cable, clicked upload and... error! Flabergasted because the system worked just fine before installing, I tore apart the dash again and removed the box. Then attempted to upload, and... success! "What the ****" I thought to myself so I reinstalled the box but before putting the dash back together, I attempted to upload again and... error! Now the only things connected are the 12V, ground, and computer (note: the ignition key is off) so that pointed towards a grounding issue so I disconnected the ground wire but left the 12V attached and tried to program and... success! So to circumvent this unforeseen situation, I added a rocker switch mounted on the side of the box to break the ground connection with the car so that the system is "isolated" while being programmed and then switched back for normal operation.
Step 7: Conclusion
In all, the project was a lot of fun and showed the versatility of an Arduino. I have has the system on the car now for about a year and so far so good. The couple of things I would do differently if I were to do this again would to mount the Arduino in the box in such a way that it could be easily removed and replaced if at some point in the future, the chip gave out. Everything I have made since has had this "modular" and easily maintained concept designed into it. Also, a characteristic of the keypad that I used is that the keys are not held in place by any positive pressure, that is, as the car vibrates thanks to my solid motor mounts, the keys vibrate audibly and aggressively at certain frequencies and their harmonics. I have grown used to this noise and don't mind it but would also not be upset if it wasn't there :). Please comment or pm if you have any questions, suggestions, or criticisms!