In this instructable, we are going to make an nfc based smart employee in/out management system which keeps track of your employees working hours.
We get the current-time information using the NTP (Network Time Protocol) with the Wi-Fi module (Esp8266) of Slabs-32 and send it to Atmega328p on the I2C bus.
The Atmega328p then uses this time information to make a record, whenever an employee swipes it's NFC tag to go outside or come inside of the office. It then calculates the time difference between the IN time and OUT time and displays it on the TFT screen of SLabs-32.
We can also send the information about the time spent by the employee in the office to the google spreadsheet using onboard Esp8266 but not in this instructable. This method has already been done by Stephen Borsay (link), I have integrated the same using this application.
To get your own SLabs-32 click on the link given below :
Step 1: List of Materials
We are using Nfc PN532 module which is a reader/writer NFC module.
In this project we require :
- NFC PN532
- Jumper Wires
Step 2: Hardware Connections
The Nfc module can be interfaced with our development board on I2C, SPI or High-speed UART bus, it's up to us to decide. In this project, we will be using SPI mode.
Make the connections as per the circuit diagram given above and you should have no problems.
- Vcc → 3.3 V
- GND → GND
- SCK → PD4
- MISO → PD3
- MOSI → PD2
- SS → PD7
Step 3: Configuring NFC PN532
NFC PN532 is an NFC reader/writer module. NFC which stands for “Near Field Communication” is a set of short-range wireless communication technologies, whose range is up to 10cm. It is designed to offer light-weight and secure communication between two devices.
NFC operates at 13.56MHz, and is based around an "initiator" and "target" model where the initiator generates a small magnetic field that powers the target, meaning that the target does not require a power source.
We can interface this sensor either by using SPI, I2C or HSU (High-speed UART). To select any one particular bus we use a dip switch. The configuration to interface them in a particular mode are as follows::
- SPI (0,1)
- I2C (1,0)
- HSU (0,0)
We will be using SPI bus to interface with this sensor.
Step 4: Programming SLabs-32
To get started with SLabs-32 click on the link given below :
Download the sketch files attached to step.
After downloading the file, open the sketch and do the following things:
- Enter you Wifi credentials
- Set the UTC offset according to your location (In the Esp sketch).
In this sketch, we are comparing the UID of the Nfc tag to know the information about the employee. Each employee is given an nfc tag which has a unique UID. For demonstration purposed this sketch gives an example of how to manage a single employee's working hours. You can also add more employees in your sketch if you wish to.
Step 5: Using Google Sheets
As mentioned earlier that we are also updating the time spent by the employees to the google sheet. To learn how to do that follow the steps provided by this link.
Instead of using the Gscrpit provided in that tutorial, use the Gscript attached to this step.
Step 6: Start Timing
That's pretty much it. IoT projects made easy by SLabs-32.
This project is not only for employee management but you can also use it for other application. I'll leave that up to your imagination.
Make sure to follow us for more easy and quick IoT projects using SLabs-32