# Products


# VALTRACK-V4-VTS-IO-INT-LTE

The awesome vehicle tracker

{% hint style="info" %}
You should find majority of the details needed for using the hardware here
{% endhint %}

### ⚡ Introduction

VALTRACK-V4-VTS as the name itself depicts, is a fully configurable low power Vehicle Tracking System device. It was designed to be versatile and flexible enough to fit into any vehicle tracking scenario, be it for tracking 🚲 Bikes, 🚗 Cars or 🚚 Trucks.

* [Features](/wiki/products/valtrack-v4-vts-io-int-lte/features)
* [Specifications](/wiki/products/valtrack-v4-vts-io-int-lte/specifications)
* [Getting Started](/wiki/products/valtrack-v4-mf/getting-started)
* [Programming Details](/wiki/products/valtrack-v4-vts-io-int-lte/programming)
* [PCB Design](/wiki/products/valtrack-v4-vts-io-int-lte/pcb-design)
* [Firmware versions](/wiki/products/valtrack-v4-vts-io-int-lte/firmware-versions)


# Features

{% hint style="info" %}
Here you will get a brief idea on what the device is capable of and the important features
{% endhint %}

### Power section :

The device has two power inputs,

![VALTRACK-V4-VTS Power section](/files/lAdt9zb9oJBEmxiWsE9b)

#### 1) Main Power input - VCHG :

This is the main power input of the device and is usually connected to the vehicles battery. Right now the device supports from 12VDC to 42VDC input range. When you power the device from VCHG it also charges the battery connected to VBAT input. The main power chip used here is the TPS54240 switching regulator.

#### 2) Backup battery power input - VBAT

This is the back up battery input and a 3.7V to 4.2V LiPo battery has to be connected to it. Use at least 400mAH battery. The main power chip used here is the MP2617 switching battery charger with power path management.

To understand the power section of the device, look at the block diagram.


# Specifications

<table data-header-hidden><thead><tr><th width="210"></th><th></th></tr></thead><tbody><tr><td><strong>Model No.</strong></td><td>VALTRACK-V4-VTS [IO-INT-LTE]</td></tr><tr><td><strong>Operating Voltage</strong></td><td><ul><li>Main Power Input : 12V to 42V DC [Connect to 12V Lead Acid Battery]</li></ul><p><span data-gb-custom-inline data-tag="emoji" data-code="26a1">⚡</span><em><mark style="color:green;"><code>Has Reverse Polarity Protection</code></mark></em></p></td></tr><tr><td></td><td><p>Backup Battery Input : 3.7V to 4.2V DC [Connect a single cell 3.7V-4.2V Li-Po or Li-Ion Battery]</p><p></p><p><span data-gb-custom-inline data-tag="emoji" data-code="26a0">⚠️</span> <em><mark style="color:orange;"><code>Doesn't have Reverse Polarity Protection</code></mark></em></p></td></tr><tr><td><strong>Dimensions</strong></td><td>With Enclosure - Length: 52mm * Width: 65mm * Height: 30 mm</td></tr><tr><td></td><td>PCB Dimensions - Length: 34mm * Width: 43mm * Thickness: 1.6 mm</td></tr><tr><td><strong>Battery Support</strong></td><td><ul><li>3.7V-4.2V DC Li-Po backup battery is supported.</li><li>Use > 400mAH capacity battery.</li><li>MP2617 Charger chip is used to handle the battery charging.</li></ul></td></tr><tr><td><strong>Cellular module</strong></td><td>SIM7600G - LTE 3G 2G - For Global use</td></tr><tr><td></td><td>SIM7600E - LTE 3G 2G - For Europe</td></tr><tr><td></td><td>SIM7600A - LTE 3G 2G - For North America</td></tr><tr><td><strong>Navigation hardware</strong></td><td>SE868K3AL GNSS module comes with inbuilt patch antenna</td></tr><tr><td></td><td>SIM7600x has inbuilt GNSS hardware which needs external active antenna [Bias is already provided to the GNSS U.FL connector]</td></tr><tr><td><strong>Aux Inputs</strong></td><td>None</td></tr><tr><td><strong>Aux Outputs</strong></td><td>1x Relay Output (MOSFET DRIVERS) [Optional]</td></tr><tr><td><strong>Operating Modes</strong></td><td>HTTP, SMS, MQTT/TCP</td></tr><tr><td><strong>Configuration Methods</strong></td><td>Bluetooth 5.0 available on board can be used to configure the device using the VALTRACK-V4 Setup application.</td></tr><tr><td><strong>Processor</strong></td><td>STM32WB55CEU6 ARM Cortex M4 , 64MHz, 512KB of Flash memory</td></tr><tr><td><strong>Motion Sensor</strong></td><td>LIS3DH 12-bit, 3-axis Accelerometer</td></tr><tr><td><strong>Memory</strong></td><td>1-Mbit / 128KB EEPROM for storing parameters and lost pings.</td></tr><tr><td><strong>Antenna</strong></td><td><p>📶 Cellular : U.FL Connector</p><ul><li>1.5 dBi gain Flexible PCB antenna comes attached</li></ul></td></tr><tr><td></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="1f6f0">🛰️</span> SIM7600x GNSS : U.FL Connector</p><ul><li>Patch antenna comes attached</li></ul><p><em><mark style="color:orange;"><code>Available on request only !</code></mark></em></p></td></tr><tr><td></td><td>🛰 SE868K3L GNSS : Inbuilt antenna</td></tr><tr><td><strong>Connectivity</strong></td><td>Bluetooth, GPRS, SMS, Call</td></tr><tr><td><strong>SIM connector</strong></td><td>Nano SIM card connector available</td></tr><tr><td><strong>Flashing options</strong></td><td>SWD Debug port available on a FFC connector [10 pin, 0.5mm pitch ]</td></tr><tr><td></td><td> MCU can be flashed Over The Air (OTA) using Bluetooth interface</td></tr><tr><td><strong>Enclosure</strong></td><td>Device ships in a standard IP67 rated enclosure.</td></tr></tbody></table>


# Getting Started

![](/files/A1QEtROpsDj0a2SsNpxB)

### Opening the enclosure

You need to remove the four screws present in the bottom of the enclosure to open it. Use a star head screw driver.

### Inserting the SIM card

Get a Nano-SIM card and insert it into the boards push-pull type SIM card slot.

Power should not be connected to the device during SIM card insertion

### Powering the device

VALTRACK-V4-VTS can run from any of the two power sources,

![](/files/vKAItEOAOnNcFJ7JiSfu)

<table data-header-hidden><thead><tr><th width="227"></th><th></th></tr></thead><tbody><tr><td><p><strong>Main Power Input</strong></p><p>[VCHG connector]</p></td><td><ul><li>Can take 12V to 42V DC [Connect to 12V Lead Acid Battery]</li><li>Its a JST type connector</li></ul><p>Has Reverse Polarity Protection</p></td></tr><tr><td><p><strong>Backup Battery Input</strong></p><p>[VBAT connector]</p></td><td><ul><li>Can take 3.7V to 4.2V DC [Connect a single cell 3.7V-4.2V Li-Po or Li-Ion Battery]</li><li>Use at least 500mAH and above capacity batteries</li><li>The battery connected to this port automatically gets charged by VCHG.</li><li>Its a JST-XH type connector</li></ul><p>Doesn't have Reverse Polarity Protection</p></td></tr></tbody></table>

Device can start functioning with any of above power sources.

### LED Indicators

* Once the device is powered ON, The LED will show up and start with all RED .
* Once the SIM is registered to the network, the NETWORK LED turns GREEN .
* Once the GNSS module gets a location sync, the LOCATION LED turns GREEN .
* After 30 seconds of inactivity, all LED will turn OFF to save power and turn ON again on movement detected by Accelerometer.
* POWER LED remains RED all the time


# Configuration

You will find information about parameter configuration by Bluetooth here

There is a mobile application presently only available for Android being developed, which supports updating of parameters using the on board Bluetooth 5 interface.

When you power on the device, it presents itself with the name **P2PSRV1**

The device runs a Custom P2P server Bluetooth profile code which exposes a few characteristics to be written to or read from to interact with the device.

Here are the Bluetooth interface details you need to be able to read and write from the device,

#### Service UUID : 0000fe40-cc7a-482a-984a-7f2ed5b3e58f

#### TX Characteristic : 0000fe41-8e22-4541-9d4c-21edae82ed19

#### Rx Characteristic : 0000fe42-8e22-4541-9d4c-21edae82ed19

Transmission and reception is from phones perspective

### List of parameters supported :

<table data-header-hidden><thead><tr><th width="95"></th><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Index</strong></td><td><strong>Command Name</strong></td><td><strong>Description</strong></td><td><strong>Size [Bytes]</strong></td></tr><tr><td>0</td><td>Band</td><td>Network band to be selected, Best to leave default</td><td>30</td></tr><tr><td>1</td><td>Working Mode</td><td>Devices location sending mode HTTP / TCP / SMS</td><td>5</td></tr><tr><td>2</td><td>Motion Alert Mode</td><td>Alert CALL or SMS or NONE [Only in SMS Working mode]</td><td>5</td></tr><tr><td>3</td><td>Motion Threshold</td><td>Accelerometer threshold from 6 to 25</td><td>1</td></tr><tr><td>4</td><td>Contact Number</td><td>Contact number to be used for sending SMS or CALL</td><td>16</td></tr><tr><td>5</td><td>APN Name</td><td>Your network providers APN name</td><td>20</td></tr><tr><td>6</td><td>APN User Name</td><td>Your network providers APN user name if any</td><td>20</td></tr><tr><td>7</td><td>APN Password</td><td>Your network providers APN password if any</td><td>20</td></tr><tr><td>8</td><td>HTTP URL</td><td>URL of HTTP post request made in HTTP mode</td><td>150</td></tr><tr><td>9</td><td>HTTP Key</td><td>Any AUTH key of HTTP post request made in HTTP mode</td><td>100</td></tr><tr><td>A</td><td>Ping Interval</td><td>Location sending interval in seconds</td><td>4</td></tr><tr><td>B</td><td>MQTT Host</td><td>IP / Domain of MQTT broker in MQTT/TCP mode</td><td>30</td></tr><tr><td>C</td><td>MQTT Port</td><td>Port of MQTT broker accepting data in MQTT/TCP mode</td><td>10</td></tr><tr><td>D</td><td>MQTT Client ID</td><td>MQTT client ID of MQTT broker in MQTT/TCP mode</td><td>20</td></tr><tr><td>E</td><td>MQTT Topic</td><td>MQTT Topic of MQTT broker in MQTT/TCP mode</td><td>30</td></tr><tr><td>F</td><td>MQTT Protocol Name</td><td>Protocol name of MQTT broker in MQTT/TCP mode</td><td>10</td></tr><tr><td>G</td><td>MQTT LVL</td><td>LVL value of MQTT broker in MQTT/TCP mode</td><td>1</td></tr><tr><td>H</td><td>MQTT Flags</td><td>Flags used in MQTT packets in MQTT/TCP mode</td><td>1</td></tr><tr><td>I</td><td>MQTT Keep Alive</td><td>Keep alive interval for MQTT connection</td><td>4</td></tr><tr><td>J</td><td>MQTT User Name</td><td>MQTT authentication user name</td><td>30</td></tr><tr><td>K</td><td>MQTT Password</td><td>MQTT authentication password</td><td>35</td></tr><tr><td>Z</td><td>Return or Exit Bluetooth</td><td>Returns from the Bluetooth loop and restarts device</td><td>0</td></tr></tbody></table>

### Writing new parameter values to the device :

When you want to update a parameters value, you need to write to the TX characteristic given above.

The format to write data is as follows,

InputData = '$VALETRON:' + InputIndex + '-' + $('#i'+InputID).val() + '#';

If you look at the above line, its a JavaScript line which forms the command to be sent to the device.

ex.,

if you want to update the Contact Number parameter to 1234567890, the command will become,

**$VALETRON:4-1234567890#**

Here the content between **-** (hyphen) and **#** (hash) characters which is **1234567890** will be written to the Contact Number parameter whose index is **4**.

**“$VALETRON:”** is the header and the **“#”** is like the footer which help the device to parse the command easily.

Once you have formed this command, you have to send the command, in a certain byte format to the device, Look at this code JavaScript code below,

```
for(var i=0;i<InputData.length;i++)
{
    data1[0] = 0x01; // Packet Identifer - Parameter Ppdate Packet
    data1[1] = InputData.charCodeAt(i);
            
    ble.writeWithoutResponse(
        deviceId,
        bluefruit.serviceUUID,
        bluefruit.txCharacteristic,
        data1.buffer, success, failure
    );
}
```

Here we are sending 0x01 as the first byte and our command byte as the second byte. Here 0x01 is a packet identifier that indicates to the device that the byte that follows is a parameter update data.

ex.,

Our data will be sent to device like this,

0x01, $

0x01, V

0x01, A etc

### Reading values from the device :

When you want to read anything from the device, you subscribe to the RX characteristic given above.

Whenever a data is available, the phone is notified by Bluetooth.

When you want to manually read the parameters, Everything explained above holds good and you just need to replace the first byte, which is the packet identifier with data1\[0] = 0x02; to indicate that its a parameter read command in below code snippet.

```
for(var i=0;i<InputData.length;i++)
{
    data1[0] = 0x02; // Packet Identifer - Parameter Read Packet
    data1[1] = InputData.charCodeAt(i);
            
    ble.writeWithoutResponse(
        deviceId,
        bluefruit.serviceUUID,
        bluefruit.txCharacteristic,
        data1.buffer, success, failure
    );
}
```

Here we are sending 0x02 as the first byte and our command byte as the second byte. Here 0x02 is a packet identifier that indicates to the device that the byte that follows is a parameter read data.

ex.,

Our data will be sent to device like this,

0x02, $

0x02, V

0x02, A etc

For example,

You can read the contact number parameter with **$VALETRON:4-000#** command.


# Programming

Here you will find the details needed for develop your own firmware for the device

If you are interested in writing firmware for the VALTRACK-V4-VTS device, you will need to know where is each pin of MCU is connected to.

Since the schematics of the device is not yet openly available, We are providing the MCU pin connection details, which should be able to help you in determining how is the whole architecture laid out. Watching our device intro video would also help to get an overall idea on the hardware present on board.

### MCU Pinout Details

<table data-header-hidden><thead><tr><th width="129"></th><th width="181"></th><th width="135"></th><th></th></tr></thead><tbody><tr><td><strong>Pin Number</strong></td><td><strong>Pin Name</strong></td><td><strong>Net Name</strong></td><td><strong>Connected to</strong></td></tr><tr><td>1</td><td>VBAT</td><td>3VDC</td><td>3VDC</td></tr><tr><td>2</td><td>PC14-OSC32_IN</td><td>CLK_IN</td><td>32.768 KHz crystal</td></tr><tr><td>3</td><td>PC15-OSC32_OUT</td><td>CLK_OUT</td><td>32K.768 KHz crystal</td></tr><tr><td>4</td><td>PH3-BOOT0</td><td>BOOT0</td><td>BOOT0 pull down resistor</td></tr><tr><td>5</td><td>PB8</td><td>NET_LED_R</td><td>Network - RED LED - Cathode pin</td></tr><tr><td>6</td><td>PB9</td><td>NET_LED_G</td><td>Network - GREEN LED - Cathode pin</td></tr><tr><td>7</td><td>NRST</td><td>RESET</td><td><p>Debug connector MCU Reset lines via RC network</p><ul><li>J60 pin no 1</li><li>J56 pin no 6</li></ul></td></tr><tr><td>8</td><td>VDDA</td><td>3VDC</td><td>3VDC</td></tr><tr><td>9</td><td>PA0</td><td>SIM_PWRKEY_3V3</td><td><p>SIM7600x PWRKEY pin through N channel MOSFET.</p><ul><li>Making this pin HIGH pulls PWRKEY pin to GND</li></ul></td></tr><tr><td>10</td><td>PA1</td><td>DTR_3V3</td><td>SIM7600x DTR input pin through level translator.</td></tr><tr><td>11</td><td>PA2 / LPUART1_TX</td><td>LPUART1_TX</td><td>SIM7600x RXD input pin through level translator.</td></tr><tr><td>12</td><td>PA3 / LPUART1_RX</td><td>LPUART1_RX</td><td>SIM7600x TXD output pin through level translator.</td></tr><tr><td>13</td><td>PA4</td><td>ANALOG_IN</td><td><p>VCHG input through voltage divider resistor network.</p><ul><li>R22,R33 govern the voltage at this pin.</li><li>Default values : R22 = 100K, R33 = 23.7K, effectively giving 2.87V for VCHG = 15V</li></ul></td></tr><tr><td>14</td><td>PA5</td><td>GEN_LED_B</td><td>Location - BLUE LED - Cathode pin</td></tr><tr><td>15</td><td>PA6</td><td>NET_LED_B</td><td>Network - BLUE LED - Cathode pin</td></tr><tr><td>16</td><td>PA7</td><td>BAT_LED_R</td><td>Battery - RED LED - Cathode pin</td></tr><tr><td>17</td><td>PA8</td><td>RELAY</td><td><p>RELAY MOSFET driver Gate Input</p><ul><li>Open drain driver with Drain pin of MOSFET exposed on a connector</li></ul></td></tr><tr><td>18</td><td>PA9 / USART1_TX</td><td>UART_TX1</td><td>SE868K3AL RX0 input pin</td></tr><tr><td>19</td><td>PB2</td><td>GEN_LED_G</td><td>Location - GREEN LED - Cathode pin</td></tr><tr><td>20</td><td>VDD</td><td>3VDC</td><td>3VDC</td></tr><tr><td>21</td><td>RF1</td><td>RF1</td><td>Bluetooth PCB antenna via matching network</td></tr><tr><td>22</td><td>VSSRF</td><td>GND</td><td>System Ground</td></tr><tr><td>23</td><td>VDDRF</td><td>3VDC</td><td>3VDC</td></tr><tr><td>24</td><td>OSC_OUT</td><td>OSC_OUT</td><td>32 MHz crystal</td></tr><tr><td>25</td><td>OSC_IN</td><td>OSC_IN</td><td>32 MHz crystal</td></tr><tr><td>26</td><td>AT0</td><td>ATO</td><td>Not connected</td></tr><tr><td>27</td><td>AT1</td><td>AT2</td><td>Not connected</td></tr><tr><td>28</td><td>PB0</td><td>INT1</td><td>INT1 interrupt output of LIS3DH Accelerometer</td></tr><tr><td>29</td><td>PB1</td><td>GPS_ENABLE</td><td><p>Enable input of power gating MOSFET for SE868K3AL GNSS module</p><ul><li>Making this pin high provides 3VDC to SE868KAL module</li></ul></td></tr><tr><td>30</td><td>PE4</td><td>RELAY1</td><td>Not connected</td></tr><tr><td>31</td><td>VFBSMPS</td><td>VFBSMPS</td><td>3VDC</td></tr><tr><td>32</td><td>VSSSMPS</td><td>GND</td><td>System Ground</td></tr><tr><td>33</td><td>VLXSMPS</td><td>VLXSMPS</td><td>3VDC</td></tr><tr><td>34</td><td>VDDSMPS</td><td>VDDSMPS</td><td>3VDC</td></tr><tr><td>35</td><td>VDD</td><td>3VDC</td><td>3VDC</td></tr><tr><td>36</td><td>PA10 / USART1_RX</td><td>UART1_RX1</td><td>SE868K3AL TX0 output pin</td></tr><tr><td>37</td><td>PA11</td><td>GSM_ENABLE</td><td><p>Enable input of power gating MOSFET for SIM7600x LTE module</p><ul><li>Making this pin high provides ~4VDC to SIM7600x module</li></ul></td></tr><tr><td>38</td><td>PA12</td><td>GEN_LED_R</td><td>Location - RED LED - Cathode pin</td></tr><tr><td>39</td><td>PA13 / JTMS_SWDIO</td><td>SWDIO</td><td><p>Debug connector SWDIO lines</p><ul><li>J60 pin no 3</li><li>J56 pin no 8</li></ul></td></tr><tr><td>40</td><td>VDDUSB</td><td>VDDUSB</td><td>3VDC</td></tr><tr><td>41</td><td>PA14 / JTMS_SWCLK</td><td>SWCLK</td><td><p>Debug connector SWDIO lines</p><ul><li>J60 pin no 2</li><li>J56 pin no 7</li></ul></td></tr><tr><td>42</td><td>PA15</td><td>SOS</td><td><p>Tactile switch input</p><ul><li>Pulled up, filtered and Active LOW</li></ul></td></tr><tr><td>43</td><td>PB3</td><td>BAT_LED_B</td><td>Battery - BLUE LED - Cathode pin</td></tr><tr><td>44</td><td>PB4</td><td>TPS_ENABLE</td><td><p>Enable input of switching regulator TPS54240</p><ul><li>Making this pin high powers the system via VCHG connector.</li></ul><p>Not connected by default as it will cause system into reset loop if no alternate backup battery power available</p></td></tr><tr><td>45</td><td>PB5</td><td>BAT_LED_G</td><td>Battery - BLUE LED - Cathode pin</td></tr><tr><td>46</td><td>PB6 / I2C1_SCL</td><td>IIC_CLK</td><td>I2C clock of LIS3DH Accelerometer and M24M01 EEPROM</td></tr><tr><td>47</td><td>PB7 / I2C1_SDA</td><td>IIC_DATA</td><td>I2C data of LIS3DH Accelerometer and M24M01 EEPROM</td></tr><tr><td>48</td><td>VDD</td><td>3VDC</td><td>3VDC</td></tr></tbody></table>

### J60 - MCU Debug Connector \[SMT pads] - Pinout Details

<table data-header-hidden><thead><tr><th width="122.33333333333331"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Pin Number</strong></td><td><strong>Pin Name</strong></td><td><strong>Connected to</strong></td></tr><tr><td>1</td><td>RESET</td><td>MCU Reset pin</td></tr><tr><td>2</td><td>SWCLK</td><td>MCU SWCLK pin</td></tr><tr><td>3</td><td>SWDIO</td><td>MCU SWDIO pin</td></tr><tr><td>4</td><td>GND</td><td>System Ground</td></tr><tr><td>5</td><td>VCC</td><td>3VDC</td></tr></tbody></table>

### J56 - Flex Debug Connector \[0.5mm 10 pin FFC] - Pinout Details

| **Pin Number** | **Pin Name**   | **Connected to**                                                      |
| -------------- | -------------- | --------------------------------------------------------------------- |
| 1              | SIM\_USB\_DN   | SIM7600x USB\_DN pin                                                  |
| 2              | SIM\_USB\_DP   | SIM7600x USB\_DP pin                                                  |
| 3              | SIM\_USB\_VBUS | SIM7600x USB\_VBUS pin                                                |
| 4              | UART\_RX1      | <ul><li>SE868K3AL TX0 output pin</li><li>MCU USART1\_RX pin</li></ul> |
| 5              | UART\_TX1      | <ul><li>SE868K3AL RX0 input pin</li><li>MCU USART1\_TX pin</li></ul>  |
| 6              | RESET          | MCU Reset pin                                                         |
| 7              | SWCLK          | MCU SWCLK pin                                                         |
| 8              | SWDIO          | MCU SWDIO pin                                                         |
| 9              | GND            | System Ground                                                         |
| 10             | VCC            | 3VDC                                                                  |

### J57 - SIM7600x USB Connector \[SMT pads] - Pinout Details

| **Pin Number** | **Pin Name**   | **Connected to**                                                      |
| -------------- | -------------- | --------------------------------------------------------------------- |
| 1              | SIM\_USB\_DN   | SIM7600x USB\_DN pin                                                  |
| 2              | SIM\_USB\_DP   | SIM7600x USB\_DP pin                                                  |
| 3              | SIM\_USB\_VBUS | SIM7600x USB\_VBUS pin                                                |
| 4              | UART\_RX1      | <ul><li>SE868K3AL TX0 output pin</li><li>MCU USART1\_RX pin</li></ul> |
| 5              | UART\_TX1      | <ul><li>SE868K3AL RX0 input pin</li><li>MCU USART1\_TX pin</li></ul>  |

### J62 - VCHG Connector \[SMT pads] - Pinout Details

| **Pin Number** | **Pin Name** | **Connected to**                                                                         |
| -------------- | ------------ | ---------------------------------------------------------------------------------------- |
| 1              | VCHG         | <p>VCHG input of system through FUSE and diode</p><ul><li>12VDC to 42VDC input</li></ul> |
| 2              | GND          | System Ground                                                                            |

### J41 - VBAT Connector \[SMT pads] - Pinout Details

| **Pin Number** | **Pin Name** | **Connected to**                                                                                |
| -------------- | ------------ | ----------------------------------------------------------------------------------------------- |
| 1              | VBAT         | <p>VBAT input of system or Backup battery input</p><ul><li>3.7V to 4.2V battery input</li></ul> |
| 2              | GND          | System Ground                                                                                   |


# PCB Design


# Firmware Versions


# VALTRACK-V4-VTS-ESP32-C3

The awesome vehicle tracker based on ESP32-C3

{% hint style="info" %}
You should find majority of the details needed for using the hardware here
{% endhint %}

### ⚡ Introduction

VALTRACK-V4-VTS-ESP32-C3 as the name itself depicts, is a fully configurable low power Vehicle Tracking System device. It was designed to be versatile and flexible enough to fit into any vehicle tracking scenario, be it for tracking 🚲 Bikes, 🚗 Cars or 🚚 Trucks.

* [Features](/wiki/products/valtrack-v4-vts-esp32-c3/features)
* [Specifications](/wiki/products/valtrack-v4-vts-esp32-c3/specifications)
* [Getting Started](/wiki/products/valtrack-v4-vts-esp32-c3/getting-started)
* [Programming Details](/wiki/products/valtrack-v4-vts-esp32-c3/programming)
* [Schematics](/wiki/products/valtrack-v4-vts-esp32-c3/schematics)
* [Firmware ](/wiki/products/valtrack-v4-vts-esp32-c3/firmware)
* [Purchase link](https://www.valetron.com/store/valtrack-v4-vts-esp-32-c3-4g-lte-gps-tracker.html)


# Features

{% hint style="info" %}
Here you will get a brief idea on what the device is capable of and the important features
{% endhint %}

### Power section :

The device has two power inputs,

![VALTRACK-V4-VTS Power section](/files/lAdt9zb9oJBEmxiWsE9b)

#### 1) Main Power input - VCHG :

This is the main power input of the device and is usually connected to the vehicles battery. Right now the device supports from 12VDC to 42VDC input range. When you power the device from VCHG it also charges the battery connected to VBAT input. The main power chip used here is the TPS54240 switching regulator.

#### 2) Backup battery power input - VBAT

This is the back up battery input and a 3.7V to 4.2V LiPo battery has to be connected to it. Use at least 400mAH battery. The main power chip used here is the MP2617 switching battery charger with power path management.

To understand the power section of the device, look at the block diagram.


# Specifications

<table data-header-hidden><thead><tr><th width="210"></th><th></th></tr></thead><tbody><tr><td><strong>Model No.</strong></td><td>VALTRACK-V4-VTS [ESP32-C3]</td></tr><tr><td><strong>Operating Voltage</strong></td><td><ul><li>Main Power Input : 12V to 42V DC [Connect to 12V Lead Acid Battery]<br>(60V version available on request)</li></ul><p><span data-gb-custom-inline data-tag="emoji" data-code="26a1">⚡</span><em><mark style="color:green;"><code>Has Reverse Polarity Protection</code></mark></em></p></td></tr><tr><td></td><td><p>Backup Battery Input : 3.7V to 4.2V DC [Connect a single cell 3.7V-4.2V Li-Po or Li-Ion Battery]</p><p></p><p><span data-gb-custom-inline data-tag="emoji" data-code="26a0">⚠️</span> <em><mark style="color:orange;"><code>Doesn't have Reverse Polarity Protection</code></mark></em></p></td></tr><tr><td><strong>Dimensions</strong></td><td>With Enclosure - Length: 52mm * Width: 65mm * Height: 30 mm</td></tr><tr><td></td><td>PCB Dimensions - Length: 34mm * Width: 43mm * Thickness: 1.6 mm</td></tr><tr><td><strong>Battery Support</strong></td><td><ul><li>3.7V-4.2V DC Li-Po backup battery is supported.</li><li>Use > 400mAH capacity battery.</li><li>MP2617 Charger chip is used to handle the battery charging.</li></ul></td></tr><tr><td><strong>Cellular module</strong></td><td>A7672S - 4G-LTE-CAT1 / 2G - For India &#x26; Asia</td></tr><tr><td></td><td>A7672E - 4G-LTE-CAT1 /2G - For Europe</td></tr><tr><td></td><td>A7672SA- 4G-LTE-CAT1 / 2G - For South America, USA &#x26; Australia</td></tr><tr><td></td><td>SIM7672G- 4G-LTE-CAT1 - For Global use</td></tr><tr><td></td><td>SIM7672NA- 4G-LTE-CAT1 - For USA</td></tr><tr><td><strong>Navigation hardware</strong></td><td>Inbuilt GNSS of A7672x</td></tr><tr><td></td><td>A7672x has inbuilt GNSS hardware which needs passive or external active antenna [Bias is already provided to the GNSS U.FL connector]</td></tr><tr><td><strong>Aux Inputs</strong></td><td>None</td></tr><tr><td><strong>Aux Outputs</strong></td><td>None</td></tr><tr><td><strong>Operating Modes</strong></td><td>HTTP, SMS, MQTT/TCP</td></tr><tr><td><strong>Configuration Methods</strong></td><td>USB / Bluetooth (Yet to be implemented)</td></tr><tr><td><strong>Processor</strong></td><td>Espressif ESP32-C3FH4 RISC-V chipset , 2.4GHz WiFi + BLE</td></tr><tr><td><strong>Motion Sensor</strong></td><td>LIS3DH 12-bit, 3-axis Accelerometer</td></tr><tr><td><strong>Memory</strong></td><td>4MB inbuilt flash of ESP32-C3FH4</td></tr><tr><td><strong>Antenna</strong></td><td><p>📶 Cellular : U.FL Connector</p><ul><li>1.5 dBi gain Flexible PCB antenna comes attached</li></ul></td></tr><tr><td></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="1f6f0">🛰️</span> x7672x GNSS : U.FL Connector</p><ul><li>Patch antenna comes attached</li></ul><p><em><mark style="color:orange;"><code>External GNSS is enabled on request only !</code></mark></em></p></td></tr><tr><td></td><td></td></tr><tr><td><strong>Connectivity</strong></td><td>Bluetooth, GPRS, SMS, Call</td></tr><tr><td><strong>SIM connector</strong></td><td>Nano SIM card connector available</td></tr><tr><td><strong>Flashing options</strong></td><td>Micro USB</td></tr><tr><td><strong>Enclosure</strong></td><td>Device ships in a standard IP67 rated enclosure if ordered.</td></tr></tbody></table>


# Purchase info

Board purchase information

### [Click on this link to visit our store for purchasing this board.](https://www.valetron.com/store/valtrack-v4-vts-esp-32-c3-4g-lte-gps-tracker.html)

### Product variants

* Without Enclosure
* With Enclosure

### GNSS Antenna Selection

* Internal Patch antenna
* External antenna

We offer the device with above options, You can order the device only if you want to use it in some other instrument along with other hardware or you can order the device with a IP67 enclosure.&#x20;

We also offer the device with internal GNSS patch antenna or external antenna. If you choose external antenna, we provide a SMA connector on the enclosure(if ordered) and add a bias resistor to power the external active antenna. Then you can connect a external antenna to the board via the U.FL connector. External GNSS antenna option is helpful when you want to install devices in places where there is no direct satellite view. In such cases you can use the external GNSS active antenna shown in below image.&#x20;

<figure><img src="/files/unzSLAaTyxCdUCS99xCO" alt=""><figcaption><p>VALTRACK-V4-VTS-ESP32-C3 enclosures with and without external antenna option  </p></figcaption></figure>

<figure><img src="/files/umHZspfCNPiugBcqXx7O" alt=""><figcaption><p>From Left, (External GNSS antenna device, External GNSS antenna device, Internal GNSS Patch antenna device)</p></figcaption></figure>


# Getting Started

### Opening the enclosure

You need to remove the four screws present in the bottom of the enclosure to open it. Use a star head screw driver.

### Inserting the SIM card

Get a Nano-SIM card and insert it into the boards push-pull type SIM card slot.

Power should not be connected to the device during SIM card insertion

### Powering the device

VALTRACK-V4-VTS-ESP32-C3 can run from any of the two power sources,

<table data-header-hidden><thead><tr><th width="227"></th><th></th></tr></thead><tbody><tr><td><p><strong>Main Power Input</strong></p><p>[VCHG connector]</p></td><td><ul><li>Can take 12V to 42V DC [Connect to 12V Lead Acid Battery]</li><li>Its a JST type connector</li></ul><p>Has Reverse Polarity Protection</p></td></tr><tr><td><p><strong>Backup Battery Input</strong></p><p>[VBAT connector]</p></td><td><ul><li>Can take 3.7V to 4.2V DC [Connect a single cell 3.7V-4.2V Li-Po or Li-Ion Battery]</li><li>Use at least 500mAH and above capacity batteries</li><li>The battery connected to this port automatically gets charged by VCHG.</li><li>Its a JST-XH type connector</li></ul><p>Doesn't have Reverse Polarity Protection</p></td></tr></tbody></table>

Device can start functioning with any of above power sources.

### LED Indicators

* Once the device is powered ON, The LED will show up and start with all RED .
* Once the SIM is registered to the network, the NETWORK LED turns GREEN .
* Once the GNSS module gets a location sync, the LOCATION LED turns GREEN .
* After 30 seconds of inactivity, all LED will turn OFF to save power and turn ON again on movement detected by Accelerometer.
* POWER LED remains RED all the time


# Configuration

VALTRACK-V4-VTS-ESP32-C3 can be configured using Bluetooth. An android application is made available on play store called VALTRACK-V4E-SETUP, which can be used to write and read the device parameters from the flash memory of ESP32-C3.\
\
Procedure is very simple.&#x20;

[Click here to Download the app](https://play.google.com/store/apps/details?id=com.valetron.valtrackv4e\&hl=en_IN\&gl=US)

<div align="left"><figure><img src="/files/cRTgsXMFJKz7Ic314sTZ" alt="https://play.google.com/store/apps/details?id=com.valetron.valtrackv4e&#x26;hl=en_IN&#x26;gl=US" width="162"><figcaption></figcaption></figure></div>

* Turn on Bluetooth and Location
* Open the VALTRACK-V4E-SETUP app.&#x20;
* Turn on the device
* Scan for devices and select CONNECT button infront of VALTRACK-V4-XX device name
* <mark style="color:orange;">Once connected, press on SYNC button to read the services</mark> <mark style="color:red;">**(This is important)**</mark>
* MTU will change to 256&#x20;
* Select the parameter name from Dropdown
* Press READ button to read the parameter, the read value will be displayed in the text box below and in the edit box above the button
* Enter the value to be written to the parameter in edit box and press write
* There is a clear button given for clearing edit box if it text becomes too big.&#x20;


# Programming

Here you will find the details needed for develop your own firmware for the device

If you are interested in writing firmware for the VALTRACK-V4-VTS device, you will need to know where is each pin of MCU is connected to.

Since the schematics of the device is not yet openly available, We are providing the MCU pin connection details, which should be able to help you in determining how is the whole architecture laid out. Watching our device intro video would also help to get an overall idea on the hardware present on board.

### MCU Pinout Details

<table data-header-hidden><thead><tr><th width="129"></th><th width="181"></th><th width="135"></th><th></th></tr></thead><tbody><tr><td><strong>Pin Number</strong></td><td><strong>Pin Name</strong></td><td><strong>Net Name</strong></td><td><strong>Connected to</strong></td></tr><tr><td>2, 3, 11, 17, 18, 31, 32</td><td>VDD3P3, VDD3P3_RTC, VDD3P3_CPU, VDD_SPI,         VDDA</td><td>3V3DC</td><td>3.3VDC output of LDO</td></tr><tr><td>19, 20, 21, 22, 23, 24</td><td>SPIHD, SPIWP, SPICS0, SPICLK, SPID, SPIQ</td><td>CLK_IN</td><td>32.768 KHz crystal</td></tr><tr><td>1</td><td>LNA_IN</td><td>RF_ANTENNA</td><td>Bluetooth / WiFi Chip antenna via matching network</td></tr><tr><td>4</td><td>GPIO0</td><td>LPUART1_TX</td><td>Cellular module RXD input pin through level translator.</td></tr><tr><td>5</td><td>GPIO1</td><td>LPUART1_RX</td><td>Cellular module TXD output pin through level translator.</td></tr><tr><td>6</td><td>GPIO2</td><td>ANALOG_IN</td><td><p>VCHG input through voltage divider resistor network.</p><ul><li>R22,R33 govern the voltage at this pin.</li><li>Default values : R22 = 100K, R33 = 3.3K</li></ul></td></tr><tr><td>7</td><td>CHIP_PU</td><td>CHIP_PU</td><td>CHIP_PU line </td></tr><tr><td>9</td><td>GPIO4</td><td>TPS_ENABLE</td><td><p>Enable input of switching regulator TPS54240</p><ul><li>Making this pin high powers the system via VCHG connector.</li></ul><p>This  will cause system into reset loop if no alternate backup battery power available <br><mark style="color:orange;"><strong>Do no activate this pin without connecting a 3,7V battery to avoid Race around condition</strong></mark></p></td></tr><tr><td>10</td><td>GPIO5</td><td>IIC_DATA</td><td>I2C data of LIS3DH Accelerometer </td></tr><tr><td>12</td><td>GPIO6</td><td>IIC_CLK</td><td>I2C clock of LIS3DH Accelerometer </td></tr><tr><td>13</td><td>GPIO7</td><td>SIM_PWRKEY_3V3</td><td><p>Cellular module PWRKEY pin through N channel MOSFET.</p><ul><li>Making this pin HIGH pulls PWRKEY pin to GND</li></ul></td></tr><tr><td>14</td><td>GPIO8</td><td>LED_SIGNAL</td><td>WS2812B battery LED input</td></tr><tr><td>15</td><td>GPIO9</td><td>GPIO9</td><td><p>Tactile switch input</p><ul><li>Pulled up, filtered and Active LOW</li></ul></td></tr><tr><td>16</td><td>GPIO10</td><td>GSM_ENABLE</td><td><p>Enable input of power gating MOSFET for Cellular module</p><ul><li>Making this pin high provides ~4VDC to Cellular module</li></ul></td></tr><tr><td>25</td><td>GPIO18</td><td>USB_DN</td><td>USB DP line</td></tr><tr><td>27</td><td>GPIO20</td><td>U0RXD</td><td>Drawn to test points</td></tr><tr><td>28</td><td>GPIO21</td><td>U0TXD</td><td>Drawn to test points</td></tr><tr><td>29</td><td>XTAL_N</td><td>OSC_OUT</td><td>40 MHz crystal</td></tr><tr><td>30</td><td>XTAL_P</td><td>OSC_IN</td><td>40 MHz crystal</td></tr><tr><td>26</td><td>GPIO19</td><td>USB_DP</td><td>USB DN line</td></tr><tr><td>33</td><td>GND</td><td>GND POWER PAD</td><td>GND</td></tr></tbody></table>

### J62 - VCHG Connector \[SMT pads] - Pinout Details

| **Pin Number** | **Pin Name** | **Connected to**                                                                         |
| -------------- | ------------ | ---------------------------------------------------------------------------------------- |
| 1              | VCHG         | <p>VCHG input of system through FUSE and diode</p><ul><li>12VDC to 42VDC input</li></ul> |
| 2              | GND          | System Ground                                                                            |

### J41 - VBAT Connector \[SMT pads] - Pinout Details

| **Pin Number** | **Pin Name** | **Connected to**                                                                                |
| -------------- | ------------ | ----------------------------------------------------------------------------------------------- |
| 1              | VBAT         | <p>VBAT input of system or Backup battery input</p><ul><li>3.7V to 4.2V battery input</li></ul> |
| 2              | GND          | System Ground                                                                                   |


# Schematics

{% embed url="<https://drive.google.com/file/d/1tOOxdebhCmiYuas9PtT7KUZKuZnZz7lf/view?usp=sharing>" %}


# Firmware

[Link to ESP-IDF based firmware ](https://github.com/ValetronSystems/VALTRACK-V4-ESP32-C3.git)

{% embed url="<https://github.com/ValetronSystems/VALTRACK-V4-ESP32-C3.git>" %}
Code for VSCode+ESP-IDF
{% endembed %}

Arduino example sketch with hardware initializations to get started

```c


// #include "main.h"
// UART1 TX-----0
// UART1 RX-----1
// ANALOG IN----2
// INT1---------3
// TPS-ENABLE---4
// IIC-DATA-----5
// IIC-CLOCK----6
// PWRKEY-------7
// LED-SIGNAL---8
// SWITCH-SW2---9
// GSM-ENABLE---10
// USB DN-------18
// USB_DP-------19
// UART0 RX-----20
// UART0 TX-----21


 #define TINY_GSM_MODEM_SIM7600

// Set serial for debug console (to the Serial Monitor, default speed 115200)
#define SerialMon Serial

// Set serial for AT commands (to the module)
// Use Hardware Serial on Mega, Leonardo, Micro
#define SerialAT Serial1


// Increase RX buffer to capture the entire response
// Chips without internal buffering (A6/A7, ESP8266, M590)
// need enough space in the buffer for the entire response
// else data will be lost (and the http library will fail).
#if !defined(TINY_GSM_RX_BUFFER)
#define TINY_GSM_RX_BUFFER 1024
#endif

// See all AT commands, if wanted
// #define DUMP_AT_COMMANDS

// Define the serial console for debug prints, if needed
#define TINY_GSM_DEBUG SerialMon
// #define LOGGING  // <- Logging is for the HTTP library

// Range to attempt to autobaud
// NOTE:  DO NOT AUTOBAUD in production code.  Once you've established
// communication, set a fixed baud rate using modem.setBaud(#).
#define GSM_AUTOBAUD_MIN 9600
#define GSM_AUTOBAUD_MAX 115200

// Add a reception delay, if needed.
// This may be needed for a fast processor at a slow baud rate.
// #define TINY_GSM_YIELD() { delay(2); }

// Define how you're planning to connect to the internet
// These defines are only for this example; they are not needed in other code.
#define TINY_GSM_USE_GPRS true
#define TINY_GSM_USE_WIFI false

// set GSM PIN, if any
#define GSM_PIN ""

// Your GPRS credentials, if any
const char apn[]      = "www";
const char gprsUser[] = "";
const char gprsPass[] = "";

// Your WiFi connection credentials, if applicable
const char wifiSSID[] = "SSID";
const char wifiPass[] = "password";

// Server details
const char server[]   = "xyz.in";
const char resource[] = "";
const int  port       = 80;

#include <TinyGsmClient.h>
#include <ArduinoHttpClient.h>
#include <Adafruit_NeoPixel.h>
#include <Wire.h>
// Just in case someone defined the wrong thing..
#if TINY_GSM_USE_GPRS && not defined TINY_GSM_MODEM_HAS_GPRS
#undef TINY_GSM_USE_GPRS
#undef TINY_GSM_USE_WIFI
#define TINY_GSM_USE_GPRS false
#define TINY_GSM_USE_WIFI true
#endif
#if TINY_GSM_USE_WIFI && not defined TINY_GSM_MODEM_HAS_WIFI
#undef TINY_GSM_USE_GPRS
#undef TINY_GSM_USE_WIFI
#define TINY_GSM_USE_GPRS true
#define TINY_GSM_USE_WIFI false
#endif

#ifdef DUMP_AT_COMMANDS
#include <StreamDebugger.h>
StreamDebugger debugger(SerialAT, SerialMon);
TinyGsm        modem(debugger);
#else
TinyGsm        modem(SerialAT);
#endif

TinyGsmClient client(modem);
HttpClient    http(client, server, port);



/////////////////////////////////////////////////////////////////////////////////////////////

// PWRKEY 7
// GSM ENABLE 10
// LED SIGNAL 8
// TPS ENABLE 4 //OR CHG IN
// INT1 3
// ANALOG IN 2
// IIC DATA 5
// IIC CLOCK 6
#define GPIO_IIC_DATA   5
#define GPIO_IIC_CLOCK  6
#define GPIO_PWRKEY     7
#define GPIO_GSM_ENABLE 10
#define GPIO_TPS_ENABLE 4
#define GPIO_INT1       3
#define GPIO_SOS        9
#define GPIO_CHG_IN     4
#define GPIO_LED_SIGNAL 8

// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(3, GPIO_LED_SIGNAL, NEO_GRB + NEO_KHZ800);

#define BATTERY_LED  0
#define NETWORK_LED  1
#define LOCATION_LED 2

#define RED   0
#define GREEN 1
#define BLUE  2

#define BRIGHTNESS 64
void UpdateLED(int LED, int Color, int Brightness )
{

  switch(Color)
  {
    case RED : 
      pixels.setPixelColor(LED, pixels.Color(Brightness, 0, 0)); 
    break;
    case GREEN : 
      pixels.setPixelColor(LED, pixels.Color(0, Brightness, 0)); 
    break;
    case BLUE : 
      pixels.setPixelColor(LED, pixels.Color(0, 0, Brightness)); 
    break;
    default:
      pixels.setPixelColor(LED, pixels.Color(0, 0, 0)); 
    break;
  }
  pixels.show(); // This sends the updated pixel color to the hardware.
}
void EnableGSM(void)
{
    digitalWrite(GPIO_GSM_ENABLE, 1);// 10 GSM_ENABLE &LED_ENABLE
}
void DisableGSM(void)
{
    digitalWrite(GPIO_GSM_ENABLE, 0);// 10 GSM_DISABLE & LED_DISABLE
}
void InitGPIO(void)
{
  pinMode(GPIO_PWRKEY, OUTPUT);
  pinMode(GPIO_GSM_ENABLE, OUTPUT);
}
void InitLED(void)
{
  // pixels.begin(); // This initializes the NeoPixel library.

  UpdateLED(BATTERY_LED,RED, BRIGHTNESS);
  UpdateLED(NETWORK_LED,GREEN, BRIGHTNESS);
  UpdateLED(LOCATION_LED,BLUE, BRIGHTNESS);  
}
void InitGSM(void)
{
  // !!!!!!!!!!!
  digitalWrite(GPIO_PWRKEY, 0);
  digitalWrite(GPIO_PWRKEY, 1);
  delay(1000);
  digitalWrite(GPIO_PWRKEY, 0);
  // Set your reset, enable, power pins here
  // !!!!!!!!!!!
}
void InitUART0(void)
{
  Serial.begin(115200);
}
void InitUART1(void)
{
  Serial1.begin(115200,SERIAL_8N1,1,0);
}


#define REG_CTRL_REG1  0x20
#define  REG_CTRL_REG2  0x21
#define  REG_CTRL_REG3  0x22
#define  REG_CTRL_REG4  0x23
#define  REG_CTRL_REG5  0x24
#define  REG_CTRL_REG6  0x25
#define  REG_INT1_CFG  0x30
#define  REG_INT1_SRC  0x31
#define  REG_INT1_THS  0x32
#define  REG_INT1_DURATION  0x33

#define ACCLEROMETER_I2C_ADDRESS 0x19  //LIS3D

uint8_t I2C_RdReg(uint8_t RegisterAddress)
{
  
  Wire.beginTransmission(ACCLEROMETER_I2C_ADDRESS);
  Wire.write(RegisterAddress);
  Wire.endTransmission();
  Wire.requestFrom(ACCLEROMETER_I2C_ADDRESS, 1); 
  delay(2); 
  
  return  (uint8_t)Wire.read();
}
void I2C_WrReg(uint8_t RegisterAddress, uint8_t Data)
{
  Wire.beginTransmission(ACCLEROMETER_I2C_ADDRESS);
  Wire.write(RegisterAddress);
  Wire.write(Data);
  Wire.endTransmission();
}
void InitAccelerometer(void)
{
  uint8_t VALREAD=0;

  Wire.begin(GPIO_IIC_DATA,GPIO_IIC_CLOCK);
  VALREAD = I2C_RdReg(0x26);

  VALREAD = I2C_RdReg(0x0F);//VALREAD = I2C_RdReg(0x0D);
  Serial.print("Motion Sensor = ");
  if(VALREAD == 0x33)
  {
    Serial.println("LIS3DH Found");    
  }
  else
  {
     Serial.println("LIS3DH Not Found"); 
  }
   
  I2C_WrReg(REG_CTRL_REG1, 0x57);
  I2C_WrReg(REG_CTRL_REG4, 0x08);
  
  delay(200);
  //  VALREAD = I2C_RdReg(REG_CTRL_REG1);
  I2C_WrReg(REG_CTRL_REG2, 0x05);
  I2C_WrReg(REG_CTRL_REG3, 0x40);//    I2C_WrReg(MMA8652_CTRL_REG3, 0x39);
  
  I2C_WrReg(REG_CTRL_REG5, 0x08);
  // VALREAD = I2C_RdReg(REG_CTRL_REG5);
  I2C_WrReg(REG_CTRL_REG6, 0x02);
  //I2C_WrReg(REG_CTRL_REG6, 0xFF);
  I2C_WrReg(REG_INT1_THS,0x18);
  I2C_WrReg(REG_INT1_DURATION,0x00);
  I2C_WrReg(REG_INT1_CFG,0x2A);

  for(uint8_t i=0x07;i<=0x3F;i++)
  {
    VALREAD = I2C_RdReg(i);      
  }  

}
void setup() {
 
  delay(5000);
  InitGPIO();
  InitUART0();
  InitUART1();  
  EnableGSM();
  InitLED();
  InitAccelerometer();

  InitGSM();
  
  

  Serial.println("Wait...");
  
  Serial.println("Wait...1");
  // Set GSM module baud rate
  //TinyGsmAutoBaud(SerialAT, GSM_AUTOBAUD_MIN, GSM_AUTOBAUD_MAX);
  //SerialAT.begin(115200,SERIAL_8N1,1,0);
  delay(6000);
  Serial.println("Hello\r\n");
  // Restart takes quite some time
  // To skip it, call init() instead of restart()
  SerialMon.println("Initializing modem...");
  modem.restart();
  // modem.init();

  String modemInfo = modem.getModemInfo();
  SerialMon.print("Modem Info: ");
  SerialMon.println(modemInfo);

#if TINY_GSM_USE_GPRS
  // Unlock your SIM card with a PIN if needed
  if (GSM_PIN && modem.getSimStatus() != 3) { modem.simUnlock(GSM_PIN); }
#endif


   modemInfo = modem.getSignalQuality();
  SerialMon.print("Signal Quality: ");
  SerialMon.println(modemInfo);
  //xTaskCreate(ADCTask, "ADCTask", 2048, NULL, 10, NULL);
    // xTaskCreate(StartTimerTask, "StartTimerTask", 4096, NULL, 10, NULL);   
    // xTaskCreate(StartMainTask, "StartMainTask", 8192, NULL, 10, NULL); //TIMER_TASK_STACK_SIZE

    //thisModem().sendAT(GF("+IPR="), baud);
    modem.sendAT(GF("+IPR?"));
    modem.waitResponse(10000,"+IPR");

    
}


void loop() {
#if TINY_GSM_USE_WIFI
  // Wifi connection parameters must be set before waiting for the network
  SerialMon.print(F("Setting SSID/password..."));
  if (!modem.networkConnect(wifiSSID, wifiPass)) {
    SerialMon.println(" fail");
    delay(10000);
    return;
  }
  SerialMon.println(" success");
#endif

#if TINY_GSM_USE_GPRS && defined TINY_GSM_MODEM_XBEE
  // The XBee must run the gprsConnect function BEFORE waiting for network!
  modem.gprsConnect(apn, gprsUser, gprsPass);
#endif

  SerialMon.print("Waiting for network...");
  if (!modem.waitForNetwork()) {
    SerialMon.println(" fail");
    delay(10000);
    return;
  }
  SerialMon.println(" success");

  if (modem.isNetworkConnected()) { SerialMon.println("Network connected"); }

#if TINY_GSM_USE_GPRS
  // GPRS connection parameters are usually set after network registration
  SerialMon.print(F("Connecting to "));
  SerialMon.print(apn);
  if (!modem.gprsConnect(apn, gprsUser, gprsPass)) {
    SerialMon.println(" fail");
    delay(10000);
    return;
  }
  SerialMon.println(" success");

  if (modem.isGprsConnected()) { SerialMon.println("GPRS connected"); }
#endif



  SerialMon.print(F("Performing HTTP GET request... "));
  int err = http.get(resource);
  if (err != 0) {
    SerialMon.println(F("failed to connect"));
    delay(10000);
    return;
  }

  int status = http.responseStatusCode();
  SerialMon.print(F("Response status code: "));
  SerialMon.println(status);
  if (!status) {
    delay(10000);
    return;
  }

  SerialMon.println(F("Response Headers:"));
  while (http.headerAvailable()) {
    String headerName  = http.readHeaderName();
    String headerValue = http.readHeaderValue();
    SerialMon.println("    " + headerName + " : " + headerValue);
  }

  int length = http.contentLength();
  if (length >= 0) {
    SerialMon.print(F("Content length is: "));
    SerialMon.println(length);
  }
  if (http.isResponseChunked()) {
    SerialMon.println(F("The response is chunked"));
  }

  String body = http.responseBody();
  SerialMon.println(F("Response:"));
  SerialMon.println(body);

  SerialMon.print(F("Body length is: "));
  SerialMon.println(body.length());

  // Shutdown

  http.stop();
  SerialMon.println(F("Server disconnected"));

#if TINY_GSM_USE_WIFI
  modem.networkDisconnect();
  SerialMon.println(F("WiFi disconnected"));
#endif
#if TINY_GSM_USE_GPRS
  modem.gprsDisconnect();
  SerialMon.println(F("GPRS disconnected"));
#endif

  // Do nothing forevermore
  while (true) { delay(1000); }
}

```


# Packet format

The data is sent to server in HTTP POST requests / MQTT publish messages.&#x20;

This is the sample packet format that is sent from the device, its a JSON array, there will be multiple fields depending on the updates, you can disable or enable what you want in the code.

{% code overflow="wrap" %}

```
{"resource":[{"devid":"861657072373444","time":"2024-07-20 11:49:03","etype":"REBOOT","lat":"16.5","lon":"28.0","vbat":"3.725","speed":"0.000000,"nlat":""15.665236,"nlon":"13.56125","vmbat":"12.0","ncsq":"31,99","pInt":"60"}]}
```

{% endcode %}

\
\
The array can be a single object as above or have multiple objects like below

{% code overflow="wrap" %}

```
{"resource":[{"devid":"861657072373444","time":"2024-07-20 11:49:03","etype":"REBOOT","lat":"16.5","lon":"28.0","vbat":"12.389","speed":"0.000000","nlat":""15.665236,"nlon":"13.56125","vmbat":"12.0","ncsq":"31,99","pInt":"60"}, 
{"devid":"861657072373444","time":"2024-07-20 11:50:03","etype":"REBOOT","lat":"16.5","lon":"28.0","vbat":"12.389","speed":"0.000000","nlat":""15.665236,"nlon":"13.56125","vmbat":"12.0","ncsq":"31,99","pInt":"60"}, 
{"devid":"861657072373444","time":"2024-07-20 11:51:03","etype":"REBOOT","lat":"16.5","lon":"28.0","vbat":"12.389","speed":"0.000000","nlat":""15.665236,"nlon":"13.56125","vmbat":"12.0","ncsq":"31,99","pInt":"60"}]}
```

{% endcode %}

\
**Acknowledgment :** \
The device firmware expects an acknowledgement string **"logid"** by default, because thats what we use in our server. You can change it to whatever value you like. Its in XHTTP\_Request function.\
For google scripts it expects response value as **"Moved"** . \
\ <mark style="color:red;">If it doesn't receive the acknowledgement text, it will keep repeating the packets.</mark>&#x20;


# Google Sheets - Script

App script info to append VALTRACK-V4 HTTP post data to Google sheets

In firmware a define in [SCI.h](https://github.com/ValetronSystems/VALTRACK-V4-ESP32-C3/blob/master/main/include/SCI.h) has to be enabled, which makes the HTTP function wait for 302 Moved Temporarily response.  Google App script gives 302 response instead of 200 so enable this #define. When you want to use custom response string, you can comment this line.

```c
#define SHEETS_ENABLED
```

### Sample packet to test&#x20;

```
{"resource":[{"devid":"123095050300182","time":"2023-03-29 12:30:44","etype":"REBOOT","lat":"15.200000","lon":"75.32000","vbat":"0.000000","speed":"0.000000"}]}
```

{% file src="/files/pKQH0arRCOHLSK341Vfg" %}
Sample file with headers
{% endfile %}

### Script to be pasted in Google sheets extension

```javascript
function doPost(req) {
  
  var logid=0;
  var devid=0;
  var lat=0;
  var lon=0;
  var time=0;
  var server_time=0;
  var etype=0;
  var speed=0;
  var vbat=0;
  var vmbat=0;
  var pInt=0;
  var nlat=0;
  var nlon=0;
  var ncsq=0;
  var ltype=0;
  var coach_num=0;
  var fuel=0;
  var origin=0;
  var engine=0;

  var output;
  var data = JSON.parse(req.postData.contents);
  var sheet = SpreadsheetApp.getActiveSheet();
  
  let datenow = new Date();
  
  var packet = data.resource;
  for(var i=0;i<packet.length;i++)
  {


    try{
        
        sheet.appendRow([
          
          packet[i].logid,
          packet[i].devid,
          packet[i].lat,
          packet[i].lon,
          packet[i].time,
          datenow,
          packet[i].etype,
          packet[i].speed,
          packet[i].vbat,
          packet[i].vmbat,
          packet[i].pInt,
          'http://maps.google.com/maps?z=18&q='+packet[i].lat+','+packet[i].lon,
          packet[i].nlat,
          packet[i].nlon,
          packet[i].ncsq,
          packet[i].ltype,    
          packet[i].coach_num,
          packet[i].fuel,
          packet[i].origin,
          packet[i].engine,
          'VALTRACK-V4-VTS-ESP32-C3'
          
          
          ]);
    }
    catch(error)
    {
      output = error;

    }
      
  }  
  return ContentService.createTextOutput(JSON.stringify({data:output})).setMimeType(ContentService.MimeType.JSON);
}

```


# Understanding Logs

The ESP-IDF code outputs a log continously every second, lets look at what each parameter means.

Here is the code which outputs the logs, the values are self explanatory

{% code overflow="wrap" %}

```c
ESP_LOGE(TAG," ST = %d, MT= %d, FT = %d, INT1 = %d, SE = %d, V = %0.2f, HT/LT = %d/%d, G = %c, SW = %d, C = %d",
         SystemTimer,MotionTimer,FrontPanelTimer,INT1,SleepModeEnabled,ADCBatteryVoltage,HeadIndex,TailIndex,GPSStatus,SOS,ChargingStatus);
         
```

{% endcode %}

**ST =  System Timer** &#x20;

Starts incrementing every second after boot and keeps doing so until next power cycle.

**MT= Motion Timer**&#x20;

Start incrementing on initialization and gets reset whenever INT1 interrupt from motion sensor goes low. Whenever INT1 or movement is detected InitAccelerometer function is called and MT is reset to 0. \
Motion Timer is checked at different stages to check if TIME\_TO\_SLEEP value has reached. If it has reached then device enters sleep mode if other conditions are satisfied. \
\
\
**FT = Front Panel Timer** &#x20;

This timer starts incrementing on boot and when it reaches 120 seconds LED are turned OFF. its just a counter for turning off LED to save power. \
\
**INT1 = INT1**&#x20;

This is Interrupt output of accelerometer which is configured to go low when movement threshold is crossed or shock is detected. Its a GPIO input which is polled continously.

**SE = SleepModeEnabled**&#x20;

This variable is just for debugging, it indicates if sleep mode variable is set or reset. It controls whether device has to enter sleep mode or not.&#x20;

\
**V = ADC Battery Voltage**&#x20;

The device main battery source is connected to ADC input of MCU which is read and converted and stored in this variable. (Main battery source is 12V input for VTS & 3.7V input for V4MFW)\
\
**HT/LT = Head Index & Tail Index**&#x20;

These values are circular buffer counters which are used to see how many packets are to be sent, if both are equal then nothing to be transmitted.&#x20;

**G = GPSStatus**&#x20;

This variable is indicator of whether GPS Sync is acheived or not.&#x20;

**SW = SOS switch input**&#x20;

This variable indicates the value read from the SOS pin. A switch is connected to this pin.&#x20;

**C = ChargingStatus**&#x20;

This variable is a GPIO input read from the Charger. It indicates whether the USB is plugged in or removed incase of the V4MFW USB tracker. Not used in VTS application .


# VALTRACK-V4-MFW-ESP32-C3

The awesome asset tracker based on ESP32-C3

{% hint style="info" %}
You should find majority of the details needed for using the hardware here
{% endhint %}

### ⚡ Introduction

VALTRACK-V4-MFW-ESP32-C3 as the name itself depicts, is a fully configurable low power asset tracking device. It was designed to be versatile and flexible enough to fit into any asset tracking scenario, be it for tracking 🚲 Bikes, 🚗 Cars or  kids or equipments.

* [Features](/wiki/products/valtrack-v4-mfw-esp32-c3/features)
* [Specifications](/wiki/products/valtrack-v4-mfw-esp32-c3/specifications)
* [Getting Started](/wiki/products/valtrack-v4-mfw-esp32-c3/getting-started)
* [Programming Details](/wiki/products/valtrack-v4-mfw-esp32-c3/programming)
* [Schematics](/wiki/products/valtrack-v4-mfw-esp32-c3/schematics)
* [Firmware ](/wiki/products/valtrack-v4-mfw-esp32-c3/firmware)
* [Purchase link](https://www.valetron.com/store/valtrack-v4-vts-esp-32-c3-4g-lte-gps-tracker.html)


# Features

{% hint style="info" %}
Here you will get a brief idea on what the device is capable of and the important features
{% endhint %}

* 4G LTE-CAT1+2G with GNSS capable device designed for asset tracking applications where you can charge the device and use for a certain time
* Its a super low power device which is optimized for low power consumption when not in use.&#x20;
* Its primary function is to keep sending GPS location to server as long as movement is present. The movement is detected by a LIS3DH accelerometer.&#x20;
* The device has indicators for  Battery level, Cellular network status, GPS location status
* Has standard USB-C port as charging input and is also used for flashing firmware
* Supports internal and external antenna . Default is internal antenna version as we put it in a enclosure. If external antenna is needed inform before hand, we need to change some jumpers for antenna bias.
* Can be used for long life tracking applications as well by connecting larger capacity batteries.&#x20;
* Has onboard boost converter for squeezing more juice out of battery and stable operation.&#x20;
* Open source firmware available on Github for customization.&#x20;


# Specifications

<table data-header-hidden><thead><tr><th width="210"></th><th></th></tr></thead><tbody><tr><td><strong>Model No.</strong></td><td>VALTRACK-V4-MFW [ESP32-C3]</td></tr><tr><td><strong>Operating Voltage</strong></td><td><ul><li><p>Battery Input : 3.7V to 4.2V DC [Connect a single cell 3.7V-4.2V Li-Po or Li-Ion Battery]</p><p></p><p><span data-gb-custom-inline data-tag="emoji" data-code="26a0">⚠️</span> <em><mark style="color:orange;"><code>Doesn't have Reverse Polarity Protection</code></mark></em></p></li></ul></td></tr><tr><td><strong>Dimensions</strong></td><td>With Enclosure - Length: 72mm * Width: 43mm * Height: 21.5 mm  </td></tr><tr><td></td><td>PCB Dimensions - Length: 58.2mm * Width: 30mm * Thickness: 7.8mm</td></tr><tr><td><strong>Battery Support</strong></td><td><ul><li>3.7V-4.2V DC Li-Po or Li-Ion battery is supported.</li><li>Use > 400mAH capacity battery. </li><li>TP4056 Charger chip is used to handle the battery charging.</li></ul></td></tr><tr><td><strong>Cellular module</strong></td><td>A7672S - 4G-LTE-CAT1 / 2G - For India &#x26; Asia</td></tr><tr><td></td><td>A7672E - 4G-LTE-CAT1 /2G - For Europe</td></tr><tr><td></td><td>A7672SA- 4G-LTE-CAT1 / 2G - For South America, USA (Not certified) &#x26; Australia<br></td></tr><tr><td></td><td>SIM7672G - 4G-LTE-CAT1 - For Global use</td></tr><tr><td><strong>Navigation hardware</strong></td><td>Inbuilt GNSS of A7672x/SIM7672x</td></tr><tr><td></td><td>A7672x/SIM7672x has inbuilt GNSS hardware which needs passive or external active antenna [Bias is already provided to the GNSS U.FL connector]</td></tr><tr><td><strong>Aux Inputs</strong></td><td>None</td></tr><tr><td><strong>Aux Outputs</strong></td><td>None</td></tr><tr><td><strong>Operating Modes</strong></td><td>HTTP, SMS, MQTT/TCP</td></tr><tr><td><strong>Configuration Methods</strong></td><td>Bluetooth  - via  VALTRACK-V4E SETUP app on play store</td></tr><tr><td><strong>Processor</strong></td><td>Espressif ESP32-C3FH4 RISC-V chipset </td></tr><tr><td><strong>Motion Sensor</strong></td><td>LIS3DH 12-bit, 3-axis Accelerometer</td></tr><tr><td><strong>Memory</strong></td><td>4MB inbuilt flash of ESP32-C3FH4</td></tr><tr><td><strong>Antenna</strong></td><td><p>📶 Cellular : U.FL Connector</p><ul><li>1.5 dBi gain Flexible PCB antenna comes attached</li></ul></td></tr><tr><td></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="1f6f0">🛰️</span> A7672x GNSS : U.FL Connector</p><ul><li>Patch antenna comes attached</li></ul><p><em><mark style="color:orange;"><code>External GNSS is enabled on request only !</code></mark></em></p></td></tr><tr><td></td><td></td></tr><tr><td><strong>Connectivity</strong></td><td>Bluetooth, GPRS, SMS, Call</td></tr><tr><td><strong>SIM connector</strong></td><td>Nano SIM card connector available</td></tr><tr><td></td><td>e-SIM in MFF2 format </td></tr><tr><td><strong>Flashing options</strong></td><td>USB-C</td></tr><tr><td><strong>Enclosure</strong></td><td>Device ships in a standard IP67 rated enclosure if ordered.</td></tr></tbody></table>


# Purchase info

Board purchase information

### [Click on this link to visit our store for purchasing this board.](https://www.valetron.com/store/valtrack-v4-vts-esp-32-c3-4g-lte-gps-tracker.html)

### Product variants

* Without Enclosure
* With Enclosure

### GNSS Antenna Selection

* Internal Patch antenna
* External antenna

We offer the device with above options, You can order the device only if you want to use it in some other instrument along with other hardware or you can order the device with a IP67 enclosure.&#x20;

We also offer the device with internal GNSS patch antenna or external antenna. If you choose external antenna, we provide a SMA connector on the enclosure(if ordered) and add a bias resistor to power the external active antenna. Then you can connect a external antenna to the board via the U.FL connector. External GNSS antenna option is helpful when you want to install devices in places where there is no direct satellite view. In such cases you can use the external GNSS active antenna.


# Getting Started

### Opening the enclosure

You need to remove the six screws present in the bottom of the enclosure to open it. Use a star head screw driver.

### Inserting the SIM card

Get a Nano-SIM card and insert it into the boards push-pull type SIM card slot. If you are using e-SIM you need to remove the SIM card from Nano-SIM card slot. You can use only one type of SIM.

Power should not be connected to the device during SIM card insertion

### Powering the device

VALTRACK-V4-MFW-ESP32-C3 can run from below power source,

<table data-header-hidden><thead><tr><th width="227"></th><th></th></tr></thead><tbody><tr><td><p><strong>Battery Input</strong></p><p>[VBAT connector]</p></td><td><ul><li>Can take 3.7V to 4.2V DC [Connect a single cell 3.7V-4.2V Li-Po or Li-Ion Battery]</li><li>Use at least 400mAH and above capacity batteries</li><li>The battery connected to this port gets charged by USB-C connector.</li><li>Its a JST-XH type connector</li></ul><p><span data-gb-custom-inline data-tag="emoji" data-code="26a0">⚠️</span>  <em><mark style="color:yellow;">Doesn't have Reverse Polarity Protection</mark></em></p></td></tr></tbody></table>

Device can start functioning with any of above power sources.

### LED Indicators

* Once the device is powered ON, The LED will show up and start with all RED .
* Once the SIM is registered to the network, the NETWORK LED turns GREEN .
* Once the GNSS module gets a location sync, the LOCATION LED turns GREEN .
* After 30 seconds of inactivity, all LED will turn OFF to save power and turn ON again on movement detected by Accelerometer.
* POWER LED conditions (Customizable in the SCI.h file of firmware)\
  GREEN : VBAT > 3.8V\
  BLUE: 3.7V > VBAT < 3.8V\
  RED : 0.0V > VBAT < 3.8V


# Configuration

VALTRACK-V4-MFW-ESP32-C3 can be configured using Bluetooth. An android application is made available on play store called VALTRACK-V4E-SETUP, which can be used to write and read the device parameters from the flash memory of ESP32-C3.\
\
Procedure is very simple.&#x20;

[Click here to Download the app](https://play.google.com/store/apps/details?id=com.valetron.valtrackv4e\&hl=en_IN\&gl=US)

<div align="left"><figure><img src="/files/cRTgsXMFJKz7Ic314sTZ" alt="https://play.google.com/store/apps/details?id=com.valetron.valtrackv4e&#x26;hl=en_IN&#x26;gl=US" width="162"><figcaption></figcaption></figure></div>

* Turn on Bluetooth and Location
* Open the VALTRACK-V4E-SETUP app.&#x20;
* Turn on the device
* Scan for devices and select CONNECT button in front of VALTRACK-V4-XX device name
* <mark style="color:orange;">Once connected, press on SYNC button to read the services</mark> <mark style="color:red;">**(This is important)**</mark>
* MTU will change to 256&#x20;
* Select the parameter name from Dropdown
* Press READ button to read the parameter, the read value will be displayed in the text box below and in the edit box above the button
* Enter the value to be written to the parameter in edit box and press write
* There is a clear button given for clearing edit box if it text becomes too big.&#x20;


# Programming

Here you will find the details needed for develop your own firmware for the device

If you are interested in writing firmware for the VALTRACK-V4-MFW device, you will need to know where is each pin of MCU is connected to.

Since the schematics of the device is not yet openly available, We are providing the MCU pin connection details, which should be able to help you in determining how is the whole architecture laid out. Watching our device intro video would also help to get an overall idea on the hardware present on board.

### MCU Pinout Details

<table data-header-hidden><thead><tr><th width="129"></th><th width="181"></th><th width="135"></th><th></th></tr></thead><tbody><tr><td><strong>Pin Number</strong></td><td><strong>Pin Name</strong></td><td><strong>Net Name</strong></td><td><strong>Connected to</strong></td></tr><tr><td>2, 3, 11, 17, 18, 31, 32</td><td>VDD3P3, VDD3P3_RTC, VDD3P3_CPU, VDD_SPI,         VDDA</td><td>3V3DC</td><td>3.3VDC output of LDO</td></tr><tr><td>19, 20, 21, 22, 23, 24</td><td>SPIHD, SPIWP, SPICS0, SPICLK, SPID, SPIQ</td><td>CLK_IN</td><td>32.768 KHz crystal</td></tr><tr><td>1</td><td>LNA_IN</td><td>RF_ANTENNA</td><td>Bluetooth / WiFi Chip antenna via matching network</td></tr><tr><td>4</td><td>GPIO0</td><td>LPUART1_TX</td><td>Cellular module RXD input pin through level translator.</td></tr><tr><td>5</td><td>GPIO1</td><td>LPUART1_RX</td><td>Cellular module TXD output pin through level translator.</td></tr><tr><td>6</td><td>GPIO2</td><td>ANALOG_IN</td><td><p>VCHG input through voltage divider resistor network.</p><ul><li>R22,R33 govern the voltage at this pin.</li><li>Default values : R22 = 100K, R33 = 3.3K</li></ul></td></tr><tr><td>7</td><td>CHIP_PU</td><td>CHIP_PU</td><td>CHIP_PU line </td></tr><tr><td>9</td><td>GPIO4</td><td>TP_CHRG</td><td>TP4056 CHRG pin input. </td></tr><tr><td>10</td><td>GPIO5</td><td>IIC_DATA</td><td>I2C data of LIS3DH Accelerometer </td></tr><tr><td>12</td><td>GPIO6</td><td>IIC_CLK</td><td>I2C clock of LIS3DH Accelerometer </td></tr><tr><td>13</td><td>GPIO7</td><td>SIM_PWRKEY_3V3</td><td><p>Cellular module PWRKEY pin through N channel MOSFET.</p><ul><li>Making this pin HIGH pulls PWRKEY pin to GND</li></ul></td></tr><tr><td>14</td><td>GPIO8</td><td>LED_SIGNAL</td><td>WS2812B battery LED input</td></tr><tr><td>15</td><td>GPIO9</td><td>GPIO9</td><td><p>Tactile switch input</p><ul><li>Pulled up, filtered and Active LOW</li></ul></td></tr><tr><td>16</td><td>GPIO10</td><td>GSM_ENABLE</td><td><p>Enable input of power gating MOSFET for Cellular module</p><ul><li>Making this pin high provides ~4VDC to Cellular module</li></ul></td></tr><tr><td>25</td><td>GPIO18</td><td>USB_DN</td><td>USB DP line</td></tr><tr><td>27</td><td>GPIO20</td><td>U0RXD</td><td>Drawn to test points</td></tr><tr><td>28</td><td>GPIO21</td><td>U0TXD</td><td>Drawn to test points</td></tr><tr><td>29</td><td>XTAL_N</td><td>OSC_OUT</td><td>40 MHz crystal</td></tr><tr><td>30</td><td>XTAL_P</td><td>OSC_IN</td><td>40 MHz crystal</td></tr><tr><td>26</td><td>GPIO19</td><td>USB_DP</td><td>USB DN line</td></tr><tr><td>33</td><td>GND</td><td>GND POWER PAD</td><td>GND</td></tr></tbody></table>

### J62 - VCHG Connector \[SMT pads] - Pinout Details

| **Pin Number** | **Pin Name** | **Connected to**                                                                         |
| -------------- | ------------ | ---------------------------------------------------------------------------------------- |
| 1              | VCHG         | <p>VCHG input of system through FUSE and diode</p><ul><li>12VDC to 42VDC input</li></ul> |
| 2              | GND          | System Ground                                                                            |

### J41 - VBAT Connector \[SMT pads] - Pinout Details

| **Pin Number** | **Pin Name** | **Connected to**                                                                                |
| -------------- | ------------ | ----------------------------------------------------------------------------------------------- |
| 1              | VBAT         | <p>VBAT input of system or Backup battery input</p><ul><li>3.7V to 4.2V battery input</li></ul> |
| 2              | GND          | System Ground                                                                                   |


# Schematics

{% embed url="<https://drive.google.com/file/d/1XKPj9q7UAbrKFakOfNk1HhEi9X6xH_yA/view>" %}


# Packet format

This is the sample packet format that is sent from the device, its a JSON array, there will be multiple fields depending on the updates, you can disable or enable what you want in the code.

{% code overflow="wrap" %}

```
{"resource":[{"devid":"861657072373444","time":"2024-07-20 11:49:03","etype":"REBOOT","lat":"16.5","lon":"28.0","vbat":"12.389","speed":"0.000000"}]}
```

{% endcode %}

\
\
The array can single object as above or have multiple objects like below

{% code overflow="wrap" %}

```
{"resource":[{"devid":"861657072373444","time":"2024-07-20 11:49:03","etype":"REBOOT","lat":"16.5","lon":"28.0","vbat":"12.389","speed":"0.000000"}, 
{"devid":"861657072373444","time":"2024-07-20 11:50:03","etype":"REBOOT","lat":"16.5","lon":"28.0","vbat":"12.389","speed":"0.000000"}, 
{"devid":"861657072373444","time":"2024-07-20 11:51:03","etype":"REBOOT","lat":"16.5","lon":"28.0","vbat":"12.389","speed":"0.000000"}]}
```

{% endcode %}

\
**Acknowledgment :** \
The device firmware expects an acknowledgement string **"logid"** by default, because thats what we use in our server. You can change it to whatever value you like. Its in XHTTP\_Request function.\
For google scripts it expects response value as **"Moved"** . \
\ <mark style="color:red;">If it doesn't receive the acknowledgement text, it will keep repeating the packets.</mark>&#x20;


# Firmware

[Link to ESP-IDF based firmware ](https://github.com/ValetronSystems/VALTRACK-V4-ESP32-C3.git)\
Make sure the defines look like this in SCI.h as the same firmware is used for VTS version as well. <br>

```c
// #define VALTRACK_V4_VTS
#define VALTRACK_V4MF
```

{% embed url="<https://github.com/ValetronSystems/VALTRACK-V4-ESP32-C3.git>" %}
Code for VSCode+ESP-IDF
{% endembed %}

Arduino example sketch with hardware initializations to get started

```c


// #include "main.h"
// UART1 TX-----0
// UART1 RX-----1
// ANALOG IN----2
// INT1---------3
// TPS-ENABLE---4
// IIC-DATA-----5
// IIC-CLOCK----6
// PWRKEY-------7
// LED-SIGNAL---8
// SWITCH-SW2---9
// GSM-ENABLE---10
// USB DN-------18
// USB_DP-------19
// UART0 RX-----20
// UART0 TX-----21


 #define TINY_GSM_MODEM_SIM7600

// Set serial for debug console (to the Serial Monitor, default speed 115200)
#define SerialMon Serial

// Set serial for AT commands (to the module)
// Use Hardware Serial on Mega, Leonardo, Micro
#define SerialAT Serial1


// Increase RX buffer to capture the entire response
// Chips without internal buffering (A6/A7, ESP8266, M590)
// need enough space in the buffer for the entire response
// else data will be lost (and the http library will fail).
#if !defined(TINY_GSM_RX_BUFFER)
#define TINY_GSM_RX_BUFFER 1024
#endif

// See all AT commands, if wanted
// #define DUMP_AT_COMMANDS

// Define the serial console for debug prints, if needed
#define TINY_GSM_DEBUG SerialMon
// #define LOGGING  // <- Logging is for the HTTP library

// Range to attempt to autobaud
// NOTE:  DO NOT AUTOBAUD in production code.  Once you've established
// communication, set a fixed baud rate using modem.setBaud(#).
#define GSM_AUTOBAUD_MIN 9600
#define GSM_AUTOBAUD_MAX 115200

// Add a reception delay, if needed.
// This may be needed for a fast processor at a slow baud rate.
// #define TINY_GSM_YIELD() { delay(2); }

// Define how you're planning to connect to the internet
// These defines are only for this example; they are not needed in other code.
#define TINY_GSM_USE_GPRS true
#define TINY_GSM_USE_WIFI false

// set GSM PIN, if any
#define GSM_PIN ""

// Your GPRS credentials, if any
const char apn[]      = "www";
const char gprsUser[] = "";
const char gprsPass[] = "";

// Your WiFi connection credentials, if applicable
const char wifiSSID[] = "SSID";
const char wifiPass[] = "password";

// Server details
const char server[]   = "xyz.in";
const char resource[] = "";
const int  port       = 80;

#include <TinyGsmClient.h>
#include <ArduinoHttpClient.h>
#include <Adafruit_NeoPixel.h>
#include <Wire.h>
// Just in case someone defined the wrong thing..
#if TINY_GSM_USE_GPRS && not defined TINY_GSM_MODEM_HAS_GPRS
#undef TINY_GSM_USE_GPRS
#undef TINY_GSM_USE_WIFI
#define TINY_GSM_USE_GPRS false
#define TINY_GSM_USE_WIFI true
#endif
#if TINY_GSM_USE_WIFI && not defined TINY_GSM_MODEM_HAS_WIFI
#undef TINY_GSM_USE_GPRS
#undef TINY_GSM_USE_WIFI
#define TINY_GSM_USE_GPRS true
#define TINY_GSM_USE_WIFI false
#endif

#ifdef DUMP_AT_COMMANDS
#include <StreamDebugger.h>
StreamDebugger debugger(SerialAT, SerialMon);
TinyGsm        modem(debugger);
#else
TinyGsm        modem(SerialAT);
#endif

TinyGsmClient client(modem);
HttpClient    http(client, server, port);



/////////////////////////////////////////////////////////////////////////////////////////////

// PWRKEY 7
// GSM ENABLE 10
// LED SIGNAL 8
// TPS ENABLE 4 //OR CHG IN
// INT1 3
// ANALOG IN 2
// IIC DATA 5
// IIC CLOCK 6
#define GPIO_IIC_DATA   5
#define GPIO_IIC_CLOCK  6
#define GPIO_PWRKEY     7
#define GPIO_GSM_ENABLE 10
#define GPIO_TPS_ENABLE 4
#define GPIO_INT1       3
#define GPIO_SOS        9
#define GPIO_CHG_IN     4
#define GPIO_LED_SIGNAL 8

// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(3, GPIO_LED_SIGNAL, NEO_GRB + NEO_KHZ800);

#define BATTERY_LED  0
#define NETWORK_LED  1
#define LOCATION_LED 2

#define RED   0
#define GREEN 1
#define BLUE  2

#define BRIGHTNESS 64
void UpdateLED(int LED, int Color, int Brightness )
{

  switch(Color)
  {
    case RED : 
      pixels.setPixelColor(LED, pixels.Color(Brightness, 0, 0)); 
    break;
    case GREEN : 
      pixels.setPixelColor(LED, pixels.Color(0, Brightness, 0)); 
    break;
    case BLUE : 
      pixels.setPixelColor(LED, pixels.Color(0, 0, Brightness)); 
    break;
    default:
      pixels.setPixelColor(LED, pixels.Color(0, 0, 0)); 
    break;
  }
  pixels.show(); // This sends the updated pixel color to the hardware.
}
void EnableGSM(void)
{
    digitalWrite(GPIO_GSM_ENABLE, 1);// 10 GSM_ENABLE &LED_ENABLE
}
void DisableGSM(void)
{
    digitalWrite(GPIO_GSM_ENABLE, 0);// 10 GSM_DISABLE & LED_DISABLE
}
void InitGPIO(void)
{
  pinMode(GPIO_PWRKEY, OUTPUT);
  pinMode(GPIO_GSM_ENABLE, OUTPUT);
}
void InitLED(void)
{
  // pixels.begin(); // This initializes the NeoPixel library.

  UpdateLED(BATTERY_LED,RED, BRIGHTNESS);
  UpdateLED(NETWORK_LED,GREEN, BRIGHTNESS);
  UpdateLED(LOCATION_LED,BLUE, BRIGHTNESS);  
}
void InitGSM(void)
{
  // !!!!!!!!!!!
  digitalWrite(GPIO_PWRKEY, 0);
  digitalWrite(GPIO_PWRKEY, 1);
  delay(1000);
  digitalWrite(GPIO_PWRKEY, 0);
  // Set your reset, enable, power pins here
  // !!!!!!!!!!!
}
void InitUART0(void)
{
  Serial.begin(115200);
}
void InitUART1(void)
{
  Serial1.begin(115200,SERIAL_8N1,1,0);
}


#define REG_CTRL_REG1  0x20
#define  REG_CTRL_REG2  0x21
#define  REG_CTRL_REG3  0x22
#define  REG_CTRL_REG4  0x23
#define  REG_CTRL_REG5  0x24
#define  REG_CTRL_REG6  0x25
#define  REG_INT1_CFG  0x30
#define  REG_INT1_SRC  0x31
#define  REG_INT1_THS  0x32
#define  REG_INT1_DURATION  0x33

#define ACCLEROMETER_I2C_ADDRESS 0x19  //LIS3D

uint8_t I2C_RdReg(uint8_t RegisterAddress)
{
  
  Wire.beginTransmission(ACCLEROMETER_I2C_ADDRESS);
  Wire.write(RegisterAddress);
  Wire.endTransmission();
  Wire.requestFrom(ACCLEROMETER_I2C_ADDRESS, 1); 
  delay(2); 
  
  return  (uint8_t)Wire.read();
}
void I2C_WrReg(uint8_t RegisterAddress, uint8_t Data)
{
  Wire.beginTransmission(ACCLEROMETER_I2C_ADDRESS);
  Wire.write(RegisterAddress);
  Wire.write(Data);
  Wire.endTransmission();
}
void InitAccelerometer(void)
{
  uint8_t VALREAD=0;

  Wire.begin(GPIO_IIC_DATA,GPIO_IIC_CLOCK);
  VALREAD = I2C_RdReg(0x26);

  VALREAD = I2C_RdReg(0x0F);//VALREAD = I2C_RdReg(0x0D);
  Serial.print("Motion Sensor = ");
  if(VALREAD == 0x33)
  {
    Serial.println("LIS3DH Found");    
  }
  else
  {
     Serial.println("LIS3DH Not Found"); 
  }
   
  I2C_WrReg(REG_CTRL_REG1, 0x57);
  I2C_WrReg(REG_CTRL_REG4, 0x08);
  
  delay(200);
  //  VALREAD = I2C_RdReg(REG_CTRL_REG1);
  I2C_WrReg(REG_CTRL_REG2, 0x05);
  I2C_WrReg(REG_CTRL_REG3, 0x40);//    I2C_WrReg(MMA8652_CTRL_REG3, 0x39);
  
  I2C_WrReg(REG_CTRL_REG5, 0x08);
  // VALREAD = I2C_RdReg(REG_CTRL_REG5);
  I2C_WrReg(REG_CTRL_REG6, 0x02);
  //I2C_WrReg(REG_CTRL_REG6, 0xFF);
  I2C_WrReg(REG_INT1_THS,0x18);
  I2C_WrReg(REG_INT1_DURATION,0x00);
  I2C_WrReg(REG_INT1_CFG,0x2A);

  for(uint8_t i=0x07;i<=0x3F;i++)
  {
    VALREAD = I2C_RdReg(i);      
  }  

}
void setup() {
 
  delay(5000);
  InitGPIO();
  InitUART0();
  InitUART1();  
  EnableGSM();
  InitLED();
  InitAccelerometer();

  InitGSM();
  
  

  Serial.println("Wait...");
  
  Serial.println("Wait...1");
  // Set GSM module baud rate
  //TinyGsmAutoBaud(SerialAT, GSM_AUTOBAUD_MIN, GSM_AUTOBAUD_MAX);
  //SerialAT.begin(115200,SERIAL_8N1,1,0);
  delay(6000);
  Serial.println("Hello\r\n");
  // Restart takes quite some time
  // To skip it, call init() instead of restart()
  SerialMon.println("Initializing modem...");
  modem.restart();
  // modem.init();

  String modemInfo = modem.getModemInfo();
  SerialMon.print("Modem Info: ");
  SerialMon.println(modemInfo);

#if TINY_GSM_USE_GPRS
  // Unlock your SIM card with a PIN if needed
  if (GSM_PIN && modem.getSimStatus() != 3) { modem.simUnlock(GSM_PIN); }
#endif


   modemInfo = modem.getSignalQuality();
  SerialMon.print("Signal Quality: ");
  SerialMon.println(modemInfo);
  //xTaskCreate(ADCTask, "ADCTask", 2048, NULL, 10, NULL);
    // xTaskCreate(StartTimerTask, "StartTimerTask", 4096, NULL, 10, NULL);   
    // xTaskCreate(StartMainTask, "StartMainTask", 8192, NULL, 10, NULL); //TIMER_TASK_STACK_SIZE

    //thisModem().sendAT(GF("+IPR="), baud);
    modem.sendAT(GF("+IPR?"));
    modem.waitResponse(10000,"+IPR");

    
}


void loop() {
#if TINY_GSM_USE_WIFI
  // Wifi connection parameters must be set before waiting for the network
  SerialMon.print(F("Setting SSID/password..."));
  if (!modem.networkConnect(wifiSSID, wifiPass)) {
    SerialMon.println(" fail");
    delay(10000);
    return;
  }
  SerialMon.println(" success");
#endif

#if TINY_GSM_USE_GPRS && defined TINY_GSM_MODEM_XBEE
  // The XBee must run the gprsConnect function BEFORE waiting for network!
  modem.gprsConnect(apn, gprsUser, gprsPass);
#endif

  SerialMon.print("Waiting for network...");
  if (!modem.waitForNetwork()) {
    SerialMon.println(" fail");
    delay(10000);
    return;
  }
  SerialMon.println(" success");

  if (modem.isNetworkConnected()) { SerialMon.println("Network connected"); }

#if TINY_GSM_USE_GPRS
  // GPRS connection parameters are usually set after network registration
  SerialMon.print(F("Connecting to "));
  SerialMon.print(apn);
  if (!modem.gprsConnect(apn, gprsUser, gprsPass)) {
    SerialMon.println(" fail");
    delay(10000);
    return;
  }
  SerialMon.println(" success");

  if (modem.isGprsConnected()) { SerialMon.println("GPRS connected"); }
#endif



  SerialMon.print(F("Performing HTTP GET request... "));
  int err = http.get(resource);
  if (err != 0) {
    SerialMon.println(F("failed to connect"));
    delay(10000);
    return;
  }

  int status = http.responseStatusCode();
  SerialMon.print(F("Response status code: "));
  SerialMon.println(status);
  if (!status) {
    delay(10000);
    return;
  }

  SerialMon.println(F("Response Headers:"));
  while (http.headerAvailable()) {
    String headerName  = http.readHeaderName();
    String headerValue = http.readHeaderValue();
    SerialMon.println("    " + headerName + " : " + headerValue);
  }

  int length = http.contentLength();
  if (length >= 0) {
    SerialMon.print(F("Content length is: "));
    SerialMon.println(length);
  }
  if (http.isResponseChunked()) {
    SerialMon.println(F("The response is chunked"));
  }

  String body = http.responseBody();
  SerialMon.println(F("Response:"));
  SerialMon.println(body);

  SerialMon.print(F("Body length is: "));
  SerialMon.println(body.length());

  // Shutdown

  http.stop();
  SerialMon.println(F("Server disconnected"));

#if TINY_GSM_USE_WIFI
  modem.networkDisconnect();
  SerialMon.println(F("WiFi disconnected"));
#endif
#if TINY_GSM_USE_GPRS
  modem.gprsDisconnect();
  SerialMon.println(F("GPRS disconnected"));
#endif

  // Do nothing forevermore
  while (true) { delay(1000); }
}

```


# Google Sheets - Script

App script info to append VALTRACK-V4 HTTP post data to Google sheets

In firmware a define in [SCI.h](https://github.com/ValetronSystems/VALTRACK-V4-ESP32-C3/blob/master/main/include/SCI.h) has to be enabled, which makes the HTTP function wait for 302 Moved Temporarily response.  Google App script gives 302 response instead of 200 so enable this #define. When you want to use custom response string, you can comment this line.

```c
#define SHEETS_ENABLED
```

### Sample packet to test&#x20;

```
{"resource":[{"devid":"123095050300182","time":"2023-03-29 12:30:44","etype":"REBOOT","lat":"15.200000","lon":"75.32000","vbat":"0.000000","speed":"0.000000"}]}
```

{% file src="/files/pKQH0arRCOHLSK341Vfg" %}
Sample file with headers
{% endfile %}

### Script to be pasted in Google sheets extension

```javascript
function doPost(req) {
  
  var logid=0;
  var devid=0;
  var lat=0;
  var lon=0;
  var time=0;
  var server_time=0;
  var etype=0;
  var speed=0;
  var vbat=0;
  var vmbat=0;
  var pInt=0;
  var nlat=0;
  var nlon=0;
  var ncsq=0;
  var ltype=0;
  var coach_num=0;
  var fuel=0;
  var origin=0;
  var engine=0;

  var output;
  var data = JSON.parse(req.postData.contents);
  var sheet = SpreadsheetApp.getActiveSheet();
  
  let datenow = new Date();
  
  var packet = data.resource;
  for(var i=0;i<packet.length;i++)
  {


    try{
        
        sheet.appendRow([
          
          packet[i].logid,
          packet[i].devid,
          packet[i].lat,
          packet[i].lon,
          packet[i].time,
          datenow,
          packet[i].etype,
          packet[i].speed,
          packet[i].vbat,
          packet[i].vmbat,
          packet[i].pInt,
          'http://maps.google.com/maps?z=18&q='+packet[i].lat+','+packet[i].lon,
          packet[i].nlat,
          packet[i].nlon,
          packet[i].ncsq,
          packet[i].ltype,    
          packet[i].coach_num,
          packet[i].fuel,
          packet[i].origin,
          packet[i].engine,
          'VALTRACK-V4-VTS-ESP32-C3'
          
          
          ]);
    }
    catch(error)
    {
      output = error;

    }
      
  }  
  return ContentService.createTextOutput(JSON.stringify({data:output})).setMimeType(ContentService.MimeType.JSON);
}

```


# Understanding Logs

The ESP-IDF code outputs a log continously every second, lets look at what each parameter means.

Here is the code which outputs the logs, the values are self explanatory

{% code overflow="wrap" %}

```c
ESP_LOGE(TAG," ST = %d, MT= %d, FT = %d, INT1 = %d, SE = %d, V = %0.2f, HT/LT = %d/%d, G = %c, SW = %d, C = %d",
         SystemTimer,MotionTimer,FrontPanelTimer,INT1,SleepModeEnabled,ADCBatteryVoltage,HeadIndex,TailIndex,GPSStatus,SOS,ChargingStatus);
         
```

{% endcode %}

**ST =  System Timer** &#x20;

Starts incrementing every second after boot and keeps doing so until next power cycle.

**MT= Motion Timer**&#x20;

Start incrementing on initialization and gets reset whenever INT1 interrupt from motion sensor goes low. Whenever INT1 or movement is detected InitAccelerometer function is called and MT is reset to 0. \
Motion Timer is checked at different stages to check if TIME\_TO\_SLEEP value has reached. If it has reached then device enters sleep mode if other conditions are satisfied. \
\
\
**FT = Front Panel Timer** &#x20;

This timer starts incrementing on boot and when it reaches 120 seconds LED are turned OFF. its just a counter for turning off LED to save power. \
\
**INT1 = INT1**&#x20;

This is Interrupt output of accelerometer which is configured to go low when movement threshold is crossed or shock is detected. Its a GPIO input which is polled continously.

**SE = SleepModeEnabled**&#x20;

This variable is just for debugging, it indicates if sleep mode variable is set or reset. It controls whether device has to enter sleep mode or not.&#x20;

\
**V = ADC Battery Voltage**&#x20;

The device main battery source is connected to ADC input of MCU which is read and converted and stored in this variable. (Main battery source is 12V input for VTS & 3.7V input for V4MFW)\
\
**HT/LT = Head Index & Tail Index**&#x20;

These values are circular buffer counters which are used to see how many packets are to be sent, if both are equal then nothing to be transmitted.&#x20;

**G = GPSStatus**&#x20;

This variable is indicator of whether GPS Sync is acheived or not.&#x20;

**SW = SOS switch input**&#x20;

This variable indicates the value read from the SOS pin. A switch is connected to this pin.&#x20;

**C = ChargingStatus**&#x20;

This variable is a GPIO input read from the Charger. It indicates whether the USB is plugged in or removed incase of the V4MFW USB tracker. Not used in VTS application .


# A7672x-EVAL

Evaluation board for SIMCOM A7672 modules designed by Valetron Systems

{% hint style="info" %}
You should find majority of the details needed for using the hardware here
{% endhint %}

### ⚡ Introduction

A7672x-EVAL is a development board designed for SIMCOM A7672 4G LTE-CAT1 modules. It supports 3 different variants, A7672S (For Indian sub continent) , A7672E( For Europe), A7672SA (For South America)

* [Features](/wiki/products/a7672x-eval/features)
* [Specifications](/wiki/products/a7672x-eval/specifications)
* [Getting Started](/wiki/products/a7672x-eval/getting-started)
* [Open CPU Programming](/wiki/products/a7672x-eval/open-cpu-programming)
* [Purchase link](https://www.valetron.com/store/a7672x-eval1.html)


# Features

A7672x modem features

{% hint style="info" %}
Here you will get a brief idea on what the device is capable of and the important features
{% endhint %}

### Power section :

The device has two power inputs,

#### 1) Main Power input - VCHG :

This is the main power input of the device and is usually connected to the 12V DC adapter. Right now the device supports from 12VDC to 42VDC input . The main power chip used here is the TPS54240 switching regulator. which converts the 12VDC input to 4V which goes to modules VBAT pin.&#x20;

#### 2) Battery power input - VBAT

This is the direct battery input and a 3.7V to 4.2V LiPo battery has to be connected to it. Use at least 400mAH battery. There is no reverse polarity protection to this pin so be careful connecting the battery. Use a battery with JST-XH size female connector.

To understand the power section of the device, look at the block diagram.


# Specifications

<table data-header-hidden><thead><tr><th width="210"></th><th></th></tr></thead><tbody><tr><td><strong>Model No.</strong></td><td>A7672x-EVAL</td></tr><tr><td><strong>Operating Voltage</strong></td><td><ul><li>Main Power Input (DC Jack): 12V to 42V DC [Connect to 12V DC Adapter]</li></ul><p><span data-gb-custom-inline data-tag="emoji" data-code="26a1">⚡</span><em><mark style="color:green;"><code>Has Reverse Polarity Protection</code></mark></em></p></td></tr><tr><td></td><td><p>Battery Input (White JST connector) : 3.7V to 4.2V DC [Connect a single cell 3.7V-4.2V Li-Po or Li-Ion Battery]</p><p></p><p><span data-gb-custom-inline data-tag="emoji" data-code="26a0">⚠️</span> <em><mark style="color:orange;"><code>Doesn't have Reverse Polarity Protection</code></mark></em></p></td></tr><tr><td><strong>Dimensions</strong></td><td></td></tr><tr><td></td><td>PCB Dimensions - Length: 75mm * Width: 50mm * Thickness: 10 mm</td></tr><tr><td><strong>Battery Support</strong></td><td><ul><li>3.7V-4.2V DC Li-Po battery is supported.</li><li>Use > 400mAH capacity battery.</li></ul><p></p></td></tr><tr><td><strong>Cellular module</strong></td><td>A767S-FASE - LTE-CAT1, 2G - For use in Indian sub continent</td></tr><tr><td></td><td>A7672E-FASE - LTE-CAT1, 2G - For Europe</td></tr><tr><td></td><td>A7672SA-FASE - LTE-CAT1, 2G - For South America &#x26; Australia &#x26; Some networks in North America</td></tr><tr><td><strong>Navigation hardware</strong></td><td>Inbuilt GNSS support, you can connect an active GPS antenna to W2 (U.FL) or J56 (SMA) connectors. Bias for active antenna is already provided. <em>If you want to use passive antenna a bias resistor has to be disconnected.</em></td></tr><tr><td></td><td></td></tr><tr><td><strong>Processor</strong></td><td>Based on ASR chipset</td></tr><tr><td><strong>Antenna</strong></td><td><p>📶 Cellular : U.FL Connector &#x26; SMA Connector</p><p> <span data-gb-custom-inline data-tag="emoji" data-code="1f6f0">🛰️</span> GNSS   : U.FL Connector &#x26; SMA Connector</p></td></tr><tr><td><strong>Connectivity</strong></td><td>Bluetooth, GPRS (HTTP, MQTT, TCP, UDP), SMS, Call</td></tr><tr><td><strong>SIM connector</strong></td><td>Push Push type Nano SIM card connector </td></tr><tr><td><strong>Flashing options</strong></td><td>On board Micro USB interface  can be used for updating module firmware and send AT commands</td></tr><tr><td><strong>Interfaces</strong></td><td>USB and UART interfaces can be used for sending AT commands</td></tr></tbody></table>


# Purchase info

Board purchase information

### [Click on this link to visit our store for purchasing this board.](https://www.valetron.com/store/a7672x-eval1.html)


# Getting Started

<figure><img src="/files/3swoPfvm4r5jY9Gf4ToN" alt=""><figcaption></figcaption></figure>

### Inserting the SIM card

Get a Nano-SIM card and insert it into the boards push-push type SIM card slot.

Power should not be connected to the device during SIM card insertion

### Powering the device

This board can run from any of the two power sources,

<table data-header-hidden><thead><tr><th width="227"></th><th></th></tr></thead><tbody><tr><td><p><strong>Main Power Input</strong></p><p>[VCHG DC Jack connector]</p></td><td><ul><li>Can take 12V to 42V DC [Connect to 12V Lead Acid Battery]</li><li>Its a DC Jack type connector</li></ul><p>Has Reverse Polarity Protection</p></td></tr><tr><td><p><strong>Battery Input</strong></p><p>[VBAT connector J41]</p></td><td><ul><li>Can take 3.7V to 4.2V DC [Connect a single cell 3.7V-4.2V Li-Po or Li-Ion Battery]</li><li>Use at least 400mAH and above capacity batteries</li><li>Its a JST-XH type connector</li></ul><p>Doesn't have Reverse Polarity Protection</p></td></tr></tbody></table>

Device can start functioning with any of above power sources.

### Turning ON the modem :&#x20;

You need to press the PWRKEY switch for at least 1 second to boot the module.\
If you are using the PWRKEY header pin connected to MCU. There is a transistor between your header pin and the modules PWRKEY pin. So, you can boot the module from MCU by sending a high pulse on the PWRKEY pin for at least 1 second.&#x20;

PWRKEY and RESET header pins are routed through a NPN transistor so you need to send HIGH pulses to activate the modules respective pins&#x20;

### LED Indicators

* Once the device is powered ON, The Power LED D18 will turn ON.
* Once the module is booted using the PWRKEY button or PWRKEY header pin GSM\_STATUS LED D17 will turn ON indicating the module has booted.&#x20;
* Once the SIM is registered to the network, the NETLIGHT LED D6 starts blinking otherwise its stable.
* POWER LED remains ON all the time

### Interface

**USB Interface :** \
You can use USB interface for sending AT commands and updating the modules firmware. Make sure you install the drivers for the module before connecting USB. Drivers can be downloaded from the store website where you purchased the module.&#x20;

**UART Interface :**&#x20;

You can also use the UART interface to send AT commands to the module. The default baud rate is 115200.  The modules IO levels are 1.8V so there is a onboard TXS0104 or TXS0102 level translator which translates the modules UART TXD, RXD, DTR, RI lines 1.8V IO levels to MCU IO levels. For level translator to function properly you need to connect the VTRANS pin to the MCU IO level voltage, either 3.3V or 5V. <br>

{% hint style="warning" %}
All remaining module pins except UART TXD, RXD, DTR, RI, PWRKEY, RESET exposed on headers are at 1.8V levels, so care must be taken when interfacing these lines to external hardware like MCU. Use appropriate IO level translation wherever needed.
{% endhint %}


# Arduino Interfacing

Making Connections

<figure><img src="/files/Mhg6fnAHtP9lHFWcNtEn" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/hjW1aprzAkVRb4uM2bOy" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/i9IIA5fItPy43PZ7rWNf" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/qJvs9kcVp9S0LOU0gfIg" alt=""><figcaption></figcaption></figure>

Here we have connected UART TX(Purple),RX(Grey),GND(Black),VTRANS(Yellow), PWRKEY(Blue) pins of modem to Arduino Uno  RX, TX, GND, 5V, GPIO2/Pin no 2 respectively&#x20;

Make sure you press PWRKEY switch before running the below code or incorporate the PWRKEY activation code before sending AT command. Wait for atleast 30 seconds after module turns on to send any AT command.

Here is a simple code for testing a simple AT command.  This code reads the IMEI number of module which is also printed on it.

```cpp

void setup()
{
  Serial.begin(115200);
  digitalWrite(2,1); // Make PWRKEY low
  delay(1000);
  digitalWrite(2,0); //  Make PWRKEY high
  Serial.println("Initializing...");
  delay(15000);
 
}

void loop()
{
  Serial.println("AT+CGSN");
  while(Serial.available()) 
  {
    Serial.write(Serial.read());//Forward what Software Serial received to Serial Port
  }
  delay(5000);

 
}

```


# Downloads

Important files needed to use the board

[Download USB Drivers](https://1drv.ms/u/s!AlyvpbP56nGwoNkc9_NXzg29yTG4tA?e=WuumZ6)

[Download SDK & Documentation for SIMCOM A7672x and A76xx](https://1drv.ms/f/s!AlyvpbP56nGwuPBCeGQS91NnBhkOCA?e=HPzekN)

[Download SSCOM terminal software](https://1drv.ms/u/s!AlyvpbP56nGwh5Iw4486BSa_Bh-eWQ?e=fh2wig)

[Download the Aboot Firmware download tool](https://1drv.ms/u/s!AlyvpbP56nGwtZ4u1KstKwXHGVPtHg?e=pnkAd6)

[Download the CAT Studio for Debugging](https://www.dropbox.com/scl/fi/3eerek9zs8chg32vgclj8/CATStudio_V3_0_3_78.7z?rlkey=7xy5jupl6o2u41fvisij5v6cr\&st=7yiilvpy\&dl=0)

[Download SIMCOM SPT tool](https://1drv.ms/u/s!AlyvpbP56nGwttZjDIZaVWVyiTTpkg?e=0yU1Ex)


# Firmware update

This page has info on how to update the firmware of the A767x modules.

{% embed url="<https://www.youtube.com/watch?v=HAsjuCcw3Qk>" %}


# Open CPU programming

Check these videos for the Open CPU build process for A7672 made by SIMCOM FAE Mr. Nithin Tiwari

### <https://www.youtube.com/watch?v=IVKZdApi51E>

{% embed url="<https://www.youtube.com/watch?v=IVKZdApi51E>" %}
A767x Open CPU build process
{% endembed %}

###

{% embed url="<https://www.youtube.com/watch?v=Jxp_64ltdTI>" %}
Debugging the A767x modules Open CPU code
{% endembed %}


# A7670x-EVAL

Evaluation board for SIMCOM A7670 modules designed by Valetron Systems

{% hint style="info" %}
You should find majority of the details needed for using the hardware here
{% endhint %}

### ⚡ Introduction

A7670x-EVAL is a development board designed for SIMCOM A767x 4G LTE-CAT1 modules without GNSS versions. It supports 3 different variants, A767xC (For Asia) , A767xE( For Europe), A767xSA (For South America)

* [Features](/wiki/products/a7670x-eval/features)
* [Specifications](/wiki/products/a7670x-eval/specifications)
* [Getting Started](/wiki/products/a7670x-eval/getting-started)
* [Open CPU Programming](/wiki/products/a7670x-eval/open-cpu-programming)
* [Purchase link](https://www.valetron.com/store/a7670x-eval1-1.html)


# Features

A7670x modem features

{% hint style="info" %}
Here you will get a brief idea on what the device is capable of and the important features
{% endhint %}

### Power section :

The device has two power inputs,

#### 1) Main Power input - VCHG :

This is the main power input of the device and is usually connected to the 12V DC adapter. Right now the device supports from 12VDC to 42VDC input . The main power chip used here is the TPS54240 switching regulator. which converts the 12VDC input to 4V which goes to modules VBAT pin.&#x20;

#### 2) Battery power input - VBAT

This is the direct battery input and a 3.7V to 4.2V LiPo battery has to be connected to it. Use at least 400mAH battery. There is no reverse polarity protection to this pin so be careful connecting the battery. Use a battery with JST-XH size female connector.

To understand the power section of the device, look at the block diagram.


# Specifications

<table data-header-hidden><thead><tr><th width="210"></th><th></th></tr></thead><tbody><tr><td><strong>Model No.</strong></td><td>A7670x-EVAL</td></tr><tr><td><strong>Operating Voltage</strong></td><td><ul><li>Main Power Input (DC Jack): 12V to 42V DC [Connect to 12V DC Adapter]</li></ul><p><span data-gb-custom-inline data-tag="emoji" data-code="26a1">⚡</span><em><mark style="color:green;"><code>Has Reverse Polarity Protection</code></mark></em></p></td></tr><tr><td></td><td><p>Battery Input (Header connector) : 3.7V to 4.2V DC [Connect a single cell 3.7V-4.2V Li-Po or Li-Ion Battery]</p><p></p><p><span data-gb-custom-inline data-tag="emoji" data-code="26a0">⚠️</span> <em><mark style="color:orange;"><code>Doesn't have Reverse Polarity Protection</code></mark></em></p></td></tr><tr><td><strong>Dimensions</strong></td><td></td></tr><tr><td></td><td>PCB Dimensions - Length: 64.2mm * Width: 42mm * Thickness: 10 mm</td></tr><tr><td><strong>Battery Support</strong></td><td><ul><li>3.7V-4.2V DC Li-Po battery is supported.</li><li>Use > 400mAH capacity battery.</li></ul><p></p></td></tr><tr><td><strong>Cellular module</strong></td><td>A7670C-LASS - LTE-CAT1 - For use in India &#x26; Asia</td></tr><tr><td></td><td>A7670E - LTE-CAT1 - For Europe</td></tr><tr><td></td><td>A7670SA - LTE-CAT1 - For South America &#x26; Australia &#x26; Some networks in North America</td></tr><tr><td></td><td>A7672S-LASC - LTE-CAT1+2G - For use India &#x26; Asia</td></tr><tr><td></td><td>A7677S-LASC - LTE-CAT1 - For use in India &#x26; Asia</td></tr><tr><td><strong>Navigation hardware</strong></td><td>Not present</td></tr><tr><td></td><td></td></tr><tr><td><strong>Processor</strong></td><td>Based on ASR chipset</td></tr><tr><td><strong>Antenna</strong></td><td>📶 Cellular : U.FL Connector &#x26; SMA Connector</td></tr><tr><td><strong>Connectivity</strong></td><td> GPRS (HTTP, MQTT, TCP, UDP), SMS, Call</td></tr><tr><td><strong>SIM connector</strong></td><td>Push Push type Nano SIM card connector </td></tr><tr><td><strong>Flashing options</strong></td><td>On board Micro USB interface  can be used for updating module firmware and send AT commands</td></tr><tr><td><strong>Interfaces</strong></td><td>USB and UART interfaces can be used for sending AT commands</td></tr></tbody></table>


# Purchase info

Board purchase information

### [Click on this link to visit our store for purchasing this board.](https://www.valetron.com/store/a7670x-eval1-1.html)


# Getting Started

<figure><img src="/files/fgSoT1uoraQIhsMxd64K" alt=""><figcaption><p>A7670-EVAL-PINOUT</p></figcaption></figure>

### Inserting the SIM card

Get a Nano-SIM card and insert it into the boards push-push type SIM card slot.

Power should not be connected to the device during SIM card insertion

### Powering the device

This board can run from any of the two power sources,

<table data-header-hidden><thead><tr><th width="227"></th><th></th></tr></thead><tbody><tr><td><p><strong>Main Power Input</strong></p><p>[VCHG DC Jack connector]</p></td><td><ul><li>Can take 12V to 42V DC [Connect to 12V Lead Acid Battery]</li><li>Its a DC Jack type connector</li></ul><p>Has Reverse Polarity Protection</p></td></tr><tr><td><p><strong>Battery Input</strong></p><p>[VBAT connector J41]</p></td><td><ul><li>Can take 3.7V to 4.2V DC [Connect a single cell 3.7V-4.2V Li-Po or Li-Ion Battery]</li><li>Use at least 400mAH and above capacity batteries</li><li>Use a JST-XH type connector</li></ul><p>Doesn't have Reverse Polarity Protection</p></td></tr></tbody></table>

Device can start functioning with any of above power sources.

### Turning ON the modem :&#x20;

You need to press the PWRKEY switch for at least 1 second to boot the module.\
If you are using the PWRKEY header pin connected to MCU. There is a transistor between your header pin and the modules PWRKEY pin. So, you can boot the module from MCU by sending a high pulse on the PWRKEY pin for at least 1 second.&#x20;

PWRKEY header pin is routed through a NPN transistor so you need to send HIGH pulse to activate the modules PWRKEY pin&#x20;

### LED Indicators

* Once the device is powered ON, The Power LED D18 will turn ON.
* Once the module is booted using the PWRKEY button or PWRKEY header pin NETLIGHT LED D6 will turn ON indicating the module has booted.&#x20;
* Once the SIM is registered to the network, the NETLIGHT LED D6 starts blinking otherwise its stable.
* POWER LED remains ON all the time

### Interface

**USB Interface :** \
You can use USB interface for sending AT commands and updating the modules firmware. Make sure you install the drivers for the module before connecting USB. Drivers can be downloaded from the store website where you purchased the module.&#x20;

**UART Interface :**&#x20;

You can also use the UART interface to send AT commands to the module. The default baud rate is 115200.  The modules IO levels are 1.8V so there is a onboard TXS0104 or TXS0102 level translator which translates the modules UART TXD, RXD, DTR, RI lines 1.8V IO levels to MCU IO levels. For level translator to function properly you need to connect the VTRANS pin to the MCU IO level voltage, either 3.3V or 5V. <br>

{% hint style="warning" %}
All remaining module pins except UART TXD, RXD exposed on headers are at 1.8V levels, so care must be taken when interfacing these lines to external hardware like MCU. Use appropriate IO level translation wherever needed.
{% endhint %}


# Arduino Interfacing

Making Connections

<figure><img src="/files/Mhg6fnAHtP9lHFWcNtEn" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/hjW1aprzAkVRb4uM2bOy" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/i9IIA5fItPy43PZ7rWNf" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/BgYzzSc6RJF81s3caIll" alt=""><figcaption></figcaption></figure>

Here we have connected UART TX(Purple),RX(Grey),GND(Black),VTRANS(Yellow), PWRKEY(Blue) pins of modem to Arduino Uno  RX, TX, GND, 5V, GPIO2/Pin no 2 respectively&#x20;

Make sure you press PWRKEY switch before running the below code or incorporate the PWRKEY activation code before sending AT command. Wait for atleast 30 seconds after module turns on to send any AT command.

Here is a simple code for testing a simple AT command.  This code reads the IMEI number of module which is also printed on it.

```cpp

void setup()
{
  Serial.begin(115200);
  digitalWrite(2,1); // Make PWRKEY low
  delay(1000);
  digitalWrite(2,0); //  Make PWRKEY high
  Serial.println("Initializing...");
  delay(15000);
 
}

void loop()
{
  Serial.println("AT+CGSN");
  while(Serial.available()) 
  {
    Serial.write(Serial.read());//Forward what Software Serial received to Serial Port
  }
  delay(5000);

 
}

```


# Downloads

Important files needed to use the board

[Download USB Drivers](https://www.dropbox.com/s/wx7w27l0yg8oifh/SIMCom_USB_Drivers-20210721T094449Z-001.zip?dl=0)

[Download SDK for SIMCOM A7672x and A76xx](https://1drv.ms/f/s!AvU4h_maREWBgZABQsdBjkWHud6jSw)

[Download SSCOM terminal software](https://drive.google.com/file/d/1A9JA1aMoHEsFbpHvMSRa3PAotOysxkTM/view?usp=sharing)

[Download the CAT Studio for Debugging](https://www.dropbox.com/scl/fi/3eerek9zs8chg32vgclj8/CATStudio_V3_0_3_78.7z?rlkey=7xy5jupl6o2u41fvisij5v6cr\&st=7yiilvpy\&dl=0)

[Download SIMCOM SPT tool ](https://1drv.ms/u/s!AlyvpbP56nGwttZjDIZaVWVyiTTpkg?e=0yU1Ex)


# Firmware update

This page has info on how to update the firmware of the A767x modules.

{% embed url="<https://www.youtube.com/watch?v=HAsjuCcw3Qk>" %}


# Open CPU programming

Check these videos for the Open CPU build process for A7672 made by SIMCOM FAE Mr. Nithin Tiwari

### <https://www.youtube.com/watch?v=IVKZdApi51E>

{% embed url="<https://www.youtube.com/watch?v=IVKZdApi51E>" %}
A767x Open CPU build process
{% endembed %}

###

{% embed url="<https://www.youtube.com/watch?v=Jxp_64ltdTI>" %}
Debugging the A767x modules Open CPU code
{% endembed %}


# Dimensions

{% embed url="<https://drive.google.com/file/d/1SdXN-LHytBmJtgcGOTQh1_l9CQV-jxvG/view?usp=sharing>" %}
A7670x-EVAL Dimensions
{% endembed %}


# VALTRACK-V4-MF

The awesome asset tracker

&#x20;


# Getting Started

Here you will understand how to start using the product


# Specifications

<table data-header-hidden><thead><tr><th width="210"></th><th></th></tr></thead><tbody><tr><td><strong>Model No.</strong></td><td>VALTRACK-V4-MF </td></tr><tr><td><strong>Operating Voltage</strong></td><td><p>Battery Input : 3.7V to 4.2V DC [Connect a single cell 3.7V-4.2V Li-Po or Li-Ion Battery]</p><p></p><p><span data-gb-custom-inline data-tag="emoji" data-code="26a0">⚠️</span> <em><mark style="color:orange;"><code>Doesn't have Reverse Polarity Protection</code></mark></em></p></td></tr><tr><td><strong>Dimensions</strong></td><td>PCB Dimensions - Length: 34mm * Width: 43mm * Thickness: 1.6 mm</td></tr><tr><td><strong>Battery Support</strong></td><td><ul><li>3.7V-4.2V DC Li-Po backup battery is supported.</li><li>Use > 400mAH capacity battery.</li><li>MP2617 Charger chip is used to handle the battery charging.</li></ul></td></tr><tr><td><strong>Cellular module</strong></td><td>A7672S - 4G-LTE-CAT1 / 2G - For India &#x26; Asia</td></tr><tr><td></td><td>A7672E - 4G-LTE-CAT1 /2G - For Europe</td></tr><tr><td></td><td>A7672SA- 4G-LTE-CAT1 / 2G - For South America, USA &#x26; Australia</td></tr><tr><td><strong>Navigation hardware</strong></td><td>Inbuilt GNSS of A7672x or Standalone GNSS module</td></tr><tr><td></td><td>A7672x has inbuilt GNSS hardware which needs passive or external active antenna [Bias is already provided to the GNSS U.FL connector]</td></tr><tr><td><strong>Operating Modes</strong></td><td>HTTP, SMS Updates</td></tr><tr><td><strong>Configuration Methods</strong></td><td>Bluetooth/Firmware</td></tr><tr><td><strong>Processor</strong></td><td>STM32 low power MCU</td></tr><tr><td><strong>Motion Sensor</strong></td><td>LIS3DH 12-bit, 3-axis Accelerometer</td></tr><tr><td><strong>Antenna</strong></td><td><p>📶 Cellular : U.FL Connector</p><ul><li>1.5 dBi gain Flexible PCB antenna comes attached</li></ul></td></tr><tr><td></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="1f6f0">🛰️</span> A7672x GNSS : U.FL Connector</p><ul><li>Patch antenna comes attached</li></ul></td></tr><tr><td><strong>Connectivity</strong></td><td>Bluetooth, GPRS, SMS, Call</td></tr><tr><td><strong>SIM connector</strong></td><td>Nano SIM card connector available</td></tr><tr><td><strong>Flashing options</strong></td><td>SWD</td></tr></tbody></table>


