Jump to content

Banner.jpg.b83b14cd4142fe10848741bb2a14c66b.jpg

Setting up an MQTT system for Weather Sensing and Astro Control


Gina

Recommended Posts

41 minutes ago, wimvb said:

If two devices show the same error at the same time, I would expect the error to be somewhere else, ie it’s not the devices that are at fault. I use uPython, but I also regularly flash new firmware to the devices I use for testing. And while experimenting, I regularly swap from uPython to the Arduino IDE and back. Usually erasing flash with the esptool solves any connection problems. And don’t ignore possible faulty usb cables.

I don't know how to erase flash with the esptool.  If I did do that would the Arduino IDE still work?

Link to comment
Share on other sites

19 minutes ago, Gina said:

I don't have Windows at all other than in a Virtual Box on the Mint machine and I've never got USB to work from that.

Check you have USB enabled in the VMs settings:

1205649002_Screenshotfrom2020-08-1813-24-47.png.9efd6ba139edb19c57c3e53e1d389b42.png

and also when you connect a USB device to the host PC select it from the Devices --> USB menu so the VM can capture it from the host.

 

 

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Gina said:

Just realised that I also have several old Arduinos that I don't care about but that's a different type of board altogether.  Would that be a realistic test?

just to see if its something to do with the board - if you are using the same cable / software IDE etc then at least it points to the board. Doesn't matter which INO sketch as you are testing the upload -so Blink still ok. Just have to remember to select the correct board type before you compile/link

As for flashing perhaps this linux s/w (ps Never used it myself) will help http://iot-bits.com/esp32/esp32-flash-download-tool-tutorial/

 

Link to comment
Share on other sites

That says it's Windows!

Quote

The ESP32 Flash Download Tool, just like the ESP8266 download tool, is the official Espressif Download tool that runs on Windows platform.

My underline.

Edited by Gina
Link to comment
Share on other sites

Shut everything down on the Mint box and rebooted from cold.  The MQTT broker RPi switched off.  Started Arduino IDE and loaded the sketch that works on the Living Room EST32 sensor unit.  Nothing else running other than standard background stuff.  Same error!

Link to comment
Share on other sites

PROGRESS!!

Decided to look carefully through the Tools menu.  Thought I would try Port : /dev/ttyUSB0 instead of /dev/ttyS0 and looked the same until I pressed BOOT hard and it uploaded.  This was with the electrolytic capacitor connected (which appeared to do nothing!!).

Link to comment
Share on other sites

Now working on the other nodes/clients.  Firstly the one that was in the observatory and used an outside (in Stevenson screen) and inside the obsy.  BME280 outside and DHT22 inside.  For testing I have it indoors.  The BME280 is working fine but not the DHT22.  When I touched the DHT22 I nearly burnt my finger so I unplugged it!!  Maybe what they say about DHT22s being unreliable is right though I've used them successfully in the past on an Arduino.  Maybe I should use a second BME280 as they're considered better.

Link to comment
Share on other sites

Thing is, can I use two BME280s on one ESP32 and if so how?  They will both have the same address on the I2C bus.  I could use two ESP32 modules but this seems a bit extravagant.  If I need to do that sobeit - the cost is relatively small.

Link to comment
Share on other sites

Found an alternative BME280 breakout board on Amazon with selectable address.  I've underlined this in the description

Quote
  • BME280 is a Breakout Board featuring a Bosch Sensortec ME280 Temperature, Humidity & Pressure Sensor.
  • The board has selectable I2C address jumper (solder link GS2), I2C pull-up resistors, 7 pin header 2.54mm, and two mounting holes 3.5mm.
  • Default setting of the board; single power rail Vdd=Vdd_IO (solder link GS1), pull-ups resistors (R2, R3) 10k, protocol selector resistor 0ohm (R1), decoupling capacitors 0.1uF on both power supply pins Vdd & Vdd_IO.
  • If you connect board to both power rails VDD_IO 1.8V and VDD 3.3V be sure to remove the power rail jumper GS1!
  • Supply voltage VDD main supply voltage range: 1.71 V to 3.6 V

HALJIA GY-BME280-3.3 High Precision I2C SPI Breakout Barometric Pressure Temperature Humidity Digital Sensor Module Board Compatible with Arduino Raspberry Pi ARM DIY Etc.

Edit :- Looked at the datasheet and it s=doesn't need solder links changed there's a pin that does it.

Quote

Using the I2C Interface

Because the I2C interface does not require level shifting when used with a 5V MCU, it is typically the preferred interface to use.

The CSB (Chip Select Bus) pin determines which bus to use.  A logic HIGH selects the I2C bus.  A 10K pull-up resistor on the module pulls this pin HIGH and so the I2C bus is selected by default unless this pin is grounded.

The module supports two different I2C addresses, either 0x76 or 0x77 which allows up to 2 sensors to be used on the same bus.  The SDO pin determines which address to used.  A weak pull-down resistor on the module pulls SDO low so 0x76 is the default address if the SDO pin is not connected.  Connect the SDO to Vcc to select 0x77.

The SCL and SDA pins connect to the SCL and SDA pins on the MCU.

If more than 2 sensors are needed, then the SPI bus can be used.

 

Edited by Gina
Link to comment
Share on other sites

4 hours ago, Gina said:

I don't know how to erase flash with the esptool.  If I did do that would the Arduino IDE still work?

https://randomnerdtutorials.com/flashing-micropython-firmware-esptool-py-esp32-esp8266/

You already have esptool.py, because the Arduino IDE uses it to write programs to the esp32. This will clear the esp flash memory, where programs are stored. It doesn't alter its behaviour in any other way. Don't install any firmware, that's only needed for microPython. Read/follow the tutorial until & including

Erasing ESP32 Flash Memory

Link to comment
Share on other sites

Having ordered more microUSB cables, I've found another and the one I've been using is working fine.  Oh well, can't have too many I guess 🤣.  Also, with all the ESP32 modules being fine I shall have a nice collection of those in the end too!  Also useful items...

Edited by Gina
Link to comment
Share on other sites

Glad you sorted that out.... !

I've never had issues with DHT22s - other than one that has recently taken to consistently reporting 99% humidity. And yes I did check if it had fallen into the water. Looks like there's a short somewhere near your device.

Was about to say that the BMP/BMEs have switchable I2C addresses but I see the issue is with your breakout boards. I suspect with a scalpel and a soldering iron you can fix that?

  • Thanks 1
Link to comment
Share on other sites

I found the DHT22 problem - my incompetence - got power wires crossed.  I shall have to watch it or I shall be destroying something costly!!

The new BME280 breakout board (due to arrive tomorrow) has a pin to control the I2C address, so no problem.

Link to comment
Share on other sites

I've put the Outside/Observatory sensor back out in the obsy to read the outside conditions.  No obsy data because the DHT22 is dead and will be replaced by a BME280 tomorrow when it arrives (or when it stops raining).  Of course, in the future there will be no need for two readings of the atmospheric pressure.  Note though that these two BME280s supposedly measuring the same pressure, differ by 2hPa.  I shall probably remove the decimal part as the pressure is less accurate than one hPa and any more resolution is pointless (no pun intended).

727265517_Screenshotfrom2020-08-1820-33-19.png.308941ee24eff5443d85f8188656989d.png

Link to comment
Share on other sites

Something funny going on.  When the Outside sensors started the Living Room ones stopped.  Surely the RPi Zero W broker isn't being overloaded by this small number of clients!!

There's another funny too with the Outside Pressure - a sudden and transitory high reading. 

1433300212_Screenshotfrom2020-08-1821-03-59.png.4f9e7b7be185e7c481d04dcdff859bd3.png

Link to comment
Share on other sites

This is very strange.  The Living Room display seems to update just occasionally and the Outdoor Pressure has another blip!  Anyone any ideas?

1230630899_Screenshotfrom2020-08-1821-33-02.png.bd739d107433fd6e08ef8e42ac0d55b0.png

Link to comment
Share on other sites

Here's the latest Dashboard display.  More Outside Pressure blips and the Humidity seems exceptionally high.  MQTT Explorer shows regular activity for outside, obsy and broker but not for ESP32 which is the Living Room sensor, agreeing with what the Dashboard shows.

1686680499_Screenshotfrom2020-08-1822-00-16.png.3ebd4bf40d647626ff3aace37ed32489.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.