Difference between revisions of "StofAnanas"

From RevSpace
Jump to navigation Jump to search
(9 intermediate revisions by the same user not shown)
Line 13: Line 13:
 
This lamp is a plastic pine apple ("ananas"), bought at the "Action" store.
 
This lamp is a plastic pine apple ("ananas"), bought at the "Action" store.
  
Concepts/ideas:
+
Features:
* 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 shows particulate matter concentration as a colour, from light blue for low concentration and bright pink 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
 
* The lamp retrieves the PM value over wifi from the the luftdaten website
 
* The luftdaten measurement station can be entered at the same time as when wifi credentials are entered.
 
* The luftdaten measurement station can be entered at the same time as when wifi credentials are entered.
  
Nice to have:
+
Ideas/nice to have:
* Automatic determination of location by means of wifi location
+
* Use HSV/HSL colour model internally (instead of RGB)
 +
* 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 increase the breathing rate for higher PM
 +
** perhaps modulate the colour saturation instead of intensity
 +
* Automatic determination of location by means of wifi location, so you don't even need to input a luftdaten monitoring station id (do this on every startup for example)
 +
** example query:
 +
  http://api.luftdaten.info/v1/filter/area=52.022,4.692,1.0
 
* Remote control over IR
 
* Remote control over IR
  
Line 36: Line 41:
 
* 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
 
* 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.
 
* NOTE: when the configuration is ongoing, the LED will be YELLOW, it turns OFF when configuration is done.
 +
 +
=== Usage ===
 +
* Turn on the light while in range of the WiFi network you configured
 +
* The LED should start yellow (connecting to the WiFi), then briefly change to OFF (retrieving PM value from Luftdaten), then change to a colour representing a PM concentration
 +
* A new PM measurement is retrieved every minute.
  
 
== Hardware ==
 
== Hardware ==
Line 43: Line 53:
  
 
Connections (using dupont female-female):
 
Connections (using dupont female-female):
* LED Din to Wemos D1 mini pin D4
+
* LED Din to Wemos D1 mini pin D3
 
* LED Gnd to Wemos D1 mini pin GND
 
* LED Gnd to Wemos D1 mini pin GND
 
* LED Vdd to Wemos D1 mini pin 5V
 
* LED Vdd to Wemos D1 mini pin 5V
Line 51: Line 61:
  
 
=== Luftdaten interface ===
 
=== Luftdaten interface ===
The current measurement value of a particular sensor can be retrieved over a REST interface, using URL
+
The current measurement value of a particular sensor can be determined by parsing the JSON messages retrieved over a REST interface, by performing an HTTP GET on URL
 
   http://api.luftdaten.info/v1/sensor/<sensor-id>/
 
   http://api.luftdaten.info/v1/sensor/<sensor-id>/
 
where <sensor-id> is the database id used by luftdaten (and visible on their map).
 
where <sensor-id> is the database id used by luftdaten (and visible on their map).
Line 58: Line 68:
 
For example:
 
For example:
 
   http://api.luftdaten.info/v1/sensor/12246/
 
   http://api.luftdaten.info/v1/sensor/12246/
 +
 +
The software looks for the "P1" (PM10) sensor value in the JSON message and averages all measurements it finds (usually the current one and a previous one).
  
 
=== Arduino libraries ===
 
=== Arduino libraries ===
 
Libraries:
 
Libraries:
 
* WiFiManager is used to manage WiFi connection to the local AP
 
* WiFiManager is used to manage WiFi connection to the local AP
 +
* ArduinoJSON for the parsing the luftdaten response
 
* FastLED is used to control the LED
 
* FastLED is used to control the LED
* ArduinoJSON for the parsing the luftdaten response
 

Revision as of 18:18, 18 June 2019

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

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.

Features:

  • The lamp shows particulate matter concentration as a colour, from light blue for low concentration and bright pink for high concentration
  • The lamp retrieves the PM value over wifi from the the luftdaten website
  • The luftdaten measurement station can be entered at the same time as when wifi credentials are entered.

Ideas/nice to have:

  • Use HSV/HSL colour model internally (instead of RGB)
  • 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 increase the breathing rate for higher PM
    • perhaps modulate the colour saturation instead of intensity
  • Automatic determination of location by means of wifi location, so you don't even need to input a luftdaten monitoring station id (do this on every startup for example)
    • example query:
 http://api.luftdaten.info/v1/filter/area=52.022,4.692,1.0
  • Remote control over IR

Operation Manual

configuration

Programming

  • connect everything up as indicated under 'hardware' and connect the Wemos D1 board to the USB port of your development PC / laptop
  • flash the software into the Wemos D1 mini, typically from the command line using platformio:
 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.

Usage

  • Turn on the light while in range of the WiFi network you configured
  • The LED should start yellow (connecting to the WiFi), then briefly change to OFF (retrieving PM value from Luftdaten), then change to a colour representing a PM concentration
  • A new PM measurement is retrieved every minute.

Hardware

pinout

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

Connections (using dupont female-female):

  • LED Din to Wemos D1 mini pin D3
  • 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 determined by parsing the JSON messages retrieved over a REST interface, by performing an HTTP GET on 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/

The software looks for the "P1" (PM10) sensor value in the JSON message and averages all measurements it finds (usually the current one and a previous one).

Arduino libraries

Libraries:

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