both BMx sensors supported

This commit is contained in:
Ollo 2021-12-06 21:28:12 +01:00
commit 95b6fcef06
4 changed files with 26 additions and 6 deletions

View File

@ -39,10 +39,10 @@ VCC | GND
``` ```
The following pins are used: The following pins are used:
* GPIO4 PM1006 particle sensor * GPIO4 PM1006 particle sensor PIN REST on Vindriktning board
* GPIO2 WS2812 stripe out of three LEDs, replacing the original LEDs at front * GPIO2 WS2812 stripe out of three LEDs, replacing the original LEDs at front
* GPIO15 Red LED (optional) * GPIO15 Red LED (optional)
* GPIO12 Green LED (optional) * GPIO12 Green LED (optional) Used as 3.3V Supply for the I2C sensor
* GPIO13 Blue LED (optional) * GPIO13 Blue LED (optional)
* GPIO13 VCC of I2C (3.3 V) * GPIO13 VCC of I2C (3.3 V)
* GPIO14 I2C clock * GPIO14 I2C clock
@ -55,4 +55,6 @@ The following pins are used:
* some wire * some wire
# Sources # Sources
For the Witty board
* [https://github.com/amkuipers/witty Witty pinout] * [https://github.com/amkuipers/witty Witty pinout]
* [https://arduino.ua/products_pictures/large_AOC361-5.jpg Schematics]

View File

@ -27,7 +27,7 @@ usage: ota_updater.py [-h] -l BROKER_HOST -p BROKER_PORT [-u BROKER_USERNAME]
[-d BROKER_PASSWORD] [-t BASE_TOPIC] -i DEVICE_ID [-d BROKER_PASSWORD] [-t BASE_TOPIC] -i DEVICE_ID
firmware firmware
ota firmware update scirpt for ESP8226 implemenation of the Homie mqtt IoT ota firmware update script for ESP8226 implementation of the Homie mqtt IoT
convention. convention.
positional arguments: positional arguments:

View File

@ -7,5 +7,6 @@ if [ $? -ne 0 ]; then
fi fi
codespell -w ../src/* codespell -w ../src/*
codespell -w ../include/* codespell -w ../include/*
codespell ../Readme.md codespell -w ../*.md
codespell -w *.md
exit 0 exit 0

View File

@ -36,7 +36,7 @@
#define SENSOR_PM1006_RX D2 /**< GPIO4 */ #define SENSOR_PM1006_RX D2 /**< GPIO4 */
#define SENSOR_PM1006_TX -1 /**< Unused */ #define SENSOR_PM1006_TX -1 /**< Unused */
#define WITTY_RGB_R D8 /**< GPIO15 */ #define WITTY_RGB_R D8 /**< GPIO15 */
#define WITTY_RGB_G D6 /**< GPIO12 */ #define WITTY_RGB_G D6 /**< GPIO12 Used as 3.3V Power supply for the I2C Sensor */
#define WITTY_RGB_B D7 /**< GPIO13 */ #define WITTY_RGB_B D7 /**< GPIO13 */
#define PM1006_BIT_RATE 9600 #define PM1006_BIT_RATE 9600
#define PM1006_MQTT_UPDATE 5000 /**< Check the sensor every 10 seconds; New measurement is done every 20seconds by the sensor */ #define PM1006_MQTT_UPDATE 5000 /**< Check the sensor every 10 seconds; New measurement is done every 20seconds by the sensor */
@ -265,6 +265,17 @@ void bmpPublishValues() {
gasNode.setProperty(NODE_GAS).send(String((bmx.gas_resistance / 1000.0))); gasNode.setProperty(NODE_GAS).send(String((bmx.gas_resistance / 1000.0)));
humidityNode.setProperty(NODE_HUMIDITY).send(String(bmx.humidity)); humidityNode.setProperty(NODE_HUMIDITY).send(String(bmx.humidity));
#endif #endif
log(MQTT_LEVEL_DEBUG, String("Temp" + String(bmx.readTemperature()) + "\tPressure:" +
String(bmx.readPressure() / 100.0F) + "\t Altitude:"+
String(bmx.readAltitude(SEALEVELPRESSURE_HPA))), MQTT_LOG_I2READ);
if ( (rgbTemp.get()) && (!mSomethingReceived) ) {
if (bmx.readTemperature() < TEMPBORDER) {
strip.setPixelColor(0, strip.Color(0,0,255));
} else {
strip.setPixelColor(0, strip.Color(255,0,0));
}
strip.show();
}
} }
/** /**
@ -429,6 +440,10 @@ void setup()
if (i2cEnable.get()) { if (i2cEnable.get()) {
strip.fill(strip.Color(0,128,0)); strip.fill(strip.Color(0,128,0));
strip.show(); strip.show();
#ifdef BME680
printf("Wait 1 second...\r\n");
delay(1000);
#endif
/* Extracted from library's example */ /* Extracted from library's example */
mFailedI2Cinitialization = !bmx.begin(); mFailedI2Cinitialization = !bmx.begin();
if (!mFailedI2Cinitialization) { if (!mFailedI2Cinitialization) {
@ -477,6 +492,8 @@ void setup()
strip.show(); strip.show();
digitalWrite(WITTY_RGB_B, HIGH); digitalWrite(WITTY_RGB_B, HIGH);
} else { } else {
digitalWrite(WITTY_RGB_R, HIGH);
digitalWrite(WITTY_RGB_G, LOW);
strip.fill(strip.Color(128,0,0)); strip.fill(strip.Color(128,0,0));
for (int i=0;i < (PIXEL_COUNT / 2); i++) { for (int i=0;i < (PIXEL_COUNT / 2); i++) {
strip.setPixelColor(0, strip.Color(0,0,128)); strip.setPixelColor(0, strip.Color(0,0,128));