Arduino Combination Lock Lockduino
Arduino Combination Lock Lockduino
Table of Contents
Step 1: Ingredients: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Author:electricloser
I enjoy learning about electronics. I am self-taught. I finished my Electronics for Dummies and The Complete Idiot's Guide to Electronics! I moved on to
Semiconductor, NJATC. Now, I am trying to learn C language for my Arduino!
Image Notes
1. The inside of the door.
Step 1: Ingredients:
Electronics:
Arduino
1 Micro servo
1 Green LED
1 Red LED
2x 350 ohm reistors
4x 10k (or 50k) micro potentiometers (the higher the resistance the better)
Perf board
2.54 cm. pin headers
Insulated jumper wire
Heat shrink
Ribbon Cable
9v battery and clip
4 AAA battery holder
Tools:
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Soldering pencil
Tool to cut perf board (I found that the oscillating saw works the best!)
Razor blade
Wire cutters
Wire strippers
Needle-nose pliers
Electrical tape
Helping hands are helpful!
Hot glue gun
Heat gun
Sharpie
Paper and pencil
Drill with 1/4 bit, and 3/8 bit.
Parts:
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes Image Notes
1. Everything in place! 1. All soldered
2. Bend the leads of the LED towards the pots.
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes Image Notes
1. Using some thing red wire, I connect these to all the right sides of the pots. 1. Here is the where the you solder a red wire to the right side of the pots.
2. Test. Hook up the red wire to 5v on Arduino and the black to GND. Connect
your multimeter to GND. Connect the red wire (of the multimeter) to the middle pin
of the pots. Turning the pot should give you a read of 0 volts through 5 volts.
Soldering:
Working with ribbon cables can be tricky, but I found a way to master it. Draw a diagram! You can see in my diagram (the top) where everything should go. The bottom is
just everything reversed because when I was soldering I was soldering with it upside down.
Image Notes
1. What's an FD drive??
2. What's this all about?? Sloppy Dell manufacturers? :D
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes Image Notes
1. Using razor blade, separate 8 wires from the rest. 1. Clip the ends off.
Image Notes
1. Plans :D
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes
1. All the ribbon cable soldered. Notice the wire 1 is soldered to the middle pin of
the pot all the way to the right. Then LED are also connected.
1. Lay the perf board on top of the the Arduino. Then stick some pin headers through the perf and into the Arduino's output pins. This is to hold the perf board on the
Arduino. Using a sharpie, outline the Arduino on the perf.
2. Cut the perf
3. Mark a rectangle in the middle. Use a dremel to cut it out. I was able to cut it about halfway, then knock it out with a screwdriver.
4. Cut off the pin headers. (1, 2, 2, 4,)
5. Place all the pin headers into the Arduino pins. (the 4 goes into pins A0-A3, one of the 2 goes into 5v and GND, the other 2 connects to pins 12 and 13, and the 1
goes into pin 9.)(see pictures)
6. Put the piece of perf on top of the Arduino, letting the pins slip in the holes.
7. Put a drop of solder on top of the pins to hold them in.
8. Feed the ribbon cable though the rectangle.
9. Make all the solder connections. Be careful! Don't forget the resistors, pins 12 & 13!
10. Cut off the connector of the servo and strip the ends.
11. Attach the battery pack's positive and negative to the positive and negative of the servo. Solder these connections
12. Solder the GND of the battery and servo to GND on Arduino
13. Solder the control wire of the servo to pin 9.
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes
1. HEAVY DUTY!
Image Notes
1. Stick all the pins in the Arduino where they belong.
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes Image Notes
1. Make a rectangle big enough for the ribbon cable to fit into. 1. Using my dremel I managed to get these cuts in. I was then able to knock it
out with a screwdriver.
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes Image Notes
1. Solder two 200-400 ohm resistors on pins 12 and 13 1. Don't forget which wire is which!
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes
1. Solder the control wire to pin 9.
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes Image Notes
1. Bend the positive wire over. 1. Slide on some heat shrink.
Image Notes
1. Servo
2. Battery for servo
3. Arduino with backpack!
4. I guess I haven't yet showed you how to make this :D. We'll get to that here
shortly.
When you are putting on the ring terminals, MAKE SURE THAT THE POT IS TURNED ALL THE WAY TO THE LEFT FIRST!
Calibrating-
To do this you need to load the sketch (at the end) to your Arduino and open up serial monitor. Slowly turn the knob, in serial monitor when it says 1, make your first
mark. When it says two, make your second mark etc..
Making a frame-
Using some basswood sticks, I cut them to length and glued them on the edges. See photos.
I attached some double-sided tape to the battery holder, Arduino and the wooden frame.
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes
1. After sticking the pots in their holes, I was able to get these markings for the
LEDs.
Use a 1/4 drill bit.
Image Notes
1. 1/4 for LEDs
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes Image Notes
1. Optional, LED holders. 1. Everything fits, and I chopped of the edges.
Image Notes
1. After you turn the pot ALL THE WAY TO THE LEFT, dab some glue on top of
the knob, then press the the ring terminal on it. Then use your thumb to smash the
glue down that comes up through the ring.
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes
1. All the knobs marked.
Image Notes
1. Border all done!
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes
1. Double sided tape added to everything.
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes Image Notes
1. Stick a small screwdriver through here and give it a good pound. Make sure it 1. These two outer holes should be vertical, not crooked!
is not crooked like shown in the picture.
Image Notes
1. Somehow with scissors I cut this rectangle out. It's for the middle piece to slid
through.
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes Image Notes
1. Yeah! 1. I wound up cutting off this top piece, I only need the bottom one.
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes
1. I only got one small cut!
Image Notes
1. The inside of the door.
Image Notes
1. NOO! I forgot! :D
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
Image Notes
1. Ahhh, better :D
#include<Servo.h>
int redLED = 12;
int greenLED = 13;
Servo myservo;
void setup()
{
Serial.begin(9600);
pinMode(redLED, OUTPUT);
pinMode(greenLED, OUTPUT);
myservo.attach(9);
}
1. Serial.begin(9600) - begins serial communication at 9600 bits per second. This is typically referred to as the buad rate.
2. Setting redLED to output
3. Setting greenLED to ouput
4. Attaching the myservo to pin 9
void loop()
{
int analog1 = analogRead(A0);
int pot1 = analog1 * (10.0 / 1023.0);
int analog2 = analogRead(A1);
int pot2 = analog2 * (10.0 / 1023.0);
int analog3 = analogRead(A2);
int pot3 = analog3 * (10.0 / 1023.0);
int analog4 = analogRead(A3);
int pot4 = analog4 * (10.0 / 1023.0);
1. All this is for taking an analog reading at pins A0-A3. The analog reading is 0-1023. The line under it is converting it to 0-10. This is quite important, so don't get it
wrong!
else
{
digitalWrite(greenLED, LOW);
digitalWrite(redLED, HIGH);
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
myservo.write(170);
}
1. This is saying, "If pot1 is equal to the value 4, pot2 equal to 5, pot3 equal to 6, and pot4 equal to 1, then do the functions in the block right under it.
2. Turn green LED on, turn red LED off, and turn the servo to 170Ëš. (note: you will have to play with the servo to get it to turn correctly. Start off with 90Ëš and work
your way up and down.)
3. If all of those statements aren't true, then run the else block.
Turn the green LED off
Turn the red LED on
Move the servo back to 90Ëš
#include<Servo.h>
int redLED = 12;
int greenLED = 13;
Servo myservo;
void setup()
{
Serial.begin(9600);
pinMode(redLED, OUTPUT);
pinMode(greenLED, OUTPUT);
myservo.attach(9);
}
void loop()
{
int analog1 = analogRead(A0);
int pot1 = analog1 * (10.0 / 1023.0);
int analog2 = analogRead(A1);
int pot2 = analog2 * (10.0 / 1023.0);
int analog3 = analogRead(A2);
int pot3 = analog3 * (10.0 / 1023.0);
int analog4 = analogRead(A3);
int pot4 = analog4 * (10.0 / 1023.0);
else
{
digitalWrite(greenLED, LOW);
digitalWrite(redLED, HIGH);
myservo.write(170);
}
Serial.print(pot1);
Serial.print(pot2);
Serial.print(pot3);
Serial.print(pot4);
Serial.println();
Bonus!
If you post a picture of your own lockduino, I'll give you a 3 month pro membership! Only for the first two posters without pro memberships!
Cheers!
Related Instructables
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/
awesome! by
Honus
Advertisements
http://www.instructables.com/id/Arduino-Combination-Lock-Lockduino/