sideralis / air Goto Github PK
View Code? Open in Web Editor NEWAir project
Air project
Air firmware =========== == FILES == =========== user/user_html.c: Set of functions to extract usefull data from a page request (GET/POST, page name, query param) Set of functions to return a page after a request user/user_led.c: Driver for red, green et blue leds user/user_main.c: Entry point. Set esp8266 in Station and softAP mode. Start main state machine Start TCP Server Start a task to capture data from SDS011 Start a task to scan wifi networks user/user_mqtt.c: To send mqtt messages to our server user/user_pages.c: Each function handles a web page for a given protocol (GET, POST or both) user/user_queue.c: To create queues which are used for inter tasks communication user/user_spiffs.c: Spiffs init user/user_sds011.c: Driver for SDS011 (PM2.5 & PM10 sensor) Use GPIO4 (RX) and GPIO5 (TX) to connect to SDS011 uart port user/user_tcp_client.c: TCP client, used to send device registration to our server user/user_tcp_server.c: TCP server + table to map functions and web page user/user_test.c: Unit tests user/user_wifi.c: Task for wifi scan and setuping wifi library/utf8.c: To convert UTF8 char to ASCII char (used when converting password with special characters) ================= == COMPILATION == ================= = Env variables = export BIN_PATH=/path/to/binary/output (already set in Eclipse project configuration) export SDK_PATH=/path/to/esp8266/sdk (already set in .bashrc for me) (tag v2.x.x) = Compiler = You need xtensa-lx106-elf cross compilation tools (version xtensa-lx106-elf-gcc (crosstool-NG 1.20.0) 4.8.2) (available on espressif web site) Or: Get it from esp-open-sdk: https://github.com/pfalcon/esp-open-sdk Clone in recursive mode. Install the required packages. Compile not in standalone mode. = To compile = make BOOT=none APP=0 SPI_SPEED=40 SPI_MODE=QIO SPI_SIZE_MAP=0 ============== == FLASHING == ============== To be called from ${BIN_PATH} esptool.py --port /dev/ttyUSB0 -b 460800 write_flash 0x00000 eagle.flash.bin 0x20000 eagle.irom0text.bin 0x3fc000 /home/gautier/git/ESP8266_RTOS_SDK/bin/esp_init_data_default.bin 0x3fe000 /home/gautier/git/ESP8266_RTOS_SDK/bin/blank.bin ============= == DEBUG == ============= To be called from ${BIN_PATH} gdbcmds should be copied from esp-gdbstub to ${BIN_PATH} Uncomment call to gdbstub_init() in user_main.c before launching it. ~/git/esp-open-sdk/xtensa-lx106-elf/bin/xtensa-lx106-elf-gdb -x gdbcmds -tui -b 115200 ~/workspace/air/.output/eagle/DEBUG/image/eagle.app.v6.out Or launch it from Eclipse (do not forget to put a breakpoint before launching it) ================== == ARCHITECTURE == ================== See UML file air in plan folder ## HTML ## The pages are stored in a spiffs image. The spiffs image is flashed to the board at address 0x300000 with command esptool.py --port /dev/ttyUSB0 -b 460800 write_flash 0x300000 spiffs-image.bin The pages are stored in the folder spiffs/data. Spiffs image is created with command ~/git/mkspiffs/mkspiffs -p 256 -b 8192 -s 0xfa000 -c data/ spiffs-image.bin The http header is added by a call to html_add_header() ## Wifi scan ## A task (task_wifi_scan())is dedicated for scanning wifi networks. A scan is done by calling wifi_station_scan(). When scan is done, scan_done() is called. Data are then read and for each network a message is queued. ## Main ## See UML file air in plan folder Goto (2) Goto (3) =============== == WEB PAGES == =============== /wifi.html: Page used to display all wifi network and let user select the one he wants to connect to /connect.html: To retrieve the ssid name and password of the wifi ssid the user wants to connect to =========== == TO DO == =========== See github issues
if one part of mac address starts with a zero, this zero is omitted.
For example 38:2b:78:03:d7:1d is sent as 38:2b:78:3:d7:1d
It is not possible to fully use IBM IOT as retain message is not working. So there is no other choices than implementing our own mqtt broker.
If user of a device is removed, then when the device connect to internet, the device is orphelin and noone can register it.
Implement a debug module which can not only print message on console but also messages as mqtt messages to our broker.
This way, I can monitor the status of each device.
It may (or may not?) happen that during a registration something is going wrong. In this case, the device may be registered at server side, but not at device side, meaning that the device does not have any token.
A new registration will fail as the device will get already registered and not the token!
Measure rate could be changed by web interface.
Min 1mn
Max 1 hour
This change impact the mqtt connection as we may loose it between two messages.
Firmware should be able to decrypt a token hashed with a public key.
Setup MQTT server on IBM cloud
Send pm values to the MQTT server
French standard
yearly average should not exceed 40ug/m3
daily average should not exceed 50ug/m3 more than 35 days per year
Source: https://www.airparif.asso.fr/reglementation/normes-francaises
Use Flutter: https://flutter.io/
Currently the reference start date is hard coded and common for all devices.
It should be linked to registration date of device.
Device should send a running/not running status.
When connecting, send a lastWillMessage = "offline", and lastWillRetain = true, and then send a publish message= "online", and retainedFlag = true
Device should know the time with precision to be able to associate the measurements with a time reference.
It should be possible to update air firmware OTA.
When registering a new device, the user provides the SSID and password of the wifi through a web page.
Once provided, the user does not have a feedback if this registration went well.
air-website may be impacted too.
Move from SDK v2.2 to SDK v3.0
Adapt air software
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.