WARNING: Work in progress!
This code contains many errors and still in development state!
✅ GPS tracking with AT6558 module
✅ WiFi-based location fallback
✅ Automatic sleep mode on inactivity
✅ Battery monitoring with accurate percentage calculation
✅ SMS command configuration
✅ Voice call support
✅ LED status indicators
✅ Data buffering during connection loss
In this mode tracker will send POST JSON to server:
{
"imei" : " 123456789012345" ,
"timestamp" : 1234567890 ,
"latitude" : 55.751244 ,
"longitude" : 37.618423 ,
"altitude" : 156.0 ,
"speed" : 45.5 ,
"course" : 180.0 ,
"satellites" : 12 ,
"battery" : 85 ,
"charging" : false ,
"source" : " gps" ,
"accuracy" : 0
}
SMS (example)
Explain
APN,internet.mts.ru,mts,mts
Configure mobile internet (APN)
SERVER,GT06,tracker.example.com:5023
Configure GT06 server or ~
SERVER,HTTP,https://example.com:8080/api/track
Configure HTTP server
WIFISERVER,location.example.com:80,/api/locate
Configure WiFi Location Server (Optional)
WIFIENABLE,1
Enable/Disable WiFi Location
ADDNUMBER,+1234567890
Add phone number for restrict configuration access
DELNUMBER,+1234567890
Remove allowed phone number
INTERVAL,10
Set data send interval (1-600 seconds)
SLEEP,30
Set inactivity timeout / Sleep mode (Minutes)
STATUS
Request current status
POWEROFF
Poweroff device
RESET,123456789012345
Reset settings (IMEI as password)
First SMS from any number becomes the primary number
If no allowed numbers configured, all numbers are allowed
If no call numbers configured, no calls will be accepted
All commands are case-insensitive
Invalid commands will receive error response
RESET command works from any number but requires IMEI
WiFi location is optional and disabled by default
WiFi networks are sent to server when GPS is unavailable
Red : GPS status
On: GPS locked
Off: GPS disabled
Blinking: Searching satellites
Blue : Network status
Off: No server configured / No internet
Blinking: Connecting to server
Pulse: Data transmission
Yellow : Battery status
On: Normal operation
Blinking slow: Charging
Blinking fast: Low battery (<20%)
Blinking very slow: Sleep mode
Main chip : Quectel EC800N-CN (LA)
System : MicroPython v.1.13.0 (mPY: 10245, Python v3.4.0, QPY v0006)
mPY RAM : 512256 bytes
mPY ROM : ~576KB in /usr/ plus ~100KB in /bak
GPS Chip : AT6558 Datasheet
Microphone is preset, but there is no voiceCall class in firmware, so we can't accept or make calls
Power button connected to dedicated power IC. Short press - poweron, long press (10+ seconds) - poweroff.
Reset button just reset power of device.
i2c0 have two devices on address: 0x62 and 0xE2. Can't understand, what is it. Maybe its i2c interface of GPS module (there is no info in datasheet)
GPIO
Pin
Function 1
Function 2
Notes
GPIO1
30
PCM_CLK
SPI0_CLK
Side port #3
GPIO2
31
PCM_SYNC
SPI0_CS
Side port #4
GPIO3
32
PCM_DIN
SPI0_MOSI
Side port #5
GPIO4
33
PCM_DOUT
SPI0_MISO
Side port #6
GPIO5
49
LCD_RST
PWM3
GPIO6
50
LCD_SPI_DOUT
SPI1_MOSI
GPIO7
51
LCD_SPI_RS
SPI1_MISO
GPIO8
52
LCD_SPI_CS
SPI1_CS
GPIO9
53
LCD_SPI_CLK
SPI1_CLK
GPIO10
54
CAM_MCLK
GPS Power pin
GPIO11
55
CAM_SPI_DATA0
GPIO12
56
CAM_SPI_DATA1
GPIO13
57
CAM_I2C_SCL
GPIO14
58
CAM_I2C_SDA
GPIO15
80
CAM_SPI_CLK
Red led
GPIO16
81
CAM_PWDN
Blue led
GPIO17
76
KP_MKOUT_2
Yellow led
GPIO18
77
KP_MKIN_2
IN2
GPIO19
82
USB_BOOT/KP_MKOUT_4
OUT4
GPIO20
83
KP_MKIN_4
IN4
GPIO21
86
KP_MKOUT_1
OUT1
GPIO22
87
KP_MKIN_1
IN1
GPIO23
66
I2C0_SDA
Device @ 0x62
GPIO24
67
I2C0_SCL
Device @ 0xE2
GPIO25
17
UART2_RXD
GPS Tx
GPIO26
18
UART2_TXD
GPS Rx
GPIO27
19
UART2_DTR
GPIO28
20
UART2_RI
GPIO29
21
UART2_DCD
GPIO30
22
UART2_CTS
GPIO31
23
UART2_RTS
GPIO32
28
UART1_RXD
IN0
AUX UART
GPIO33
29
UART1_TXD
OUT0
GPIO34
38
UART0_RXD
DEBUG UART
GPIO35
39
UART0_TXD
GPIO36
16
NET_STATUS
PWM2
GPIO37
78
LCD_TE
PWM1
79
PWM0