In many situations, a lap counter would be handy. RC sports, motorsports, roller derbies, track events, etc. would benefit from a simple counter that is keeping track of how many laps have been completed.
Basics
The idea in this tutorial is to build a counter using two RuuviTags.
One RuuviTag will travel on a competitor/car and is continuously broadcasting.
The another one is listening from a fixed base. This “base station” will record data from the racing RuuviTag and will broadcast a lap count.
All the nearby Android/iOS mobile phones will be able to receive messages from it.
Prerequisites
Get familiar with Espruino and Eddystone and learn how to update the firmware over-the-air.
To get started, flash Eddystone firmware to the first RuuviTag. Then flash Espruino firmware to the other one. You can find the files from here.
Step 1
Configure the racing RuuviTag to broadcast following parameters. Check the Eddystone tutorial to see how it’s done.
- Eddystone-UID (you can random-generate the ID)
- 100ms transmission interval
- -12dBm transmission power
Step 2
Copy & paste the following code to Espruino IDE and hit flash. Note that before flashing the code, you need to modify ID to match your Eddystone beacon’s MAC address.
The address can be seen using nRF Connect mobile app (Android | iOS).
Done!
Use a beacon scanner of your choice (nRF Connect for example) to see what the base station is broadcasting. The LED of the base station is also worth checking. It should light up every time the other beacon is close.
Tweaks
You can modify the script or configure the Eddystone beacon’s TX parameters. To find the best transmission interval and transmission power settings that work, you may need to do some field testing.
If you enhance the script, please let others know by commenting the tutorial.
Video Tutorial
This video is made by students of Centria University of Applied Sciences. Thanks for contributing!