RCP stimulator

Revision as of 01:07, 7 January 2019 by Brentp (talk | contribs)

Analog outputs

8 Analog outputs are provided to simulate the respective sensor inputs. The 8 channels are the knobs in the upper row.

RPM/Pulse outputs

4 Pulse outputs are provided to stimulate up to 4 RPM/Pulse inputs. The pulse outputs work well for simulating a low to high RPM range using the following RPM channel settings:

  • 1 pulse per revolution
  • Medium Speed timer channel
  • RPM mode

GPIO

The respective LEDs will illuminate when the GPIO port is active Low (connected to ground) - either by pressing the switch, or if activated by RaceCapture when the GPIO is in output mode.

Input Mode

Configure your GPIOs under Setup/Digital In/Out for input mode, and then configure a gauge on the dash to observe the state.

When the Button is pressed, the value will read as '1', indicating the GPIO is connected to ground (Active Low).

Output mode and Demo script

Run this script to demonstrate the GPIOs in output mode.

  • Note Ensure the GPIO ports are in output mode under RaceCapture Setup / Digital In/Out.
--Demo script for toggling LEDs on stimulator board
--GPIOs must be set for output mode in RaceCapture Setup

setTickRate(1)

count = 0

function onTick()
  --toggle LEDs
  local state = count % 2
  setGpio(0, state == 0)
  setGpio(1, state == 0)
  setGpio(2, state == 0)
  count = count + 1

end

CAN bus output=

4 knobs control the value of 4 CAN channels. These channels are broadcast on CAN ID 276:

  • Channel 1: Offset 0, length 2
  • Channel 2: Offset 2, length 2
  • Channel 3: Offset 4, length 2
  • Channel 4: Offset 6, length 2

They broadcast a raw value between 0-10000 and can be scaled further using the CAN channel mapping.

Stim can mapping.png

RS232 serial output

The stimulator will output the current Analog channel data on the serial port, which can be read by the Aux Serial input of RaceCapture/Pro.

Baud Rate

Baud rate is 115200, 8N1

Format

The output format is CSV with the following columns:

  • Timestamp in milliseconds
  • Channel 1 value (0-10000)
  • Channel 2 value (0-10000)
  • Channel 3 value (0-10000)
  • Channel 4 value (0-10000)
  • Value echoed back from received data

Example Lua script to read serial data

--initialize Aux serial port to 115200, 8, N, 1
initSer(6, 115200, 8, 0, 1)

setTickRate(10)

function onTick()
  --write something to be echoed back
  writeSer(6, 'echo')
  --read a line from the aux serial port with a 100ms timeout
  value = readSer(6, 1000)
  if value ~= nil and value ~= '' then
    print('read value: ' ..value)
  end
end

Stimulator serial data script.png

Example Raw output stream from Stimulator

352023 ,0,0,0,0,echo
352223 ,0,0,0,0,echo
352423 ,0,0,0,0,echo
352623 ,0,0,0,0,echo
352823 ,0,0,0,0,echo
353023 ,0,0,0,0,echo
353223 ,275,0,0,0,echo
353423 ,1680,0,0,0,echo
353623 ,1680,0,0,0,echo
353823 ,1680,0,0,0,echo
354023 ,1672,0,0,0,echo
354223 ,1697,1181,0,0,echo
354423 ,1699,2666,0,0,echo
354623 ,1704,2649,0,0,echo
354823 ,1706,2656,0,0,echo
355023 ,1692,2647,0,0,echo
355223 ,1728,4554,0,0,echo
355423 ,1724,4595,0,0,echo
355623 ,1741,4588,0,0,echo
355823 ,1753,4590,1199,0,echo
356023 ,1750,4588,1323,0,echo
356223 ,1755,4588,4730,0,echo
356423 ,1750,4588,4984,0,echo
356623 ,1758,4586,4981,0,echo
356823 ,1750,4583,4959,1299,echo
357023 ,1758,4586,4964,4129,echo
357223 ,1758,4588,4947,4473,echo
357423 ,1753,4586,4957,5269,echo
357623 ,1753,4586,4957,5768,echo