StofAnanas: Difference between revisions

From RevSpace
Jump to navigation Jump to search
No edit summary
No edit summary
Line 20: Line 20:
* Automatic determination of location by means of wifi location
* Automatic determination of location by means of wifi location
* Remote control over IR
* Remote control over IR
== Operation Manual ==
Programming:
* connect everything up as indicated under 'hardware' and plug the Wemos D1 in the USB port
* flash the software into the Wemos D1 mini, typically from the command line
  pio run -t upload
Configuration:
* on https://netherlands.maps.luftdaten.info find the particulate matter station you want to follow and note the number of the station, for example "12246"
* on a mobile phone, connect to the "ESP-STOFANANAS" network, and select login
* when presented with the captive portal, select a WiFi network, fill in the WiFi password, AND ALSO fill in the number you looked up earlier, press SAVE
* NOTE: when the configuration is ongoing, the LED will be YELLOW, it turns OFF when configuration is done.


== Hardware ==
== Hardware ==
Line 42: Line 55:
For example:
For example:
   http://api.luftdaten.info/v1/sensor/12246/
   http://api.luftdaten.info/v1/sensor/12246/
A HTTP GET results in a list of JSON structure like this:
<pre>
  {
    "id": 3941048759,
    "location": {
      "altitude": "0.6",
      "id": 6186,
      "indoor": 0,
      "country": "NL",
      "exact_location": 0,
      "longitude": "4.692",
      "latitude": "52.022"
    },
    "timestamp": "2019-06-16 09:46:03",
    "sampling_rate": null,
    "sensordatavalues": [
      {
        "id": 8353891652,
        "value_type": "P0",
        "value": "10.60"
      },
      {
        "id": 8353891653,
        "value_type": "P1",
        "value": "17.80"
      },
      {
        "id": 8353891654,
        "value_type": "P2",
        "value": "15.60"
      }
    ],
    "sensor": {
      "id": 12246,
      "sensor_type": {
        "name": "PMS7003",
        "id": 22,
        "manufacturer": "Plantower"
      },
      "pin": "1"
    }
  }
</pre>


=== Arduino libraries ===
=== Arduino libraries ===

Revision as of 21:45, 16 June 2019

Project StofAnanas
StofAnanas.jpg
Showing particulate matter concentration as a coloured light
Status Initializing
Contact bertrik
Last Update 2019-06-16

The idea

Show current airborne particulate matter concentration using a LED light in a lamp, inspired by http://stoflamp.nl The data that the LED colour is based on is simply retrieved over WiFi from the luftdaten website.

This lamp is a plastic pine apple ("ananas"), bought at the "Action" store.

Concepts/ideas:

  • The lamp shows particulate matter concentration as a colour, e.g. soft/positive colours for low concentration and hard/bright colour for high concentration
  • The lamp "breathes" by varying the intensity over time, e.g. a cycle of 10 seconds where the light dims a bit and brightens a bit. Perhaps we can increase the breathing rate as well for higher PM.
  • The lamp retrieves the PM value over wifi from the the luftdaten website

Nice to have:

  • Automatic determination of location by means of wifi location
  • Remote control over IR

Operation Manual

Programming:

  • connect everything up as indicated under 'hardware' and plug the Wemos D1 in the USB port
  • flash the software into the Wemos D1 mini, typically from the command line
 pio run -t upload

Configuration:

  • on https://netherlands.maps.luftdaten.info find the particulate matter station you want to follow and note the number of the station, for example "12246"
  • on a mobile phone, connect to the "ESP-STOFANANAS" network, and select login
  • when presented with the captive portal, select a WiFi network, fill in the WiFi password, AND ALSO fill in the number you looked up earlier, press SAVE
  • NOTE: when the configuration is ongoing, the LED will be YELLOW, it turns OFF when configuration is done.

Hardware

pinout

The lamp is controlled by an ESP8266, a Wemos D1 mini board. The LEDs used has a built-in PL9823 controller.

Connections:

  • LED Din to Wemos D1 mini pin D4
  • LED Gnd to Wemos D1 mini pin GND
  • LED Vdd to Wemos D1 mini pin 5V

Software

Software is available on github.

Luftdaten interface

The current measurement value of a particular sensor can be retrieved over a REST interface, using URL

 http://api.luftdaten.info/v1/sensor/<sensor-id>/

where <sensor-id> is the database id used by luftdaten (and visible on their map). The trailing slash in the URL is significant.

For example:

 http://api.luftdaten.info/v1/sensor/12246/

Arduino libraries

Libraries:

  • WiFiManager is used to manage WiFi connection to the local AP
  • FastLED is used to control the LED
  • ArduinoJSON for the parsing the luftdaten response