Introduction: Lap/Run Counter RFID

A simple lap/run counter using RFID for users. Uses a database for storing the lap count of users. Code can be easily changed to a checkpoint system or other system.


What can it do?

This device can track multiple people running/cycling/swimming (You name it). It can be used in multiple ways, such as a run counter or a checkpoint system. All the data is trackable in the database and it isn't a lot of work to make the data visible for the participants


What did I learn?

I learned a lot about tiny electronics and power. The last time I soldered was 6 years ago. It was different from the last time I soldered. It was a lot smaller and soldering errors were inevitable.

Supplies

For each unit:

1x RC522 RFID

1x D1 Mini - ESP8266-12F (Use https://github.com/esp8266/Arduino for use as Arduino)

3x Resistor 220 ohm

1x Blue, Red, Green LED 5mm Diffused

1x Tactile Switch Momentary 4pin 12*12*7.3mm

1x Resistor 10k ohm

1x Buzzer 5v

5x Female > Male Jumper wires.

8x Male > Male Jumper wires

2x Small piece of double-sided tape

1x Rocker switch

1x 4x AA battery holder

4x AA battery


Extra Tools:

Glue Gun

1x USB > Micro USB

1x Database (MySQL) + Website for API


Laser cut box:

Step 1: Setup

Install the board manager in the Arduino IDE:

Installing with Boards Manager


Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (32 and 64 bit).

  • Download and install Arduino IDE 1.x or 2.x
  • Start Arduino and open the Preferences window
  • Enter https://arduino.esp8266.com/stable/package_esp8266com_index.json into the File>Preferences>Additional Boards Manager URLs field of the Arduino IDE. You can add multiple URLs, separating them with commas.
  • Open Boards Manager from Tools > Board menu and install esp8266 platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation).

(https://github.com/esp8266/Arduino)


Upload the code to the Arduino ESP8266

(Don't forget to change the network name and password in the code file to your wifi or hotspot.)

https://pastebin.com/X0SreB3S

Step 2: Setup Database

Upload the Users.csv file to the database. (Go to the database and press Import and upload the file.)


On your website/api upload the files:

Name: ITConnection.php https://pastebin.com/vgXVzGZU

Name: CreateAccount.php https://pastebin.com/3JR5Lgej

Name: LapUpdate.php https://pastebin.com/LfU85NTe


Add account entry:

http://YOURURL /CreateAccount.php?username=[Name]&NFCUID=[NFCUID

Step 3: Laser Cutter

Upload the RFIDBox.dxf to the laser cutter and cut. The box is 13x8x4,5 cm and the file is 38 x 27,5 cm.

The red lines should be cut and the Blue lines should be engraved.


(You can also use a 3D printer. Just make the box 13x8x4,5 cm. Leave room for the Rock Switch and 3 LEDs)

Step 4: Soldering

  1. Start by soldering the power supply. Connect the ground from the battery to the rock switch and connect the other pin of the rock switch to your ground line on your PCB board.
  2. Solder the wire from the battery power to a male header and put that in the ESP8266 in the 5v pin.
  3. Run the 3.3v to the PCB board and use it as the power line for the board.
  4. Solder the 3 LEDS to the board in order: Red > Green > Blue.
  5. Connect the RED LED to pin: D1. (Using half of a male prototype cable)
  6. Connect the GREEN LED to pin: D3. (Using half of a male prototype cable)
  7. Connect the BLUE LED to pin: D4. (Using half of a male prototype cable)
  8. Solder the buzzer to the PCB Board. (Connect Ground to Ground). Connect the buzzer to pin D2.
  9. Solder the button and connect the button to A0.
  10. Cut 2 female cables and use them to connect the 3.3v and ground to the RFID component.
  11. Connect the Reset to pin D0 (using a female > male cable.)
  12. Connect SDA to D8 (using a female > male cable.)
  13. Connect SCK to D5 (using a female > male cable.)
  14. Connect MOSI to D7 (using a female > male cable.)
  15. Connect MISO to D6 (using a female > male cable.)

(Make sure to test often to prevent issues.)

Step 5: Test

The program is programmed to enable all the LEDS and the buzzer when turning on. If the LED isn't on it's probably not working correctly.

The device is starting and will try to make a connection to your network.

When no connection is made the red led will turn on and won't turn off.

When a connection is made the green led will turn on for a few seconds and will turn off.


With the button you can set the deviceID. Hold the button for 4 seconds. A beep will start and you can cycle through the channels. The LEDs will indicate the ID (in binary). Max ID's 7 (0-6). When you set your channel hold the button for 4 seconds and the program will continue it's normal routine.