Added more explanation to readme.

This commit is contained in:
Michael Biermann 2020-11-19 22:13:21 +01:00
parent 0ea5d3c105
commit 7231c28e32
1 changed files with 62 additions and 25 deletions

View File

@ -1,48 +1,85 @@
# co2ampel
# CO2ampel
![](https://git.unhb.de/smash/co2ampel/raw/branch/master/doc/case.jpg)
## idea
higher concentrations of CO2 inside will make you sleepy and have an impact on your wellbeing. during the current pandemic higher CO2 concentrations inside are also a pretty good indic
ation for higher levels of aerosol and as such a higher risk for infection. the 'CO2 Ampel' (CO2 traffic light) will give you a visual representation of the current situation and remin
d you to open windows to keep you happy and healthy
## Idea
Higher concentrations of CO2 inside will make you sleepy and have an impact on your wellbeing. During the current pandemic higher CO2 concentrations inside are also a pretty good indication for higher levels of aerosol and as such a higher risk for infection. The 'CO2 Ampel' (CO2 traffic light) will give you a visual representation of the current situation and remind you to open windows to keep you happy and healthy.
## parts list
## Get help building your own CO2ampel
You can always get help by contacting us. The fastet way is probably our maxtrix chat channel, but you can always use our mailing list or any other contact methods found at [https://www.un-hack-bar.de/kontakt/] (https://www.un-hack-bar.de/kontakt/).
## Parts list
Have a list of all the parts necessary. We added an aliexpress link for convenience, but feel free to use other sources. The prices will vary among shops and we don't update the links.
### For the electronics
| description | part | link |
| -------------------- | ----------- | ------------------------------------------- |
| ESP32 | ESP-32 30Pin | [Aliexpress Link ](https://de.aliexpress.com/item/32864722159.html?spm=a2g0o.productlist.0.0.6e7e745aBnlwmM&algo_pvid=b9be1fdc-113a-4e2e-aafa-4e08151af66c&algo_expid=b9be1fdc-113a-4e2e-aafa-4e08151af66c-1&btsid=0ab50f6215990625361401073eaad4&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_)|
| ESP32 development board | ESP-32 30Pin | [Aliexpress Link ](https://de.aliexpress.com/item/32864722159.html?spm=a2g0o.productlist.0.0.6e7e745aBnlwmM&algo_pvid=b9be1fdc-113a-4e2e-aafa-4e08151af66c&algo_expid=b9be1fdc-113a-4e2e-aafa-4e08151af66c-1&btsid=0ab50f6215990625361401073eaad4&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_)|
| Infrared CO2 Sensor | mhz-19 | [Aliexpress Link ](https://de.aliexpress.com/i/32952229446.html) |
| Active piezzo buzzer (optional) | KY-012 | [Aliexpress Link](https://de.aliexpress.com/item/32740686896.html?spm=a2g0o.productlist.0.0.554c8f02ZzXw5y&algo_pvid=a49664ca-1685-4d9a-b7ba-45c1fbf5a7ba&algo_expid=a49664ca-1685-4d9a-b7ba-45c1fbf5a7ba-0&btsid=0ab6f83115990618356642096e52ad&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_) |
| OLED Display | SSD1306 | |
| LED-Ring (9 Pixel) | WS2812 | [Aliexpress Link ](https://de.aliexpress.com/item/32835427711.html?spm=a2g0o.productlist.0.0.847c3d32JLroFX&algo_pvid=32c7c01b-df4b-430e-b550-00097f15afde&algo_expid=32c7c01b-df4b-430e-b550-00097f15afde-0&btsid=0ab6f83115990618906573133e52ad&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_) |
| 3m USB-Kabel | USB-Kabel | [Aliexpress Link ](https://www.aliexpress.com/item/32686380889.html) |
| LED-Ring (8 or 9 Pixel) | WS2812 | [Aliexpress Link ](https://de.aliexpress.com/item/32835427711.html?spm=a2g0o.productlist.0.0.847c3d32JLroFX&algo_pvid=32c7c01b-df4b-430e-b550-00097f15afde&algo_expid=32c7c01b-df4b-430e-b550-00097f15afde-0&btsid=0ab6f83115990618906573133e52ad&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_) |
| 3m USB cable | USB cable | [Aliexpress Link ](https://www.aliexpress.com/item/32686380889.html) |
| red, green, black and white wires | Signal wires | no link |
| 30 cm of shrinking tube | shrinking tube | no link |
### For the case
| part | description |
| 3mm pylwood | Any 3mm thick material will do. We use pine. You could even use acrylic. |
| Wood glue | Glue for the case. |
| Translucent filament | We used translucent PLA, but any filament will be OK. |
| 3x10mm machine screws | Should be a cylinderhead screw. Sinkhead screws will probable need 3x12mm. |
| Hot glue | To fix the electronics on the board. |
## Connection schema
## build
Solder the wires according to the connection schema:
* solder everything according to the connection schema
* get yourself a copy of esphome (https://esphome.io/) ```pip3 install esphome```
* create a secrects.yaml file with your wifi settings (see also secrets.yaml.example)
* compile the firmware with ```co2ampel=USER_ROOM esphome co2sensor.yaml run```
![](https://git.unhb.de/smash/co2ampel/raw/branch/master/doc/CO2Ampel_Schaltplan.png)
There is also a PCB-version of this project available (to be documented).
## Firmware
### Preparation
* If you are on Windows: Make sure you have the proper drivers for your version of the ESP32 installed.
* If you are on Linux: Do the duck dance!
### Option 1: ESPHome
* Get yourself a copy of ESPHome (https://esphome.io/) ```pip3 install esphome```
* Create a secrects.yaml file with your wifi settings. You can use secrets.yaml.example as a template.
* In your console of choice (bash, cmd, ...): Set the environment variable co2ampel to the preferred name of the CO2Ampel: ```co2ampel=USER_ROOM```
* replace user with a nick that identifies you or your organisation
* replace room with the place the sensor is located at
* e.g. unhb_hackspace or unhb_001 for obfuscation
* these will be used for online graphing! if sensor has wifi access
* hold boot on your esp32 until fw upload starts.
* compile the firmware with ```esphome co2sensor.yaml run```
* You may have to hold the boot button on your esp32, until fw upload starts.
## setup
* place the sensor in your room, keep it away from direct exposure of breath (give it at least 1-2m distance to humans or other co2 sources to get the average co2 level of the room)
* when there is a freifunk wifi around there is nothing to do for you, same when you defined your own wifi via secrets.yaml.
* else just wait a bit and the sensor will spawn an wifi without a password. connect with your phone and choose to login or open http://192.168.4.1 in a browser to enter your wifi credentials
* when everything is done, the default config will send the sensor readings back to the project where you can view online graphs (see grafana)
### Option 2: Custom firmware written in C++ with platform.io
* Clone the git repository [https://git.unhb.de/smash/ebk-unhb-co2ampel](https://git.unhb.de/smash/ebk-unhb-co2ampel)
* Use platform.io to compile / flash the firmware to the ESP32.
## grafana
## Setup
* The sensor needs to be calibrated to measure acurately. This will happen automatically if the sensor is acrive at least 24 hours. The lowest measurement in this time will serve as a baseline of 400 ppm. It is advised to keep the sensor on power for at least 24 hours, at least once a month.
* Place the sensor in your room, keep it away from direct exposure of breath (give it at least 1-2m distance to humans or other co2 sources to get the average co2 level of the room)
### Using option 1
* When there is a freifunk wifi around there is nothing to do for you, same when you defined your own wifi via secrets.yaml.
* Else just wait a bit and the sensor will spawn an wifi without a password. connect with your phone and choose to login or open http://192.168.4.1 in a browser to enter your wifi credentials
* When everything is done, the default config will send the sensor readings back to the project where you can view online graphs (see grafana)
#### Grafana
there is a quick setup on [here](http://co2.cyber23.de:3000/d/1axlpIdGk/co2?orgId=1&refresh=10s&var-co2name=smash_wohnzimmer&from=now-2d&to=now) your sensor should apper in the list on the left as soon it is connected via wifi.
### schema
### Schema as a table
| ESP32 PIN | peripherals | note |
| ------------- | ----------------- | ------------------------------ |
@ -60,12 +97,12 @@ there is a quick setup on [here](http://co2.cyber23.de:3000/d/1axlpIdGk/co2?orgI
| I2C SDA / D21 | SSD1306 (SDA) | |
| I2C SCL / D22 | SSD1306 (SCL) | |
### ws2812
if your ws2812 don't work on 3.3V power (most will do) you can try to use 5V instead. there are plenty different ws2812 builds so ymmv... if the leds don't work with 5V try to add a pullup resistor to your data line and a diode towards D4 to raise your high level while protecting your GPIO (https://forum.arduino.cc/index.php?topic=578735.msg3941756#msg3941756)
### ws2812 troubleshooting
If your ws2812 don't work on 3.3V power (most will do) you can try to use 5V instead. There are plenty different ws2812 builds so ymmv... if the leds don't work with 5V try to add a pullup resistor to your data line and a diode towards D4 to raise your high level while protecting your GPIO (https://forum.arduino.cc/index.php?topic=578735.msg3941756#msg3941756)
looks like this:
![](https://git.unhb.de/smash/co2ampel/raw/branch/master/doc/levelshifter.png)
either way it might be a good idea to have a capacitor between VCC and GND. my prototype worked without any of these, but from time to time some LEDs just randomly turn on...
either way it might be a good idea to have a capacitor between VCC and GND. my prototype worked without any of these, but from time to time some LEDs just randomly turn on and the lights flicker slightly when the sensor takes a measurement.