DriverID Selector Switch: Difference between revisions

mNo edit summary
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
DriverID Selector Switch allows you to easily select which driver is driving so that you can quickly and easily see who was driving in the data later by looking at the DriverID channel.  Just assign each driver a number, and tell them to turn the switch to their number when they get in.
- Written by [https://www.facebook.com/scott.barton.76 Scott Barton] of [https://www.facebook.com/ProFormanceCoachingcom ProFormance Coaching]
 
DriverID Selector Switch allows you to easily select which driver is driving so that you can quickly and easily see who was driving in the data later by looking at the DriverID channel.  Just assign each driver a number, and tell them to turn the switch to their number when they get in.   You can also use this switch to automatically reset the session information (Fastest Lap Time, Session Duration, etc) each time a new driver gets in.




Line 20: Line 22:
[[image:Resister.png|400px]]
[[image:Resister.png|400px]]


'''Resistors (1ea):'''
'''[https://amzn.to/2ubkvCX Resistors:]'''
For switches with 2-6 positions:
{| class="wikitable"
! DriverID
! Resister
! Voltage
|-
| 1
| 2.4K (2.2K will work)
| 1.0V (0.9V if 2.2K used)
|-
| 2
| 3K
| 1.75V
|-
| 3
| 4.7K
| 2.5V
|-
| 4
| 8.2K
| 3.25V
|-
| 5
| 22K
| 4.0V
|-
| 6
| 150K
| 4.75V
|-
|
| 10K
| required for 5V voltage divider
|}
 
For switches with 7-11 Positions:
{| class="wikitable"
! DriverID
! Resister
! Voltage
|-
| 1
| 1K
| 0.45V
|-
| 2
| 1.5K
| 1.0V
|-
| 3
| 1.8K
| 1.5V
|-
| 4
| 2.2K
| 1.97V
|-
| 5
| 3.3K
| 2.48V
|-
| 6
| 5.1K
| 3.0V
|-
| 7
| 8.06K
| 3.48V
|-
| 8
| 16.9K
| 4.0V
|-
| 9
| 51K
| 4.5V
|-
| 10
| 1M
| 4.95V
|-
| 11
| 16 Ohm
| 0.0V (If you need an 11th driver move this to Driver1 and all others down one position)
|-
|
| 10K
| required for 5V voltage divider
|}
 
You can get these resisters from [https://www.digikey.com/products/en/resistors/through-hole-resistors/53 Digi-Key.com] and search by resistance.  Try to get as close as possible. 


If you get different resisters than ones above, you can use this [http://www.ohmslawcalculator.com/voltage-divider-calculator link to figure out what the output voltage will be]Set Vs to 5V, R1 to 10KFor R2, take the resister you have and add all of the resisters before it, to get the total resistanceIt will calculate Vout for you. Use this to map your sensor inputs in Race Capture App.
You can use any value resister you want, but they all need to be the same value. Recommend 1k-100K range (10k is popular). You need '''total number of drivers - 1''' resistersIe if you have a 6 driver switch, you need 5 resistors (all same value)If you have 4 driver switch, you need 3 resistors, etc.   
   


http://www.ohmslawcalculator.com/voltage-divider-calculator


==Wiring==
==Wiring==
Line 121: Line 32:


[[image:DriverSelectorSwitchAnotated.jpg|800px]]
[[image:DriverSelectorSwitchAnotated.jpg|800px]]
 
*Solder a resister between each post on the switch. 
*Solder the resister for Driver 2 between switch position 1 and switch position 2, down low on the posts
*You will need to alternate soldering the resisters low on the posts and high on the posts in order for them to fit. 
*Solder the resister for Driver 4 between switch position 3 and switch position 4, down low on the posts
*The resisters that attach to the end posts will have to be low on the posts, so that you can also solder a wire to those posts as well and cover it with shrink tube.
*Solder the resister for Driver 6 between switch position 5 and switch position 6, down low on the posts
*It is easier to solder all of the resisters that need to be low first, then solder the resisters that will be high on the posts.
*Solder the resister for Driver 3 between switch position 2 and switch position 3, up high on the posts
*Solder Ground wire to switch position 1 post (black wire in pics).
*Solder the resister for Driver 5 between switch position 4 and switch position 5, up high on the posts
*Solder 5V Input wire to last switch position post (yellow wire in pics )
*Solder the resister for Driver 1 onto switch post position 1, sticking up
*Solder Voltage Out wire to the center post, this goes to RCP analog input (red or white wire in pics).
*Solder a 2 wires to the other side of of the resister for Driver 1.  One wire for 5V in (yellow in pic above), and one wire for RCP Analog input (white in pic above)
*Solder the 10K resister inline with the 5V wire (yellow in pic above)
*Solder ground wire to the center post
*Use heat shrink tube to protect the wires
*Use heat shrink tube to protect the wires


Line 136: Line 44:
[[image:DriverSelectorSwitchAnotated2.jpg|400px]] [[image:DriverSelectorSwitch3.jpg|400px]]
[[image:DriverSelectorSwitchAnotated2.jpg|400px]] [[image:DriverSelectorSwitch3.jpg|400px]]


Install the switch and wire the ground wire (black in pics above) to ground.  The wire with the 10K resister is the 5V In (yellow in pics above), wire it to 5V Ref.  The other wire connected to the Driver 1 resister (white wire in pics above) goes to an RCP Analog Input.   
Install the switch and wire the ground wire (black wire connected to the first post in pics above) to ground.  The 5V In (yellow wire connected to the last post in pics above), wire it to 5V Ref on the RCP (see below).  The wire connected to the center post (white or red wire in pics above) goes to an RCP Analog Input.   


[[image:RCPInputs.jpg|link=RacecapturePro_MK3_hardware_install#Connections]]
[[image:RCPInputs.jpg|link=RacecapturePro_MK3_hardware_install#Connections]]


==Race Capture Settings==
==Race Capture Settings==
Line 148: Line 58:




For Mode, select Mapped. If you have a 2-5 driver switch, use the voltage values in the table above that correspond with the each Driver numberIf you have less than 5 drivers, copy the last driver value to the remaining positions.   
For Mode, select Mapped.  
If you have more than 5 drivers, you will need to input the 1st and last driver values in the the 1st and 5th cells in the race capture mapping tableYou will then pick 3 other driver/voltage pairs from the table above, spreading them out as evenly as possible.
0V gets mapped to 15V gets mapped to however many positions your switch hasIt will interpolate in between so you can just use those values.   
 
Here is an example of a  6 position switch.


[[image:RaceCaptureSwitchMappings.png]]
[[image:RaceCaptureSwitchMappings.png]]


Write the config to Race Capture and test the switch with the dashboard.   
Write the config to Race Capture and test the switch with the dashboard (see video above).   


If it does not work properly, go back to the settings, change Precision to 2 and change the Mode to Raw.  Write the config, and test again.  Write down the Voltage for each position on the switch. If any do not match up with what is in the table above, go back and input that value in the Race Capture mapping table in an appropriate cell locationChange the Precision back to 0 and Mode back to Mapped and test again.  Rinse and repeat.
If it does not work properly, go back to the settings, change Precision to 2 and change the Mode to Raw.  Write the config, and test again with the dashboard.  Write down the Voltage for each position on the switch. To get an idea of what the mappings should be, take the number of resisters you used and divide 5V by that number to get the voltage spread between the positions on the switchSet Precision back to 0 and Mode back to Mapped.  The first number should always be 0V and the last should always be 5V (unless you swapped the 5Vin and the GND wires),  Use the values you found in your testing to map the 2nd position and 2nd from last position and then chose another position in the middle for the middle mapping.  Rinse and repeat until you get it working properly.


See the [[RaceCapturePro_Calibrate_Sensor|Calibrating Sensors Guide]] for more info on how to map sensors properly.
See the [[RaceCapturePro_Calibrate_Sensor|Calibrating Sensors Guide]] for more info on how to map sensors properly.
==Lua Script to Reset Session when DriverID changes==
You can have the session information (Session Time, Number of Laps, Best Time, Predicted Time, etc) reset when you select a different driver using the following Lua code in the Scripting Section of the Race Capture Settings.
<pre>
DriverID=1
function checkDriverSwitch()
  local cDriverID = math.floor(getChannel("DriverID")+0.4)
  if cDriverID~=nil and cDriverID ~= DriverID then
    DriverID = cDriverID
    resetLapStats()
  end
end
function onTick()
  checkDriverSwitch()
end
</pre>

Latest revision as of 20:00, 5 January 2021

- Written by Scott Barton of ProFormance Coaching

DriverID Selector Switch allows you to easily select which driver is driving so that you can quickly and easily see who was driving in the data later by looking at the DriverID channel. Just assign each driver a number, and tell them to turn the switch to their number when they get in. You can also use this switch to automatically reset the session information (Fastest Lap Time, Session Duration, etc) each time a new driver gets in.


{{#evu:https://www.youtube.com/watch?v=vGHrShqMUa4}}

Parts Needed:

SelectorSwitch.jpg

1 pole Selector Switch (chose one):


Resister.png

Resistors:

You can use any value resister you want, but they all need to be the same value. Recommend 1k-100K range (10k is popular). You need total number of drivers - 1 resisters. Ie if you have a 6 driver switch, you need 5 resistors (all same value). If you have 4 driver switch, you need 3 resistors, etc.


Wiring

DriverSelectorResisterWiring.jpg

DriverSelectorSwitchAnotated.jpg

  • Solder a resister between each post on the switch.
  • You will need to alternate soldering the resisters low on the posts and high on the posts in order for them to fit.
  • The resisters that attach to the end posts will have to be low on the posts, so that you can also solder a wire to those posts as well and cover it with shrink tube.
  • It is easier to solder all of the resisters that need to be low first, then solder the resisters that will be high on the posts.
  • Solder Ground wire to switch position 1 post (black wire in pics).
  • Solder 5V Input wire to last switch position post (yellow wire in pics )
  • Solder Voltage Out wire to the center post, this goes to RCP analog input (red or white wire in pics).
  • Use heat shrink tube to protect the wires


DriverSelectorSwitchAnotated2.jpg DriverSelectorSwitch3.jpg

Install the switch and wire the ground wire (black wire connected to the first post in pics above) to ground. The 5V In (yellow wire connected to the last post in pics above), wire it to 5V Ref on the RCP (see below). The wire connected to the center post (white or red wire in pics above) goes to an RCP Analog Input.

RCPInputs.jpg


Race Capture Settings

Edit the Analog input channel that you wired the DriverID Switch to. Click the gear icon and change the name to DriverID, set Precision to 0, Min to 0, and Max to however many positions your switch has. Set the Sample Rate to 1Hz.

RaceCaptireSwitchSettings.png


For Mode, select Mapped. 0V gets mapped to 1. 5V gets mapped to however many positions your switch has. It will interpolate in between so you can just use those values.

Here is an example of a 6 position switch.

RaceCaptureSwitchMappings.png

Write the config to Race Capture and test the switch with the dashboard (see video above).

If it does not work properly, go back to the settings, change Precision to 2 and change the Mode to Raw. Write the config, and test again with the dashboard. Write down the Voltage for each position on the switch. To get an idea of what the mappings should be, take the number of resisters you used and divide 5V by that number to get the voltage spread between the positions on the switch. Set Precision back to 0 and Mode back to Mapped. The first number should always be 0V and the last should always be 5V (unless you swapped the 5Vin and the GND wires), Use the values you found in your testing to map the 2nd position and 2nd from last position and then chose another position in the middle for the middle mapping. Rinse and repeat until you get it working properly.

See the Calibrating Sensors Guide for more info on how to map sensors properly.

Lua Script to Reset Session when DriverID changes

You can have the session information (Session Time, Number of Laps, Best Time, Predicted Time, etc) reset when you select a different driver using the following Lua code in the Scripting Section of the Race Capture Settings.

DriverID=1

function checkDriverSwitch()
  local cDriverID = math.floor(getChannel("DriverID")+0.4)
  if cDriverID~=nil and cDriverID ~= DriverID then
    DriverID = cDriverID
    resetLapStats()
  end
end

function onTick()
  checkDriverSwitch()
end