<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.autosportlabs.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Imdacrocker</id>
	<title>Autosport Labs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.autosportlabs.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Imdacrocker"/>
	<link rel="alternate" type="text/html" href="https://wiki.autosportlabs.com/Special:Contributions/Imdacrocker"/>
	<updated>2026-09-20T14:12:56Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://wiki.autosportlabs.com/index.php?title=AutomaticCameraControl&amp;diff=9504</id>
		<title>AutomaticCameraControl</title>
		<link rel="alternate" type="text/html" href="https://wiki.autosportlabs.com/index.php?title=AutomaticCameraControl&amp;diff=9504"/>
		<updated>2022-11-16T15:22:03Z</updated>

		<summary type="html">&lt;p&gt;Imdacrocker: /* Customization */  Added link to page explaining how to find your camera&amp;#039;s MAC address&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Automatic Camera Control=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This guide shows you how to enable automatic start / stop control of WiFi enabled cameras, such as GoPro using RaceCapture or PodiumConnect. &lt;br /&gt;
&lt;br /&gt;
==How it works==&lt;br /&gt;
Most action cameras offer a WiFi interface for remote control. GoPro is one such camera, and allows shutter control via the WiFi interface, which RaceCapture or PodiumConnect can leverage for automatic triggering. &lt;br /&gt;
&lt;br /&gt;
===Currently supported versions of RaceCapture hardware===&lt;br /&gt;
* PodiumConnect&lt;br /&gt;
* RaceCapture/Apex&lt;br /&gt;
* RaceCapture/Pro MK3&lt;br /&gt;
* RaceCapture/Track MK1 and MK2&lt;br /&gt;
* RaceCapture/Pro MK2 with external WiFi add-on (see below)&lt;br /&gt;
&lt;br /&gt;
===Currently supported cameras===&lt;br /&gt;
* GoPro Hero 2/3&lt;br /&gt;
* GoPro Hero 4/5 (experimental)&lt;br /&gt;
* Garmin Virb Ultra 30 (experimental)&lt;br /&gt;
&lt;br /&gt;
Note, We recommend GoPro 2/3 due to stability / reliability issues seen with the later GoPro devices. &lt;br /&gt;
&lt;br /&gt;
Additional Camera support will be added with future firmware releases.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
RaceCapture or PodiumConnect is configured so it&#039;s WiFi client connects to the camera&#039;s access point using its SSID and WiFi password.  &lt;br /&gt;
&lt;br /&gt;
When RaceCapture/PodiumConnect triggers the camera based on a sensor threshold such as speed, RPM or other value, it sends a command to the camera to start recording.  When the sensor falls below the threshold, the corresponding command is sent to stop the recording. &lt;br /&gt;
&lt;br /&gt;
===Simultaneous WiFi connection with the RaceCapture App===&lt;br /&gt;
Since the WiFi client feature is used on RaceCapture/PodiumConnect to connect to the camera, the Access Point remains available for the RaceCapture app to connect via WiFi, as usual. Or, via Bluetooth, if supported by the RaceCapture system.&lt;br /&gt;
&lt;br /&gt;
[[Image:automatic_camera_control.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
==Setting up Automatic Camera Control==&lt;br /&gt;
&lt;br /&gt;
===Applies to===&lt;br /&gt;
* PodiumConnect&lt;br /&gt;
* RaceCapture/Apex&lt;br /&gt;
* RaceCapture/Pro MK3&lt;br /&gt;
* RaceCapture/Track MK1 and MK2&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* Firmware 2.13.0 or higher&lt;br /&gt;
&lt;br /&gt;
===Set up WiFi client===&lt;br /&gt;
Navigate to Setup / Wireless and ensure:&lt;br /&gt;
* WiFi is turned &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
* WiFi client is turned &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
* Camera SSID and password are specified in the WiFi client settings. &lt;br /&gt;
&lt;br /&gt;
[[image:WiFi_camera_control_config.png]]&lt;br /&gt;
&lt;br /&gt;
===Set up Automatic Control===&lt;br /&gt;
Navigate to Setup / Automatic Control and ensure:&lt;br /&gt;
* The desired sensor channel trigger is selected (Speed is the default)&lt;br /&gt;
* Your start / stop and time thresholds are configured&lt;br /&gt;
* Camera Control is turned &#039;&#039;&#039;ON&#039;&#039;&#039; and you have your camera model selected. &lt;br /&gt;
&lt;br /&gt;
[[Image:automatic_control_camera_settings.png]]&lt;br /&gt;
&lt;br /&gt;
===Write Settings===&lt;br /&gt;
Write the settings back to RaceCapture by pressing the &#039;&#039;&#039;Write&#039;&#039;&#039; button under Setup. &lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
Turn on the camera and ensure the camera has it&#039;s WiFi interface enabled. &lt;br /&gt;
&lt;br /&gt;
Power up RaceCapture, connect the RaceCapture app and verify the WiFi client is connected under the System Status page. &lt;br /&gt;
[[image:verifying_wifi_client_connected.png]]&lt;br /&gt;
&lt;br /&gt;
It may take several seconds for the client to connect. If not, re-check the camera&#039;s SSID/password, and ensure WiFi is enabled on the camera. &lt;br /&gt;
* &#039;&#039;&#039;Note&#039;&#039;&#039;: On GoPros, the Camera must be in &#039;App mode&#039; with WiFi enabled. &lt;br /&gt;
&lt;br /&gt;
Once it is connected to the camera, you can test the camera by triggering the configured camera&#039;s threshold. &lt;br /&gt;
* &#039;&#039;&#039;Tip&#039;&#039;&#039;: For static testing, you can configure the camera control to one of the Accelerometer channels, such as &#039;&#039;&#039;AccelZ&#039;&#039;&#039; and trigger by inverting RaceCapture. Or, use RPM, battery voltage or similar. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==RaceCapture/Pro MK2==&lt;br /&gt;
While the automatic camera control firmware feature is not available for RaceCapture/Pro MK2, it can still be controlled via a Lua script. &lt;br /&gt;
&lt;br /&gt;
[[image:RaceCapture_WiFi_GoPro_control_diagram.png]]&lt;br /&gt;
&lt;br /&gt;
When WiFi is enabled on your GoPro camera it creates a network that other devices can connect to.  A WiFi enabled version of RaceCapture/Pro can connect to this network and issue the appropriate commands to control various camera functions - in this case, starting and stopping video recording.&lt;br /&gt;
&lt;br /&gt;
Starting and stopping the GoPro can be controlled by a variety of means: speed, RPM or based on other sensor data, enabled by a Lua Script running on RaceCapture/Pro.&lt;br /&gt;
&lt;br /&gt;
This guide focuses on using GPS speed to trigger the camera; for triggering on other sensors see the [[RaceCapturePro_Lua_Scripting|Lua scripting guide]] as a reference for what other sensor data is available.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
* Currently, the WiFi module can only be used to enable GoPro triggering. &lt;br /&gt;
* &#039;&#039;&#039;If running firmware version 2.10.x or higher&#039;&#039;&#039; To use this script, you must disable the built-in WiFi control, or else it will take over the connection and block the script from running. &lt;br /&gt;
* Future versions of RaceCapture firmware and app will allow built-in firmware control of GoPro cameras, which will eliminate the need for this script. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* RaceCapture/Pro MK2 running firmware 2.9.1 or higher&lt;br /&gt;
* [https://www.autosportlabs.com/product/racecapturepro-wifi-module/ RaceCapture/Pro WiFi module]&lt;br /&gt;
* WiFi enabled GoPro Hero camera, with WiFi activated&lt;br /&gt;
* GPS Connectivity (for speed measurement)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
===Configure your GoPro===&lt;br /&gt;
Using the GoPro app, configure the WiFi network, making a note of the network name (SSID) and password.&lt;br /&gt;
&lt;br /&gt;
===Connect the WiFi module===&lt;br /&gt;
Connect the RaceCapture/Pro WiFi module to the outermost (Auxiliary) port of RaceCapture/Pro.&lt;br /&gt;
* When powered up, you should see the power LED illuminate.&lt;br /&gt;
* This port is to the right of the Bluetooth Port.&lt;br /&gt;
** The WiFi module does not interfere with the operation of the Bluetooth module.&lt;br /&gt;
&lt;br /&gt;
===Enable Lua script for GoPro connectivity===&lt;br /&gt;
Customize the Lua script shown at the bottom with the GoPro&#039;s WiFi network name (SSID) and password, then copy and paste the Lua script shown at the bottom into the scripting window of your RaceCapture/Pro. &lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
* Connect RaceCapture/Pro to the RaceCapture app and read the current configuration.&lt;br /&gt;
* Copy the Lua script into the Scripting window:&lt;br /&gt;
** Ensure the script window is first blank by removing the default script by deleting the text in the window.&lt;br /&gt;
*** &#039;&#039;&#039;Note&#039;&#039;&#039;: If you have an existing script you want to keep, you will need to blend the camera functionality with your existing script. How to do this is beyond the scope of this guide; see the [[RaceCapturePro_Lua_Scripting|Lua Scripting Guide]] for more information.&lt;br /&gt;
** Copy the script into the window by using the &#039;&#039;&#039;ctrl-v&#039;&#039;&#039; keyboard shortcut.&lt;br /&gt;
* Write the configuration back to RaceCapture/Pro.&lt;br /&gt;
&lt;br /&gt;
[[image:gopro_script.png]]&lt;br /&gt;
&lt;br /&gt;
===Bench testing===&lt;br /&gt;
Once the Lua script is written to RaceCapture/Pro, it will attempt to connect to the network created by the GoPro camera. Once connected, it will be ready to issue start / stop commands to the camera.&lt;br /&gt;
&lt;br /&gt;
[[image:GoProCameraControl_RaceCapture.jpg]]&lt;br /&gt;
&lt;br /&gt;
Before road testing, ensure RaceCapture/Pro can connect to the GoPro&#039;s WiFi network by observing the messages in the window below the script.&lt;br /&gt;
* &#039;&#039;&#039;Tip 1&#039;&#039;&#039;: Touch or click the &#039;&#039;&#039;Poll Log&#039;&#039;&#039; to see the current message in the RaceCapture/Pro log&lt;br /&gt;
* &#039;&#039;&#039;Tip 2&#039;&#039;&#039;: To restart the Lua script, touch or click the &#039;Restart&#039; button.&lt;br /&gt;
&lt;br /&gt;
===Road testing===&lt;br /&gt;
Mount the GoPro in the car as usual and power up RaceCapture/Pro, waiting for GPS achieve a lock.&lt;br /&gt;
&lt;br /&gt;
* Drive carefully above the speed threshold and observe the GoPro - you should hear and see the familiar beep and red light activate, just as if you manually started recording using the shutter button on the camera. &lt;br /&gt;
* When you drop below the threshold, the GoPro should stop recording.&lt;br /&gt;
&lt;br /&gt;
As RaceCapture/Pro starts and stops the camera, you will see the following information in the log:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[GoProWiFi] start GoPro&lt;br /&gt;
[GoProWiFi] stop GoPro&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Troubleshooting=&lt;br /&gt;
If RaceCapture/Pro cannot control the camera, check the following:&lt;br /&gt;
* &#039;&#039;&#039;GoPro WiFi network name (SSID) and password&#039;&#039;&#039;: Ensure the name and password currently in the script matches how your GoPro was configured.&lt;br /&gt;
* &#039;&#039;&#039;Enable WiFi on the GoPro&#039;&#039;&#039;: The blue LED on the GoPro should be blinking periodically&lt;br /&gt;
* &#039;&#039;&#039;RaceCapture/Pro WiFi module connection&#039;&#039;&#039;: Ensure the module is plugged into the outermost RJ11 port and the green LED is illuminated.&lt;br /&gt;
* &#039;&#039;&#039;Verify WiFi connection&#039;&#039;&#039;: Ensure RaceCapture/Pro can connect to the GoPro WiFi network. You should see the following messages in the log upon power-up:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[lua] Successfully loaded script.&lt;br /&gt;
[GoProWiFi] initializing&lt;br /&gt;
[GoProWiFi] ready for GoPro&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If RaceCapture/Pro cannot connect to the GoPro&#039;s network you will see this in the log:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[GoProWiFi] initializing&lt;br /&gt;
[GoProWiFi] could not connect to GoPro&lt;br /&gt;
[GoProWiFi] initializing&lt;br /&gt;
[GoProWiFi] could not connect to GoPro&lt;br /&gt;
[GoProWiFi] initializing&lt;br /&gt;
[GoProWiFi] could not connect to GoPro&lt;br /&gt;
[GoProWiFi] initializing&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Lua Script for GoPro=&lt;br /&gt;
&lt;br /&gt;
The following Lua Script enables WiFi control of your GoPro camera. &lt;br /&gt;
&lt;br /&gt;
==Customization==&lt;br /&gt;
You will need to edit the following fields at the minimum, located at the top of the script:&lt;br /&gt;
&lt;br /&gt;
===Required===&lt;br /&gt;
* &#039;&#039;&#039;GoPro WiFi password&#039;&#039;&#039;: Specify the WiFi password used for the GoPro WiFi adapter&lt;br /&gt;
* &#039;&#039;&#039;GoPro SSID&#039;&#039;&#039;: Specify the GoPro WiFi network name (SSID)&lt;br /&gt;
&lt;br /&gt;
===Optional===&lt;br /&gt;
* &#039;&#039;&#039;goproStart&#039;&#039;&#039;: Change this if you want to start recording at a different threshold. &lt;br /&gt;
* &#039;&#039;&#039;goproStop&#039;&#039;&#039;: Change this if you want to stop recording at a different threshold. &#039;&#039;&#039;Ensure this is less than the start trigger&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;tickRate&#039;&#039;&#039;: Adjust this to update how often you want RaceCapture/Pro to perform a start/stop check. Value is in Hz. If uncertain, leave this alone&lt;br /&gt;
* &#039;&#039;&#039;debug&#039;&#039;&#039;: If things aren&#039;t working as expected you can set this to 1 to see the conversation between the WiFi module and the GoPro.&lt;br /&gt;
** This information shows up in the log window below the script window - check the box &#039;&#039;&#039;Poll log&#039;&#039;&#039; to see this information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--Specify your GoPro wifi password here&lt;br /&gt;
goproPwd = &#039;12345678&#039;&lt;br /&gt;
&lt;br /&gt;
--Specify your GoPro SSID here&lt;br /&gt;
goproSsid = &#039;aslhero1&#039;&lt;br /&gt;
&lt;br /&gt;
--Speed threshold to start recording&lt;br /&gt;
goproStart = 10&lt;br /&gt;
&lt;br /&gt;
--Speed threshold to stop recording&lt;br /&gt;
goproStop = 5&lt;br /&gt;
&lt;br /&gt;
--How fast we check, in Hz&lt;br /&gt;
tickRate = 10&lt;br /&gt;
&lt;br /&gt;
--Set this to 1 to log communications between RCP &amp;amp; WiFi&lt;br /&gt;
debug = 0&lt;br /&gt;
-----------------------------&lt;br /&gt;
--DO NOT EDIT BELOW&lt;br /&gt;
-----------------------------&lt;br /&gt;
--the serial port where the WiFi is connected&lt;br /&gt;
port = 4&lt;br /&gt;
--indicates wifiStatus&lt;br /&gt;
--0 = not init, 1 = init sent, 2 = got IP, 3 = ready&lt;br /&gt;
wifiStatus = 0&lt;br /&gt;
lastInitTime = 0&lt;br /&gt;
initTimeout = 20000&lt;br /&gt;
&lt;br /&gt;
function logMsg(msg)&lt;br /&gt;
  println(&#039;[GoProWiFi] &#039; ..msg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendCrlf()&lt;br /&gt;
  writeCSer(port, 13)&lt;br /&gt;
  writeCSer(port, 10)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendRaw(val)&lt;br /&gt;
  for i=1, #val do&lt;br /&gt;
    local c = string.sub(val, i, i)&lt;br /&gt;
    writeCSer(port, string.byte(c))&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendAt(val)&lt;br /&gt;
  if debug == 1 then logMsg(&#039;send: &#039; ..val) end&lt;br /&gt;
  sendRaw(val)&lt;br /&gt;
  sendCrlf()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function toInt(val)&lt;br /&gt;
  return string.sub(val, 1, -3)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function httpGet(url)&lt;br /&gt;
  sendAt(&#039;AT+CIPSTART=&amp;quot;TCP&amp;quot;,&amp;quot;10.5.5.9&amp;quot;,80&#039;)&lt;br /&gt;
  sleep(500)&lt;br /&gt;
  local crlf = string.char(13) ..string.char(10)&lt;br /&gt;
  local get = &#039;GET &#039; ..url ..&#039; HTTP/1.0&#039; ..crlf ..crlf&lt;br /&gt;
  sendAt(&#039;AT+CIPSEND=&#039; ..toInt(#get))&lt;br /&gt;
  sleep(100)&lt;br /&gt;
  sendRaw(get)&lt;br /&gt;
  sleep(100)&lt;br /&gt;
  sendAt(&amp;quot;AT+CIPCLOSE&amp;quot;) &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendGoProShutter(cmd)&lt;br /&gt;
  httpGet(&#039;/bacpac/SH?t=&#039; ..goproPwd ..&#039;&amp;amp;p=%&#039; ..cmd)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function startGoPro()&lt;br /&gt;
  logMsg(&#039;start GoPro&#039;)&lt;br /&gt;
  sendGoProShutter(&#039;01&#039;)    &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function stopGoPro()&lt;br /&gt;
  logMsg(&#039;stop GoPro&#039;)&lt;br /&gt;
  sendGoProShutter(&#039;00&#039;)    &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
recording = 0&lt;br /&gt;
&lt;br /&gt;
function initWiFi()&lt;br /&gt;
  logMsg(&#039;initializing&#039;)&lt;br /&gt;
  sendAt(&#039;AT+RST&#039;)&lt;br /&gt;
  sleep(2000)&lt;br /&gt;
  sendAt(&#039;AT+CWMODE_CUR=1&#039;)&lt;br /&gt;
  sleep(1000)&lt;br /&gt;
  sendAt(&#039;AT+CWJAP_CUR=&amp;quot;&#039; ..goproSsid ..&#039;&amp;quot;,&amp;quot;&#039; ..goproPwd ..&#039;&amp;quot;&#039;)&lt;br /&gt;
  wifiStatus = 1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function processIncoming()&lt;br /&gt;
  local line = readSer(port, 100)&lt;br /&gt;
  if line ~= &#039;&#039; and debug == 1 then print(line) end&lt;br /&gt;
  if string.match(line, &#039;WIFI GOT IP&#039;) then &lt;br /&gt;
    wifiStatus = 2&lt;br /&gt;
  end&lt;br /&gt;
  if wifiStatus == 2 and string.match(line, &#039;OK&#039;) then&lt;br /&gt;
    wifiStatus = 3&lt;br /&gt;
    logMsg(&#039;ready for GoPro&#039;)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function checkGoPro()&lt;br /&gt;
  if wifiStatus == 0 then&lt;br /&gt;
    initWiFi()&lt;br /&gt;
    lastInitTime = getUptime()&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  if wifiStatus == 1 and getUptime() &amp;gt; lastInitTime + initTimeout then&lt;br /&gt;
    logMsg(&#039;could not connect to GoPro&#039;)&lt;br /&gt;
    wifiStatus = 0&lt;br /&gt;
  end&lt;br /&gt;
  processIncoming()&lt;br /&gt;
  if wifiStatus ~= 3 then&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  trigger = getGpsSpeed()&lt;br /&gt;
&lt;br /&gt;
  if recording == 0 and trigger &amp;gt; goproStart then&lt;br /&gt;
    startGoPro()&lt;br /&gt;
    recording = 1&lt;br /&gt;
  end&lt;br /&gt;
  if recording == 1 and trigger &amp;lt; goproStop then&lt;br /&gt;
    stopGoPro()&lt;br /&gt;
    recording = 0&lt;br /&gt;
  end &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function onTick()&lt;br /&gt;
  checkGoPro()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
setTickRate(tickRate)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Lua Script for Garmin Virb=&lt;br /&gt;
&lt;br /&gt;
The following Lua Script enables WiFi control of your Garmin Virb camera using the Garmin [https://developer.garmin.com/downloads/virb/Camera_Network_Services_API_v0.5.pdf Camera Network Services API].   Not all commands in the API may work.  Use commandList (via [https://www.postman.com/ Postman]) to determine which API commands are supported by your Garmin Virb camera.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;The Garmin Virb always uses 192.168.0.1 HTTP port ( 80 ).&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: this Lua script is different than the GoPro script above in that Garmin uses POST commands instead of GET commands.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;For a more detailed explanation, see&#039;&#039; [https://forum.autosportlabs.com/viewtopic.php?t=6267 How to send HTTP POST request via Lua Script?]&amp;lt;br&amp;gt;&lt;br /&gt;
It may be possible to control other WiFi devices by altering the POST command accordingly.  e.g. instead of sending httpPost arguments {&amp;quot;command&amp;quot;:&amp;quot;startRecording&amp;quot;} substitute this with the commands specified by the device API.   Be sure to adjust the server host IP address if different than the Garmin standard.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Customization==&lt;br /&gt;
You will need to edit the following fields at the minimum, located at the top of the script:&lt;br /&gt;
&lt;br /&gt;
===Required===&lt;br /&gt;
* &#039;&#039;&#039;Ssid&#039;&#039;&#039;: Specify the WiFi network name (SSID)&lt;br /&gt;
* &#039;&#039;&#039;Pwd&#039;&#039;&#039;: Specify the WiFi password&lt;br /&gt;
&lt;br /&gt;
===Optional===&lt;br /&gt;
* &#039;&#039;&#039;Port&#039;&#039;&#039;: 5 is the WiFi port for the RaceCapture/Track MK2.  Change according to [https://wiki.autosportlabs.com/RaceCapturePro_Lua_Scripting#Port_mappings Port mapping]&lt;br /&gt;
* &#039;&#039;&#039;autoStart&#039;&#039;&#039;: Change this if you want to start recording at a different threshold. &lt;br /&gt;
* &#039;&#039;&#039;autoStop&#039;&#039;&#039;: Change this if you want to stop recording at a different threshold.&lt;br /&gt;
* &#039;&#039;&#039;debug&#039;&#039;&#039;: If things aren&#039;t working as expected you can set this to 1 to see the conversation between the WiFi module and the GoPro.&lt;br /&gt;
** This information shows up in the log window below the script window - check the box &#039;&#039;&#039;Poll log&#039;&#039;&#039; to see this information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
setTickRate(10) --TickRate is in Hz&lt;br /&gt;
--configure WiFi serial port&lt;br /&gt;
port = 5&lt;br /&gt;
initSer(port,115200,8,0,1)&lt;br /&gt;
--Specify client SSID here&lt;br /&gt;
Ssid = &#039;VIRB-4615&#039;&lt;br /&gt;
--Specify client wifi password here&lt;br /&gt;
Pwd = &#039;12345678&#039;&lt;br /&gt;
--Set this to 1 to log communications between RCP &amp;amp; WiFi&lt;br /&gt;
debug = 0&lt;br /&gt;
&lt;br /&gt;
--initialize variables&lt;br /&gt;
trigger = 0&lt;br /&gt;
recording = 0&lt;br /&gt;
&lt;br /&gt;
--define constants&lt;br /&gt;
autoStart = 0  --Threshold to start recording&lt;br /&gt;
autoStop = 1  --Threshold to stop recording&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
------WiFi Code--------------&lt;br /&gt;
--DO NOT EDIT BELOW&lt;br /&gt;
-----------------------------&lt;br /&gt;
&lt;br /&gt;
--indicates wifiStatus&lt;br /&gt;
--0 = not init, 1 = init sent, 2 = got IP, 3 = ready&lt;br /&gt;
wifiStatus = 0&lt;br /&gt;
lastInitTime = 0&lt;br /&gt;
initTimeout = 20000&lt;br /&gt;
reps = 3 --number of times to repeat command&lt;br /&gt;
&lt;br /&gt;
function logMsg(msg)&lt;br /&gt;
  println(&#039;[WiFi] &#039; ..msg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendCrlf()&lt;br /&gt;
  writeCSer(port, 13)&lt;br /&gt;
  writeCSer(port, 10)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendRaw(val)&lt;br /&gt;
  for i=1, #val do&lt;br /&gt;
    local c = string.sub(val, i, i)&lt;br /&gt;
    writeCSer(port, string.byte(c))&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendAt(val)&lt;br /&gt;
  if debug == 1 then logMsg(&#039;send: &#039; ..val) end&lt;br /&gt;
  sendRaw(val)&lt;br /&gt;
  sendCrlf()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function toInt(val)&lt;br /&gt;
  return string.sub(val, 1, -3)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function httpPost(cmd)&lt;br /&gt;
  sendAt(&#039;AT+CIPSTART=&amp;quot;TCP&amp;quot;,&amp;quot;192.168.0.1&amp;quot;,80&#039;)&lt;br /&gt;
  sleep(500)&lt;br /&gt;
  local crlf = string.char(13) ..string.char(10)&lt;br /&gt;
  local post = &#039;POST /virb HTTP/1.1\r\nHost: 192.168.0.1\r\nAccept: */*\r\nContent-Length: &#039; ..toInt(#cmd)..&#039;\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n&#039; ..cmd ..&#039;\r\n&#039; ..crlf ..crlf&lt;br /&gt;
  sendAt(&#039;AT+CIPSEND=&#039; ..toInt(#post))&lt;br /&gt;
  sleep(100)&lt;br /&gt;
  sendRaw(post)&lt;br /&gt;
  if debug == 1 then println(post) end&lt;br /&gt;
  sleep(100)&lt;br /&gt;
  sendAt(&#039;AT+CIPCLOSE&#039;) &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function initWiFi()&lt;br /&gt;
  logMsg(&#039;initializing&#039;)&lt;br /&gt;
  sendAt(&#039;AT+RST&#039;)&lt;br /&gt;
  sleep(2000)&lt;br /&gt;
  sendAt(&#039;AT+CWMODE_CUR=1&#039;)&lt;br /&gt;
  sleep(1000)&lt;br /&gt;
  sendAt(&#039;AT+CWJAP_CUR=&amp;quot;&#039; ..Ssid ..&#039;&amp;quot;,&amp;quot;&#039; ..Pwd ..&#039;&amp;quot;&#039;)&lt;br /&gt;
  wifiStatus = 1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function processIncoming()&lt;br /&gt;
  local line = readSer(port, 100)&lt;br /&gt;
  if line ~= &#039;&#039; and debug == 1 then print(line) end&lt;br /&gt;
  if string.match(line, &#039;WIFI GOT IP&#039;) or string.match(line, &#039;WIFI CONNECTED&#039;) then &lt;br /&gt;
    wifiStatus = 2&lt;br /&gt;
  end&lt;br /&gt;
  if wifiStatus == 2 and string.match(line, &#039;OK&#039;) then&lt;br /&gt;
    wifiStatus = 3&lt;br /&gt;
    logMsg(&#039;ready for WiFi&#039;)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function checkWiFi()&lt;br /&gt;
  if wifiStatus == 0 then&lt;br /&gt;
    initWiFi()&lt;br /&gt;
    lastInitTime = getUptime()&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  if wifiStatus == 1 and getUptime() &amp;gt; lastInitTime + initTimeout then&lt;br /&gt;
    logMsg(&#039;could not connect to WiFi&#039;)&lt;br /&gt;
    wifiStatus = 0&lt;br /&gt;
  end&lt;br /&gt;
  processIncoming()&lt;br /&gt;
  if wifiStatus ~= 3 then&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  --trigger = getGpsSpeed()&lt;br /&gt;
  trigger = bit.rshift(bit.band(getChannel(&amp;quot;77AB2&amp;quot;),0x40),6)&lt;br /&gt;
  --trigger = 1&lt;br /&gt;
  if recording == 0 and trigger &amp;gt; autoStart then&lt;br /&gt;
    for i=1,reps,1&lt;br /&gt;
    do&lt;br /&gt;
    httpPost(&#039;{&amp;quot;command&amp;quot;:&amp;quot;startRecording&amp;quot;}&#039;)&lt;br /&gt;
    end&lt;br /&gt;
    recording = 1&lt;br /&gt;
  end&lt;br /&gt;
  if recording == 1 and trigger &amp;lt; autoStop then&lt;br /&gt;
    for i=1,reps,1&lt;br /&gt;
    do&lt;br /&gt;
    httpPost(&#039;{&amp;quot;command&amp;quot;:&amp;quot;stopRecording&amp;quot;}&#039;)&lt;br /&gt;
    end&lt;br /&gt;
    recording = 0&lt;br /&gt;
  end &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function onTick()&lt;br /&gt;
  checkWiFi()&lt;br /&gt;
  --println(&#039;trigger value: &#039; ..trigger)&lt;br /&gt;
  --println(&#039;recording status: &#039; ..recording)&lt;br /&gt;
  if debug ==1 then println(&amp;quot;WiFi Status: &amp;quot; ..wifiStatus) end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A few comments:&lt;br /&gt;
* The POST command is repeated the number of times specified by reps.  This is because during testing the startRecording was not entirely reliable.  The camera somehow missed the command.&lt;br /&gt;
* The trigger condition is set to use bit 6 of the CAN channel 77AB2.  This signal comes from a switch on the dashboard wired to an ECU, which then sends switch status on the CAN to which the RaceCapture/Track MK2 is connected.  Modify accordingly if you have a similar switch, otherwise comment this out and uncomment the getGpsSpeed() line, altering the autoStart and autoStop thresholds accordingly.&lt;br /&gt;
&lt;br /&gt;
=Experimental GoPro Hero4 Control=&lt;br /&gt;
The GoPro Hero4 has proven to be a cheap and reliable camera in many uses, and motorsports is no exception.&lt;br /&gt;
&lt;br /&gt;
Limited testing has been done using custom Lua code to use UDP camera commands&lt;br /&gt;
&lt;br /&gt;
This has been shown to work with newer cameras as well, up through Hero8, but no field testing has been done.&lt;br /&gt;
&lt;br /&gt;
==Customization==&lt;br /&gt;
You will want to edit the MAC address to match the camera you are pairing.  Edit this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
local mac = string.char(0xd4, 0xd9, 0x19, 0x99, 0xc4, 0xef) -- This is the mac addres of my camera, d4:d9:19:99:c4:ef&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So if your MAC address is d4:d9:27:87:b6:e5, change the line to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
local mac = string.char(0xd4, 0xd9, 0x27, 0x87, 0xb6, 0xe5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can find your camera&#039;s MAC address using the following tips:&lt;br /&gt;
&lt;br /&gt;
https://havecamerawilltravel.com/gopro/gopro-mac-address/&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
To connect the camera to the RaceCapture, first turn on the RaceCapture.  Then, from the GoPro, connect a new Smart Remote.  &lt;br /&gt;
&lt;br /&gt;
The RaceCapture emulates the GoPro smart remote&lt;br /&gt;
&lt;br /&gt;
Once connected, you can confirm connection by looking at the virtual channel &amp;quot;Camera&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*0 indicates not connected&lt;br /&gt;
*1 indicates connected and not recording&lt;br /&gt;
*2 indicates connected and recording&lt;br /&gt;
&lt;br /&gt;
Once paired, when the RaceCapture is shut down, you can turn the Camera&#039;s Wifi on.  When the RaceCapture powers on, it should automatically turn on the camera.&lt;br /&gt;
&lt;br /&gt;
==Use== &lt;br /&gt;
This code is set up to watch the isLogging() value, and trigger camera recording when logging begins.&lt;br /&gt;
&lt;br /&gt;
==Lua Code==&lt;br /&gt;
The Lua Code is available in the RaceCapture app as a preset.  Simply choose Presets from the Scripting tab in Setup, choose Shared, and then find the preset named GoPro Hero4 Automatic Control&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:ImportGoProPreset.png]]&lt;/div&gt;</summary>
		<author><name>Imdacrocker</name></author>
	</entry>
	<entry>
		<id>https://wiki.autosportlabs.com/index.php?title=AutomaticCameraControl&amp;diff=9503</id>
		<title>AutomaticCameraControl</title>
		<link rel="alternate" type="text/html" href="https://wiki.autosportlabs.com/index.php?title=AutomaticCameraControl&amp;diff=9503"/>
		<updated>2022-11-16T05:18:41Z</updated>

		<summary type="html">&lt;p&gt;Imdacrocker: Updated to redirect to the preset, instead of the actual code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Automatic Camera Control=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This guide shows you how to enable automatic start / stop control of WiFi enabled cameras, such as GoPro using RaceCapture or PodiumConnect. &lt;br /&gt;
&lt;br /&gt;
==How it works==&lt;br /&gt;
Most action cameras offer a WiFi interface for remote control. GoPro is one such camera, and allows shutter control via the WiFi interface, which RaceCapture or PodiumConnect can leverage for automatic triggering. &lt;br /&gt;
&lt;br /&gt;
===Currently supported versions of RaceCapture hardware===&lt;br /&gt;
* PodiumConnect&lt;br /&gt;
* RaceCapture/Apex&lt;br /&gt;
* RaceCapture/Pro MK3&lt;br /&gt;
* RaceCapture/Track MK1 and MK2&lt;br /&gt;
* RaceCapture/Pro MK2 with external WiFi add-on (see below)&lt;br /&gt;
&lt;br /&gt;
===Currently supported cameras===&lt;br /&gt;
* GoPro Hero 2/3&lt;br /&gt;
* GoPro Hero 4/5 (experimental)&lt;br /&gt;
* Garmin Virb Ultra 30 (experimental)&lt;br /&gt;
&lt;br /&gt;
Note, We recommend GoPro 2/3 due to stability / reliability issues seen with the later GoPro devices. &lt;br /&gt;
&lt;br /&gt;
Additional Camera support will be added with future firmware releases.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
RaceCapture or PodiumConnect is configured so it&#039;s WiFi client connects to the camera&#039;s access point using its SSID and WiFi password.  &lt;br /&gt;
&lt;br /&gt;
When RaceCapture/PodiumConnect triggers the camera based on a sensor threshold such as speed, RPM or other value, it sends a command to the camera to start recording.  When the sensor falls below the threshold, the corresponding command is sent to stop the recording. &lt;br /&gt;
&lt;br /&gt;
===Simultaneous WiFi connection with the RaceCapture App===&lt;br /&gt;
Since the WiFi client feature is used on RaceCapture/PodiumConnect to connect to the camera, the Access Point remains available for the RaceCapture app to connect via WiFi, as usual. Or, via Bluetooth, if supported by the RaceCapture system.&lt;br /&gt;
&lt;br /&gt;
[[Image:automatic_camera_control.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
==Setting up Automatic Camera Control==&lt;br /&gt;
&lt;br /&gt;
===Applies to===&lt;br /&gt;
* PodiumConnect&lt;br /&gt;
* RaceCapture/Apex&lt;br /&gt;
* RaceCapture/Pro MK3&lt;br /&gt;
* RaceCapture/Track MK1 and MK2&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* Firmware 2.13.0 or higher&lt;br /&gt;
&lt;br /&gt;
===Set up WiFi client===&lt;br /&gt;
Navigate to Setup / Wireless and ensure:&lt;br /&gt;
* WiFi is turned &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
* WiFi client is turned &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
* Camera SSID and password are specified in the WiFi client settings. &lt;br /&gt;
&lt;br /&gt;
[[image:WiFi_camera_control_config.png]]&lt;br /&gt;
&lt;br /&gt;
===Set up Automatic Control===&lt;br /&gt;
Navigate to Setup / Automatic Control and ensure:&lt;br /&gt;
* The desired sensor channel trigger is selected (Speed is the default)&lt;br /&gt;
* Your start / stop and time thresholds are configured&lt;br /&gt;
* Camera Control is turned &#039;&#039;&#039;ON&#039;&#039;&#039; and you have your camera model selected. &lt;br /&gt;
&lt;br /&gt;
[[Image:automatic_control_camera_settings.png]]&lt;br /&gt;
&lt;br /&gt;
===Write Settings===&lt;br /&gt;
Write the settings back to RaceCapture by pressing the &#039;&#039;&#039;Write&#039;&#039;&#039; button under Setup. &lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
Turn on the camera and ensure the camera has it&#039;s WiFi interface enabled. &lt;br /&gt;
&lt;br /&gt;
Power up RaceCapture, connect the RaceCapture app and verify the WiFi client is connected under the System Status page. &lt;br /&gt;
[[image:verifying_wifi_client_connected.png]]&lt;br /&gt;
&lt;br /&gt;
It may take several seconds for the client to connect. If not, re-check the camera&#039;s SSID/password, and ensure WiFi is enabled on the camera. &lt;br /&gt;
* &#039;&#039;&#039;Note&#039;&#039;&#039;: On GoPros, the Camera must be in &#039;App mode&#039; with WiFi enabled. &lt;br /&gt;
&lt;br /&gt;
Once it is connected to the camera, you can test the camera by triggering the configured camera&#039;s threshold. &lt;br /&gt;
* &#039;&#039;&#039;Tip&#039;&#039;&#039;: For static testing, you can configure the camera control to one of the Accelerometer channels, such as &#039;&#039;&#039;AccelZ&#039;&#039;&#039; and trigger by inverting RaceCapture. Or, use RPM, battery voltage or similar. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==RaceCapture/Pro MK2==&lt;br /&gt;
While the automatic camera control firmware feature is not available for RaceCapture/Pro MK2, it can still be controlled via a Lua script. &lt;br /&gt;
&lt;br /&gt;
[[image:RaceCapture_WiFi_GoPro_control_diagram.png]]&lt;br /&gt;
&lt;br /&gt;
When WiFi is enabled on your GoPro camera it creates a network that other devices can connect to.  A WiFi enabled version of RaceCapture/Pro can connect to this network and issue the appropriate commands to control various camera functions - in this case, starting and stopping video recording.&lt;br /&gt;
&lt;br /&gt;
Starting and stopping the GoPro can be controlled by a variety of means: speed, RPM or based on other sensor data, enabled by a Lua Script running on RaceCapture/Pro.&lt;br /&gt;
&lt;br /&gt;
This guide focuses on using GPS speed to trigger the camera; for triggering on other sensors see the [[RaceCapturePro_Lua_Scripting|Lua scripting guide]] as a reference for what other sensor data is available.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
* Currently, the WiFi module can only be used to enable GoPro triggering. &lt;br /&gt;
* &#039;&#039;&#039;If running firmware version 2.10.x or higher&#039;&#039;&#039; To use this script, you must disable the built-in WiFi control, or else it will take over the connection and block the script from running. &lt;br /&gt;
* Future versions of RaceCapture firmware and app will allow built-in firmware control of GoPro cameras, which will eliminate the need for this script. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* RaceCapture/Pro MK2 running firmware 2.9.1 or higher&lt;br /&gt;
* [https://www.autosportlabs.com/product/racecapturepro-wifi-module/ RaceCapture/Pro WiFi module]&lt;br /&gt;
* WiFi enabled GoPro Hero camera, with WiFi activated&lt;br /&gt;
* GPS Connectivity (for speed measurement)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
===Configure your GoPro===&lt;br /&gt;
Using the GoPro app, configure the WiFi network, making a note of the network name (SSID) and password.&lt;br /&gt;
&lt;br /&gt;
===Connect the WiFi module===&lt;br /&gt;
Connect the RaceCapture/Pro WiFi module to the outermost (Auxiliary) port of RaceCapture/Pro.&lt;br /&gt;
* When powered up, you should see the power LED illuminate.&lt;br /&gt;
* This port is to the right of the Bluetooth Port.&lt;br /&gt;
** The WiFi module does not interfere with the operation of the Bluetooth module.&lt;br /&gt;
&lt;br /&gt;
===Enable Lua script for GoPro connectivity===&lt;br /&gt;
Customize the Lua script shown at the bottom with the GoPro&#039;s WiFi network name (SSID) and password, then copy and paste the Lua script shown at the bottom into the scripting window of your RaceCapture/Pro. &lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
* Connect RaceCapture/Pro to the RaceCapture app and read the current configuration.&lt;br /&gt;
* Copy the Lua script into the Scripting window:&lt;br /&gt;
** Ensure the script window is first blank by removing the default script by deleting the text in the window.&lt;br /&gt;
*** &#039;&#039;&#039;Note&#039;&#039;&#039;: If you have an existing script you want to keep, you will need to blend the camera functionality with your existing script. How to do this is beyond the scope of this guide; see the [[RaceCapturePro_Lua_Scripting|Lua Scripting Guide]] for more information.&lt;br /&gt;
** Copy the script into the window by using the &#039;&#039;&#039;ctrl-v&#039;&#039;&#039; keyboard shortcut.&lt;br /&gt;
* Write the configuration back to RaceCapture/Pro.&lt;br /&gt;
&lt;br /&gt;
[[image:gopro_script.png]]&lt;br /&gt;
&lt;br /&gt;
===Bench testing===&lt;br /&gt;
Once the Lua script is written to RaceCapture/Pro, it will attempt to connect to the network created by the GoPro camera. Once connected, it will be ready to issue start / stop commands to the camera.&lt;br /&gt;
&lt;br /&gt;
[[image:GoProCameraControl_RaceCapture.jpg]]&lt;br /&gt;
&lt;br /&gt;
Before road testing, ensure RaceCapture/Pro can connect to the GoPro&#039;s WiFi network by observing the messages in the window below the script.&lt;br /&gt;
* &#039;&#039;&#039;Tip 1&#039;&#039;&#039;: Touch or click the &#039;&#039;&#039;Poll Log&#039;&#039;&#039; to see the current message in the RaceCapture/Pro log&lt;br /&gt;
* &#039;&#039;&#039;Tip 2&#039;&#039;&#039;: To restart the Lua script, touch or click the &#039;Restart&#039; button.&lt;br /&gt;
&lt;br /&gt;
===Road testing===&lt;br /&gt;
Mount the GoPro in the car as usual and power up RaceCapture/Pro, waiting for GPS achieve a lock.&lt;br /&gt;
&lt;br /&gt;
* Drive carefully above the speed threshold and observe the GoPro - you should hear and see the familiar beep and red light activate, just as if you manually started recording using the shutter button on the camera. &lt;br /&gt;
* When you drop below the threshold, the GoPro should stop recording.&lt;br /&gt;
&lt;br /&gt;
As RaceCapture/Pro starts and stops the camera, you will see the following information in the log:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[GoProWiFi] start GoPro&lt;br /&gt;
[GoProWiFi] stop GoPro&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Troubleshooting=&lt;br /&gt;
If RaceCapture/Pro cannot control the camera, check the following:&lt;br /&gt;
* &#039;&#039;&#039;GoPro WiFi network name (SSID) and password&#039;&#039;&#039;: Ensure the name and password currently in the script matches how your GoPro was configured.&lt;br /&gt;
* &#039;&#039;&#039;Enable WiFi on the GoPro&#039;&#039;&#039;: The blue LED on the GoPro should be blinking periodically&lt;br /&gt;
* &#039;&#039;&#039;RaceCapture/Pro WiFi module connection&#039;&#039;&#039;: Ensure the module is plugged into the outermost RJ11 port and the green LED is illuminated.&lt;br /&gt;
* &#039;&#039;&#039;Verify WiFi connection&#039;&#039;&#039;: Ensure RaceCapture/Pro can connect to the GoPro WiFi network. You should see the following messages in the log upon power-up:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[lua] Successfully loaded script.&lt;br /&gt;
[GoProWiFi] initializing&lt;br /&gt;
[GoProWiFi] ready for GoPro&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If RaceCapture/Pro cannot connect to the GoPro&#039;s network you will see this in the log:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[GoProWiFi] initializing&lt;br /&gt;
[GoProWiFi] could not connect to GoPro&lt;br /&gt;
[GoProWiFi] initializing&lt;br /&gt;
[GoProWiFi] could not connect to GoPro&lt;br /&gt;
[GoProWiFi] initializing&lt;br /&gt;
[GoProWiFi] could not connect to GoPro&lt;br /&gt;
[GoProWiFi] initializing&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Lua Script for GoPro=&lt;br /&gt;
&lt;br /&gt;
The following Lua Script enables WiFi control of your GoPro camera. &lt;br /&gt;
&lt;br /&gt;
==Customization==&lt;br /&gt;
You will need to edit the following fields at the minimum, located at the top of the script:&lt;br /&gt;
&lt;br /&gt;
===Required===&lt;br /&gt;
* &#039;&#039;&#039;GoPro WiFi password&#039;&#039;&#039;: Specify the WiFi password used for the GoPro WiFi adapter&lt;br /&gt;
* &#039;&#039;&#039;GoPro SSID&#039;&#039;&#039;: Specify the GoPro WiFi network name (SSID)&lt;br /&gt;
&lt;br /&gt;
===Optional===&lt;br /&gt;
* &#039;&#039;&#039;goproStart&#039;&#039;&#039;: Change this if you want to start recording at a different threshold. &lt;br /&gt;
* &#039;&#039;&#039;goproStop&#039;&#039;&#039;: Change this if you want to stop recording at a different threshold. &#039;&#039;&#039;Ensure this is less than the start trigger&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;tickRate&#039;&#039;&#039;: Adjust this to update how often you want RaceCapture/Pro to perform a start/stop check. Value is in Hz. If uncertain, leave this alone&lt;br /&gt;
* &#039;&#039;&#039;debug&#039;&#039;&#039;: If things aren&#039;t working as expected you can set this to 1 to see the conversation between the WiFi module and the GoPro.&lt;br /&gt;
** This information shows up in the log window below the script window - check the box &#039;&#039;&#039;Poll log&#039;&#039;&#039; to see this information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--Specify your GoPro wifi password here&lt;br /&gt;
goproPwd = &#039;12345678&#039;&lt;br /&gt;
&lt;br /&gt;
--Specify your GoPro SSID here&lt;br /&gt;
goproSsid = &#039;aslhero1&#039;&lt;br /&gt;
&lt;br /&gt;
--Speed threshold to start recording&lt;br /&gt;
goproStart = 10&lt;br /&gt;
&lt;br /&gt;
--Speed threshold to stop recording&lt;br /&gt;
goproStop = 5&lt;br /&gt;
&lt;br /&gt;
--How fast we check, in Hz&lt;br /&gt;
tickRate = 10&lt;br /&gt;
&lt;br /&gt;
--Set this to 1 to log communications between RCP &amp;amp; WiFi&lt;br /&gt;
debug = 0&lt;br /&gt;
-----------------------------&lt;br /&gt;
--DO NOT EDIT BELOW&lt;br /&gt;
-----------------------------&lt;br /&gt;
--the serial port where the WiFi is connected&lt;br /&gt;
port = 4&lt;br /&gt;
--indicates wifiStatus&lt;br /&gt;
--0 = not init, 1 = init sent, 2 = got IP, 3 = ready&lt;br /&gt;
wifiStatus = 0&lt;br /&gt;
lastInitTime = 0&lt;br /&gt;
initTimeout = 20000&lt;br /&gt;
&lt;br /&gt;
function logMsg(msg)&lt;br /&gt;
  println(&#039;[GoProWiFi] &#039; ..msg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendCrlf()&lt;br /&gt;
  writeCSer(port, 13)&lt;br /&gt;
  writeCSer(port, 10)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendRaw(val)&lt;br /&gt;
  for i=1, #val do&lt;br /&gt;
    local c = string.sub(val, i, i)&lt;br /&gt;
    writeCSer(port, string.byte(c))&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendAt(val)&lt;br /&gt;
  if debug == 1 then logMsg(&#039;send: &#039; ..val) end&lt;br /&gt;
  sendRaw(val)&lt;br /&gt;
  sendCrlf()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function toInt(val)&lt;br /&gt;
  return string.sub(val, 1, -3)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function httpGet(url)&lt;br /&gt;
  sendAt(&#039;AT+CIPSTART=&amp;quot;TCP&amp;quot;,&amp;quot;10.5.5.9&amp;quot;,80&#039;)&lt;br /&gt;
  sleep(500)&lt;br /&gt;
  local crlf = string.char(13) ..string.char(10)&lt;br /&gt;
  local get = &#039;GET &#039; ..url ..&#039; HTTP/1.0&#039; ..crlf ..crlf&lt;br /&gt;
  sendAt(&#039;AT+CIPSEND=&#039; ..toInt(#get))&lt;br /&gt;
  sleep(100)&lt;br /&gt;
  sendRaw(get)&lt;br /&gt;
  sleep(100)&lt;br /&gt;
  sendAt(&amp;quot;AT+CIPCLOSE&amp;quot;) &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendGoProShutter(cmd)&lt;br /&gt;
  httpGet(&#039;/bacpac/SH?t=&#039; ..goproPwd ..&#039;&amp;amp;p=%&#039; ..cmd)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function startGoPro()&lt;br /&gt;
  logMsg(&#039;start GoPro&#039;)&lt;br /&gt;
  sendGoProShutter(&#039;01&#039;)    &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function stopGoPro()&lt;br /&gt;
  logMsg(&#039;stop GoPro&#039;)&lt;br /&gt;
  sendGoProShutter(&#039;00&#039;)    &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
recording = 0&lt;br /&gt;
&lt;br /&gt;
function initWiFi()&lt;br /&gt;
  logMsg(&#039;initializing&#039;)&lt;br /&gt;
  sendAt(&#039;AT+RST&#039;)&lt;br /&gt;
  sleep(2000)&lt;br /&gt;
  sendAt(&#039;AT+CWMODE_CUR=1&#039;)&lt;br /&gt;
  sleep(1000)&lt;br /&gt;
  sendAt(&#039;AT+CWJAP_CUR=&amp;quot;&#039; ..goproSsid ..&#039;&amp;quot;,&amp;quot;&#039; ..goproPwd ..&#039;&amp;quot;&#039;)&lt;br /&gt;
  wifiStatus = 1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function processIncoming()&lt;br /&gt;
  local line = readSer(port, 100)&lt;br /&gt;
  if line ~= &#039;&#039; and debug == 1 then print(line) end&lt;br /&gt;
  if string.match(line, &#039;WIFI GOT IP&#039;) then &lt;br /&gt;
    wifiStatus = 2&lt;br /&gt;
  end&lt;br /&gt;
  if wifiStatus == 2 and string.match(line, &#039;OK&#039;) then&lt;br /&gt;
    wifiStatus = 3&lt;br /&gt;
    logMsg(&#039;ready for GoPro&#039;)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function checkGoPro()&lt;br /&gt;
  if wifiStatus == 0 then&lt;br /&gt;
    initWiFi()&lt;br /&gt;
    lastInitTime = getUptime()&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  if wifiStatus == 1 and getUptime() &amp;gt; lastInitTime + initTimeout then&lt;br /&gt;
    logMsg(&#039;could not connect to GoPro&#039;)&lt;br /&gt;
    wifiStatus = 0&lt;br /&gt;
  end&lt;br /&gt;
  processIncoming()&lt;br /&gt;
  if wifiStatus ~= 3 then&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  trigger = getGpsSpeed()&lt;br /&gt;
&lt;br /&gt;
  if recording == 0 and trigger &amp;gt; goproStart then&lt;br /&gt;
    startGoPro()&lt;br /&gt;
    recording = 1&lt;br /&gt;
  end&lt;br /&gt;
  if recording == 1 and trigger &amp;lt; goproStop then&lt;br /&gt;
    stopGoPro()&lt;br /&gt;
    recording = 0&lt;br /&gt;
  end &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function onTick()&lt;br /&gt;
  checkGoPro()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
setTickRate(tickRate)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Lua Script for Garmin Virb=&lt;br /&gt;
&lt;br /&gt;
The following Lua Script enables WiFi control of your Garmin Virb camera using the Garmin [https://developer.garmin.com/downloads/virb/Camera_Network_Services_API_v0.5.pdf Camera Network Services API].   Not all commands in the API may work.  Use commandList (via [https://www.postman.com/ Postman]) to determine which API commands are supported by your Garmin Virb camera.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;The Garmin Virb always uses 192.168.0.1 HTTP port ( 80 ).&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: this Lua script is different than the GoPro script above in that Garmin uses POST commands instead of GET commands.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;For a more detailed explanation, see&#039;&#039; [https://forum.autosportlabs.com/viewtopic.php?t=6267 How to send HTTP POST request via Lua Script?]&amp;lt;br&amp;gt;&lt;br /&gt;
It may be possible to control other WiFi devices by altering the POST command accordingly.  e.g. instead of sending httpPost arguments {&amp;quot;command&amp;quot;:&amp;quot;startRecording&amp;quot;} substitute this with the commands specified by the device API.   Be sure to adjust the server host IP address if different than the Garmin standard.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Customization==&lt;br /&gt;
You will need to edit the following fields at the minimum, located at the top of the script:&lt;br /&gt;
&lt;br /&gt;
===Required===&lt;br /&gt;
* &#039;&#039;&#039;Ssid&#039;&#039;&#039;: Specify the WiFi network name (SSID)&lt;br /&gt;
* &#039;&#039;&#039;Pwd&#039;&#039;&#039;: Specify the WiFi password&lt;br /&gt;
&lt;br /&gt;
===Optional===&lt;br /&gt;
* &#039;&#039;&#039;Port&#039;&#039;&#039;: 5 is the WiFi port for the RaceCapture/Track MK2.  Change according to [https://wiki.autosportlabs.com/RaceCapturePro_Lua_Scripting#Port_mappings Port mapping]&lt;br /&gt;
* &#039;&#039;&#039;autoStart&#039;&#039;&#039;: Change this if you want to start recording at a different threshold. &lt;br /&gt;
* &#039;&#039;&#039;autoStop&#039;&#039;&#039;: Change this if you want to stop recording at a different threshold.&lt;br /&gt;
* &#039;&#039;&#039;debug&#039;&#039;&#039;: If things aren&#039;t working as expected you can set this to 1 to see the conversation between the WiFi module and the GoPro.&lt;br /&gt;
** This information shows up in the log window below the script window - check the box &#039;&#039;&#039;Poll log&#039;&#039;&#039; to see this information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
setTickRate(10) --TickRate is in Hz&lt;br /&gt;
--configure WiFi serial port&lt;br /&gt;
port = 5&lt;br /&gt;
initSer(port,115200,8,0,1)&lt;br /&gt;
--Specify client SSID here&lt;br /&gt;
Ssid = &#039;VIRB-4615&#039;&lt;br /&gt;
--Specify client wifi password here&lt;br /&gt;
Pwd = &#039;12345678&#039;&lt;br /&gt;
--Set this to 1 to log communications between RCP &amp;amp; WiFi&lt;br /&gt;
debug = 0&lt;br /&gt;
&lt;br /&gt;
--initialize variables&lt;br /&gt;
trigger = 0&lt;br /&gt;
recording = 0&lt;br /&gt;
&lt;br /&gt;
--define constants&lt;br /&gt;
autoStart = 0  --Threshold to start recording&lt;br /&gt;
autoStop = 1  --Threshold to stop recording&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
------WiFi Code--------------&lt;br /&gt;
--DO NOT EDIT BELOW&lt;br /&gt;
-----------------------------&lt;br /&gt;
&lt;br /&gt;
--indicates wifiStatus&lt;br /&gt;
--0 = not init, 1 = init sent, 2 = got IP, 3 = ready&lt;br /&gt;
wifiStatus = 0&lt;br /&gt;
lastInitTime = 0&lt;br /&gt;
initTimeout = 20000&lt;br /&gt;
reps = 3 --number of times to repeat command&lt;br /&gt;
&lt;br /&gt;
function logMsg(msg)&lt;br /&gt;
  println(&#039;[WiFi] &#039; ..msg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendCrlf()&lt;br /&gt;
  writeCSer(port, 13)&lt;br /&gt;
  writeCSer(port, 10)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendRaw(val)&lt;br /&gt;
  for i=1, #val do&lt;br /&gt;
    local c = string.sub(val, i, i)&lt;br /&gt;
    writeCSer(port, string.byte(c))&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendAt(val)&lt;br /&gt;
  if debug == 1 then logMsg(&#039;send: &#039; ..val) end&lt;br /&gt;
  sendRaw(val)&lt;br /&gt;
  sendCrlf()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function toInt(val)&lt;br /&gt;
  return string.sub(val, 1, -3)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function httpPost(cmd)&lt;br /&gt;
  sendAt(&#039;AT+CIPSTART=&amp;quot;TCP&amp;quot;,&amp;quot;192.168.0.1&amp;quot;,80&#039;)&lt;br /&gt;
  sleep(500)&lt;br /&gt;
  local crlf = string.char(13) ..string.char(10)&lt;br /&gt;
  local post = &#039;POST /virb HTTP/1.1\r\nHost: 192.168.0.1\r\nAccept: */*\r\nContent-Length: &#039; ..toInt(#cmd)..&#039;\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n&#039; ..cmd ..&#039;\r\n&#039; ..crlf ..crlf&lt;br /&gt;
  sendAt(&#039;AT+CIPSEND=&#039; ..toInt(#post))&lt;br /&gt;
  sleep(100)&lt;br /&gt;
  sendRaw(post)&lt;br /&gt;
  if debug == 1 then println(post) end&lt;br /&gt;
  sleep(100)&lt;br /&gt;
  sendAt(&#039;AT+CIPCLOSE&#039;) &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function initWiFi()&lt;br /&gt;
  logMsg(&#039;initializing&#039;)&lt;br /&gt;
  sendAt(&#039;AT+RST&#039;)&lt;br /&gt;
  sleep(2000)&lt;br /&gt;
  sendAt(&#039;AT+CWMODE_CUR=1&#039;)&lt;br /&gt;
  sleep(1000)&lt;br /&gt;
  sendAt(&#039;AT+CWJAP_CUR=&amp;quot;&#039; ..Ssid ..&#039;&amp;quot;,&amp;quot;&#039; ..Pwd ..&#039;&amp;quot;&#039;)&lt;br /&gt;
  wifiStatus = 1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function processIncoming()&lt;br /&gt;
  local line = readSer(port, 100)&lt;br /&gt;
  if line ~= &#039;&#039; and debug == 1 then print(line) end&lt;br /&gt;
  if string.match(line, &#039;WIFI GOT IP&#039;) or string.match(line, &#039;WIFI CONNECTED&#039;) then &lt;br /&gt;
    wifiStatus = 2&lt;br /&gt;
  end&lt;br /&gt;
  if wifiStatus == 2 and string.match(line, &#039;OK&#039;) then&lt;br /&gt;
    wifiStatus = 3&lt;br /&gt;
    logMsg(&#039;ready for WiFi&#039;)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function checkWiFi()&lt;br /&gt;
  if wifiStatus == 0 then&lt;br /&gt;
    initWiFi()&lt;br /&gt;
    lastInitTime = getUptime()&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  if wifiStatus == 1 and getUptime() &amp;gt; lastInitTime + initTimeout then&lt;br /&gt;
    logMsg(&#039;could not connect to WiFi&#039;)&lt;br /&gt;
    wifiStatus = 0&lt;br /&gt;
  end&lt;br /&gt;
  processIncoming()&lt;br /&gt;
  if wifiStatus ~= 3 then&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  --trigger = getGpsSpeed()&lt;br /&gt;
  trigger = bit.rshift(bit.band(getChannel(&amp;quot;77AB2&amp;quot;),0x40),6)&lt;br /&gt;
  --trigger = 1&lt;br /&gt;
  if recording == 0 and trigger &amp;gt; autoStart then&lt;br /&gt;
    for i=1,reps,1&lt;br /&gt;
    do&lt;br /&gt;
    httpPost(&#039;{&amp;quot;command&amp;quot;:&amp;quot;startRecording&amp;quot;}&#039;)&lt;br /&gt;
    end&lt;br /&gt;
    recording = 1&lt;br /&gt;
  end&lt;br /&gt;
  if recording == 1 and trigger &amp;lt; autoStop then&lt;br /&gt;
    for i=1,reps,1&lt;br /&gt;
    do&lt;br /&gt;
    httpPost(&#039;{&amp;quot;command&amp;quot;:&amp;quot;stopRecording&amp;quot;}&#039;)&lt;br /&gt;
    end&lt;br /&gt;
    recording = 0&lt;br /&gt;
  end &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function onTick()&lt;br /&gt;
  checkWiFi()&lt;br /&gt;
  --println(&#039;trigger value: &#039; ..trigger)&lt;br /&gt;
  --println(&#039;recording status: &#039; ..recording)&lt;br /&gt;
  if debug ==1 then println(&amp;quot;WiFi Status: &amp;quot; ..wifiStatus) end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A few comments:&lt;br /&gt;
* The POST command is repeated the number of times specified by reps.  This is because during testing the startRecording was not entirely reliable.  The camera somehow missed the command.&lt;br /&gt;
* The trigger condition is set to use bit 6 of the CAN channel 77AB2.  This signal comes from a switch on the dashboard wired to an ECU, which then sends switch status on the CAN to which the RaceCapture/Track MK2 is connected.  Modify accordingly if you have a similar switch, otherwise comment this out and uncomment the getGpsSpeed() line, altering the autoStart and autoStop thresholds accordingly.&lt;br /&gt;
&lt;br /&gt;
=Experimental GoPro Hero4 Control=&lt;br /&gt;
The GoPro Hero4 has proven to be a cheap and reliable camera in many uses, and motorsports is no exception.&lt;br /&gt;
&lt;br /&gt;
Limited testing has been done using custom Lua code to use UDP camera commands&lt;br /&gt;
&lt;br /&gt;
This has been shown to work with newer cameras as well, up through Hero8, but no field testing has been done.&lt;br /&gt;
&lt;br /&gt;
==Customization==&lt;br /&gt;
You will want to edit the MAC address to match the camera you are pairing.  Edit this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
local mac = string.char(0xd4, 0xd9, 0x19, 0x99, 0xc4, 0xef) -- This is the mac addres of my camera, d4:d9:19:99:c4:ef&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So if your MAC address is d4:d9:27:87:b6:e5, change the line to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
local mac = string.char(0xd4, 0xd9, 0x27, 0x87, 0xb6, 0xe5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
To connect the camera to the RaceCapture, first turn on the RaceCapture.  Then, from the GoPro, connect a new Smart Remote.  &lt;br /&gt;
&lt;br /&gt;
The RaceCapture emulates the GoPro smart remote&lt;br /&gt;
&lt;br /&gt;
Once connected, you can confirm connection by looking at the virtual channel &amp;quot;Camera&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*0 indicates not connected&lt;br /&gt;
*1 indicates connected and not recording&lt;br /&gt;
*2 indicates connected and recording&lt;br /&gt;
&lt;br /&gt;
Once paired, when the RaceCapture is shut down, you can turn the Camera&#039;s Wifi on.  When the RaceCapture powers on, it should automatically turn on the camera.&lt;br /&gt;
&lt;br /&gt;
==Use== &lt;br /&gt;
This code is set up to watch the isLogging() value, and trigger camera recording when logging begins.&lt;br /&gt;
&lt;br /&gt;
==Lua Code==&lt;br /&gt;
The Lua Code is available in the RaceCapture app as a preset.  Simply choose Presets from the Scripting tab in Setup, choose Shared, and then find the preset named GoPro Hero4 Automatic Control&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:ImportGoProPreset.png]]&lt;/div&gt;</summary>
		<author><name>Imdacrocker</name></author>
	</entry>
	<entry>
		<id>https://wiki.autosportlabs.com/index.php?title=File:ImportGoProPreset.png&amp;diff=9502</id>
		<title>File:ImportGoProPreset.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.autosportlabs.com/index.php?title=File:ImportGoProPreset.png&amp;diff=9502"/>
		<updated>2022-11-16T05:12:33Z</updated>

		<summary type="html">&lt;p&gt;Imdacrocker: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Imdacrocker</name></author>
	</entry>
	<entry>
		<id>https://wiki.autosportlabs.com/index.php?title=AutomaticCameraControl&amp;diff=9501</id>
		<title>AutomaticCameraControl</title>
		<link rel="alternate" type="text/html" href="https://wiki.autosportlabs.com/index.php?title=AutomaticCameraControl&amp;diff=9501"/>
		<updated>2022-11-15T21:03:07Z</updated>

		<summary type="html">&lt;p&gt;Imdacrocker: Added a section for the Hero4 control&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Automatic Camera Control=&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
This guide shows you how to enable automatic start / stop control of WiFi enabled cameras, such as GoPro using RaceCapture or PodiumConnect. &lt;br /&gt;
&lt;br /&gt;
==How it works==&lt;br /&gt;
Most action cameras offer a WiFi interface for remote control. GoPro is one such camera, and allows shutter control via the WiFi interface, which RaceCapture or PodiumConnect can leverage for automatic triggering. &lt;br /&gt;
&lt;br /&gt;
===Currently supported versions of RaceCapture hardware===&lt;br /&gt;
* PodiumConnect&lt;br /&gt;
* RaceCapture/Apex&lt;br /&gt;
* RaceCapture/Pro MK3&lt;br /&gt;
* RaceCapture/Track MK1 and MK2&lt;br /&gt;
* RaceCapture/Pro MK2 with external WiFi add-on (see below)&lt;br /&gt;
&lt;br /&gt;
===Currently supported cameras===&lt;br /&gt;
* GoPro Hero 2/3&lt;br /&gt;
* GoPro Hero 4/5 (experimental)&lt;br /&gt;
* Garmin Virb Ultra 30 (experimental)&lt;br /&gt;
&lt;br /&gt;
Note, We recommend GoPro 2/3 due to stability / reliability issues seen with the later GoPro devices. &lt;br /&gt;
&lt;br /&gt;
Additional Camera support will be added with future firmware releases.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
RaceCapture or PodiumConnect is configured so it&#039;s WiFi client connects to the camera&#039;s access point using its SSID and WiFi password.  &lt;br /&gt;
&lt;br /&gt;
When RaceCapture/PodiumConnect triggers the camera based on a sensor threshold such as speed, RPM or other value, it sends a command to the camera to start recording.  When the sensor falls below the threshold, the corresponding command is sent to stop the recording. &lt;br /&gt;
&lt;br /&gt;
===Simultaneous WiFi connection with the RaceCapture App===&lt;br /&gt;
Since the WiFi client feature is used on RaceCapture/PodiumConnect to connect to the camera, the Access Point remains available for the RaceCapture app to connect via WiFi, as usual. Or, via Bluetooth, if supported by the RaceCapture system.&lt;br /&gt;
&lt;br /&gt;
[[Image:automatic_camera_control.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
==Setting up Automatic Camera Control==&lt;br /&gt;
&lt;br /&gt;
===Applies to===&lt;br /&gt;
* PodiumConnect&lt;br /&gt;
* RaceCapture/Apex&lt;br /&gt;
* RaceCapture/Pro MK3&lt;br /&gt;
* RaceCapture/Track MK1 and MK2&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* Firmware 2.13.0 or higher&lt;br /&gt;
&lt;br /&gt;
===Set up WiFi client===&lt;br /&gt;
Navigate to Setup / Wireless and ensure:&lt;br /&gt;
* WiFi is turned &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
* WiFi client is turned &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
* Camera SSID and password are specified in the WiFi client settings. &lt;br /&gt;
&lt;br /&gt;
[[image:WiFi_camera_control_config.png]]&lt;br /&gt;
&lt;br /&gt;
===Set up Automatic Control===&lt;br /&gt;
Navigate to Setup / Automatic Control and ensure:&lt;br /&gt;
* The desired sensor channel trigger is selected (Speed is the default)&lt;br /&gt;
* Your start / stop and time thresholds are configured&lt;br /&gt;
* Camera Control is turned &#039;&#039;&#039;ON&#039;&#039;&#039; and you have your camera model selected. &lt;br /&gt;
&lt;br /&gt;
[[Image:automatic_control_camera_settings.png]]&lt;br /&gt;
&lt;br /&gt;
===Write Settings===&lt;br /&gt;
Write the settings back to RaceCapture by pressing the &#039;&#039;&#039;Write&#039;&#039;&#039; button under Setup. &lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
Turn on the camera and ensure the camera has it&#039;s WiFi interface enabled. &lt;br /&gt;
&lt;br /&gt;
Power up RaceCapture, connect the RaceCapture app and verify the WiFi client is connected under the System Status page. &lt;br /&gt;
[[image:verifying_wifi_client_connected.png]]&lt;br /&gt;
&lt;br /&gt;
It may take several seconds for the client to connect. If not, re-check the camera&#039;s SSID/password, and ensure WiFi is enabled on the camera. &lt;br /&gt;
* &#039;&#039;&#039;Note&#039;&#039;&#039;: On GoPros, the Camera must be in &#039;App mode&#039; with WiFi enabled. &lt;br /&gt;
&lt;br /&gt;
Once it is connected to the camera, you can test the camera by triggering the configured camera&#039;s threshold. &lt;br /&gt;
* &#039;&#039;&#039;Tip&#039;&#039;&#039;: For static testing, you can configure the camera control to one of the Accelerometer channels, such as &#039;&#039;&#039;AccelZ&#039;&#039;&#039; and trigger by inverting RaceCapture. Or, use RPM, battery voltage or similar. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==RaceCapture/Pro MK2==&lt;br /&gt;
While the automatic camera control firmware feature is not available for RaceCapture/Pro MK2, it can still be controlled via a Lua script. &lt;br /&gt;
&lt;br /&gt;
[[image:RaceCapture_WiFi_GoPro_control_diagram.png]]&lt;br /&gt;
&lt;br /&gt;
When WiFi is enabled on your GoPro camera it creates a network that other devices can connect to.  A WiFi enabled version of RaceCapture/Pro can connect to this network and issue the appropriate commands to control various camera functions - in this case, starting and stopping video recording.&lt;br /&gt;
&lt;br /&gt;
Starting and stopping the GoPro can be controlled by a variety of means: speed, RPM or based on other sensor data, enabled by a Lua Script running on RaceCapture/Pro.&lt;br /&gt;
&lt;br /&gt;
This guide focuses on using GPS speed to trigger the camera; for triggering on other sensors see the [[RaceCapturePro_Lua_Scripting|Lua scripting guide]] as a reference for what other sensor data is available.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
* Currently, the WiFi module can only be used to enable GoPro triggering. &lt;br /&gt;
* &#039;&#039;&#039;If running firmware version 2.10.x or higher&#039;&#039;&#039; To use this script, you must disable the built-in WiFi control, or else it will take over the connection and block the script from running. &lt;br /&gt;
* Future versions of RaceCapture firmware and app will allow built-in firmware control of GoPro cameras, which will eliminate the need for this script. &lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* RaceCapture/Pro MK2 running firmware 2.9.1 or higher&lt;br /&gt;
* [https://www.autosportlabs.com/product/racecapturepro-wifi-module/ RaceCapture/Pro WiFi module]&lt;br /&gt;
* WiFi enabled GoPro Hero camera, with WiFi activated&lt;br /&gt;
* GPS Connectivity (for speed measurement)&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
&lt;br /&gt;
===Configure your GoPro===&lt;br /&gt;
Using the GoPro app, configure the WiFi network, making a note of the network name (SSID) and password.&lt;br /&gt;
&lt;br /&gt;
===Connect the WiFi module===&lt;br /&gt;
Connect the RaceCapture/Pro WiFi module to the outermost (Auxiliary) port of RaceCapture/Pro.&lt;br /&gt;
* When powered up, you should see the power LED illuminate.&lt;br /&gt;
* This port is to the right of the Bluetooth Port.&lt;br /&gt;
** The WiFi module does not interfere with the operation of the Bluetooth module.&lt;br /&gt;
&lt;br /&gt;
===Enable Lua script for GoPro connectivity===&lt;br /&gt;
Customize the Lua script shown at the bottom with the GoPro&#039;s WiFi network name (SSID) and password, then copy and paste the Lua script shown at the bottom into the scripting window of your RaceCapture/Pro. &lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
* Connect RaceCapture/Pro to the RaceCapture app and read the current configuration.&lt;br /&gt;
* Copy the Lua script into the Scripting window:&lt;br /&gt;
** Ensure the script window is first blank by removing the default script by deleting the text in the window.&lt;br /&gt;
*** &#039;&#039;&#039;Note&#039;&#039;&#039;: If you have an existing script you want to keep, you will need to blend the camera functionality with your existing script. How to do this is beyond the scope of this guide; see the [[RaceCapturePro_Lua_Scripting|Lua Scripting Guide]] for more information.&lt;br /&gt;
** Copy the script into the window by using the &#039;&#039;&#039;ctrl-v&#039;&#039;&#039; keyboard shortcut.&lt;br /&gt;
* Write the configuration back to RaceCapture/Pro.&lt;br /&gt;
&lt;br /&gt;
[[image:gopro_script.png]]&lt;br /&gt;
&lt;br /&gt;
===Bench testing===&lt;br /&gt;
Once the Lua script is written to RaceCapture/Pro, it will attempt to connect to the network created by the GoPro camera. Once connected, it will be ready to issue start / stop commands to the camera.&lt;br /&gt;
&lt;br /&gt;
[[image:GoProCameraControl_RaceCapture.jpg]]&lt;br /&gt;
&lt;br /&gt;
Before road testing, ensure RaceCapture/Pro can connect to the GoPro&#039;s WiFi network by observing the messages in the window below the script.&lt;br /&gt;
* &#039;&#039;&#039;Tip 1&#039;&#039;&#039;: Touch or click the &#039;&#039;&#039;Poll Log&#039;&#039;&#039; to see the current message in the RaceCapture/Pro log&lt;br /&gt;
* &#039;&#039;&#039;Tip 2&#039;&#039;&#039;: To restart the Lua script, touch or click the &#039;Restart&#039; button.&lt;br /&gt;
&lt;br /&gt;
===Road testing===&lt;br /&gt;
Mount the GoPro in the car as usual and power up RaceCapture/Pro, waiting for GPS achieve a lock.&lt;br /&gt;
&lt;br /&gt;
* Drive carefully above the speed threshold and observe the GoPro - you should hear and see the familiar beep and red light activate, just as if you manually started recording using the shutter button on the camera. &lt;br /&gt;
* When you drop below the threshold, the GoPro should stop recording.&lt;br /&gt;
&lt;br /&gt;
As RaceCapture/Pro starts and stops the camera, you will see the following information in the log:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[GoProWiFi] start GoPro&lt;br /&gt;
[GoProWiFi] stop GoPro&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Troubleshooting=&lt;br /&gt;
If RaceCapture/Pro cannot control the camera, check the following:&lt;br /&gt;
* &#039;&#039;&#039;GoPro WiFi network name (SSID) and password&#039;&#039;&#039;: Ensure the name and password currently in the script matches how your GoPro was configured.&lt;br /&gt;
* &#039;&#039;&#039;Enable WiFi on the GoPro&#039;&#039;&#039;: The blue LED on the GoPro should be blinking periodically&lt;br /&gt;
* &#039;&#039;&#039;RaceCapture/Pro WiFi module connection&#039;&#039;&#039;: Ensure the module is plugged into the outermost RJ11 port and the green LED is illuminated.&lt;br /&gt;
* &#039;&#039;&#039;Verify WiFi connection&#039;&#039;&#039;: Ensure RaceCapture/Pro can connect to the GoPro WiFi network. You should see the following messages in the log upon power-up:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[lua] Successfully loaded script.&lt;br /&gt;
[GoProWiFi] initializing&lt;br /&gt;
[GoProWiFi] ready for GoPro&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If RaceCapture/Pro cannot connect to the GoPro&#039;s network you will see this in the log:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[GoProWiFi] initializing&lt;br /&gt;
[GoProWiFi] could not connect to GoPro&lt;br /&gt;
[GoProWiFi] initializing&lt;br /&gt;
[GoProWiFi] could not connect to GoPro&lt;br /&gt;
[GoProWiFi] initializing&lt;br /&gt;
[GoProWiFi] could not connect to GoPro&lt;br /&gt;
[GoProWiFi] initializing&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Lua Script for GoPro=&lt;br /&gt;
&lt;br /&gt;
The following Lua Script enables WiFi control of your GoPro camera. &lt;br /&gt;
&lt;br /&gt;
==Customization==&lt;br /&gt;
You will need to edit the following fields at the minimum, located at the top of the script:&lt;br /&gt;
&lt;br /&gt;
===Required===&lt;br /&gt;
* &#039;&#039;&#039;GoPro WiFi password&#039;&#039;&#039;: Specify the WiFi password used for the GoPro WiFi adapter&lt;br /&gt;
* &#039;&#039;&#039;GoPro SSID&#039;&#039;&#039;: Specify the GoPro WiFi network name (SSID)&lt;br /&gt;
&lt;br /&gt;
===Optional===&lt;br /&gt;
* &#039;&#039;&#039;goproStart&#039;&#039;&#039;: Change this if you want to start recording at a different threshold. &lt;br /&gt;
* &#039;&#039;&#039;goproStop&#039;&#039;&#039;: Change this if you want to stop recording at a different threshold. &#039;&#039;&#039;Ensure this is less than the start trigger&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;tickRate&#039;&#039;&#039;: Adjust this to update how often you want RaceCapture/Pro to perform a start/stop check. Value is in Hz. If uncertain, leave this alone&lt;br /&gt;
* &#039;&#039;&#039;debug&#039;&#039;&#039;: If things aren&#039;t working as expected you can set this to 1 to see the conversation between the WiFi module and the GoPro.&lt;br /&gt;
** This information shows up in the log window below the script window - check the box &#039;&#039;&#039;Poll log&#039;&#039;&#039; to see this information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--Specify your GoPro wifi password here&lt;br /&gt;
goproPwd = &#039;12345678&#039;&lt;br /&gt;
&lt;br /&gt;
--Specify your GoPro SSID here&lt;br /&gt;
goproSsid = &#039;aslhero1&#039;&lt;br /&gt;
&lt;br /&gt;
--Speed threshold to start recording&lt;br /&gt;
goproStart = 10&lt;br /&gt;
&lt;br /&gt;
--Speed threshold to stop recording&lt;br /&gt;
goproStop = 5&lt;br /&gt;
&lt;br /&gt;
--How fast we check, in Hz&lt;br /&gt;
tickRate = 10&lt;br /&gt;
&lt;br /&gt;
--Set this to 1 to log communications between RCP &amp;amp; WiFi&lt;br /&gt;
debug = 0&lt;br /&gt;
-----------------------------&lt;br /&gt;
--DO NOT EDIT BELOW&lt;br /&gt;
-----------------------------&lt;br /&gt;
--the serial port where the WiFi is connected&lt;br /&gt;
port = 4&lt;br /&gt;
--indicates wifiStatus&lt;br /&gt;
--0 = not init, 1 = init sent, 2 = got IP, 3 = ready&lt;br /&gt;
wifiStatus = 0&lt;br /&gt;
lastInitTime = 0&lt;br /&gt;
initTimeout = 20000&lt;br /&gt;
&lt;br /&gt;
function logMsg(msg)&lt;br /&gt;
  println(&#039;[GoProWiFi] &#039; ..msg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendCrlf()&lt;br /&gt;
  writeCSer(port, 13)&lt;br /&gt;
  writeCSer(port, 10)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendRaw(val)&lt;br /&gt;
  for i=1, #val do&lt;br /&gt;
    local c = string.sub(val, i, i)&lt;br /&gt;
    writeCSer(port, string.byte(c))&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendAt(val)&lt;br /&gt;
  if debug == 1 then logMsg(&#039;send: &#039; ..val) end&lt;br /&gt;
  sendRaw(val)&lt;br /&gt;
  sendCrlf()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function toInt(val)&lt;br /&gt;
  return string.sub(val, 1, -3)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function httpGet(url)&lt;br /&gt;
  sendAt(&#039;AT+CIPSTART=&amp;quot;TCP&amp;quot;,&amp;quot;10.5.5.9&amp;quot;,80&#039;)&lt;br /&gt;
  sleep(500)&lt;br /&gt;
  local crlf = string.char(13) ..string.char(10)&lt;br /&gt;
  local get = &#039;GET &#039; ..url ..&#039; HTTP/1.0&#039; ..crlf ..crlf&lt;br /&gt;
  sendAt(&#039;AT+CIPSEND=&#039; ..toInt(#get))&lt;br /&gt;
  sleep(100)&lt;br /&gt;
  sendRaw(get)&lt;br /&gt;
  sleep(100)&lt;br /&gt;
  sendAt(&amp;quot;AT+CIPCLOSE&amp;quot;) &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendGoProShutter(cmd)&lt;br /&gt;
  httpGet(&#039;/bacpac/SH?t=&#039; ..goproPwd ..&#039;&amp;amp;p=%&#039; ..cmd)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function startGoPro()&lt;br /&gt;
  logMsg(&#039;start GoPro&#039;)&lt;br /&gt;
  sendGoProShutter(&#039;01&#039;)    &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function stopGoPro()&lt;br /&gt;
  logMsg(&#039;stop GoPro&#039;)&lt;br /&gt;
  sendGoProShutter(&#039;00&#039;)    &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
recording = 0&lt;br /&gt;
&lt;br /&gt;
function initWiFi()&lt;br /&gt;
  logMsg(&#039;initializing&#039;)&lt;br /&gt;
  sendAt(&#039;AT+RST&#039;)&lt;br /&gt;
  sleep(2000)&lt;br /&gt;
  sendAt(&#039;AT+CWMODE_CUR=1&#039;)&lt;br /&gt;
  sleep(1000)&lt;br /&gt;
  sendAt(&#039;AT+CWJAP_CUR=&amp;quot;&#039; ..goproSsid ..&#039;&amp;quot;,&amp;quot;&#039; ..goproPwd ..&#039;&amp;quot;&#039;)&lt;br /&gt;
  wifiStatus = 1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function processIncoming()&lt;br /&gt;
  local line = readSer(port, 100)&lt;br /&gt;
  if line ~= &#039;&#039; and debug == 1 then print(line) end&lt;br /&gt;
  if string.match(line, &#039;WIFI GOT IP&#039;) then &lt;br /&gt;
    wifiStatus = 2&lt;br /&gt;
  end&lt;br /&gt;
  if wifiStatus == 2 and string.match(line, &#039;OK&#039;) then&lt;br /&gt;
    wifiStatus = 3&lt;br /&gt;
    logMsg(&#039;ready for GoPro&#039;)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function checkGoPro()&lt;br /&gt;
  if wifiStatus == 0 then&lt;br /&gt;
    initWiFi()&lt;br /&gt;
    lastInitTime = getUptime()&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  if wifiStatus == 1 and getUptime() &amp;gt; lastInitTime + initTimeout then&lt;br /&gt;
    logMsg(&#039;could not connect to GoPro&#039;)&lt;br /&gt;
    wifiStatus = 0&lt;br /&gt;
  end&lt;br /&gt;
  processIncoming()&lt;br /&gt;
  if wifiStatus ~= 3 then&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  trigger = getGpsSpeed()&lt;br /&gt;
&lt;br /&gt;
  if recording == 0 and trigger &amp;gt; goproStart then&lt;br /&gt;
    startGoPro()&lt;br /&gt;
    recording = 1&lt;br /&gt;
  end&lt;br /&gt;
  if recording == 1 and trigger &amp;lt; goproStop then&lt;br /&gt;
    stopGoPro()&lt;br /&gt;
    recording = 0&lt;br /&gt;
  end &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function onTick()&lt;br /&gt;
  checkGoPro()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
setTickRate(tickRate)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Lua Script for Garmin Virb=&lt;br /&gt;
&lt;br /&gt;
The following Lua Script enables WiFi control of your Garmin Virb camera using the Garmin [https://developer.garmin.com/downloads/virb/Camera_Network_Services_API_v0.5.pdf Camera Network Services API].   Not all commands in the API may work.  Use commandList (via [https://www.postman.com/ Postman]) to determine which API commands are supported by your Garmin Virb camera.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;The Garmin Virb always uses 192.168.0.1 HTTP port ( 80 ).&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: this Lua script is different than the GoPro script above in that Garmin uses POST commands instead of GET commands.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;For a more detailed explanation, see&#039;&#039; [https://forum.autosportlabs.com/viewtopic.php?t=6267 How to send HTTP POST request via Lua Script?]&amp;lt;br&amp;gt;&lt;br /&gt;
It may be possible to control other WiFi devices by altering the POST command accordingly.  e.g. instead of sending httpPost arguments {&amp;quot;command&amp;quot;:&amp;quot;startRecording&amp;quot;} substitute this with the commands specified by the device API.   Be sure to adjust the server host IP address if different than the Garmin standard.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Customization==&lt;br /&gt;
You will need to edit the following fields at the minimum, located at the top of the script:&lt;br /&gt;
&lt;br /&gt;
===Required===&lt;br /&gt;
* &#039;&#039;&#039;Ssid&#039;&#039;&#039;: Specify the WiFi network name (SSID)&lt;br /&gt;
* &#039;&#039;&#039;Pwd&#039;&#039;&#039;: Specify the WiFi password&lt;br /&gt;
&lt;br /&gt;
===Optional===&lt;br /&gt;
* &#039;&#039;&#039;Port&#039;&#039;&#039;: 5 is the WiFi port for the RaceCapture/Track MK2.  Change according to [https://wiki.autosportlabs.com/RaceCapturePro_Lua_Scripting#Port_mappings Port mapping]&lt;br /&gt;
* &#039;&#039;&#039;autoStart&#039;&#039;&#039;: Change this if you want to start recording at a different threshold. &lt;br /&gt;
* &#039;&#039;&#039;autoStop&#039;&#039;&#039;: Change this if you want to stop recording at a different threshold.&lt;br /&gt;
* &#039;&#039;&#039;debug&#039;&#039;&#039;: If things aren&#039;t working as expected you can set this to 1 to see the conversation between the WiFi module and the GoPro.&lt;br /&gt;
** This information shows up in the log window below the script window - check the box &#039;&#039;&#039;Poll log&#039;&#039;&#039; to see this information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
setTickRate(10) --TickRate is in Hz&lt;br /&gt;
--configure WiFi serial port&lt;br /&gt;
port = 5&lt;br /&gt;
initSer(port,115200,8,0,1)&lt;br /&gt;
--Specify client SSID here&lt;br /&gt;
Ssid = &#039;VIRB-4615&#039;&lt;br /&gt;
--Specify client wifi password here&lt;br /&gt;
Pwd = &#039;12345678&#039;&lt;br /&gt;
--Set this to 1 to log communications between RCP &amp;amp; WiFi&lt;br /&gt;
debug = 0&lt;br /&gt;
&lt;br /&gt;
--initialize variables&lt;br /&gt;
trigger = 0&lt;br /&gt;
recording = 0&lt;br /&gt;
&lt;br /&gt;
--define constants&lt;br /&gt;
autoStart = 0  --Threshold to start recording&lt;br /&gt;
autoStop = 1  --Threshold to stop recording&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
------WiFi Code--------------&lt;br /&gt;
--DO NOT EDIT BELOW&lt;br /&gt;
-----------------------------&lt;br /&gt;
&lt;br /&gt;
--indicates wifiStatus&lt;br /&gt;
--0 = not init, 1 = init sent, 2 = got IP, 3 = ready&lt;br /&gt;
wifiStatus = 0&lt;br /&gt;
lastInitTime = 0&lt;br /&gt;
initTimeout = 20000&lt;br /&gt;
reps = 3 --number of times to repeat command&lt;br /&gt;
&lt;br /&gt;
function logMsg(msg)&lt;br /&gt;
  println(&#039;[WiFi] &#039; ..msg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendCrlf()&lt;br /&gt;
  writeCSer(port, 13)&lt;br /&gt;
  writeCSer(port, 10)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendRaw(val)&lt;br /&gt;
  for i=1, #val do&lt;br /&gt;
    local c = string.sub(val, i, i)&lt;br /&gt;
    writeCSer(port, string.byte(c))&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendAt(val)&lt;br /&gt;
  if debug == 1 then logMsg(&#039;send: &#039; ..val) end&lt;br /&gt;
  sendRaw(val)&lt;br /&gt;
  sendCrlf()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function toInt(val)&lt;br /&gt;
  return string.sub(val, 1, -3)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function httpPost(cmd)&lt;br /&gt;
  sendAt(&#039;AT+CIPSTART=&amp;quot;TCP&amp;quot;,&amp;quot;192.168.0.1&amp;quot;,80&#039;)&lt;br /&gt;
  sleep(500)&lt;br /&gt;
  local crlf = string.char(13) ..string.char(10)&lt;br /&gt;
  local post = &#039;POST /virb HTTP/1.1\r\nHost: 192.168.0.1\r\nAccept: */*\r\nContent-Length: &#039; ..toInt(#cmd)..&#039;\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n&#039; ..cmd ..&#039;\r\n&#039; ..crlf ..crlf&lt;br /&gt;
  sendAt(&#039;AT+CIPSEND=&#039; ..toInt(#post))&lt;br /&gt;
  sleep(100)&lt;br /&gt;
  sendRaw(post)&lt;br /&gt;
  if debug == 1 then println(post) end&lt;br /&gt;
  sleep(100)&lt;br /&gt;
  sendAt(&#039;AT+CIPCLOSE&#039;) &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function initWiFi()&lt;br /&gt;
  logMsg(&#039;initializing&#039;)&lt;br /&gt;
  sendAt(&#039;AT+RST&#039;)&lt;br /&gt;
  sleep(2000)&lt;br /&gt;
  sendAt(&#039;AT+CWMODE_CUR=1&#039;)&lt;br /&gt;
  sleep(1000)&lt;br /&gt;
  sendAt(&#039;AT+CWJAP_CUR=&amp;quot;&#039; ..Ssid ..&#039;&amp;quot;,&amp;quot;&#039; ..Pwd ..&#039;&amp;quot;&#039;)&lt;br /&gt;
  wifiStatus = 1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function processIncoming()&lt;br /&gt;
  local line = readSer(port, 100)&lt;br /&gt;
  if line ~= &#039;&#039; and debug == 1 then print(line) end&lt;br /&gt;
  if string.match(line, &#039;WIFI GOT IP&#039;) or string.match(line, &#039;WIFI CONNECTED&#039;) then &lt;br /&gt;
    wifiStatus = 2&lt;br /&gt;
  end&lt;br /&gt;
  if wifiStatus == 2 and string.match(line, &#039;OK&#039;) then&lt;br /&gt;
    wifiStatus = 3&lt;br /&gt;
    logMsg(&#039;ready for WiFi&#039;)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function checkWiFi()&lt;br /&gt;
  if wifiStatus == 0 then&lt;br /&gt;
    initWiFi()&lt;br /&gt;
    lastInitTime = getUptime()&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  if wifiStatus == 1 and getUptime() &amp;gt; lastInitTime + initTimeout then&lt;br /&gt;
    logMsg(&#039;could not connect to WiFi&#039;)&lt;br /&gt;
    wifiStatus = 0&lt;br /&gt;
  end&lt;br /&gt;
  processIncoming()&lt;br /&gt;
  if wifiStatus ~= 3 then&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  --trigger = getGpsSpeed()&lt;br /&gt;
  trigger = bit.rshift(bit.band(getChannel(&amp;quot;77AB2&amp;quot;),0x40),6)&lt;br /&gt;
  --trigger = 1&lt;br /&gt;
  if recording == 0 and trigger &amp;gt; autoStart then&lt;br /&gt;
    for i=1,reps,1&lt;br /&gt;
    do&lt;br /&gt;
    httpPost(&#039;{&amp;quot;command&amp;quot;:&amp;quot;startRecording&amp;quot;}&#039;)&lt;br /&gt;
    end&lt;br /&gt;
    recording = 1&lt;br /&gt;
  end&lt;br /&gt;
  if recording == 1 and trigger &amp;lt; autoStop then&lt;br /&gt;
    for i=1,reps,1&lt;br /&gt;
    do&lt;br /&gt;
    httpPost(&#039;{&amp;quot;command&amp;quot;:&amp;quot;stopRecording&amp;quot;}&#039;)&lt;br /&gt;
    end&lt;br /&gt;
    recording = 0&lt;br /&gt;
  end &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function onTick()&lt;br /&gt;
  checkWiFi()&lt;br /&gt;
  --println(&#039;trigger value: &#039; ..trigger)&lt;br /&gt;
  --println(&#039;recording status: &#039; ..recording)&lt;br /&gt;
  if debug ==1 then println(&amp;quot;WiFi Status: &amp;quot; ..wifiStatus) end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A few comments:&lt;br /&gt;
* The POST command is repeated the number of times specified by reps.  This is because during testing the startRecording was not entirely reliable.  The camera somehow missed the command.&lt;br /&gt;
* The trigger condition is set to use bit 6 of the CAN channel 77AB2.  This signal comes from a switch on the dashboard wired to an ECU, which then sends switch status on the CAN to which the RaceCapture/Track MK2 is connected.  Modify accordingly if you have a similar switch, otherwise comment this out and uncomment the getGpsSpeed() line, altering the autoStart and autoStop thresholds accordingly.&lt;br /&gt;
&lt;br /&gt;
=Experimental GoPro Hero4 Control=&lt;br /&gt;
The GoPro Hero4 has proven to be a cheap and reliable camera in many uses, and motorsports is no exception.&lt;br /&gt;
&lt;br /&gt;
Limited testing has been done using custom Lua code to use UDP camera commands&lt;br /&gt;
&lt;br /&gt;
This has been shown to work with newer cameras as well, up through Hero8, but no field testing has been done.&lt;br /&gt;
&lt;br /&gt;
==Customization==&lt;br /&gt;
You will want to edit the MAC address to match the camera you are pairing.  Edit this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
local mac = string.char(0xd4, 0xd9, 0x19, 0x99, 0xc4, 0xef) -- This is the mac addres of my camera, d4:d9:19:99:c4:ef&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So if your MAC address is d4:d9:27:87:b6:e5, change the line to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
local mac = string.char(0xd4, 0xd9, 0x27, 0x87, 0xb6, 0xe5)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
To connect the camera to the RaceCapture, first turn on the RaceCapture.  Then, from the GoPro, connect a new Smart Remote.  &lt;br /&gt;
&lt;br /&gt;
The RaceCapture emulates the GoPro smart remote&lt;br /&gt;
&lt;br /&gt;
Once connected, you can confirm connection by looking at the virtual channel &amp;quot;Camera&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*0 indicates not connected&lt;br /&gt;
*1 indicates connected and not recording&lt;br /&gt;
*2 indicates connected and recording&lt;br /&gt;
&lt;br /&gt;
Once paired, when the RaceCapture is shut down, you can turn the Camera&#039;s Wifi on.  When the RaceCapture powers on, it should automatically turn on the camera.&lt;br /&gt;
&lt;br /&gt;
==Use== &lt;br /&gt;
This code is set up to watch the isLogging() value, and trigger camera recording when logging begins.&lt;br /&gt;
&lt;br /&gt;
==Lua Code==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
local c = addChannel(&amp;quot;Camera&amp;quot;, 1, 0, 0, 2)&lt;br /&gt;
lastResponse = getUptime()&lt;br /&gt;
lastKeepAlive = getUptime()&lt;br /&gt;
lastRequest = getUptime()&lt;br /&gt;
&lt;br /&gt;
function sendRaw(val)&lt;br /&gt;
    for i = 1, #val do&lt;br /&gt;
        local c = string.sub(val, i, i)&lt;br /&gt;
        writeCSer(5, string.byte(c))&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendAt(val)&lt;br /&gt;
    sendRaw(val)&lt;br /&gt;
    writeCSer(5, 13)&lt;br /&gt;
    writeCSer(5, 10)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function sendCommand(command, connection)&lt;br /&gt;
    sendAt(&#039;AT+CIPSEND=&#039; .. connection .. &#039;,&#039; .. string.sub(#command, 1, -3))&lt;br /&gt;
    pi()&lt;br /&gt;
    sendRaw(command)&lt;br /&gt;
    pi()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function pi() -- process incoming, reads from serial character by character&lt;br /&gt;
    local char = readCSer(5, 100)&lt;br /&gt;
    if char == nil then&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
    local line = &#039;&#039;&lt;br /&gt;
    while (char ~= nil) do&lt;br /&gt;
        line = line .. string.char(char)&lt;br /&gt;
        if string.find(line, &#039;+IPD,&#039;) then -- This means incoming packet&lt;br /&gt;
            readCSer(5, 100)&lt;br /&gt;
            char = readCSer(5, 100)&lt;br /&gt;
            char = readCSer(5, 100)&lt;br /&gt;
            local length = &#039;&#039;&lt;br /&gt;
            while char ~= 58 do&lt;br /&gt;
                if char == nil then&lt;br /&gt;
                    return&lt;br /&gt;
                end&lt;br /&gt;
                length = length .. string.char(char)&lt;br /&gt;
                char = readCSer(5, 100)&lt;br /&gt;
            end&lt;br /&gt;
            local packet = &#039;&#039;&lt;br /&gt;
            if tonumber(length) == nil then&lt;br /&gt;
            else&lt;br /&gt;
                for i = 1, tonumber(length) do&lt;br /&gt;
                    packet = packet .. string.sub(readCSer(5, 100), 1, -3) .. &#039; &#039;&lt;br /&gt;
                end&lt;br /&gt;
                lastResponse = getUptime()&lt;br /&gt;
                if getChannel(c) == 0 then&lt;br /&gt;
                    setChannel(c, 1)&lt;br /&gt;
                end&lt;br /&gt;
                if packet == &#039;95 71 80 72 68 95 58 48 58 48 58 50 58 1 &#039; then -- This is the KeepAlive response&lt;br /&gt;
                    if getChannel(c) == 0 then&lt;br /&gt;
                        setChannel(c, 1)&lt;br /&gt;
                    end&lt;br /&gt;
                elseif packet == &#039;0 0 0 0 0 0 0 0 0 0 0 115 116 0 0 0 0 0 0 0 &#039; then -- This response means camera is on and not recording&lt;br /&gt;
                    setChannel(c, 1)&lt;br /&gt;
                elseif packet == &#039;0 0 0 0 0 0 0 0 0 0 0 115 116 0 0 1 0 1 0 0 &#039; then -- This response means the camera IS recording&lt;br /&gt;
                    setChannel(c, 2)&lt;br /&gt;
                elseif packet == &#039;0 0 0 0 0 0 0 0 0 0 0 115 116 1 0 0 0 0 0 0 &#039; then -- This means the camera is off&lt;br /&gt;
                    setChannel(c, 0)&lt;br /&gt;
                end&lt;br /&gt;
                return&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        char = readCSer(5, 100)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
sendAt(&#039;AT+RST&#039;) -- Reset ESP8266&lt;br /&gt;
pi()&lt;br /&gt;
sendAt(&#039;AT+CWMODE_CUR=2&#039;) -- Set as an access point&lt;br /&gt;
pi()&lt;br /&gt;
sendAt(&#039;AT+CWSAP_CUR=&amp;quot;HERO-RC-000000&amp;quot;,&amp;quot;&amp;quot;,1,0&#039;) -- This is the SSID to emulate a remote.  The last 6 need to match the below piece&lt;br /&gt;
pi()&lt;br /&gt;
sendAt(&#039;AT+CIPAPMAC_CUR=&amp;quot;d8:96:85:00:00:00&amp;quot;&#039;) -- Remote MAC address all start with the same 3 sets, then you can use any set.  all 0&#039;s work&lt;br /&gt;
pi()&lt;br /&gt;
sendAt(&#039;AT+CIPAP_CUR=&amp;quot;10.71.79.1&amp;quot;&#039;) -- The remote IP&lt;br /&gt;
pi()&lt;br /&gt;
sendAt(&#039;AT+CIPMUX=1&#039;) -- Setting to accept multiple connections&lt;br /&gt;
pi()&lt;br /&gt;
sleep(1000)&lt;br /&gt;
sendAt(&#039;AT+CIPSTART=0,&amp;quot;UDP&amp;quot;,&amp;quot;255.255.255.255&amp;quot;,9&#039;) -- Set up a connection to the subnet for the WOL&lt;br /&gt;
pi()&lt;br /&gt;
sendAt(&#039;AT+CIPSTART=1,&amp;quot;UDP&amp;quot;,&amp;quot;10.71.79.2&amp;quot;,8484,8383&#039;) -- Set up a connection to the camera&lt;br /&gt;
pi()&lt;br /&gt;
&lt;br /&gt;
setTickRate(10)&lt;br /&gt;
function onTick()&lt;br /&gt;
    -- checkCamera()&lt;br /&gt;
    if (getUptime() - lastResponse) &amp;gt; 5000 then -- If there has been no response for 5 seconds, start sending a WOL packet&lt;br /&gt;
        setChannel(c, 0) -- Set camera to not connected&lt;br /&gt;
        local mac = string.char(0xd4, 0xd9, 0x19, 0x99, 0xc4, 0xef) -- This is the mac addres of my camera, d4:d9:19:99:c4:ef&lt;br /&gt;
        local packet = string.char(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF) -- The opening of the packet is a null packet&lt;br /&gt;
        for i = 1, 16 do&lt;br /&gt;
            packet = packet .. mac -- And then the MAC address 16 times&lt;br /&gt;
        end&lt;br /&gt;
        sendCommand(packet, &#039;0&#039;)&lt;br /&gt;
    end&lt;br /&gt;
    if isLogging() == 0 and getChannel(c) == 2 then -- If we are not logging, but the camera is recording, stop the camera&lt;br /&gt;
     sendCommand(string.char(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x53, 0x48, 0x00), &#039;1&#039;) -- Stop camera&lt;br /&gt;
        setChannel(c, 1)&lt;br /&gt;
    end&lt;br /&gt;
    if isLogging() ~= 0 and getChannel(c) == 1 then -- If we ARE logging, and not recording, then record&lt;br /&gt;
        sendCommand(string.char(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x53, 0x48, 0x02), &#039;1&#039;) -- Start camera&lt;br /&gt;
        setChannel(c, 2)&lt;br /&gt;
    end&lt;br /&gt;
    if (getUptime() - lastKeepAlive) &amp;gt; 1500 then -- Send a keep alive packet every 1.5 seconds&lt;br /&gt;
        sendAt(&#039;AT+CIPSEND=1,22&#039;)&lt;br /&gt;
        pi()&lt;br /&gt;
        sendRaw(&#039;_GPHD_:0:0:2:0.000000\n&#039;) -- This is the actual keep alive command&lt;br /&gt;
        pi()&lt;br /&gt;
        lastKeepAlive = getUptime()&lt;br /&gt;
    end&lt;br /&gt;
    if (getUptime() - lastRequest) &amp;gt; 5000 then -- Send a status request every 5 seonds&lt;br /&gt;
        sendCommand(string.char(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x74), &#039;1&#039;) -- This is the actual request command&lt;br /&gt;
        lastRequest = getUptime()&lt;br /&gt;
    end&lt;br /&gt;
    pi() -- Process incoming every tick&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Imdacrocker</name></author>
	</entry>
	<entry>
		<id>https://wiki.autosportlabs.com/index.php?title=RaceCapture_on_Raspberry_Pi&amp;diff=9175</id>
		<title>RaceCapture on Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.autosportlabs.com/index.php?title=RaceCapture_on_Raspberry_Pi&amp;diff=9175"/>
		<updated>2021-10-29T05:11:59Z</updated>

		<summary type="html">&lt;p&gt;Imdacrocker: The killall does not need the .sh at the end.  Removed from documentation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
We designed the RaceCapture app to run nearly anywhere - even a Raspberry Pi. And now, for about $100 you can create a hardwired, dedicated dash for your RaceCapture system. &lt;br /&gt;
&lt;br /&gt;
[[image:racecapture_raspberry_pi.jpg|1024px]]&lt;br /&gt;
&lt;br /&gt;
==Benefits==&lt;br /&gt;
You get all of the benefits of a dedicated dash:&lt;br /&gt;
* &#039;&#039;&#039;Automatically runs upon power up&#039;&#039;&#039; - you can configure the dash to automatically launch the RaceCapture App - just as you&#039;d expect it to work.&lt;br /&gt;
* &#039;&#039;&#039;Hard-wired data connection to RaceCapture&#039;&#039;&#039; - no wireless connections to configure, with the reliability of a direct wire.&lt;br /&gt;
* &#039;&#039;&#039;Runs on the bare metal&#039;&#039;&#039; - The RaceCapture app runs without Android or iOS; there&#039;s no other apps competing for resources, or compromising system stability. &lt;br /&gt;
* &#039;&#039;&#039;Overheating resistance&#039;&#039;&#039; -  Your typical mobile device requires extra care in very hot weather to prevent damage to it&#039;s internal battery, and will shut down if overheated. With proper heat-sinking, the Raspberry Pi should handle the heat.&lt;br /&gt;
&lt;br /&gt;
==Compatibility==&lt;br /&gt;
The RaceCapture app running on the Raspberry Pi is compatible with any hardware version of RaceCapture or PodiumConnect. &lt;br /&gt;
&lt;br /&gt;
[[image:racecapture_raspberry_pi_backside.jpg|1024px]]&lt;br /&gt;
&lt;br /&gt;
==Experimental!==&lt;br /&gt;
While the results are pretty great, these instructions are &#039;&#039;currently&#039;&#039; for those adventurous race car hackers who know their away around a command line, comfortable working with hardware and want to dig in.  &#039;&#039;&#039;Think it&#039;s cool, but too much to tackle?&#039;&#039;&#039; Rope in your nearest computer/electronics geek - you need one on your race team, anyway. :)  &#039;&#039;&#039;Or, just use the plug and play option&#039;&#039;&#039; and use an Android or iOS device via Bluetooth or WiFi.&lt;br /&gt;
&lt;br /&gt;
==Current status and future plans==&lt;br /&gt;
Even though this is brand new and officially experimental in nature, we still made it as easy as reasonably possible: we wrapped up the RaceCapture App into as close to a self-running installer, that can run on a bone stock Raspberry Pi image - only a few changes are required to the default image, detailed below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;However&#039;&#039;&#039;, in the near future we will create a dedicated Raspberry Pi image that you can burn to an SD card and simply boot up, and move towards more official support as we iron out the issues. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reporting issues and getting support===&lt;br /&gt;
Chances are you&#039;ll encounter an issue you&#039;ll want to report. Before you do that, [https://github.com/autosportlabs/RaceCapture_App/issues?q=is%3Aopen+is%3Aissue+label%3A%22raspberry+pi%22 check the issue log] to see if it&#039;s already known.&lt;br /&gt;
&lt;br /&gt;
Otherwise - the best place for support, feedback and sharing success stories is [http://forum.autosportlabs.com on the  forums] .  Drop us a note there so we can see the progress of your project!&lt;br /&gt;
&lt;br /&gt;
=Hardware Selection=&lt;br /&gt;
===Raspberry Pi===&lt;br /&gt;
RaceCapture currently requires the Raspberry Pi 3: [https://www.raspberrypi.org/products/raspberry-pi-3-model-b/ Raspberry Pi 3].&lt;br /&gt;
&lt;br /&gt;
It is not yet compatible with the Pi 4, due to extensive changes in the graphics subsystem.  Expect to see Pi 4 support in the 2.0 version of the app. &lt;br /&gt;
&lt;br /&gt;
===Display===&lt;br /&gt;
The RaceCapture app package is designed to recognize the following screens:&lt;br /&gt;
&lt;br /&gt;
* [https://www.raspberrypi.org/products/raspberry-pi-touch-display/ Official Raspberry Pi display] with capacitive touch screen;&lt;br /&gt;
* Displays supporting the AR1100 resistive touch screen controller.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other displays can work as well, and additional work may be needed to support the screen&#039;s touch controller. If unsure, just pick the [https://www.raspberrypi.org/products/raspberry-pi-touch-display/ Official Raspberry Pi display]&lt;br /&gt;
===Enclosure===&lt;br /&gt;
A recommended enclosure is the [http://https://www.amazon.com/dp/B01HV97F64 Smart Pi Touch Case]&lt;br /&gt;
&lt;br /&gt;
You can 3D print a sun shade for this enclosure  [[file:P001 Raspberry Pi Display Sun Shade.stl.zip|download the .stl file]] (&#039;&#039;Courtesy of Michael Lee&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
[[image:SmartPi_touch_case.jpg|400px]] [[image:RaceCapture_Sun_shade_3dprinted_preview.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
[[image:RaceCapture_RaspberryPi_sun_shade_dashboard.jpg|800px]]&lt;br /&gt;
&lt;br /&gt;
Installed on Dashboard&lt;br /&gt;
&lt;br /&gt;
===Power Supply===&lt;br /&gt;
The Raspberry Pi dashboard requires its own power supply.  You&#039;ll need a high quality 5v power supply with 2 amps minimum capacity; 3 amps is highly recommended, and ideally one with a low drop out voltage, so power is not cut to the Raspberry Pi when you&#039;re loading the main battery, such as when cranking the engine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Suggested Power Supplies&#039;&#039;&#039;&lt;br /&gt;
* [https://www.amazon.com/Jabinco-LM2596-Converter-3-0-40V-1-5-35V/dp/B0817P8BGB/ Buck Converter based on the LM2596]&lt;br /&gt;
&lt;br /&gt;
====Powering RaceCapture====&lt;br /&gt;
After you have power to the Raspberry Pi dashboard, you may notice your RaceCapture device will be powered by the USB cable connected to the Pi, just as if you&#039;re powering RaceCapture from your laptop.  &#039;&#039;&#039;You will still want to power your RaceCapture via 12v&#039;&#039;&#039;; see the respective installation guides for information on how to power your device.&lt;br /&gt;
&lt;br /&gt;
===Heat sinking===&lt;br /&gt;
If you&#039;re running in hot weather, we recommend the standard Raspberry Pi heatsink kit to keep your system cool.&lt;br /&gt;
&lt;br /&gt;
=Installation=&lt;br /&gt;
==Installing Rasbian OS==&lt;br /&gt;
We recommend installing Raspian Jessie Lite - [https://www.raspberrypi.org/downloads/raspbian/ download from the official site] and follow the instructions for burning to an SD card. &lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve created your image, boot up your Raspberry Pi and log in with the default username of &#039;pi&#039; and password &#039;raspberry&#039;.&lt;br /&gt;
&lt;br /&gt;
==Raspberry Pi support==&lt;br /&gt;
The RaceCapture app is compatible with Raspberry Pi 4 and 3.&lt;br /&gt;
&lt;br /&gt;
===Raspberry Pi 4 Notes===&lt;br /&gt;
Raspberry Pi 4 support is only available with the V2 Beta app, see our Discord channel to access testing.&lt;br /&gt;
&lt;br /&gt;
===Raspberry Pi 3 Notes===&lt;br /&gt;
Enable Fake KMS under advanced boot options:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo raspi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go to Advanced Options -&amp;gt; GL Driver -&amp;gt; Select OpenGL desktop driver with fake KMS&lt;br /&gt;
&lt;br /&gt;
* Be sure to reboot after exiting raspi-config&lt;br /&gt;
&lt;br /&gt;
==Installing dependencies==&lt;br /&gt;
===Activate ssh===&lt;br /&gt;
Ssh is used to store passwords used by the app. Steps to ensure it is running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo raspi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go under Advanced Options and start the ssh service. &lt;br /&gt;
&lt;br /&gt;
Next, at the command prompt enter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh-add&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to create at least one key.&lt;br /&gt;
&lt;br /&gt;
===Install package dependencies===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install mesa-utils libgles2 libegl1-mesa libegl-mesa0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Change the default password===&lt;br /&gt;
For maximum security, change the password for the default user &#039;pi&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;gt; passwd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and specify a new, secure password.&lt;br /&gt;
&lt;br /&gt;
===Configure Raspberry Pi base settings===&lt;br /&gt;
====Enable WiFi====&lt;br /&gt;
If you want network capability in addition to the ethernet connection, [https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md enable and configure WiFi per the official documentation]&lt;br /&gt;
&lt;br /&gt;
====(Optional) Enable SSH====&lt;br /&gt;
You can optionally enable SSH for remote management from the comfort of your main computer&#039;s keyboard and screen. &lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.org/documentation/remote-access/ssh/ Enable and configure ssh per the official documentation]&lt;br /&gt;
&lt;br /&gt;
====Install multi-touch tools====&lt;br /&gt;
Install the packages that enable multi-touch interfaces.  Enter the following at the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;gt; sudo apt-get install mtdev-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Configure memory split====&lt;br /&gt;
You&#039;ll need to bump up the memory made available to the GPU. Increase the default value of 64 to &#039;&#039;&#039;256&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Via raspi-config tool&#039;&#039;&#039;&lt;br /&gt;
You can adjust the memory split by running the raspi-config tool. See the [https://www.raspberrypi.org/documentation/configuration/raspi-config.md official documentation]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Editing /boot/config.txt&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can adjust the value directly by editing the /boot/config.txt file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;gt; sudo nano /boot/config.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the line containing gpu_mem=64 and change the number to 256&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
gpu_mem=256&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Save the file by pressing &#039;&#039;&#039;ctrl-x&#039;&#039;&#039; then  press &#039;&#039;&#039;Y&#039;&#039;&#039;  to confirm.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Installing the RaceCapture app package==&lt;br /&gt;
&lt;br /&gt;
Download the latest [http://podium.live/software RaceCapture app package for Raspberry Pi] and place it in the /opt/ directory of the Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Directly downloading to the Raspberry Pi&#039;&#039;&#039;&lt;br /&gt;
You can download it directly by getting the URL of the package by right-clicking the download link and copying the URL to your clipboard. Then, use it in the command below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /opt&lt;br /&gt;
sudo wget &amp;lt;package URL&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Extract the package===&lt;br /&gt;
Now extract the downloaded package :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo tar -xjvf &amp;lt;downloaded file&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Launch the app===&lt;br /&gt;
Launch the RaceCapture app by running the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/opt/racecapture/run_racecapture.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Launching with Watchdog===&lt;br /&gt;
You can enable an automatic watchdog that re-launches the app in case a crash occurs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/opt/racecapture/run_racecapture.sh -w 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Note:&#039;&#039;&#039; You can break out of the application by issuing &#039;&#039;&#039;Alt + PrntScn + k&#039;&#039;&#039; to the application. &lt;br /&gt;
&lt;br /&gt;
You can further stop all racecapture processes by issuing the following command (e.g. via ssh)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
killall -9 run_racecapture&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Automatic start upon power up==&lt;br /&gt;
To get the full dedicated dashboard experience, you can enable automatic launch of the RaceCapture app upon power up. &lt;br /&gt;
&lt;br /&gt;
To do this, edit the system&#039;s startup file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo nano /etc/rc.local&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and add the following line &#039;&#039;&#039;before the exit 0&#039;&#039;&#039; line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/opt/racecapture/boot_racecapture.sh pi&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Save the file by pressing &#039;&#039;&#039;ctrl-x&#039;&#039;&#039; then  press &#039;&#039;&#039;Y&#039;&#039;&#039;  to confirm.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Connecting to your RaceCapture system=&lt;br /&gt;
[[image:racecapture_raspberry_pi_connections.jpg|900px]]&lt;br /&gt;
===Powering up===&lt;br /&gt;
* Connect the power to your display and power up. &lt;br /&gt;
* Connect your RaceCapture/Pro or RaceCapture/Track to the Raspberry Pi using the USB cable.  &lt;br /&gt;
&lt;br /&gt;
* Launch the RaceCapture app by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/opt/racecapture/run_racecapture.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have it set to launch automatically, simply let it start upon power-up.&lt;br /&gt;
&lt;br /&gt;
===Connection and usage===&lt;br /&gt;
&lt;br /&gt;
Once the RaceCapture App is running, it will connect automatically over USB.  You can use the app just as you would on Android or iOS.&lt;br /&gt;
&lt;br /&gt;
=Extra Features=&lt;br /&gt;
&lt;br /&gt;
===Hardwire buttons===&lt;br /&gt;
&lt;br /&gt;
The RaceCapture app responds to keyboard commands for certain behaviors. You can use a USB keyboard - or a device that emulates keyboard commands - to control the RaceCapture App.&lt;br /&gt;
&lt;br /&gt;
Currently there are keyboard commands for the following:&lt;br /&gt;
* &#039;&#039;&#039;Navigating dashboard screens&#039;&#039;&#039;  - Use the left and right arrow keys to switch between screens&lt;br /&gt;
* &#039;&#039;&#039;Escaping from screens / menus&#039;&#039;&#039; - The Escape key can be used to exit out of screens and options, just like the &#039;back&#039; button on Android.&lt;br /&gt;
* &#039;&#039;&#039;Acknowledging alerts&#039;&#039;&#039; - Use the following keys to acknowledge alerts, including responding to pit-to-car alerts:&lt;br /&gt;
** K : to indicate &#039;Yes&#039; or &#039;OK&#039;&lt;br /&gt;
** N : to indicate &#039;No&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Additional Tips=&lt;br /&gt;
See this link for additional tips on how to setup the Pi and speed up the boot times.  This should be especially helpful for beginners.&lt;br /&gt;
&lt;br /&gt;
https://wiki.autosportlabs.com/Raspberry_Pi_Tips&lt;/div&gt;</summary>
		<author><name>Imdacrocker</name></author>
	</entry>
	<entry>
		<id>https://wiki.autosportlabs.com/index.php?title=Raspberry_Pi_Tips&amp;diff=8472</id>
		<title>Raspberry Pi Tips</title>
		<link rel="alternate" type="text/html" href="https://wiki.autosportlabs.com/index.php?title=Raspberry_Pi_Tips&amp;diff=8472"/>
		<updated>2019-11-02T03:58:58Z</updated>

		<summary type="html">&lt;p&gt;Imdacrocker: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
I started out my Raspberry Pi project as a beginner to all things Pi.  There was lots of useful information in the forums, but I still had to learn a lot along the way.  Although I don&#039;t spell out every detail, this page should help beginners along.  All of the &amp;quot;boxes&amp;quot; are text that you will type in or see on the screen.  Unless otherwise instructed, press the &amp;quot;Enter&amp;quot; key after typing the text.&lt;br /&gt;
&lt;br /&gt;
I started with a writeup by PS14 on the forums, then added my own notes and additional sections.  Huge thanks to PS14 for their awesome notes!&lt;br /&gt;
&lt;br /&gt;
You can pick and choose which sections in these Tips may be appropriate for you.  Depending on  your setup, not all of them will be.&lt;br /&gt;
&lt;br /&gt;
=Install Raspbian Stretch Lite on MicroSD card=&lt;br /&gt;
*Choose the fastest MicroSD card you can for fastest boot times.  32gb is plenty big and reasonably cheap.  Class 10 is preferred.  I used this one:&lt;br /&gt;
** https://www.amazon.com/gp/product/B06XYHN68L/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1&lt;br /&gt;
*On a computer, format the card to FAT32 format&lt;br /&gt;
*Download the latest Raspberry Pi Image to the computer&lt;br /&gt;
**Stretch Lite - https://www.raspberrypi.org/downloads/raspbian/&lt;br /&gt;
*Write the image to the SD card using Win32DiskImager (or alternate method)&lt;br /&gt;
**https://raspberry-projects.com/pi/pi-operating-systems/win32diskimager&lt;br /&gt;
**Mac users - https://www.tweaking4all.com/hardware/raspberry-pi/applepi-baker-v2/?fbclid=IwAR27PN0QA5QpTNQRhU2sJF9hP53N8Dz36iDZZezMQlAoF40p3SsLXQScp_c&lt;br /&gt;
&lt;br /&gt;
=Start Pi and Update OS=&lt;br /&gt;
*Place the MicroSD card in the Pi, connect a LAN cable to the Pi&#039;s Cat5 connection for internet access, connect a keyboard, monitor, (and mouse if you wish), then power up.&lt;br /&gt;
*You will be asked to login to the device:&lt;br /&gt;
**Login: pi&lt;br /&gt;
**Password: raspberry&lt;br /&gt;
*Once you have a blinking command line prompt, update to the latest packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
sudo apt-get dist-upgrade&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*You will be asked if you would like to continue, press &amp;quot;Y&amp;quot; and press enter&lt;br /&gt;
*Once the upgrade is done, clean the upgrade junk&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt-get clean&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Tweak the Pi’s config to make it startup and run faster=&lt;br /&gt;
*Open the console based raspi-config application:&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo raspi-config&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Use the up and down arrow keys to move the highlighted selection between the options available. Pressing the right arrow key will jump out of the Options menu and take you to the &amp;lt;Select&amp;gt; and &amp;lt;Finish&amp;gt; buttons. Pressing left will take you back to the options. Alternatively, you can use the Tab key to switch between these.&lt;br /&gt;
*Highlight #3 Boot Options, hit the right arrow key, and press enter.&lt;br /&gt;
*Choose Desktop/CLI as Pi&lt;br /&gt;
**Choose B2 Console Autologin (with this you will no longer need to enter the password every time the Pi boots up) and press enter&lt;br /&gt;
*Highlight #4 Localisation Options and hit enter.  I live in the Eastern Timezone of the US - customize these selections to your location.&lt;br /&gt;
**Choose I1 Change Locale&lt;br /&gt;
**Uncheck en_GB.UTF-8 UTF-8 by hitting the spacebar&lt;br /&gt;
**Check en_US.UTF-8 UTF-8 by hitting the spacebar&lt;br /&gt;
**Hit tab so OK is highlighted and hit enter&lt;br /&gt;
**Choose en_US.UTF-8, hit tab to highlight Ok, and hit enter&lt;br /&gt;
**Choose I2 Change Timezone and hit enter&lt;br /&gt;
**Choose US, hit tab to highlight Ok, and hit enter&lt;br /&gt;
**Choose Eastern, hit tab to highlight Ok, and hit enter&lt;br /&gt;
**Choose I4 Change Wi-Fi Country and hit enter&lt;br /&gt;
**Scroll down to US United States, hit tab to highlight Ok, and hit enter&lt;br /&gt;
**Hit enter&lt;br /&gt;
*Highlight #7 Advanced Options&lt;br /&gt;
*Choose A3 Memory split and change 64 to 256 and press enter&lt;br /&gt;
*Exit out of menu and hit enter with “Yes” selected to reboot&lt;br /&gt;
*When the Pi reboots you should now be auto logged in as user &amp;quot;Pi&amp;quot; and have a blinking command line prompt&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo nano /boot/cmdline.txt&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Inside this file, append the following to the end of the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;quiet splash loglevel=0 logo.nologo&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Save the file by pressing Ctrl + X, type Y, and hit enter&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo nano /boot/config.txt&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Add the following line to the bottom of the file:&lt;br /&gt;
&amp;lt;pre&amp;gt;disable_splash=1&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Save the file by pressing Ctrl + X, type Y, and hit enter&lt;br /&gt;
*If you are not using the Pi’s internet,wifi or bluetooth during racing, you can turn these services off to boot up faster. They are easily turned back on when you need to do updates.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo systemctl stop dhcpcd.service&lt;br /&gt;
sudo systemctl disable dhcpcd.service&lt;br /&gt;
sudo systemctl stop hciuart.service&lt;br /&gt;
sudo systemctl disable hciuart.service&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*When you need to use the internet to update Pi or RaceCapture, simply enable and start the same services.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo systemctl enable dhcpcd.service&lt;br /&gt;
sudo systemctl start dhcpcd.service&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Change keyboard to US=&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo nano /etc/default/keyboard&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Change XKBLAYOUT from “gb” to “us”&lt;br /&gt;
*Save the file by pressing Ctrl + X, type Y, and hit enter&lt;br /&gt;
&lt;br /&gt;
=Installing the RaceCapture App=&lt;br /&gt;
*Change to the /opt directory to install the RaceCapture app&lt;br /&gt;
&amp;lt;pre&amp;gt;cd /opt&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Download the RaceCapture app.  Update the URL below for the version that you want.  This is the latest version as of 2019-07-08.&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo wget https://autosportlabs-software.s3-us-west-2.amazonaws.com/racecapture_linux_raspberrypi_1.16.0.tar.bz2&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Extract the downloaded package.  Hit the tab key after typing &amp;quot;race&amp;quot; and it should autofill the name for you so you don&#039;t have to type it all out.&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo tar -xjvf race...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Setup for Mausberry circuit=&lt;br /&gt;
The Mausberry circuit is a great way to power the Pi on/off with the ignition and (hopefully) prevent the MicroSD card from becoming corrupt.&lt;br /&gt;
*Here is the link.  Follow the instructions for Raspbian distributions (or just follow the instructions below).&lt;br /&gt;
**https://mausberry-circuits.myshopify.com/pages/car-setup&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget http://files.mausberrycircuits.com/carsetup.sh&lt;br /&gt;
sudo bash carsetup.sh&lt;br /&gt;
sudo reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*If you want, you can change the minute multiplier in the carsetup.sh file to “60” to change it to seconds.  I set my delay to 1 and minutes multiplier to 5, so my delay is 5 seconds.&lt;br /&gt;
&lt;br /&gt;
=Make the RaceCapture app Auto-start=&lt;br /&gt;
*I recommend waiting until you have everything configured the way you want before making the app auto-start.  &lt;br /&gt;
&amp;lt;pre&amp;gt;sudo nano /etc/rc.local&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Add the following line before the exit 0 line:&lt;br /&gt;
&amp;lt;pre&amp;gt;/opt/racecapture/boot_racecapture.sh pi&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Save the file by pressing Ctrl + X, type Y, and hit enter.&lt;br /&gt;
*Reboot to take effect.&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo reboot&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Set up for DFRobot display=&lt;br /&gt;
*If you use the official Pi display, there&#039;s not much setup  to do.  If you choose another display, you may need to configure it.  I chose to use a 7&amp;quot; DFRobot display:&lt;br /&gt;
**[https://bit.ly/2YwRkrj DFRobot Instructions]&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo nano /boot/config.txt&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Uncomment this line:&lt;br /&gt;
&amp;lt;pre&amp;gt;disable_overscan=1&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Add this line:&lt;br /&gt;
&amp;lt;pre&amp;gt;hdmi_cvt 1024 600 60 6 0 0 0&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Uncomment and modify these two lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hdmi_group=2 &lt;br /&gt;
hdmi_mode=87&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Save the file by pressing Ctrl + X, type Y, and hit enter.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Cd /opt/racecapture/&lt;br /&gt;
Sudo nano run_racecapture.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Comment out both checks for &amp;quot;check for ar1100 resistive touch&amp;quot; and &amp;quot;check for ft5406 capacitive touch&amp;quot; by putting a # symbol at the front of the line&lt;br /&gt;
*Change kivy settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;Sudo nano /home/pi/.kivy/config.ini&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Add these lines to the input section of the file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[input] &lt;br /&gt;
mouse = mouse &lt;br /&gt;
mtdev_%(name)s = probesysfs,provider=mtdev&lt;br /&gt;
hid_%(name)s = probesysfs,provider=hidinput&lt;br /&gt;
#%(name)s = probesysfs,provider=hidinput&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Save the file by pressing Ctrl + X, type Y, and hit enter.&lt;br /&gt;
&lt;br /&gt;
=General Notes and Commands=&lt;br /&gt;
===Run Racecapture manually===&lt;br /&gt;
*If you don&#039;t set it up to run automatically, you&#039;ll have to use this command to run it manually.  &lt;br /&gt;
&amp;lt;pre&amp;gt;/opt/racecapture/run_racecapture.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Make cursor visible===&lt;br /&gt;
*This may cause lag in the dashboard so it&#039;s not recommended except for setup if you elect to use a mouse&lt;br /&gt;
&amp;lt;pre&amp;gt;Sudo nano /home/pi/.kivy/config.ini&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Add this to the modules ection&lt;br /&gt;
&amp;lt;pre&amp;gt;cursor = 1&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Save the file by pressing Ctrl + X, type Y, and hit enter&lt;br /&gt;
&lt;br /&gt;
===Exit RaceCapture===&lt;br /&gt;
*Depending on how you have this setup, it may be tricky.  This method usually works best for when you have RaceCapture auto-boot.&lt;br /&gt;
**Alt + PrintScreen + K , followed by exiting the app via touch screen&lt;br /&gt;
&lt;br /&gt;
To kill the watchdog  loop until the next restart, you can use the following command:&lt;br /&gt;
&amp;lt;pre&amp;gt; killall -9 run_racecapture.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Manually shutdown pi===&lt;br /&gt;
&amp;lt;pre&amp;gt;Sudo Shutdown -h now&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Manually restart PI===&lt;br /&gt;
&amp;lt;pre&amp;gt; sudo reboot&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rotate screen 180*===&lt;br /&gt;
*This just rotates the display, but does not rotate the touch settings&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo nano /boot/config.txt&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Add this line:&lt;br /&gt;
&amp;lt;pre&amp;gt;display_rotate=2&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Save the file by pressing Ctrl + X, type Y, and hit enter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*If you have a touch screen, you will need to rotate the touch settings for RaceCapture&lt;br /&gt;
&amp;lt;pre&amp;gt;Sudo nano /home/pi/.kivy/config.ini&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Modify this line:&lt;br /&gt;
&amp;lt;pre&amp;gt;mtdev_%(name)s = probesysfs,provider=mtdev,param=rotation=180&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Save the file by pressing Ctrl + X, type Y, and hit enter.&lt;br /&gt;
&lt;br /&gt;
===Transfer RaceCapture from Pi to another device (or vice versa)===&lt;br /&gt;
*I like to keep the dashboard settings similar between my phone, laptop, and in-dash screen.  Once you follow the directions in the link, you can save the config file from RaceCapture to the thumb drive and transfer it between devices.  In my experience, this was not a foolproof and reliable solution and required a bit of playing around with it, but it&#039;s the easiest solution I found.&lt;br /&gt;
**https://www.raspberrypi-spy.co.uk/2014/05/how-to-mount-a-usb-flash-disk-on-the-raspberry-pi/&lt;/div&gt;</summary>
		<author><name>Imdacrocker</name></author>
	</entry>
</feed>