Commit c0cb43ab authored by Nelso Jost's avatar Nelso Jost

ADD better docs

parent 291f5c8d
# Meteorolog
This repository contains several applications devoted to perform data logging of sensor data from the EMM boards.
This repository contains several applications devoted to perform data logging of sensor data from the EMM boards:
First, sensors are attached to an Arduino board that read data upon serial commands. Next you can choose one of two platforms to perform data logging:
* **Arduino firmware** -- Read sensor data upon serial commands like `read,dt,t` (which returns the RTC datetime and the temperature as comma-separated values);
* NodeMCU + SD card: microcontroller with embedded Wifi.
* **NodeMCU firmware** -- communicate with Arduino via software serial to retrieve sensor data and perform data logging into SD card and remote server via wifi (ESP8266);
* Arduino firmware: read sensor data via serial commands.
* PyLogger software (Linux): alternative data logger that can run on a RaspberryPi with the Arduino plugged on the USB;
* Example: send the string "read,t,p,h" for reading temperature, pressure and humidty. The answer will be a three comma-separated numbers.
## Arduino Firmware
* NodeMCU firmware: retrieve sensor data from Arduino via software serial and perform data logging on SD card and remote server.
The Modular Meteorological Station (EMM in portuguese) concept starts with the use of cheap but reliable sensors plugged onto the popular open-source hardware Arduino board. The basic kit includes:
* Example: via serial monitor, execute the command "meteorolog 5 read,t,p,h <board_hash>" to start data logging with 5 minutes interval.
<board_hash> can be retrieved from the website
* DHT22 for reading temperature and air humidity;
* BMP180 for reading atmospheric pressure and also temperature;
* LDR for reading luminosity (not calibrated for lux);
* RTC DS1307/DS3231 (Real-time Clock) to provide reliable timestamps;
* Python Datalogger: read Arduino data via serial port and perform datalogging locally on the computer HD and also send data to the server.
Reading of those sensores rely on great, easy-to-find, open-source libraries. You can install and use the firmware on a board with none or only some of the components.
> This firmware does not perform datalogging! It just read sensor data.
### Installation
The Arduino-IDE-compatible firmware source code is inside the `arduino/meteorolog` directory. There are two options for compiling and upload to the board:
(i) Simply use the Arduino IDE. Open the `meteorolog.ino` file, select board model (ex: Uno), port (ex: `/dev/ttyACM0`) and click the right-arrow upload button;
(ii) PlatformIO for those who like to stay on the terminal.
* The `arduino/Makefile` provide commands to make the proccess as easy as typing `make` to build, upload and open the serial monitor :-)
* Make sure you have the tool with `make install-platformio` (just once);
* Edit the file's `BOARD` variable with your board model (check `platformio boards arduino` for all possible names);
* For more info check the full file at `utils/platformio/Makefile`;
### Usage
Simply send a string with a valid board command via serial monitor or another serial tool and wait for the response. The `help` command list all of them:
* `read,<name1>,<name2>,...,<nameN>`
Read one or more sensor values by using the full name as registered on the web site ( or the respective short nickname. Retunrs a list of comma-separated values.
Example: `read,dt,t` returns the RTC datetime and the DHT22 temperature.
* `setrtc,<year>,<month>,<day>,<hour>,<minute>,<second>`
Configure the real time clock (RTC either DS1307 or DS3231) with given datetime.
* `listall`
List all available sensores along with their nicknames.
* `help`
Show the list of all available commands.
## NodeMCU firmware
## PyLogger firmware
......@@ -8,7 +8,6 @@
#include "sdcard.h"
#include "wifi.h"
DynamicJsonBuffer jsonBuffer(1000);
Meteorologger::Meteorologger(REPL * repl,
SoftwareSerial * arduinoSerial,
......@@ -199,6 +198,7 @@ void Meteorologger::set_board(int board_id, String user_password)
StaticJsonBuffer<500> jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
root["board_id"] = board_id;
root["user_password"] = user_password;
......@@ -230,6 +230,7 @@ bool Meteorologger::save_config(bool print_after)
this->config_filename + "'");
return false;
StaticJsonBuffer<500> jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
root["board_id"] = String(this->board_id);
root["board_hash"] = String(this->board_hash);
......@@ -257,6 +258,7 @@ void Meteorologger::load_config(void)
this->config_filename + "'");
StaticJsonBuffer<500> jsonBuffer;
JsonObject& root = jsonBuffer.parseObject(fp);
this->board_id = root["board_id"].as<String>().toInt();
this->board_hash = root["board_hash"].as<String>();
......@@ -285,6 +287,7 @@ void Meteorologger::print_config(void)
String Meteorologger::generate_json(void)
StaticJsonBuffer<500> jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
JsonObject& root_sensors = jsonBuffer.createObject();
JsonObject& root_datetime = jsonBuffer.createObject();
......@@ -342,6 +345,7 @@ String Meteorologger::generate_json(void)
bool Meteorologger::server_upload(String json)
StaticJsonBuffer<500> jsonBuffer;
this->repl->log("\n[INFO] Attemping upload to server..");
String response=wpost(APIURL_POSTRAWSENSORDATA, "application/json", json);
this->repl->log("\n[DEBUG] Response:\n" + response);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment