mohamedboubaker / gps-tracker Goto Github PK
View Code? Open in Web Editor NEWSTM32 and SIM808 GPS tracker with a custom PCB design and support for MQTT and AES-128 encryption.
STM32 and SIM808 GPS tracker with a custom PCB design and support for MQTT and AES-128 encryption.
possible visualization solutions
The program should collect position and speed data every 10 seconds and stores the new values if the traveled distance is superior than 10 meters and then sends the data to the server every minute
When the device is moving, this will result in 6 updates sent together every minute.
the firmware should send a status report every T duration (30 min or 1h) to a status MQTT topic.
Report includes : board temperature - uptime - cell signal strength - visible GPS satellites - ping duration
sim_mqtt_publish should include
The Client ID as an input with fixed length = 4 Bytes
The topic name with an maximum length of 64 Bytes
The message length which is variable with a maximum of 256
uint8_t sim_mqtt_publish(char * server_address, char * port, char * client_id, char * topic, uint8_t topic_length, char * message, uint8_t msg_length);
After receiving the board, the initial power on failed. The board doesn't work when given a 9V input.
develop a minimalist stm32 breakout board that contains the power regulation circuit and an STM32
The purpose of the circuit is to
add a function sd_log(char * msg, char * file name); that logs a message into a text file on the SD card.
This function will be called after performing each step in the program.
Add a Standard 10 pin SWD connector to the board.
create a function uart8_t sim_gprs_get_status() that returns the status of the GPRS connection by checking the following points:
At this point, there are 3 functions just to send commands the module. This creates confusion.
Create only one function to send commands to the module.
@param char * cmd the command to be sent to the module
@rx_wait the time required by the module to process the command. wait this time before checking the receive buffer
@param char * rx_buffer copy the reply of the module into this buffer
@param uint8_t get_reply is used to tell the function if it should copy the reply into the buffer or not.
uint8_t send_command(char * cmd, uint8_t rx_wait, char * rx_buffer, uint8_t get_reply)
The sim_tcp_send function below to send the TCP payload without checking if the underlying GPRS connection is still on. When the GPRS connection is disconnected, sim_tcp_send will fail with unpredictable behavior.
Note: GPRS connection could disconnected for several reasons:
a cell handover could go wrong
the network could disconnect the device
the cell is not reachable
Add the following changes to the send_cmd function:
GPS board should have an SD card on board that can be used to log GPS data in case of GPRS connection issue.
Change the circuit so that the board can be powered by a battery.
Change the circuit to utilize the internal charging circuit inside the sim808.
Change the buck converter configuration so that the output voltage is 4V. and add a Linear regulator to drop voltage to for the STM32.
4V input will be necessary for the SIM808 if it is used to charge a battery.
Add a 2 pin JTS connector for battery input.
Change the 2 layer design into a one layer design to reduce manufacturing costs.
All components should be placed on one side.
using global variable is not recommended as it can lead to bugs due to race conditions.
receive buffer should be encapsulated by a wrapper function.
the buffer should be static inside the function.
the HAL UART receive interrupt callback HAL_UART_RxCpltCallback() should insert the received byte into the buffer by calling a function instead of accessing the global variable.
The STM32 should be programmable through a USB.
To do so, add USB to UART circuit to interface with the STM32.
Add a button to the boot pin of the STM32.
Use the CP2102 IC or an equivalent.
The USB connection will be used to communicate with the STM32 UART or to program it without the need of SWD.
Develop a circuit to regulate the input voltage with the following requirements:
3.6V is required because it is the intersection between the working voltage ranges of both STM32 and SIM808
SIM808 range: 3.4V->4V
STM32F0 range: 1.8V->3.6V
change the power input connector into JST XH 2.54 mm
review the current code and refactor functions if possible
The watchdog timer is important to save the hardware/firmware in case of an infinite loop introduced by an unknown bug or a hardware issue.
Watch dog timer should be enabled and watch dog reset should be introduced in the code
Add the circuit and layout for Bluetooth antenna on the SIM808
Use UF.L IPEX connector for the antenna.
Position data sent to the server must be encrypted.
A function to encrypt the position payload should be developed.
When power is turned off, the sim808 loses track of time. This means, when it is turned on again, it will take around 60-90 seconds to acquire a GPS fix. Hooking up the sim808 to a backup battery ensures it always has correct time. Which will speed up the Time To First Fix (TTFF) to around 10-15 seconds.
Add a battery socket or a large capacitor to the VRTC pin.
On some received boards, even after fixing issue #21 the circuit cannot power on correctly.
The MCU and SIM808 have sleep modes.
The board should enter into sleep mode as much as possible to save power consumption.
it should also turn of the GPS Antenna DC bias.
Reset button is currently connected only to the reset of the MCU.
It should also be connected to the Reset pin of the SIM808.
SIM808 uses USB to upgrade the firmware.
Add the circuit and layout for the USB.
sim_init() should:
To power on the module:
The current version of the PCB has a GPS antenna issue. The GPS signal is not strong enough for the SIM808 to get a GPS fix.
Probable root cause: lack of DC bias on the antenna line to activate the active GPS Antenna.
DC signal in the antenna line should be introduced and turned on and off using a transistor (or other switch) connected to a GPIO on the MCU. It should be activated and deactivated by software to control power consumption of the Active antenna.
In network_functions.c in function sim_tcp_send
after constructing the open tcp connection command, using strcat. the command is sent to the module to open a tcp connection,
in case the creation of connection fails the module sends CONNECT FAIL error. This error msg is not captured in the receive buffer.
Even when the connection has succeeded with CONNECT OK,
The only thing captured in the receive buffer is the "issued command"
In case the module freezes or connectivity is disrupted a reset could be useful.
Create a function void system_reset(); that resets the module then the stm32
Write about all the project details in the GitHub README file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.