This is a server providing information about ambient CO2, temperature and humidity built with a Node MCU v2 and SCD30 Sensor
-
Connect the Sensor on the following pins:
SCD30 -> nodeMCUv2
GND -> GND
VCC -> 3V3
SDA -> D2
SCL -> D1 -
Hook up the nodeMCUv2 via usb to your pc
-
Make sure you have platformio installed (see here)
-
enter the
altitude
,ssid
,password
anddeviceName
variables in Server.cpp -
run
platformio run --target upload
or use the vscode task -
profit!
do a GET request to your servers IP (which you can find out via serial: platformio device list
and then platformio device monitor
)
you will recieve a application/json
response which looks like this:
$ curl -s 192.168.2.209
{
"node": "co2node-1",
"co2": 801,
"temperature": 27.00008,
"humidity": 40.42664
}
i recommend getting the Platformio IDE extension for vscode otherwise you can do everything manually
- Install PlatformIO Core
- Download development platform with examples
- Extract ZIP archive
- Run these commands:
# Build project
> platformio run
# Upload firmware
> platformio run --target upload
# Clean build files
> platformio run --target clean