Firmware for GPS-tracked PM10 sensors on opensensemap.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
noerw 54b9f91628 read SDS011 & HDC1008 instead 1 year ago
..
LICENSE move libraries to ../libraries 1 year ago
README.md move libraries to ../libraries 1 year ago
TelnetPrint.h move libraries to ../libraries 1 year ago
api.h move libraries to ../libraries 1 year ago
box.jpg move libraries to ../libraries 1 year ago
config.h move libraries to ../libraries 1 year ago
esp8266-gps.ino read SDS011 & HDC1008 instead 1 year ago
gps.h move libraries to ../libraries 1 year ago
storage.h move libraries to ../libraries 1 year ago
streampipe.h move libraries to ../libraries 1 year ago
ublox-neo7m-config_10hz-europe.txt move libraries to ../libraries 1 year ago
wifi.h move libraries to ../libraries 1 year ago

README.md

esp8266-gps

This is a modular (but probably overcomplicated) sketch for a mobile sensebox, written as a part of my bachelors thesis. It measures arbitrary phenomena (currently only implemented: WiFi network count), which are geocoded and uploaded to the openSenseMap upon wifi connection.

Supports debug logging via telnet on it’s own access point + the connected network.

box setup

hardware setup

Written for a ESP8266 (Wemos D1 R1) with a connected GPS Module (NEO-7M), and based on the ESP8266 Arduino core for Arduino IDE. The sketch should work with any other ESP variant as well.

The GPS module must provide NMEA sentences & be connected via the hardware serial (Wemos Pins 0 & 1). SoftSerial did not work for me but created many issues (random crashes, due to buffer overflows?).

software installation

  • install Arduino IDE
  • install ESP8266 Arduino core
  • connect your ESP8266 via USB
  • open the file mobile-sensebox.ino in Arduino IDE
  • change the configuration to your needs in the file config.h
  • select the board Wemos D1 (retired) (or whatever you have)
  • hit upload (the GPS device must not be connected!)

program behaviour

Once started, the device will idle until a first GPS fix was established. From then on the following procedure runs repeatedly:

  1. measure phenomena (wifi scan takes ~1sec)
  2. update GPS location (takes 0.5-2sec)
  3. store measurements to local filesystem (SPIFFS)
  4. check if internet connection is available & upload stored measurements to openSenseMap
  5. idle until the box moved a given distance and/or a time interval has passed (depends on config, default 25m, 12sec)

Two hardware switches are implemented, which enable/disable the measurement- and/or upload-procedure: By default, connecting pin 15 to GND disables the upload, connecting pin 14 to GND disables the measurements. This can be useful for quickly uploading accumulated stored measurements!

debug logging

A telnet logger is enabled by default, and provides basic debug output.

You can connect to it both from the created accesspoint (which is there only for this purpose), as well as on the connected wifi network. So you either..

  • connect to the open network mobile-sensebox and run telnet 192.168.1.1
  • connect to the same network as configured in config.h and run telnet <whateverIPtheESPgets>

Connections are not polled all the time, so you may have to wait a moment until you receive first data.

Note that, due to the limited single-channel hardware of the ESP8266, a reconnection to the configured WiFi network fails, when a client is connected to the telnet logger on the open access point.

dev environment

Developed using ESP8266 Arduino core v2.3.0 in Arduino IDE v1.6.8.

Depends on the following libraries, of which copies are stored in the lib/ directory:

further resources

license

GPL-3.0