floss.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
For people who care about, support, and build Free, Libre, and Open Source Software (FLOSS).

Administered by:

Server stats:

685
active users

I've decided I need to do something vaguely useful with a few microcontroller boards I have, use some of the simple ESP8266 ones to collect temperature and humidity data from various rooms of the house to a MQTT server, collect that data in a RRD and show the current values on an epaper panel together with the current time and weather forecast.

Current status is:

* the MQTT server at home is no longer working (uops, that's why I wasn't receiving other unrelated notifications. I believe I know what the reason is, and how to solve it, but not today. I have mosquitto installed also on the laptop and that one is working)
* the python library I wanted to use to read data from MQTT is broken in debian testing (bug opened at the end of november)
* I can't find the ESP8266 boards. I know that they are around here somewhere, but WHERE???

#microcontrollers #arduino
Last week we might have received a few ESP32-C3-DevKit-Lipo, yesterday I promptly managed to semi-brick one of them while programming them via arduino.

To avoid that semibricking, the right board to use is ESP32C3 Dev Module, AND you need to enable USB CDC On Boot

And to avoid panicking, bringing GPIO9 to GND will set the board into bootloader mode :D
Then, with the board nicely sitting on a breadboard, a stable 3.3V and no ratnest of jumper cables I've seen that the code I wrote last week works: the board turns on, connects and sends the temperature and humidity data from the DHT22 on mqtt, sets a timer and goes into deep sleep.

As long as you don't use Serial.flush(); before going into deep sleep, otherwise it will hang on it until it *gets* a serial, or something, and it will not have a serial while running on battery (uooops).

(yes, the DHT22 seems to be working fine on 3.3V, probably as long as it's close enough to the board that the voltage isn't dropping. and I'm not going to have 5V while on battery, so 3.3V it is)
The Bag of Random Sensors that had the DHT22 also gifted me with 3 (THREE!) BMP280 (temperature and atmospheric pressure, I2C or SPI).

While playing with them I've learned:

* The #esp32c3 can use #i2c on any pin; the default I believe is 8 and 9, but they are also used while programming, so meh
* You can change the i2c pins in #arduino by calling Wire.setPins(I2C_SDA, I2C_SCL); before any Wire.begin();
* There is an example sketch called Wire -> WireScan which scans for i2c devices (you will have to change it to use the pins you want to use with a call to Wire.setPins) which is a godsend.