RFID Controlled Car Trunk

77,563

385

52

Introduction: RFID Controlled Car Trunk

Projected Achievement:
One will be able to walk up to the trunk of the car, touch their hip (which contains their wallet which contains an RFID card) to a specified point, causing the trunk to pop open. It will employ radio frequency identification to sense the human subject, a servo to pull the cord that pops the car trunk and an arduino to control the system. The system will be completely hidden from the outside.
This project will also allow me to explore a deeper understanding of electronics and C based code. 

Overarching Goal:
It is important to integrate technology into our lives, enhancing day to day activities, and the standard of life. My goal in this project is turn a mindless but routine task into a natural extension of our lives.

Thank you to sparkfun.com and Electronics plus for being great part suppliers with awesome consumer service and an infinite amount of helpful information. Shout out the Open Source community...

I don't expect anything negative to occur, but this is electronics, so that being said:
I am not responsible for anything bad that may come from this instructables, by reading this, you agree to not hold me responsible for anything.

Step 1: What Is RFID



RFID stands for Radio Frequency Identification. It is a system that employ's low power radio waves to transmit data. The system requires a reader and a tag. The tag stores the data which gets read by the reader. All tags will transmit data but how they are activated or actually transmit the data varies depending on the tag.

Three main types of tags:

- Passive 
Cheap, small tags that require no internal battery. The reader outputs a radio frequency which "activates" the tag's circuit. The energy from the radio wave is also enough to activate the tag and then send back the data through the returning radio wave. This relies heavily on the connection between an electric field and a magnetic field. The radio wave induces a magnetic field in the circuit and thereby induces electric current, powering the system. The tag includes a small amount of circuitry and an antenna. The larger the antenna, the greater the range as a result of greater energy "absorption". 

- Semi-passive
Relies on the reader to supply the power required to send the signal (radio wave full of data) back to the reader. They have a small battery to power the circuit but rely on the energy from the radio wave to broadcast the signal back to the reader (similar to how the passive tag broadcasts it signal) 

- Active
Active tags are completely battery powered. They still respond to a reader but the circuit and the return signal are battery powered. This greatly increases the range as well as the cost. 

Extra Sources (and sources used):
http://www.abrfid.com/Passive-RFID-Tags-vs-Active-RFID-Tags
http://electronics.howstuffworks.com/gadgets/high-tech-gadgets/rfid2.htm
http://electronics.howstuffworks.com/gadgets/high-tech-gadgets/rfid3.htm
Picture: http://cbnbaggage.files.wordpress.com/2012/02/rfidlogo1.jpg

Step 2: Arduino Basics

Sparkfun.com has a great description of what is an arduino:

"Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments. Or more simply, you load on some code and it can read sensors, perform actions based on inputs from buttons, control motors, and accept shields to further expand it's capabilities. Really, you can do almost anything."

"All Arduino boards have one thing in common: they are programmed through the Arduino IDE. This is the software that allows you to write and upload code. Beyond that, there can be a lot of differences. The number of inputs and outputs (how many sensors, LEDs, and buttons you can use on a single board), speed, operating voltage, and form factor are just a few of the variables."

Arduino used in this project:

Arduino Uno:
Great for prototyping, includes a direct USB hub for easy connection to a computer, female headers for easy breadboard and direct wire connection 

Arduino Pro Mini:
Great for use in final project, through hole soldiering for solid connections, perfectly capable but small and light, does require an adapter of sorts (FTDI basic) to upload code though

Uno Picture: http://blogdoteiodotcom.files.wordpress.com/2012/04/arduino-uno-r3.jpg

Step 3: Preparation

Overview of RFID Controlled Trunk:
This system uses a passive RFID system to activate a servo when the card-like tag is sensed. The reader is embedded in a empty cavity in the car where it is easily within range of a human. It is meant to be easy and helpful. 

Parts list:
ID-20 Reader: http://www.sparkfun.com/products/8628
 - See step 1
USB Reader (interface hardware for ID-20 to computer or arduino/microprocessor): http://www.sparkfun.com/products/9963
 - Breakout (device) used to interface the ID-20 to the computer or arduino/microprocessor
Passive RFID tags (non-reprogramable ): http://www.sparkfun.com/products/10169
 - See step 1
Arduino Pro Mini 5v: http://www.sparkfun.com/products/11113
 - See step 2
Large Limited Rotation Servo (limited rotation makes it easier to program): http://www.sparkfun.com/products/9064
Wire (insulated!!) 
Hot Glue
Electrical Tape (lots of electrical tape)
Soldering materials
Nuts, bolts, and other metal pieces used to attach servo to car trunk
Optional: Arduino Uno and breadboard (selectively conductive board used for prototyping) 

Tools:
Soldering Iron (and accompanying equipment) 
Wire Strippers
Plyers
Screw driver/wrench 
Computer
FTDI basic for uploading code to arduino: http://www.sparkfun.com/products/9716
Other tools that you will find necessary  

Picture: http://upload.wikimedia.org/wikipedia/commons/6/6c/Electronics_tools_and_material.jpg

Step 4: Setting Up the Electronics

 When it comes to hooking up electronics, I recommend starting with the Arduino Uno. Its easier and less risky to setup, and is a great way to make sure the system works. I keep use my uno for prototyping and when I finish my system, I buy a pro mini and solder  the wires to that (which proves to work better in the long term). 

The flowchart below depicts the setup (scroll over the parts to learn more). Be careful when soldering, use a soldering heat sink (I learned this the hard way). 

Another important lesson I learned was the use of female headers. Instead of soldering directly to the board, I soldered wires that were connected to female headers. Then I plugged in the components into these female headers. This may sound pointless, and even after testing with the uno, problems will still arise. With this setup, you can stay flexible, and when your completely done, you can just hot glue them the wire to the header. 

Step 5: Understanding the Code

Thanks to an unknown code writer for most of this code!
/////////////////////////////////////////////
#include <Servo.h>  // Includes libraries (computer files) that include lines of code for the servo
Servo myservo; // Gives the servo a name

int RFIDResetPin = 0;

//Register your RFID tags here
char tag1[13] = "------------";  //First tag ID, I replaced the letters and numbers with a corresponding amount of dashes (i'd rather you              
                                                  //not hack my system...)

char tag2[13] = "------------";  //Second tag ID

void setup(){                        // everything within the void setup runs the code once on start-up 
  Serial.begin(9600);    //Sets up a connection to the computer when prototyping, incredibly useful to figure out whats happening in                      
                                        //the code because it can print lines of code onto a computer screen 
  myservo.attach(8);     //Attaches the servo to a specific pin on the arduino, this is like the lane of a highway for information 
  myservo.write(178);  // Sets the limited rotation (0-180 degrees) servo to 178, the idle position
  pinMode(RFIDResetPin, OUTPUT);  //Clears the slate for sensing a tag
  digitalWrite(RFIDResetPin, HIGH);    //puts it on "high alert"


}

void loop(){              //everything within the void loop is run through in a linear fashion over and over again 

  char tagString[0];                    //the next couple of lines work with the incoming data to turn it into numbers and letters which form
  int index = 0;                            //the ID tag 
  boolean reading = false;

  while(Serial.available()){               //while there is a serial connection (while the reader is communicating to the board...)

    int readByte = Serial.read(); //read next available byte          //code that begins decoding (haha) the binary 

    if(readByte == 2) reading = true; //begining of tag
    if(readByte == 3) reading = false; //end of tag

    if(reading && readByte != 2 && readByte != 10 && readByte != 13){
      //store the tag
      tagString[index] = readByte;
      index ++;
    }
  }

  checkTag(tagString); //Check if it is a match
  clearTag(tagString); //Clear the char of all value
  resetReader(); //reset the RFID reader
}

void checkTag(char tag[]){                   //Check the read tag against known tags


  if(strlen(tag) == 0) return; //empty, no need to contunue

  if(compareTag(tag, tag1)){                 // if matched tag1, do this
    servoGo();                                            //Activate the servo!

    Serial.println("card 1 read");             //print "card 1 read" to the computer, helps see if the code reaches this point when and how it
                                                                  //should
  }
/*
  else if(compareTag(tag, tag2)){           //if matched tag2, do this
   servoGo();                                                //Activate the servo!
   Serial.println("card 2 read");
  }*/

/* else{
    Serial.println(tag); //read out any unknown tag
    Serial.println("unknown card");
  }*/

}

void servoGo(){                                     
  Serial.println("Servo Activated");         //prints a line to the computer that tells me that its reaches this point 
    myservo.write(20);                               //writes the servo to a position that will pull the cord that pops the trunk
    delay(500);
    myservo.write(178);                            //resets the position for the next activation 
    delay(2000);
  Serial.println("Servo Action Complete");    //prints a line to the computer confirming the completion of this method (external code of
                                                                            //sorts)
}

/////////////////////////////////// The rest is code used to control the system that reads the code

void resetReader(){

//Reset the RFID reader to read again.

  digitalWrite(RFIDResetPin, LOW);
  digitalWrite(RFIDResetPin, HIGH);
  delay(150);
}

void clearTag(char one[]){

//clear the char array by filling with null - ASCII 0
//Will think same tag has been read otherwise

  for(int i = 0; i < strlen(one); i++){
    one[i] = 0;
  }
}

boolean compareTag(char one[], char two[]){

//compare two value to see if same,
//strcmp not working 100% so we do this


  if(strlen(one) == 0) return false; //empty

  for(int i = 0; i < 12; i++){
    if(one[i] != two[i]) return false;
  }

  return true; //no mismatches
}

//picture: http://www.thinkgeek.com/images/products/additional/large/wrapping_paper-binary.jpg

Step 6: Installing the System

This is where is really gets complicated. You will most likely not be installing your system onto a 2003 Mazda Protege, so you are going to have to get creative. 

Key points to remember when installing system:
 - Install the reader close to the surface of the car (less resistance = more range)
 * Install the reader where the radio waves will not have to travel through metal!! (This is a low power system, if the waves have to travel through metal, they lose their energy and effectively block the communication between the tag and the reader) 
 - Use lots of wire, its better to have extra than to realize half way through the install that you need to solder on more wire
 - Cover the reader with many, many, zip-lock bags and cover the entire system with waterproof electrical tape, make sure the tape extends to the wire (don't want a short causing a fire...)
 - As for installing the servo: My car's trunk is not furnished and there is an accessible cord that pops the trunk. I attached the servo to this cord, when it rotates, it pulls the cord. There are convenient holes that I used for mounting the system. I used some flat metal pieces and nuts and bolts to attach the servo to the car, so far this has worked great. 
 - Put the system in a box ( doesn't have to be fancy) to protect the electronics from unnecessary crushing 
 - Try to be neat and not do damage to the car (I hope this one is obvious) 

Step 7: Power Supply

Power Issues:

There are two main power systems that I considered: Battery power and power from the car. I choose to use battery power because its safer and won't run the risk of running down the car battery. It also makes it easier to maintain. I am using a 6v 4.5 amp hour battery that is rechargeable. This should be ample (pun intended) to power the system for a little while (months), but I have not yet tested this. 

UPDATE (5/28/12) - Copied from my comment on this 'Ible:
I powered the arduino with a regular 9v (just a regular Duracell) and powered the servo separately with the same 9v. I had two sets of alligator clips connected to the 9v. One set was simply connected to the raw and ground pins on the arduino and the other set was sent to the ground wire for the servo and a variable voltage regulator which then went to the servo's vcc wire. This allowed me to play with the voltage values for the servo only. I was very surprised by what I found: the arduino ran fine with the 9v and strangely the servo ran best on 1.55v pulling 6.8 mA. I always thought this servo would take 5-6v but it clearly ran best on 1.55v.
Now I need to figure out how I can permanently power the system. I can find a battery that is 9v with a high amp/hour rating (am open to suggestions though) but need to find a power system for the servo now. I will probably try to connect it to the car like jwhitley suggested. Thanks again for the help everyone!

Problem: For some reason, whenever I plug in the battery, the system pulses as if a capacitor is hooked in series. This is strange because the same thing happens when the system is powered through the vcc port. The system works fine when powered by the computer, which is strange because this goes through the vcc port that was not working. It does not seem to work with any port. I thought it might be a problem with the voltage, so I created a variable voltage regulator. This keeps the voltage level at a constant rate, which I assumed would also help regulate the current (I=V/R). While the system would pulse less at certain voltages, the system proved stubborn. For now I am stuck experimenting in an to attempt to identify the problem.

To use the system, I use the FTDI basic, which for some reason, works...

Picture: http://www.amazon.com/UB645-Sealed-Lead-Acid-Batteries/dp/B0006N61RW

Step 8: Conclusion

It works (Except for the power issue)!!
Remote Control Challenge

Finalist in the
Remote Control Challenge

Education Contest

Finalist in the
Education Contest

Be the First to Share

    Recommendations

    • Make It Bridge

      Make It Bridge
    • Big and Small Contest

      Big and Small Contest
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge

    52 Comments

    0
    muddog15
    muddog15

    9 years ago

    Maybe add a reed valve to turn on the power only when the card with a magnet and RFID chip is presented.

    0
    yeti bear
    yeti bear

    9 years ago on Introduction

    I would like to purchase an rfid setup. Basically powered from 12 to fire a spst relay.
    If you can supply something like that please email me direct. Greenzero13 at gmail

    Thanks

    0
    WABIX
    WABIX

    10 years ago on Step 6

    I have a pro micro and I never solder my FTDI headers into it. Instead, I stick the long end of a 6 pin straight header into the USB - FTDI. Then stick the short end into the 6 holes on the pro micro while programming. When finished, all you have to do is remove the header + FTDI. If you are doing small projects, this can save a lot of space.

    0
    AJMansfield
    AJMansfield

    10 years ago on Step 3

    Why do you have a computer hard disk, an old tape cassette reader, a graphics card, and either a dial-up modem or an Ethernet board pictured at the top right of the image?

    0
    Lucas Reed
    Lucas Reed

    Reply 10 years ago on Step 3

    It is just a title picture. I could have set up all of my supplies and tools for a photoshoot but I choose to progress my electronic projects instead :)
    Sorry if it was confusing.

    0
    mr monoply33
    mr monoply33

    10 years ago on Introduction

    This is the first time I've been truly disappointed in a feature of my car. I know my trunk latch mechanism inside & out from when I had everything dismantled to install a rear-view camera...and there is no way I can manage this :'(

    0
    SuzyMac
    SuzyMac

    10 years ago on Introduction

    I am not an electronics geek, but I am a Braille Geek and very curious about why you included the Braille....I love to see Braille where ever it is!

    1
    Hycro
    Hycro

    10 years ago on Step 6

    With my car I could just run a power wire from the car battery to a relay triggered by the Arduino, since with my car the interior trunk release is electric...

    0
    josephlebold
    josephlebold

    10 years ago on Step 5

    Great place to start. I can see where it could be integrated into the car a little more. One could use the car's own battery, make sure your Arduino can take 14 volts or use a regulator. Most cars now have an electric trunk release so you could hook into that using a relay instead of the servo.
    Heat sinks, good idea, I rarely use one though. I would recommend anyone new to soldering use one. I find if you move quickly you get the best joints. If your flux is smoking get the joint completed before it quits and don't be afraid to use lots.

    0
    Lucas Reed
    Lucas Reed

    Reply 10 years ago on Introduction

    Thanks, I am looking into integrating parts of it into my car battery but am also trying to be careful in order to not find my car with a dead battery one day.
    Unfortunately my car does not have an electric trunk release. That would have made things a lot easier for me.
    As for the soldering heat sink, it turns out I didn't need it, my board is not broken. I had not ruled that out as a possibility because the power system was not working, but since it now is, I have no reason to blame the board.

    0
    jwhitley
    jwhitley

    10 years ago on Step 7

    The Arduino's lowest >required< voltage is 6V, but recommended is 7V. The "pulsing" you are experiencing may or may not be too much current draw. You can test this by using a multimeter on the 5V + GRND pins. If the 5V drops to 0 during the "pulse off" phase, then it is likely that the Arduino is seeing more current than it can handle and the overcurrent protection is kicking in. I've had this happen with certain loads.

    After looking at your "flow diagram," here is my recommendation: Use a separate supply for the servo. That size of servo is very likely to pull more amperage than the Arduino can handle regardless of what supply you have hooked up to the Arduino. I think the best option is to use the 12V from your car, regulated down to the required 6V, to power the servo and buy a different battery with a higher voltage to power the Arudino. The servo obviously doesn't use power unless you're actually actuating it so it won't be a drain on the battery and it can draw much more current without bothering the Arduino.

    0
    Lucas Reed
    Lucas Reed

    Reply 10 years ago on Introduction

    Thanks, those are some good suggestions. If the issue is that the current is more than the arduino can handle, why would the system work when plugged in to the computer? I will definitely try the higher voltage battery though, I could see that being the problem. Thanks for the help!

    0
    jwhitley
    jwhitley

    Reply 10 years ago on Introduction

    The USB connection is current-limited. The battery is not. You can pump as much current as the battery will allow through the Arduino (and eventually hit the overcurrent protection) but the USB connection will only allow a certain amount of current to be drawn thanks to current-limiting resistors in your motherboard.

    0
    MecranA0
    MecranA0

    Reply 10 years ago on Introduction

    I agree with jwhitley, use the car's battery as the power source(s) and let the arduino become a "relay-like" trigger, not a power supplier. Also, USB is MB limited to 500mw max and yes I'd think the arduino would switch to it's USB power mgmnt upon USB connection. It looks like you have a crown vic so running a voltage line is easy enough by removing the trim along the bottom of the doors and you can punch through the thick rubber boot that allows the car's wiring harness through the firewall. Just remember to fuse at the battery (as close as you can get) to limit any potential damage from shorts to GND. You can also find switched voltage under the dash that is only "HOT" while the key is in the "RUN" position or only "HOT" while the key is in the "STARTING-ONLY" position should you choose to explore other options! I have kitted a few Crown V's up for police use (as well as other cars/truck/suvs) and this has way more potential than just a novelty! Great job! See now I need to dig out my barely used UNO kit and get an RIFD kit too! Peace n God bless! <><

    0
    Shadetree Engineer
    Shadetree Engineer

    Reply 10 years ago on Introduction

    When plugged into the PC, doesn't the Arduino automatically switch it's power to run off of the USB? That would have a much higher amperage capacity, to run the servo.

    0
    jimmytvf
    jimmytvf

    10 years ago on Step 8

    wow, this gave me an idea to how to make an anti thief system. instead of powering up the servo with the RFID, you can put a heavy duty relay from the spark plug wires in your car and trigger it with the RFID, so anybody can drive it! you could start the car also with the RFID, but is a pretty seen idea.

    nice ible dude, i mean duke!

    0
    backyardengineer
    backyardengineer

    Reply 10 years ago on Introduction

    I have never seen a relay that would hold up to a spark plug voltage and surges for long. I would think you could wire in the switch to the rfid easier.

    0
    jimmytvf
    jimmytvf

    Reply 10 years ago on Introduction

    mr. stacey davids got the solution.
    http://www.youtube.com/watch?v=-zbC6T6sfZM
    skip to 1:52

    0
    Lucas Reed
    Lucas Reed

    Reply 10 years ago on Introduction

    That's a cool idea, it would be fun to touch my wallet to a predefined spot thereby stating my car. Unfortunately though I am already working on a push button start system that is tied into a Nike + door unlock system.