Arduino Nano C Code to be created and Mysql connector app/service to integrate.
Project is to have an Arduino Nano, powered from a 2 wire connection to a car battery 12v. There will be a potential divider, onto an input pin say A0 which will have 5v when the car battery shows 14V (allowing for some buffer when engine running). There will be a push button connected to A1 which will wake the unit or trigger an action. There will be a 16x2 LCD display connected SDL SCA connected to A2 A3. There will be a DHT22 sensor connected to D2. There will be a simcom SIM800L connected via a 4V from a LM317 TX to pin D5 RX to pin D6. There will be a FET to turn on the LM317 and GSM module connected to pin D7.
On power up, the LCD will initialise, the device will read the battery voltage (or the analogue voltage of 0-5v on pin A0 x scaler). On power up, the temperature and humidity will be checked. On power up, D7 will be powered to turn on the GSM module so it can start network connection. The LCD will display the current battery voltage and the temperature for 10 seconds. Then, the GSM module will initialise and make a PDP connection. Then, the GSM will send an HTTP Post message to a listening application on a web server which will decode the message and insert into a mysql database the ID, temperature, humidity, voltage and event flag. The listener app, will responsd with GSM OK and a number from the db, from a config table, which has a value of 1 - 24 back to the arduino - which will display on the LCD - Message sent - and the backlight will then go off after 10 seconds following this message. when the backlight goes off, the FET will switch off which will power down the GSM module.
The arduino will now start in internal timer running on the device (which may not be extremely accurate) but after 1 hour, the device is to read the temperature, humidity and voltage again and store it locally. This will happen every hour. Every 12 hours (approx) the device will wake up the GSM engine and send the data back to the database. This value of 12 (is the number which is already in the DB under the config value for each device). The ID stored in the DB is the at+ccid number from the module.
So, if the config value in the db is set to 1, then the device will wake every hour and send data to the db. if the config value in the db is set to 24, then the device will wake every 24 hours and send in 24 previously stored values.
If someone presses the push button, this will simply turn on the backlight of the LCD and display the current voltage reading. if someone presses and holds the button down for 5 seconds, then the device will wake the GSM and send teh reading back (event = 2 with the current and any stored readings to the db and check the stored config etc.
Event flags are 1= power on 2= manual 3= timed
The LCD has standard libraries, the GSM module has standard libraries also Tiny_GSM_Sim800 which work well with the SIM800 module.
if you require some external flash to store the values - let me know, but i was hoping we could do this with existing arduino nano - or we simply reduce the amount of storage we offer.
I am looking for the code to be created for arduino and the web connector source code. Arduino to be Arduino IDE or C, web connector to be linux or php or windows app/service - just let me know which you prefer (i prefer php). i will create the mysql db and crons etc on a webserver somewhere. the connection will be a dns lookup on a static port - so for instance tcp or udp push to www.battconnect.com:8000 (this doesnt exist but i will create something similar)
Existing libraries for driving LCD and Driving GSM make that very simple - I can certainly help with commands required to establish pdp and socket connection, and retrieving sim details etc.