Introduction: Arduino Thermistor/Solenoid Box

Picture of Arduino Thermistor/Solenoid Box

This project was part of my digital multimedia class. I was tasked with designing an object which would house the Arduino micro-controller while utilizing a sensor of some sort and a switch the user could operate which would allow the object to do something physical. In this case, the object was a lock box which would operate off of a thermistor (set to 72 degrees) and a slide potentiometer (set to 600) to activate a pair of solenoids. Once activated, the solenoids would retract allowing the user to lift the lid of the box. The box itself is made of black acrylic panels. The lid of the box would house all of the electronic components sandwiched between two layers of acrylic panels with the exception of the batteries to power everything and the slide potentiometer. These would be placed in a separate "key" which would connect to the top of the lid via two 1/4'' phone jacks inserted into a small project box which Radio Shack sells. The idea for the box was based upon inspiration from FoamboardRC's Lockduino along with the various useless boxes seen on Instructables with a little sci-fi inspiration which places the box in a setting of a sort of found object/alien artifact which has been recently discovered by a team of explorers. A more elaborate version of the box before I was forced to tone my ideas down could possibly include the use of a gas strut to propel a smaller inner box up from inside a larger outer box.

Disclaimer: As I am a novice when it comes to assembling these types of things not everything in this project is a complete success though with a little more time spent debugging I'm sure most of the bugs could be worked out. As always use caution when when working with hand tools or corrosive chemicals. Having a clean and well lit work environment with plenty of space will also help.

Tools required:

Drill of some sort (either battery or corded with ability to change bits)

Drill bits (I used a 3/8'' carbide tipped for the audio jacks and a 1/8'' glass/tile drill bit for small screw holes - it's recommended to use glass and tile bits for drilling into acrylic panel as other bits can supposedly cause the material to crack which I did almost run into, though mine had just chipped it certainly sounded like it had cracked in half. Also acrylic can melt if too high a speed is reached or too long of a time is spent drilling or cutting it. I used the 3/8'' for the top panel of acrylic because I couldn't find that size in glass/tile bit; but be cautious as it slips on the surface a great deal compared to the other bits.

Needle nose or small pliers

Dremelwith diamond wheel attachment 545

Soldering Iron

Precision screw driver setsuch as this one from Harbour Freight

Measuring tape or rule

Bill of Materials

Arduino Uno R3 with compatible USB cable

(1) 1/4" thick Black Acrylic Panel measuring 12"x12" (can be purchased online if not found locally) approx. $10.48 each

(6) 1/8" thick Black Acrylic Panel measuring 12"x12" (can be purchased online if not found locally) approx. $5.64 each

(1) 4 oz. can of acrylic cement solvent (I used IPS Weld-On #3) $9.41

(1) syringe or applicator bottle for solvent if not included with it

(1) project box for "key" from Radio Shack or similar $4.99

(1) pack of 1/4" phone plug from Radio Shack or similar $4.49

(1) pack of 1/4" panel-mount phone jack from Radio Shack or similar $4.49

(1) pack of 22 gauge hook-up wire (I used solid but you can also use stranded) from Radio Shack or similar $8.49

(1) pack of heat shrink tubing from Radio Shack or similar $4.99

(1) spool of rosin-core solder light-duty from Radio Shack or similar $5.99

(1) 8xAA battery holder from Radio Shack or similar $2.99

(1) pack of 9V battery snap connectors from Radio Shack or similar $2.99

(1) pack of 9V barrel jack connectors from Radio Shack or similar $3.99

(2) 12 volt "pull" solenoids from Jameco Electronics $7.95 each

(1) 10K thermistor from Sparkfun Electronics at $0.75 each

(2) TIP120 Darlington Transistors from Adafruit Industries at $2.50 for a three pack but cheaper at Jameco

(2) 1N4001 Diode in a ten pack from Adadruit Industries at $1.50

(1) 10K slide potentiometer - medium size from Sparkfun Electronics at $2.50 each

(1) 220 ohm resistor for slide potentiometer wiper leg

(3) 10k ohm resistors for solenoids and thermistor

(4) threaded nylon spacers 30mm M3 screw size at 3drobotics at $0.70 each

(4) threaded nylon spacers 24mm M3 screw size at 3drobotics at $0.70 each

(4) M3 screws

Other resources for parts include Mouser Electronics and Amazon among others.

For other resources on projects visit: http://www.arduino.cc/

Also look up the Arduino Cookbook and Arduino Notebook, both useful guides.


Step 1: Building the Enclosure

Picture of Building the Enclosure

The box itself is made from acrylic panels and although in the end didn't turn out square, it's possible to get it done correctly with careful planning. It's also a good idea to try and set up a 90 degree jig or brace if you don't have a 90 degree clamp on hand. This is to have something to brace the panels together as you are gluing them. A spare set of hands or helping partner is also recommended.

Since the enclosure is a cube shape, we're working with 90 degree angles for each of the four corners of the box. The box should have two sides which are the "inside panels" if you will, and two sides as the "outside panels". Then once the sides are connected they are glued at the bottom on the base of the box. The 1/8" panels are for the sides of the box and the 1/4" panel for the bottom. Unfortunately I don't have photos of this process as it took place in a classroom setting and I didn't have my camera with me. I will however take some photos of the damaged panels from an earlier attempt at routing them to smaller sizes which didn't work (the manufacturer who supplied my panels did not cut them to the correct size as specified - followed by the school CNC router which would not hold the material down to cut).

First make sure that all edges are smooth enough for butt welding. Any rough or irregular edges will cause gaps in the weld which will make for an uneven bonding process. Also leave on the protective paper or film until ready to remove - only peeling back enough area to work with when necessary. This enclosure will use 4 out of 6 of the 1/8" panels.

I've also included a helpful video that I watched prior to ordering supplies and welding the panels together. This is an instructional video from a plastics supplier about welding acrylic together.

1. Once you've gathered your supplies, get two panels of the 1/8" thick acrylic. Carefully and slowly peel back just enough of the paper or film protecting it, probably about two inches worth, on both edges and sides to be glued together. You might have to get some clear packing or gift wrap tape and tape down the paper out of the way. If you don't have a 90 degree jig, you can take some scrap (but good condition-not warped) wood that is a few inches larger width and length than the acrylic panels you are working with. Make sure these wood panels are about 3/4" or 1" thick and either have straight cuts on each of two ends so you can butt the ends together or have been measured straight before driving some screws into them. Once your jig/panels are aligned you will carefully drag the applicator needle of the solvent cement along the corner edge of the panels you want glued together. Be careful not to apply too much as it will "craze" the acrylic it touches and don't let it come into contact with your skin as it's a corrosive chemical and will burn. Once solvent has been applied, maintain enough pressure against the panels either by holding or having someone else help hold them together for roughly two minutes as the solvent is quick setting to about 80 percent strength. It then takes around a full 24 hours for it to completely bond however it should be strong enough to very carefully move the panels around. If you notice any gaps or wobbling, the cement hasn't reached all the acrylic and might need a reapplication. You will then repeat this step for the other two 1/8" panels. Also of importance, (especially if you decided to have different length panels) make sure that for one set of panels (so that when you glue both sets of two panels together) you have two panels glued on the inside of the other two panels.

3. After two sets of panels have been glued together, carefully align them into the cube shape and once in place apply the solvent again to each set of edges. Double check your alignments and fitment. Can't stress that enough since mine didn't turn out square.

4. After four of the panels are glued together you will take your 1/4" thick panel and prepare the next steps. Lie the 1/4" panel flat on your work surface and carefully peel back the edging of the paper around all four edges and temporarily tape down out of the way. Then you will carefully peel the paper of all surrounding edges and sides of the edge to be glued down of the 1/8" square. Align your cube's edge to be glued down to the edge of the bottom panel. Since the corrosive chemical can damage the surface of the acrylic it's recommended to work from the inside of the box gluing down one edge at a time. It might be necessary to have someone hold the top panels down while you gently press on the inside edge to help align it to the bottom plate's edge while the solvent sets. Hopefully your version will turn out better. As another note, since I had to make adjustments to the size of my panels - if you're building this with the 12"x12" panels as I was originally going to, you might end up joining the edges of your 1/8" panels to the side of the 1/4" bottom instead of the top. The thickness of the panels has to be taken into consideration as well and since mine weren't cut straight to begin with I had them routed down at a local shop which gave an end size of 11 3/4" x 11 1/2".

Step 2: Breadboarding the Circuit

Picture of Breadboarding the Circuit

This project started out as a series of circuits which were breadboarded separately before being joined together and finally soldered together on a copper proto-board.

This first portion is for the thermistor which would sense a set temperature and upon recognizing would either send a signal to an LED or perform another function. In my case I was trying to have it recognize a set temperature and along with either one or more slide potentiometers acting as a combination, allow the solenoids to retract and unlock the lid of the box.

The code I used was borrowed from Ben Miller off of this website.

I only added the LED notification so I could see it easier.

#include <math.h> //loads the more advanced math functions


int LEDtemp = 13;

void setup() { //This function gets called when the Arduino starts

Serial.begin(115200); //This code sets up the Serial port at 115200 baud rate

}

double Thermister(int RawADC) { //Function to perform the fancy math of the Steinhart-Hart equation

double Temp;

Temp = log(((10240000/RawADC) - 10000));

Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );

Temp = Temp - 273.15; // Convert Kelvin to Celsius

Temp = (Temp * 9.0)/ 5.0 + 32.0; // Celsius to Fahrenheit - comment out this line if you need Celsius

return Temp;

}

void loop() { //This function loops while the arduino is powered

int val; //Create an integer variable

double temp; //Variable to hold a temperature value

val=analogRead(0); //Read the analog port 0 and store the value in val

temp=Thermister(val); //Runs the fancy math on the raw analog value

Serial.println(temp); //Print the value to the serial port

delay(1000); //Wait one second before we do it again

}

Next, I breadboarded one solenoid and used the basic blink sketch to test it out. After that, I connected the second one up and had them running in sequence before adding the thermistor to it and finally adding one of the slide pots.

I used some of the Arduino Cookbook for reference when connecting the solenoids

Step 3: Soldering the Board

Picture of Soldering the Board

Soldering the board turned out to be quite a mess as working with the copper clad proto-board was a lot more difficult than expected and I need more practice at bridging connections without wire. With that said lets lay out everything and start wiring up.

First I set everything out to get a general idea of how it would look. Then I set it aside and just got out the board and let the soldering iron heat up.

1. Insert one of the TIP120 Darlington Transistors in one side of the board making sure to note which legs are which. With the text facing towards you from left to right the legs are: Base, Collector, Emitter. It also should help to space things out a bit more than I had as connection points crowded together became a pain to work on.

2. Solder the ends of the pins at the copper side

3. Right the board again and insert one of the 10K resistors so that one leg is inline with the base pin on the TIP120. Solder it in place.

4. Cut a small length (around 2") of black wire for your solenoids ground and strip both ends. Insert one end inline with the collector pin of the TIP120 and solder that connection. (Note: this wire and another like it are used later on since I forgot about them - so these 2" black wires will be used later on)

5. Take one of the 1N4001 Diodes and solder the end without the stripe to the collector leg. The end with the stripe will connect to the power.

6. Cut a length of green wire about 5" to 6" long and solder one end to the base leg of the TIP120. The other end will connect with digital pin 2 of the Arduino.

7. Cut a length of red wire about 3.5 to 4 inches and strip both ends. Solder each end to the striped connection of the diodes.

8. Next, take the third 10K resistor and place it close to the middle of the board. This resistor is for the thermistor.

9. Flip the board over and solder the connection points.

10. From the left leg of the thermistors resistor, solder a small 2" black wire. Solder the other end of the wire to the collector leg of the transistor.

11. Cut a 5 or 6 inch section of green wire and solder one end to the right leg of the thermistors resistor. The other end will plug into the Arduino analog A0 pin.

12. Insert the thermistor you have adjacent to the resistor with the left leg of the thermistor soldered to the right leg of the resistor and the green wire leading to A0.

13. Solder the right leg of the thermistor. Attach a section of red wire around 4" to the right leg with the other going to the red wire connected to the power line of the diode.

14. Take the 220 ohm resistor for the slide pot and place it a little further down and to the left of the thermistor. Solder its legs in place on the reverse.

Now we're going to take the solenoids we'll be using and cut off the molex connector. Unless of course you want to spend the time finding the right connector for it and incorporating it into the box which would also be cool.

15. So grab a wire cutter and snip off the end and strip the wires. Do this to both solenoids.

16. Afterwards, cut equal lengths of black and red wires in two pairs. I made mine roughly 6" in length.

17. Solder one end of the black wires to one end of each of the solenoids and the red wires to the other end. Solenoids are not polarized so it won't matter which end is which until you begin to finalize the connections. After soldering, cut a length of heat shrink tubing and slide over the connection Then, using the barrel of the soldering iron or a heat gun, gently shrink the tubing in place. I used red tubing for most connections and wish I had black for negative but oh well. If you make a mistake like I did at one point later on and need to redo the connection for whatever reason, a utility knife or x-acto blade can come in handy, just be careful not to slice open your finger!

18. Now you will need to solder the solenoids to the board. Red wire to red wire and black to black. Originally I was going to connect the black to the small 2" sections that I had made earlier but for some reason forgot about them and connected using poorly made bridge connections on the other side of the TIP120s.

Step 4: Building the Key - Drilling

Picture of Building the Key - Drilling

In order to build the specialized "key" with this box I purchased a project box from Radio Shack which is 6"x3"x2". It's enough to fit one of their 8xAA battery holders along with their 1/4" phone plugs and house the slide pot. In a different way of doing things, the other end of the slide pot and battery connection would be bridged via 1/4" phone jacks which would each be positive and negative. One of these jacks would also serve purpose to the wiper leg of the potentiometer. The battery snap connector would lead from the battery holder with one end going to one jack and the other to the second jack for power and ground each. The Arduino would have a barrel jack connector which would be cut and have the power wire to the corresponding power jack and the ground to ground with the wiper leg of the potentiometer in line with the resistor on the board connected to one of the 1/4" jacks as well.

1. Find center as best you can on the plastic lid with the project box. This is 1 1/2" x 3". Account for the thickness of the stem on the slide pot lever which seems to be roughly 1.5mm to 2mm. Also note the travel of the lever itself. It's roughly 2" worth of travel. I tried to give some extra room but ended up giving a little too much travel room. Also if I had found my digital caliper I would've been able to more accurately gauge these measurements.

2. Using the dremel diamond wheel 545 attachment, carefully grind into the plastic lid where you need the slide pot lever to protrude from. Test for fitment and adjust as necessary.

3. Now, mark off the spots where you need to drill into the housing of the project box. I placed the battery holder in the middle for even weight distribution and placed a mark on either side of the holder in the middle of the 1 1/2" margin.

4. Next, grab your drill and using a 3/8" drill bit carefully drive into the housing where you marked. This next part could be frustrating. For me, it was, because I didn't take into account the small lip of the edge of the phone plug as I tried to have it flush mount into the housing. If you do happen to have a drill bit which is ever so slightly larger than a 3/8" you might be able to get away with doing this the easy way. But the hard way is several minutes of trying to tap the plug into the housing with a hammer or skimming the hole with the bit in a pitiful attempt to widen or smooth the hole. Eventually, after skimming, banging, more skimming, and using the soft carpet to rock the plug back and forth while I held the plastic(very carefully as it could crack and ruin everything), the plugs began to work their way into the housing. VERY snugly.

Step 5: Building the Key - Wiring

Picture of Building the Key - Wiring

Now let's move on to the wiring.

1. Taking the lid of the box and placing the potentiometer for test fitment I then cut small sections of equal length wire in black, red, and green. About 3" worth. Solder the connections with red to power and black to ground making sure to note which leg of the pot is the wiper. I had done this earlier in my testing and with these particular pots the wiper leg was shown to be the left leg on the bottom of the pot as you hold it upright with the single leg in the air and the two others at the bottom. To find out when you don't have documentation, you will need to use a multimeter to check resistance between the legs. The green wire went to the wiper.

2. Not realizing that I would need a longer set of wires to allow the phone plugs to connect to the pot and to further allow the battery to connect to the rest of it is why I had to make 2 additional cuts of wire to run to each of these components. So I have an additional 4" or so of wire running from the ends of the wire I connected to the potentiometer to the lower prongs on the phone plugs. The green extension running from the wiper extension would connect to the top of the phone plug that has the red wire for power. Then the other connection is from the battery snap which is already cut and stripped to an extent so I just added to the length of the strip to make it more workable. Solder the red wire of the battery snap to the red extension which connects the phone plug and the power leg of the pot. Then, solder the black wire of the snap to the black extension.

3. Place the battery holder with batteries inside the box and with all other connections soldered you can fit the pot in the opening of the lid. The fitment is loose so far and since I didn't have any sure fire way to stop it I improvised by holding the pot down with electrical tape to the underside of the lid because I realized that the foam poster board idea I had wouldn't work because it was too thick to allow the lever the reach through the other side. I also didn't have a sure fire way to keep the batteries from moving around inside so again I improvised and used some of the perf board that I didn't use and cut it down to form a barrier between the batteries and one of the phone plugs. There was a sort of natural slight lip within the box that I placed this in and then taped it down slightly with electrical tape. Then I cut some of the foam board down and used it on the side of the battery box which fit against the side of the project box and with some notches cut around it for the standoff and some squeezing with pliers it provided a snug fitment.

4. Last, I had some unused knobs I had purchased from Radio Shack and with the help of a small screwdriver I placed the set screw against the lever of the slide pot and had a makeshift knob to move the lever back and forth.

Step 6: Assembling the Lid - Upper Lid

Picture of Assembling the Lid - Upper Lid

The lid assembly was just as trying as the assembly of the board, the key, and the box, just with its own problems.

Since the box wasn't square the lid would no longer fit inside like I had planned to do. But just as problematic perhaps was my idea of using acrylic rods within the box to support the lid and at the same time prevent it from lifting up due to the solenoids being pinned underneath it. I had tried to find another source of locking the lid to the box, but didn't find anything that seemed like it would work in the narrow sliver of space that I had predetermined I would need. I had some of the leftover panels of acrylic which were mostly damaged by the CNC router from earlier and I tried to find a way to cut into them so I could remove two small sections perhaps only 2"x2" and since they were 1/4" thick it was just thin enough to fit between the lower portion of the lid as I had planned but still prevent the upper portion from falling in. This didn't pan out though as the hand saw just wasn't going to cut it (pardon the pun).

So with that it's time to finish the lid. Earlier the box used 4 of 6 panels of acrylic with the other two set aside. These other two will form the lid, with the one 12"x12" panel as the upper lid, and the smaller 10 3/4" x 11 1/2" forming the bottom lid. Note: the size of the smaller bottom lid is based on my modified panel sizes (due to incorrect sizing upon shipment). If you were originally able to use the 12"x12" panel that I ordered you would want to cut at least an inch off of one side, perhaps slightly more, to accommodate the acrylic pieces that I would've glued to the inside of the box to support the upper lid/prevent the solenoids from moving upwards. The use of a CNC router or a table/band saw would be needed for this.

1. I couldn't find any drill bits for glass/tile in the size I would need for the upper lid so I used the carbide tipped masonry hammer drill bits. The hammer part of the drill bit might not have helped it so much. The bit wanted to slide all over the place. My success in getting it drilled was probably luck. Mark off the spots noting the distance between the phone plugs on the "key." This is very crucial as it won't fit if you're off. I placed folded paper underneath the acrylic so the bit would have something else to drill into besides my work surface. Then, while holding down with some force on the drill and going slowly, I began to dig my way into the acrylic making sure to keep running the bit after I made my way through. I made two or three passes before bringing the bit all the way out. One of the holes made a terrifying sound that I thought was the acrylic panel cracking in two but turned out just to be a chip from it.

3. Next, fit the 1/4" phone jacks into place and tighten down the collar nut.

4. Find out which solder point on the jack corresponds with which point on the plug. You can use a multimeter set to determine resistance.

5. Cut 10" long pieces of red and black wire and strip both ends of each.

6. Solder one end of the red wire to the corresponding point on the jack with the power lead from the tip of the phone plug from earlier. Do the same with the black wire on the other phone jack which should correspond to the tip of the other phone plug.

Then, cut a 10" long piece of green wire and solder one end to the opposite solder connection from the red power connection. Make sure this connection point corresponds with the one from the upper sleeve of the phone plug from the "key".

Note: the photos with these connections show only a 3" length of red, black, and green wire. The reason for this is because I should have had them longer to begin with to allow the upper lid to pull away from the lower lid with room to set it to the side. But because I didn't think of this beforehand, I ended up having smaller sections once again linked to longer sections.

7. Take the remaining end of the green wire and solder it to the right leg of the resistor to the potentiometer on the board.

8. Cut and strip another section of green wire roughly 5-6" in length and solder one end to the left of the resistor for the pot. The other end will be placed in analog A3 of the Arduino.

9. Take the barrel plug for use with the Arduino and supplying power and snip off the battery snap connector. Strip both ends of the wire and set to the side for now.

10. Cut two pieces each of red and black wire. Make each pair 4" long, strip all ends, and set to the side. Go back to the 10" pieces of red and black which are connected to the phone jacks and solder the red wire to one of the red wires from the proto-board by bridging connections. Take the black wire from the phone jack and solder it to one of the 2" black wires from the beginning of the board setup (The same 2" black wire from earlier). Take one of the 4" black wires and solder one end to the other 2" black wire from the board at the beginning of the board setup. The other end will plug into Arduino ground pin. Take the second black 4" wire and solder one end to the board by bridging connections with solder. Take the other end and solder it to the black wire of the barrel jack making sure to slip on a piece of heat shrink tubing beforehand and away from the heat until finished. With one of the 4" pieces of red wire you will solder to the board and bridge connections. The other end of this one will go to Arduino's vin pin. The second 4" red wire will solder to the board as well with a bridge connection and its other end will be soldered to the red wire of the barrel plug.

Note: this has been modified from my original version which has shorter lengths of wire running from the barrel plug and makes it difficult to unplug from Arduino when all assembled as ideally even though my Arduino is not secured to the bottom acrylic panel the idea was to have the lid be able to separate a few inches and have one half of it rest to the side of the other.

11. The idea of having the two lids form a sandwich for the electronics while having the batteries stay separate for ease of replacement also needed something to keep the panels separate. It is actually remarkably difficult to find black threaded nylon spacers at a decent height to prevent smashing of electronics. These would also work better if I had longer screws and even better if I didn't have to drill into the top panel at all since originally I was thinking of having them glued to the underside. (As this is a lock box and you wouldn't want to destroy the integrity of that purpose, but I had to, as finding another way proved difficult. Perhaps someone else has a better way and can improve it).

12. Using the 1/8" glass/tile drill bit and marking off where you want the holes drilled, carefully drill through the panel in four corners. I chose to mark off at 3" from the top and bottom and 2" in from the sides. Even still, I managed to mess up and one of my holes is off by almost half an inch. Oh well, I guess after having the box be out of square and the resulting lid not able to fit, this makes sense in the design some how? Any way...

Step 7: Assembling the Lid - Lower Lid

Picture of Assembling the Lid - Lower Lid

The lower portion is what will house the electronics and the spacers/standoffs as well as the solenoids themselves.

1. The first step is drilling holes again into the same locations as the upper lid (which means the same mistake must be carried over). I really wasn't sure how to go about this in some easy fashion. Perhaps someone else has a better idea. I simply placed the upper lid over the lower lid with some paper underneath to catch the bit. Have the panels orientated the correct way; two of the edges will be the same length, while the other two will be half an inch short on either side. This is to allow the bottom lid to slip past what would've been the solenoid stops if I had found a way to make those. Drill carefully and slowly with enough pressure on the drill to prevent slipping while holding onto the panels to prevent moving. I drilled the holes in a criss-cross pattern like you're taught when removing or installing lug nuts on your vehicle while installing the threaded spacers after each hole to help hold the panels. I used the male-female spacers male side down through the bottom with an M3 screw on the upper panel and the smaller female-female spacers on the bottom side of the lower panel. It wasn't how I originally wanted things, but it worked.

2. Next, I had to install the solenoids themselves. I really wish I had been able to find some u-shaped brackets at the right size to hold them down while having more screws drilled into the bottom panel. But since I couldn't find anything suitable and ran out of time I attempted to glue them down with a loctite adhesive. Or rather, I slipped a zip tie around the body of the solenoid and glued that down. I wouldn't recommend it as it won't hold very well. Try to find some brackets suitable for them or what I also should've done is buy solenoids which have the predrilled rectangular metal housing. One solenoid went on the bottom left and the other the top right of the panel. After measuring the amount of distance that the plunger would pull in after power was applied (half an inch), I used that as reference for where to glue down since I wanted the solenoid plunger/pin to be flush with the lower panel so it too wouldn't obstruct the panel from lifting up through the top of the housing.

Also, I wish I had found suitable standoffs and extra screws in time so that I could mount the Arduino and the board to the bottom panel. As it is, it just rests within the panels with some of the wire taped down.

Step 8: The Final Code

Picture of The Final Code

The final code is uploaded. Hopefully it works for anyone trying to replicate this. However, issues that I didn't have originally, such as the slide potentiometer not affecting the locking or unlocking as it did in the breadboarding setup still puzzles me. The "key" still operates the solenoids and will of course disengage when unplugged, however, the original intent was for the key to plug in and provide power allowing the user to slide the potentiometer until the set parameter was met which also included the thermistor with its set temperature being met allowing for the solenoids to engage. Then, when the potentiometer was moved, the solenoids would disengage even with the thermistor having reached the set 72 degrees. If those problems were sorted out and more pots added to make it more of a combination lock along with the thermistor being more surface mounted so as touch could play a factor, the project would be more of a success.

All that's needed now is for final assembly. With your Arduino in place and the final code uploaded, make sure that the red wire leading from the proto-board connects to the vin pin on the Arduino, the black wire connects to the ground, the green wires leading from the solenoids go to digital pins 2 and 4, the green wires leading from the thermistor and the slide potentiometer go to analog pins A0 and A3 respectively.

Now make sure that the barrel jack is plugged into the Arduino. Also check that the battery snap within the "key" has been plugged in and that the batteries are present.

Take the two panels comprising of the lid and screw them together with the four M3 screws on top and the four female-female 24mm spacers on the bottom of the lower lid.

Make sure that you have marked both the upper lid and the key somehow so that you know which side is positive and which is negative.

Insert the key into the top of the upper lid carefully until it snaps in place and slide the potentiometer until the solenoids activate. (Although mine didn't after final assembly, all it took was putting in the key and the solenoids automatically retracted). To deactivate, gently pull up on the key while holding down the lid.

Please feel free to modify/improve this overly complicated lock box.

Comments

MsSweetSatisfaction (author)2014-08-11

Well done, especially for a novice! Thanks for sharing!

crank_girl (author)2014-08-04

Really cool! Great 'ible!