RFIDuino Project 2 - Solenoid Unlocker


Now we will extend upon Project 1 to activate other devices. In this case we are going to activate a small solenoid via a RobotGeek Relay board. This code will work for any digital output device (such as LEDs). Activating a solenoid or motor upon a read of the 'key' tag is the basic principal behind RFID enabled locks.

Hardware Required


  1. Connect your components as shown here.
    NOTE: Getting power to all of your devices may take a litle work. You can use the barrel jack to terminal converter found in the Power Converter Pack and wire up your devices as shown here. Alternativley you can cut off the barrel jack, then re-soldering it on, and also soldering two extra lines out, like this. Alternativley, you can use two 12v power supplies, like this. RFIDuino-solenoid_bb_th.png
  2. Open RFIDuino_project2 in your Arduino IDE. You can find this sketch under
  3. We will need to modify the sketch to include the ID of a tag that we found in Hello World 2. Find line 12 - it looks like this.
    byte key_tag[5] ={0,0,0,0,0}
    Now insert the ID numbers for your tag. For example, if our tags ID was '70 0 44 22 242 we would modify the code to look like this
    byte key_tag[5] ={77,0,44,22,242};	
  4. Load the Sketch onto your Geekduino
  5. Once loaded, you can leave your board connected to your computer - you will need this connection to power the board.
  6. Swipe the 'key' tag across the RFIDuio antenna. The green light will light up and your buzzer play three different notes. Additionaly, the solenoid will fire.
  7. Swipe any tag that is not the 'key' tag across the RFIDuio antenna. The red light will light up and your buzzer play three monotone notes. The solenoid will not react.

Code Overview

This code is a modified version of RFIDuino_project1. The code activates a new digital pin (9) so that it can control the relay board. By sending a High signal to the relay board, the code activates the 'Normaly Open(NO)' pin, connecting it to the common pin. When this connection is made, power can flow through the solenoid, activating it.

RFIDuino Functions used in this example

Next: Wireless Communication

Feedback Form