Skip to content

Commit

Permalink
Merge pull request #38 from scottgchin/release-0.5
Browse files Browse the repository at this point in the history
Release 0.5
  • Loading branch information
howflyquad authored Jul 9, 2017
2 parents fc5c3d5 + 0fc7824 commit c29f1cd
Show file tree
Hide file tree
Showing 54 changed files with 11,166 additions and 1,712 deletions.
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# Delta 5 Race Timer

### Description:
<img src="doc/img/delta5racetimer.jpg" align="right" alt="Delta5 Race Timer"/>

Multi-node radio frequency race timer for drone racing. This timing system uses the 5.8Ghz video signals being broadcast by FPV racing drones to trigger a lap timer; no additional equipment required on the drone. Each receiver node is tuned to the video frequency that a drone is broadcasting on. Each of the receiver nodes are connected to a raspberry pi, which aggregates the data and also provides a simple user interface for the race director. Up to eight video frequencies can be tracked in a race.
Multi-node radio frequency race timing system for FPV drone racing. Uses the 5.8Ghz video signals already being broadcast by each drones to trigger a lap timer; no additional equipment is required on the drone.

### Facebook Group page:
Have questions? Comments? Join us at the Delta 5 Race Timer Facebook Group page and we'll try to help troubleshoot.
https://www.facebook.com/groups/Delta5RaceTimer/

### Video Demo (Note: video shows the shows 4 Receiver Node version):
https://youtu.be/UdelgqwngX4
Each receiver node is tuned to the video frequency that a drone is broadcasting on and then connected to a raspberry pi. By default, up to eight racing drones can be tracked in a race.

### Hardware and Software Setup Instructions
[/doc/Hardware and Software Setup Instructions.md](/doc/Hardware%20and%20Software%20Setup%20Instructions.md)
### Major Features
* The system hosts its own web server which is used to control the system, no additional software is needed, any device with a web browser can connect
* Automatic calibration; the system sets triggers at the start of each race
* Manage pilot names, assign them to heats, and after each race save the results to a local database
* Supports the standard 40 FPV video channels

### Tuning Parameter Explanation
[/doc/Tuning Parameters.md](/doc/Tuning%20Parameters.md)
### Hardware and Software Setup
To build the system, follow the instructions here: [/doc/Hardware and Software Setup Instructions.md](/doc/Hardware%20and%20Software%20Setup%20Instructions.md)

### User Guide
[/doc/User Guide.md](/doc/User%20Guide.md)
For initial setup and running races, follow these instructions: [/doc/User Guide.md](/doc/User%20Guide.md)

### Support
Have questions? Comments? Join us at the Delta 5 Race Timer Facebook Group page and we'll try to help troubleshoot.
https://www.facebook.com/groups/Delta5RaceTimer/
89 changes: 46 additions & 43 deletions doc/Hardware and Software Setup Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,100 +2,103 @@

## Parts List

### Receiver Node(s) (this is enough for one receiver node, build as many as needed)
### Receiver Node(s) (this list makes one node, build up to eight)
* 1 x Arduino Nano
* 1 x rx5808 with SPI mod
* 3 x 1k ohm resistor
* 1 x 100k ohm resistor
* 26 AWG and 30 AWG silicone wire

### Main Controller
### System Components
* 1 x Raspberry Pi2 or Pi3
* 8 GB (minimum) Micro SD Card
* 26 AWG and 30 AWG silicone wire (for wiring to each receiver node)
* 3D printed case for housing the electronics
* 5V power supply, 3 amp minimum

### The Rest
* 3D printed case for the electronics
* 3 amp minimum 5V power supply
### Additional Components
* Ethernet cable, 50ft plus
* Outdoor power cable, 50ft plus
* Network router
* Laptop/tablet

## Hardware Setup

### RX5808
You will have to modify the rx5808 receiver so that it can use SPI.
### RX5808 Video Receivers
Modify the rx5808 receivers to use SPI.

1. Remove the shield from the rx5808. The shield is normally held on by a few spots of solder around the edges. Use some solder wick to remove the solder and free the shield from the receiver. Careful not to pull the shield off as the shield is connected to ground pads on the receiver. There are usually small holes around the edge you can use to help push off the shield.
Remove the shield from the rx5808, the shield is normally held on by a few spots of solder around the edges. Use some solder wick to remove the solder and free the shield from the receiver. Be careful not to damage any ground pads on the receiver. There are usually small holes around the edge you can use to help push off the shield.

2. Remove the following resistor:
![alt text](img/rx5808-new-top.jpg)
Remove the following resistor:
![rx5808 spi mod](img/rx5808-new-top.jpg)

3. The sheild should be soldered back in place after removing the resistor.
The sheild should be soldered back in place after removing the resistor.

### Receiver Node(s)
### Receiver Nodes
Complete wiring connections between each Arduino and RX5808.
![alt text](img/Receivernode.png)
![receiver node wiring](img/Receivernode.png)

### Main Controller
### System Assembly
Complete wiring connections between each Arduino and the Raspberry Pi.

Note: be sure all Receiver Nodes and the Raspberry Pi are tied to a common ground; if not, the i2c messages can be corrupted.
![alt text](img/D5-i2c.png)
![system wiring](img/D5-i2c.png)

## Software Setup

### Raspberry Pi
1. Start by instaling Raspbian, follow the official instructions here: https://www.raspberrypi.org/downloads/raspbian/, use 'RASPBIAN JESSIE WITH PIXEL'
### Receiver Nodes (Arduinos)
Note: The latest Arduino IDE (1.8+) is required from https://www.arduino.cc/en/Main/Software

Open '/delta5_race_timer/src/delta5node/delta5node.ino' in the Arduino IDE.

2. Enable I2C on the Raspberry Pi
Configure the '#define i2cSlaveAddress' line of the .ino for each node before uploading.
```
sudo raspi-config
// Node Setup -- Set the i2c address here
// Node 1 = 8, Node 2 = 10, Node 3 = 12, Node 4 = 14
// Node 5 = 16, Node 6 = 18, Node 7 = 20, Node 8 = 22
#define i2cSlaveAddress 8
```
Go to Advanced Options, and enable I2C

3. Install Python
### System (Raspberry Pi)
Start by installing Raspbian, follow the official instructions here: https://www.raspberrypi.org/downloads/raspbian/, use 'RASPBIAN JESSIE WITH PIXEL'

Enable I2C on the Raspberry Pi, go to 'Advanced Options' and enable I2C.
```
sudo apt-get install python-dev
sudo raspi-config
```
and install the python drivers for the GPIO

Install python and the python drivers for the GPIO.
```
sudo apt-get install python-dev
sudo apt-get install python-rpi.gpio
```

4. Final Update and upgrade
Final system update and upgrade.
```
sudo apt-get update && sudo apt-get upgrade
```

5. Clone or download this repo to '/home/pi/' on the Raspberry Pi
Clone or download this repo to '/home/pi/' on the Raspberry Pi.

6. Open a terminal in '/delta5_race_timer/src/delta5server' and run
Install web server packages, open a terminal in '/home/pi/delta5_race_timer/src/delta5server' and run
```
sudo pip install -r requirements.txt
```

### Receiver Node Arduino Code:
1. Open '/delta5_race_timer/src/delta5node/delta5node.ino' in the Arduino IDE

2. Configure 'i2cSlaveAddress' in the setup section of the .ino

3. Upload to each Arduino receiver node changing 'i2cSlaveAddress' each time

### Start the Server
## Starting the System

There are two types of servers that the pi can run to collect timing data. The following instructions are for a hosted webapp that can be used to do everything needed to run a race and collect times.
The following instructions will start the Delta5 Race Timer web server on the raspberry pi allowing full control and configuration of the system to run races and save lap times.

The other alternative is a slimmed down timing server intended to be used to communicate with external timing software. If you wish to use the timing server, replace "delta5server" with "timingserver" in the paths provided in the following instructions.
Alternatively, to use your Delta5 Race Timer hardware with 3rd party timing software, replace each reference of 'delta5server' with 'timingserver' in the following instructions.

#### Manual Start
1. Open a terminal in '/delta5_race_timer/src/delta5server' and run
Open a terminal in '/delta5_race_timer/src/delta5server' and run
```
python server.py
```

#### Start on Boot
1. Create a service
Create a service
```
sudo nano /lib/systemd/system/delta5.service
```
Expand All @@ -106,20 +109,20 @@ Description=Delta5 Server
After=multi-user.target
[Service]
Type=idle
ExecStart=/usr/bin/python /home/pi/delta5_race_timer/src/delta5server/server.py
WorkingDirectory=/home/pi/delta5_race_timer/src/delta5server
ExecStart=/usr/bin/python server.py
[Install]
WantedBy=multi-user.target
```
save and exit, [CTRL-X], [Y], [ENTER]
save and exit (CTRL-X, Y, ENTER).

2. Update permissions
Update permissions.
```
sudo chmod 644 /lib/systemd/system/delta5.service
```

3. Start on boot
Start on boot commands.
```
sudo systemctl daemon-reload
sudo systemctl enable delta5.service
Expand Down
32 changes: 22 additions & 10 deletions doc/Tuning Parameters.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
# Tuning parameters
# Auto Calibration and Sensor Tuning Parameters

There are a few parameters that can be used to tune the behavior of the delta5 nodes. This document will attempt to explain them.
The Delta5 Race Timer will auto-calibrate trigger values for the nodes during the first pass of the timing gate after starting each new race.

## Auto Calibration
In order for auto-calibration to work, the system has to make a guess about when a quad passes the gate the first time. In theory, the RSSI will go up as you approach the timing gate and then fall as you travel away from it. In practice, there is a lot of noise and the value oscillates quite a bit.

The delta5 will auto-calibrate the trigger value for the nodes during the first pass of the timing gate. In order for auto-calibration to work, the system has to make a guess about when a quad passes the gate the first time. In theory, the RSSI will go up as you approach the timing gate and then fall as you travel away from it. In practice, there is a lot of noise and the value oscillates quite a bit.
Auto-calibration works best with the launch pads and start gate positioned in the middle of a straight away. You want a clean rise and fall of the RSSI value for the first pass and for each lap after.

Auto-calibration works best with the launch pads and start gate positioned in the middle of a straight away. You want a clean rise and fall of the RSSI value at the start and for each lap.
### First Pass
To help with this explanation we're going to use some example values talking about one quad passing the gate. Let's assume that with the quad powered off the sensor is getting a background RSSI value of 100. With the quad powered and on the launch pad some distance away the RSSI is 150.

**Calibration Threshold** - Helps to add a buffer around the fluctuating RSSI value during the first pass. Before a peak in the RSSI value is considered to be a gate pass, it must first fall below *Peak RSSI - Calibration Offset*. Set this value higher if you are getting lower than expected trigger values because the fist pass has been triggered before actually crossing the gate. If you are not getting a pass record for the fist pass (and likely ever), lower this value; The quad has not gotten far enough away from the gate for the RSSI to fall below *Peak RSSI - Calibration Offset*. This value tends to be higher than the **Trigger Threshold** explained below. As the first pass is happening, the trigger value is being pulled up as the quad approaches the gate. A relatively large value is needed to avoid false positives because of noise in the RSSI signal.
After the race start button is pressed and the quad starts moving towards the gate, the RSSI value will begin to increase from its initial value of 150. Eventually the quad passes the gate and the RSSI value starts to fall, let's say the Peak RSSI seen was 300. The trigger is set during this pass by subtracting the Calibration Offset (8) from the Peak RSSI (300), so the Trigger will be 292.

**Calibration Offset** - Basically "Gate Size". When calibrating on the first pass, this value will be subtracted from the peak RSSI value to act as the trigger value. If you are missing some pass records, raise this value. If you are getting extra pass records when looping close to the start gate at another point in the course, you can try lowering this value.
Now the system is waiting to detect when the quad has left the starting gate to confirm the Peak RSSI and Trigger values detected. It waits for the RSSI value to fall below the Trigger (292) minus Calibration Threshold (95) which is 197. Once the RSSI has dropped below 197 the system considers the first pass to be complete.

## Other Passes
### Future Passes

**Trigger Threshold** - Similar to **Calibration Threshold** but used for all passes other than the calibration first pass. During a normal pass, the RSSI must fall below *trigger value - trigger threshold* in order to consider the pass complete. This value helps avoid multiple lap records during a single pass because of noise in the RSSI. Raise this value if you get several pass records while passing the start gate. Lower this value if the quad has to travel very far before a passing event is triggered.
The system is now waiting for the RSSI to rise above the Trigger value of 292 again. Once this happens it will consider the next gate pass to be happening. It will keep track of the Peak RSSI value seen and the time it happened, and continue to do so until the RSSI value falls below Trigger (292) minus Trigger Threshold (40) which is 252. Once the RSSI has dropped below 252, that gate pass is complete and the lap information is sent to the Raspberry Pi.

**Note**: In all cases, the passing time is taken when the RSSI has reached it peak (when the quad should be closest to the sensor). Even if larger threshold values cause there to be a delay in the lap being reported, the timing information will sill be correct.
Note that the passing time is taken when the RSSI has reached it peak (when the quad should be closest to the sensor). Even if larger threshold values cause there to be a delay in the lap being reported, the timing information will sill be correct.

### Tuning

##### Calibration Offset
If you are missing some passes, it means the Calibration Offset value is too small and the quad is not reaching as high a peak RSSI value as was seen on the first pass. Increase Calibration Offset to ensure all laps are captured.

##### Calibration Threshold
Adds a buffer around the fluctuating RSSI value during the first pass. Increase the value if you are getting lower than expected trigger values because the fist pass has been triggered before actually crossing the gate. If you are not getting a pass record for the fist pass (and likely ever), decrease this value. A relatively large value is needed to avoid false positives because of noise in the RSSI signal.

##### Trigger Threshold
Increase this value if you get several pass records while passing the start gate. Lower this value if the quad has to travel very far before a passing event is triggered.
46 changes: 25 additions & 21 deletions doc/User Guide.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,50 @@
# Delta 5 Race Timer User Guide

### Hardware and Software Setup
1. Follow the instructions here if not done already: [/doc/Hardware and Software Setup Instructions.md](Hardware%20and%20Software%20Setup%20Instructions.md)
Follow the instructions here if not done already: [/doc/Hardware and Software Setup Instructions.md](Hardware%20and%20Software%20Setup%20Instructions.md)

### Connect to the server
1. Open a browser and type in the ip address of the timing system on your network using port 5000
### Connect to the Server
Find the ip address of the raspberry pi by opening the 'Clients' list on your routers admin page.

Open a browser and type in the ip address of the timing system on your network using port 5000 or as configured in 'server.py'.
```
XXX.XXX.XXX.XXX:5000/
```

### Settings
Pages reserved for the race director are password protected with the default user 'admin' and password 'delta5'.

### System Settings and Configuration ('Settings' page)

1. Go to the 'Settings' page
Start by resetting the database at the start of each race event. You have the option of a complete reset 'Reset Database' or if mostly the same pilots are racing 'Reset Keep Pilots'.

2. Start by resetting the database by clicking 'Reset Database' at the bottom of the page
Frequencies are configured under the Nodes heading. Defaults are IMD for up to 6 nodes or Raceband when 7 or 8 nodes are detected. Use the dropdowns to change frequencies as needed.

3. Frequencies are defined under the Nodes heading, defaults are IMD for up to 6 nodes or raceband when 7 or 8 nodes are detected
Click 'Add Pilot' until you have an entry for each pilot racing and then update the pilot callsigns and names.

4. Click 'Add Pilot' until you have an entry for each pilot racing
Click 'Add Heat' until there are enough for all the pilots racing. Assign each pilot to a heat using the drop down buttons. The '-' pilot can be used for blank positions.

5. Edit the pilot callsigns and names
If you are noticing any missed or multiple laps when passing the gate, the sensor tuning values can be adjusted from defaults with a detailed description found here [/doc/Tuning Parameters.md](Tuning%20Parameters.md)

6. Click 'Add Heat' until you have enough for all the pilots
### Running Races ('Race' page)

7. Assign each pilot to a heat using the drop down buttons
The race director will spend most of their time on this page running races.

### Running Races
Start by selecting the 'Heat' button to set which heat will be racing.

1. Go to the 'Race' page
Click 'Start Race' for a count up timer starting from zero with no defined end. This is used for heads up racing, first to finish X laps. The race director clicks the 'Stop Race' button after all pilots have completed their laps.

2. Select the 'Heat' button to select which heat will be racing
Alternatively click the 'Start Race 2min' for a count down timer from two minutes. This is used for most laps racing, each pilot has two minutes to complete as many laps as possible. After the last buzzer and all pilots have completed their last lap, click the 'Stop Race' button.

3. Click 'Start Race' for a count up timer and 'Start Race 2min' for a count down timer
For each node in a row under the pilot callsigns will be the RSSI values, Current RSSI / Trigger / Peak. This gives the race director immediate sensor feedback for any adjustments that might need to be made.

6. When the race is complete, click 'Stop Race'
During a race there will be a 'X' button next to each lap. This will discard that lap and move it's time into the next lap if it's not the last lap. It's generally perferable to tune the system to pick up more laps instead of missing laps and this is how the extras are deleted. At the end of the race you may have pilots flying by the start gate when they go to land, this is also how you remove those laps which might get picked up.

7. Click 'Save Laps' to store the results of a good race or 'Clear Laps' for a false start or as needed
After each race, click 'Save Laps' to store the results of a good race to the database, or 'Clear Laps' for a false start or as needed to discard the current laps.

### Saved Races
### Saved Races ('Rounds' page)

1. Saved races can be seen on the 'Rounds' page
This is a public page, previous race results are displayed on this page sorted by heats and rounds.

### Pilots and Heats
### Pilots and Heats ('Heats' page)

1. A summary of pilots and their heats is on the 'Heats' page
Also a public page, shows a summary of pilots and their heats with channel assignment.
Binary file added doc/img/delta5racetimer.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c29f1cd

Please sign in to comment.