With this project you can build an RFID time-clock system to keep track of employees, children and more.
Recently I was listening to a friend who has three teenage children, of whom needed to arrive home before their parent. Unfortunately the parent needs to work all day and arrives home in the evening, and they lamented not being able to check when the children had arrived home.
After a few hours it occurred to me that a simple time clock would solve her problem – each child could check-in upon arriving home, and the parent could review the check-in times later on. And thus the kid-e-log was born.
From a hardware perspective, it would be quite simple. An LCD screen, RFID reader and some tags, and a real time clock IC such as a Maxim DS1307 – all running from the ubiquitous Arduino board. After some contemplation it occurred to me that smart kids might try to mess up the hardware by pulling the power, so it also uses an EEPROM to store time data which is impervious to power loss, and the kid-e-log will not have any user buttons. After initial programming for time and RFID key data, any changes will need to be effected by the programmer (i.e. me).
If RFID is new to you, review my Arduino tutorials before moving forward.
Before jumping ahead and making something, we discussed exactly what the function would be. Each child would have an RFID tag, and when it is read the hardware will save the arrival time in memory, and display it on the LCD. The time data will be reset automatically at 0400h or by reading an RFID card belonging to the parent. There will not be any buttons, and the hardware must be power-failure resistant – therefore EEPROM memory is needed for time data and a backup battery for the real-time clock.
From a hardware perspective, the requirements are quite simple:
- An Arduino-style board of some sort (we used the Freetronics Eleven)
- Maxim DS1307 or DS3232 real-time clock IC
- Microchip 24LC256 EEPROM
- Usual 16 character, 2 line LCD with HD44780-compatible interface
- 125kHz RFID reader with serial output, and four RFID tags (don’t get the Weigand version!)
- Two 4.7 kilo ohm resistors (for I2C bus with EEPROM)
- Two 0.1 uF ceramic capacitors (for power smoothing on the breadboard)
- a solderless breadboard for prototyping
- a nine volt DC power adaptor, rated for no less than 300 milliamps
- And for the final product, a nice enclosure. More on that later…
The DS1307 and the EEPROM are both using the I2C bus, and the RFID reader (more information) uses Arduino digital pin zero (serial input). The LCD is pretty straight forward as well, as described in the tutorials.
Here is the schematic for the prototype hardware:
From a software (sketch) perspective, the design is easily broken up into distinct functions which makes programming quite easy. The sketch is a basic loop, which follows as such:
- check to see if a tag is read by the RFID reader – if so, branch to the the reading function (which compares the read tag against those on file, and records the time matching the tag to the EEPROM)
- display real time, date and check-in data on the LCD – another function
- delay for a moment to stop the LCD flickering from fast updating
- check if the time is 4am, and if so call a function to reset the check-in times
From each of those four main instructions, functions are called to handle various tasks. For example the displayData() funtion is used to read the DS1307 real time clock, and display the time and date on the top line of the LCD. Then it reads the contents of the EEPROM, and displays the check in time for each RFID tag – or a line if they have not checked in yet.
The data stored in the EEPROM is held in following order
- tag 1 status (0 for not checked in, 1 for checked in)
- tag 1 check-in hour
- tag 1 check-in minute
and repeats for tag two and three. You will notice in the sketch that the RFID cards’ serial data are stored in individual arrays. You will need to read your RFID cards first with another sketch in order to learn their values. The rest of the sketch should be quite easy to follow, however if you have any questions please ask.
You can download the sketch from here. Next for the hardware. Here is our prototype, ready for action:
And now for a short video clip of the prototype kid-e-log in operation:
Notice how removing the power does not affect the real time nor the stored check-in data. Almost child-proof. The final task was to reassemble the prototype in order to fit into a nice enclosure. Unfortunately by this stage the person concerned had moved away, so I had no need to finish this project. However I had already purchased this nice enclosure:
It was just large enough to accept the Eleven board, and protoshield with the EEPROM and RFID reader circuitry, and the LCD module. It is custom-designed with mounts for Arduino boards and the LCD – a perfect fit. However the use of it can wait for another day. So an important note to self – even if designing things for a friend – get a deposit!
Such is life. I hope you enjoyed reading about this small project and perhaps gained some use for it of your own or sparked some other ideas in your imagination that you can turn into reality.
In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, subscribe for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other – and we can all learn something.