User Manual

www.geolink.io
User Manual (1.3) OpenTracker 2 17
Voltage detection VDET (ignition detection)
The voltage detection is designed to give feedback about the power status. If the Pin VDET is connected to
the Ignition line of a car the Tracker is able to detect a logical 1 (Ignition off) or a logical 0 (ignition on) on
S_DETECT. This is useful to put the tracker asleep or wake it up. VDET is a Digital input.
Operating conditions
VDET Logic 1 (ignition off)
VDET Logic 0 (ignition on)
MIN
MAX
MIN
MAX
V input
0VDC
< 0,7VDC
> 2VDC
32VDC
Using Ignition detection (VDET)
The ignition detection is a simple Input to detect if the vehicle is started. By adding code the user can define
what to do when ignition is turned on / off. In this example the Tracker will print a string to the debug port.
1. #define DEBUG 1 //enable debug msg, sent to serial port
2. #define debug_port SerialUSB
3.
4. #ifdef DEBUG
5. #define debug_print(x) debug_port.print(x)
6. #else
7. #define debug_print(x)
8. #endif
9.
10.
11. void setup() {
12.
13. // Ignition detection
14. pinMode(PIN_S_DETECT, INPUT); // Initialize pin as input
15.
16. }
17.
18. void loop() {
19.
20. // Check If Ignition is on
21. if (digitalRead(PIN_S_DETECT) == LOW)
22. debug_print(F("Ignition detected!"));
23. }