Archive for November, 2009

Arduino-Controlled Lock with Keypad

Difficulty Level = 6 [What’s this?]

After tearing down an old CD player, I was inspired by the CD laser scanning assembly to build a door lock for my subterranean lab. The assembly has two motors: one for turning the CD (I’m not using this one) and one for slowly moving the laser across the CD’s surface. This second motor provides a nice linear motion that I wanted to use to build an electronically-controlled dead bolt lock for my lab.

Here’s the assembled lock. The circuit board in the middle is an H-bridge circuit I built to allow the motor to move in both directions. There are two position sensing switches so the Arduino senses when the motor has reached its limit in either direction. A 9V power supply powers the Arduino board, and a separate 5V supply drives the motor through the H-bridge. The dead bolt is literally a bolt — connected to the assembly with a piece of scrap circuit board — that travels through the door jamb and into the door.

The lock in the closed (locked) position.

The lock in the closed (locked) position.

The black CAT5 cable connected to pins 2-8 goes through a small hole in the wall (under a desk) to the keypad on the outside of the lab (I wasn’t sure I wanted to permanently mount the keypad in the wall). The user types in the correct code and presses the # key to open or close the lock. The green LED indicates the door is unlocked. Red indicates locked.

Lock keypad - green indicates that it's unlocked, red indicates locked.

Lock keypad - green indicates that it's unlocked, red indicates locked.

Let’s see the lock in action. (While recording, I gave instructions to my son to lock and unlock using the keypad off camera.)


Read more…


Published by Michael, on November 23rd, 2009 at 7:51 am. Filed under: Arduino,Level 6. | 16 Comments |

Wireless Temperature Sensor

Difficulty Level = 5 [What’s this?]

UPDATE: I have re-done this project using simple 434MHz RF transmitter/receiver devices. Check out the new project!.


UPDATE: Also see this project for an easy way to display a temperature reading: Digit Shield Temperature Display.


I decided to explore the more advanced features of XBee radios by building a remote temperature sensor. You can get quite a bit of control over an XBee radio without a microcontroller at all. You can configure the radio to send sensor readings at particular intervals when it detects changes on certain input pins. For the details on configuring XBee radios, see the documentation at Digi International.

For this project, I configured the radio at the sensor end to read the analog input of pin 19 every 4 seconds and to send a sensor reading packet. Both the sender and receiver radios must be running the API firmware. This does not work if they are running the default AT firmware. And the “API” parameter is not the same as running the API firmware. You literally need to write a different firmware image to your radios using the X-CTU tool from Digi. I have Series 2 radios, so if you are using Series 1, you need to read the correct documentation for your radios and modify the code.

Input pin 19 on my sensor radio is configured (parameter D1) with value ‘2’ which means that it will read analog input, and the IO sampling rate (parameter IR) is set to ‘1000’ which sends a sample every 4096ms.

An LM34 temperature sensor outputs a variable voltage depending on the temperature. The mapping is extremely simple: 10mV for every Fahrenheit degree. So, at 72 degrees F, the output is 720mV.

Why did I choose pin 19? I started with pin 20, but I burned it out. The pins can only handle an analog input of up to 1.2V, and I think I may have sent too much into the pin. How? Well, let’s say it involved holding a cold Pepsi can on the circuit to cool off the temperature sensor, and I shorted out a connection with the can. Oops. I’m lucky I didn’t burn out the entire XBee chip.

Remote temperature sensor

Remote temperature sensor

Here is the circuit for the remote sensor:

Schematic for remote sensor circuit

Schematic for remote sensor circuit

For the receiving side, I used an Arduino with an XBee shield and a two digit LED display:

Read more…


Published by Michael, on November 1st, 2009 at 12:50 pm. Filed under: Arduino,Level 5,XBee. | 124 Comments |