Introduction: RFID Controlled Bike Lock
This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com). This project was conceived and worked on throughout the Fall semester of 2015.
- A little background about myself: Prior to this class I had no experience with electronics, programming, 3D modeling, or 'hacking'. The only things I knew about electronics were the basics of electricity that I learned in physics 2. With that being said I believe that I have come away from the course with much more knowledge and experience. It was very difficult for me to pick up the concepts which other, more experienced, students were able to absorb with ease. It was frustrating and disheartening to fall behind but eventually it began to make sense and I was able to imagine and create something I could be proud of. I want to thank Eric Tridas, Alex Murphy, and Chris Frazier in particular for their patience and extra help. They are the reason I continued in the course and was able to complete this project.
- The idea behind this project was one that came to me when we started learning about the RFID scanners. I was intrigued at the 'DumpInfo' sketch which could read the supplied RFID card and key fob and print out the identifying code. The RFID bike lock works by scanning for that correct code and driving the servo in the appropriate direction (whether locking or unlocking).
- In its current state this device is a functioning prototype. I have many ideas on how the project can be improved and turned into a single and usable unit; however this project has been limited by the constraints of the course. One of the requirements is to use the basic black box supplied to all students in some way with the project. Because of this my electronics housing is contained in the box with power cord and wiring slots at either end. I would have liked to have designed the unit as a whole with the arduino and power source integrated into the frame itself. That is my plan for the continuation of this project.
Step 1: Designing and Printing the Key Holder and Exterior Shell
TIP: All of my designs were oversized to the nearest mm or half mm. For example if a part needed 1.2 mm I would design it at 2mm. If a part was at 1.85mm I would design it for 2.5mm. This may be different for your printer but it seemed to give me nice snug fits.
Everything you see in this project was designed using AutoDesk Inventor. You can get this 3D modeling program for free (if you are a student).
I have included the full .IPT files (3D models, inventor filetype) if you would like to make changes directly to mine or you can follow the steps I took to design your own (below). I also included the STL files for all the pieces and the cut STL files for the lock body if you would like to get straight to printing.
The first step to this project was to design a holder for the key. I wanted something that could firmly connect the key to the servo while also minimizing the length of the mechanism. At the same time it had to allow for the key to be removed without damaging it.
- Measure the key at the widest and thinnest points.
- In this case the key was trapezoidal in shape so designing the holder had to account for the sloping angle.
- Originally I printed a piece that would hold the entire base of the key.
- After some modifications I ended up with a holder that covered about 1/4 of the base of the key.
- Recreate the trapezoidal base of the key to be held and extrude a block around its shape.
- Use a dremel to smooth out any lingering filament in the holder and ensure a good fit with the key.
The second and much more lengthy step of the process was to design the exterior shell. I will not be detailing every step in inventor but rather giving an overview of the process to recreate a shell for your particular bike lock.
- Measure the widest diameter and length of the lock and extrude a block around the diameter to the given length
- Cut a length off the top of the block so that a gap is formed in the the upper edge of the circle
- This will give enough room for the lock's holes to slide into place
- Ensure that this gap is greater than or equal to the diameter of the lock's holes
- If it is not the right size you can cut away some of the sides to make the gap wider
- Add an extra length of block to accommodate the entire servo + key holder + key plus a few mm of shell thickness
- Measure this combined length by placing the key into the lock with the holder and servo attached.
- Measure the diameter needed for the key to turn without scraping the wall and cut a new circle of that diameter into the model
- Be aware that just the servo + key holder + key may not be representative
- My key stuck out around 2mm when inserted into the lock, you have to account for this distance
- Make sure that both circles are centered in each other so everything lines up
- Using the servo model (attached) measure a slot and hole for the servo to sit in.
- The slot will be for the servo 'wing' to secure the servo in place without adhesives
- The hole will be for the wiring to go through the servo holding region
- Use project geometry to make sure that the servo lines up with the other two circles
- Add filleting to the edges to give a smoother looking design
- Design a cap to fit over the servo housing
- Make a cutout for the RFID chip to slide in
This design was too large to be printed as one unit. I did some research and found a great (and free) program which effortlessly cuts your STL files to be printed as multiple pieces. Below are links to the video I learned from and the program's download link.
Printer - GEEETech Dual Extruder Prusa i3
Filament - White MakerGeek PLA Purchase Link
Repetier Host Printer Settings:
0.3mm layer height (first and subsequent layers)
10% rectilinear infill (top / bottom and inside)
First layer - 190*C extruder / 60* bed
Subsequent layers - 194*C extruder / 60* bed
I used blue painter's tape on the bed with no additional coating
TIP: Turn the bed up to 70-80*C when the print is done to make it easier to remove. I used an extra RFID card to slide under the corners. Due to the filleting it will be easier to get something under the corners. BE CAREFUL and slowly work it off in each corner so you don't break your glass bed.
Step 2: Arduino Code
Please see the uploaded code file for more information. Every line has been commented but I would be happy to answer any further questions about it. I have included 4 files - the main RFID Bike Lock sketch, the DumpInfo sketch, the MFRC522 .h and .cpp files (required for using the RFID reader).
- Make sure that you have placed both the .h and .cpp files in your Arduino library folder before compiling the RFID Bike Lock or DumpInfo sketches.
To use the DumpInfo sketch you will follow these steps:
- Connect your RFID reader and prepare your RFID chip
- Upload the DumpInfo sketch to the arduino and open the serial monitor
- Scan your RFID chip
- The third line of the serial monitor you will see "Card UID: X X X X" where the X's are your individual code bytes
- Copy each byte into the code array of the RFID Controlled Bike Lock sketch replacing each 'YourCode1-4' with the respective byte
Step 3: Wiring
Originally I had intended to use an RJ-45 network cable and the female port from an old router as my connection between the servo, RFID reader, and arduino. I was very excited about this possibility and ended up testing each cable from end to end and color coding where everything would be soldered. In the end after hours of soldering, testing, desoldering, resoldering and so forth I simply could not get it to work. If anyone can explain why it may not have worked I would appreciate the lesson.
Refer to the Fritzing diagram for a better understanding of the wiring. A representation of the RFID chip was used in the diagram with the actual wiring to be seen in the pictures.
At the top of the RFID Bike Lock sketch (in the code section) you will find a wiring map to ensure everything is put together properly. You may also refer to the pictures for another angle.
Step 4: Finishing
In order to get a smoother and more professional looking prototype I did some sanding and painting of the printed parts.
- 600 grit sand paper on all the edges and faces (across the grain)
- Thick layer of acrylic paint (black)
- Repeat steps one and two 6 times for a much smoother coat
You can see in the images the finished print vs. finished product. The sanding and painting helped everything to mesh together better and cover up the steps visible in the print. Behind the printed pieces you can see the other prototypes. I went through 4 designs and am most pleased with this one.
Although the parts were designed to be screwed into place I chose to use superglue (cyanoacrylate) after reading about it in a 3D printer forum. With PLA prints it will slightly melt the PLA and cause the parts to fuse to each other similar to welding. In the end I did not need to put the support bolts in the end pieces but you may choose to for additional support.
You can use the same glue on the faces of the servo when placing for a tight fitting. No glue is needed for attaching the key holder to the servo - the hole fits snugly over the servo end.
The servo housing cap can be fit over the upper wing of the servo. The way it is designed will provide a perfectly snug fit when printed. Additional screw can be placed through the cap for a more secure fit.
4 years ago
can i get the full report? and the coding?
5 years ago
Hey Hubert nice work there buddy.I am working on a similar project and would be very thankful of you if you provide me more details about the lock you used.
7 years ago
I love RFID projects !
7 years ago
Great wireless control project.