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
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
reshared this
Elena ``of Valhalla''
in reply to Elena ``of Valhalla'' • •I wonder if I should change it to 20°C to make it feel warmer :D
or rather, tomorrow I'll try to attach a DHT22 and fill in realistic values :D
hopefully the same #arduino code will work on the ESP8266 boards when I'll find them.
Olimex reshared this.
Elena ``of Valhalla''
in reply to Elena ``of Valhalla'' • •Possible causes:
* the DHT22 is dead
* I'm not powering it enough
* The ESP32 is not able to bitbang the DHT22 protocol
I think I'll stop here and resume the attempts later.
If I find the boards I originally wanted to use I can try to test the power issues (here I was using an unholy maze of jumper cables).
I may have planned to buy a DHT20 in the future (probably after the christmas holidays, however, and for sure after this weekend), so if it's an issue with bitbanging the DHT22 protocol that will get a different solution.
And I may try to connect the DHT22 to some other board to check whether it's still alive, but probably not today.
#microcontrollers
Damiano Verzulli
in reply to Elena ``of Valhalla'' • • •👉 "the DHT22 is dead": very unlikely, unless you "burned" it... Did you?
👉 "I'm not powering it enough": the datasheed say that it operates within a 3.3V-6V . How are you powering it?
👉 "The ESP32 is not able to bitbang the DHT22 protocol" : there should be battle-tested libraries dealing with the DHT22. Which one are you using?
----- https://www.sparkfun.com/datasheets/Sensors/Temperature/DHT22.pdf
Elena ``of Valhalla''
in reply to Damiano Verzulli • •* the DHT22 has been in a drawer for years: I don't think I would have put it back in the drawer if it had been burned, but who knows
* as I said, I'm powering it through an unholy ratnest of jumper cables. it should provide 5V, but an earlier attempt at powering it at 3.3V with a bit less of a ratnest only provided 2.something V, and with the 5V I didn't have room to actually measure it without breaking the ratnest and disconnecting everything (yes, I tried).
This is caused by the way the board I'm using is being powered (through the programmer, on the single available 5V pin), and since I'm not planning to use this specific board anyway I've decided it's not worth spending any more time.
* I'm using the library from Adafruit, it was their documentation that recommended¹ trying things with an arduino uno first, as on some boards it didn't work (but it didn't have a list of working boards, or at least it wasn't directly linked).
¹ following recommendations? from the documentation? NEVER :D the documentation is only skimmed to find the syntax to use :D
Elena ``of Valhalla''
in reply to Elena ``of Valhalla'' • •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
rag. Gustavino Bevilacqua reshared this.
Elena ``of Valhalla''
in reply to Elena ``of Valhalla'' • •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)
rag. Gustavino Bevilacqua reshared this.
Elena ``of Valhalla''
in reply to Elena ``of Valhalla'' • •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.
reshared this
rag. Gustavino Bevilacqua reshared this.
Elena ``of Valhalla''
in reply to Elena ``of Valhalla'' • •for some reason, however, right now arduino isn't compiling the sketch twice in a row (with the error “panic: runtime error: index out of range [9] with length 9”).
But I'll look into it probably during the Christmas holidays, for today I'm ok with this.
Elena ``of Valhalla''
in reply to Elena ``of Valhalla'' • •instead, I've looked a bit at the python side of things, and surprisingly what I did worked fine, even if it wasn't much.
Larry (Mr. Prototype)
in reply to Elena ``of Valhalla'' • • •https://github.com/bitbank2/BitBang_I2C
GitHub - bitbank2/BitBang_I2C: A software I2C implementation to run on any GPIO pins on any system
GitHubElena ``of Valhalla'' likes this.