The purpose of this project is to provide our local flyball club with a heat tracker. The heat tracker is used to keep track of which heat we are currently on during a flyball race. A race is usually a best 3 out of 5 heats, or a 4 out of 4 heats. This keeps track of which team won which heats.
The following is provided without support. Use it at your own will/risk.
The heat tracker is simply composed of 5 lights, in a wooden box and looks something like this:
It is built using relatively cheap components. A custom PCB, detachable-esp8266-4x-wire-to-board, provides a somewhat better way to connect a development ESP8266 board, in this case a LOLIN (WEMOS) D1 R2, to a few lights (in this case 5 x 7 LEDs controlled by a WS2812B), with a DC power jack.
A REST API is provided by the ESP8266 which exposes endpoints used by the browser based remote. The current endpoints are as follow:
The root endpoint, /
, provides the browser based remote that makes calls to the other endpoints
Retrieves a list of all of the heats and their results. It will always return TOTAL_HEATS elements.
- URL: /heats
- Method:
GET
- Success Response:
- Code: 200
Content:[ 'left', 'right', 'tie', 'none', 'none ]
- Code: 200
Content:[ 'left', 'left', 'right', 'left', 'none ]
- Code: 200
Content:[ 'none', 'none', 'none', 'none', 'none ]
- Code: 200
- Sample Call:
curl -H "Accept: application/json" -i http://192.168.4.1/heats
Sets the results for the current heat.
-
URL: /heat
-
Method:
POST
-
Data Params This method takes in JSON, with only one property: result
{ "result": "left" }
The valid values for result are:
left, right, tie
-
Success Response:
- Code: 201
-
Error Response:
- Code: 400
Content:{ "error": "Invalid JSON body." }
- Code: 400
-
Sample Call:
curl -d '{"result": "right"}' -H "Content-Type: application/json" -X POST http://192.168.4.1/heat
Resets all heats, starts a new race.
- URL: /heats
- Method:
DELETE
- Success Response:
- Code: 200
- Sample Call:
curl -H "Content-Type: application/json" -X DELETE http://192.168.4.1/heats
Resets the last heat, in case it was done by mistake.
- URL: /heat/last
- Method:
DELETE
- Success Response:
- Code: 200
- Error Response:
- Code: 400
Content:{ "error": "Cannot undo heat, currently on first heat." }
- Code: 400
- Sample Call:
curl -H "Content-Type: application/json" -X DELETE http://192.168.4.1/heat/last
This provides the Arduino compatible code to control the lights. It provides the application logic in order to set the lights according to the heats' results, and provides a way to restart the race. Currently, this is meant to be controlled with a browser, by connecting to an access point broadcasted by the ESP8266. The IP address of the ESP8266 defaults to 192.168.0.1.
Optionally, one can use this PCB (done in EAGLE) in order to facilitate how the LEDs are connected to the LOLIN D1 R2. This provides a PCB that has the LOLIN D1 R2 on headers, 5 x board connectors and a DC power jack. It makes it easy to swap the LOLIN D1 R2 and the lights.
- Add programs, ie: best 3 out of 5, 4 out of 4, etc.