SI7021 and BMP280 on same ESP8266

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
-manuel-
Normal user
Posts: 14
Joined: 26 Oct 2020, 15:37

SI7021 and BMP280 on same ESP8266

#1 Post by -manuel- » 18 Dec 2020, 11:40

Hello
I'm not an expert in electronics but managed thanks to ESP Easy to attach a SI7021 for measuring temperature and humidity together with openhab. Now I also attached a BMP280 to mesure the pressure. Unfortunately I don't get any data from the sensor. Maybe there is a GPIO conflict but I really don't know. Can some one point me in the right direction how to attach both sensors on the board and how I have to configure ESP Easy?

That would be very very cool!

Thank you so much.

Greetings Manuel
Attachments
ESP Wohnzimmer.png
ESP Wohnzimmer.png (20.32 KiB) Viewed 9116 times

Eisbahn
Normal user
Posts: 14
Joined: 06 Jul 2020, 10:30

Re: SI7021 and BMP280 on same ESP8266

#2 Post by Eisbahn » 18 Dec 2020, 13:26

Hi,
both are I2C sensors and if they have different address (in standard they have) they should work on the same bus.
How did you connected them so far (physically)? They need to be parallel, but pay some attention on lenght of wires and also resistors (pull-ups) for data lines SDA SCL. And don't connect them like a star with your ESP in the middle/star point, always one after the other. Most likely you used not the pure sensors but have them on some PCB with integrated resistors/pull up and now you have at least two of them on the I2C bus...
And what happens if you just connect the new added BMP sensor and disconnect the previous connected one?

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: SI7021 and BMP280 on same ESP8266

#3 Post by Ath » 18 Dec 2020, 13:32

Besides the remarks of Eisbahn,

A few questions:
- Does the sensor show up in the I2C Scan? (Tools tab) (SI7021 should be at 0x40, and BMP280 at 0x76 or 0x77, some builds don't show the (possible) device names anymore to save some flash space)
- Have you tried to use the BMx280 plugin instead of the BMP280? The BMx280 plugin is up to date and supports both the BMP280 and BME280 sensors, where the BMP280 plugin seems obsolete. Maybe it should get an (obsolete) marker.
- Have you triple-checked your wiring? (that's the first thing I do when some hardware doesn't seem to work here :D )
/Ton (PayPal.me)

-manuel-
Normal user
Posts: 14
Joined: 26 Oct 2020, 15:37

Re: SI7021 and BMP280 on same ESP8266

#4 Post by -manuel- » 18 Dec 2020, 22:19

Hello Ath and Eisbahn
Thank you very much for your quick answer. Now it's getting hard for me to understand what you're talking about. The physical connections of the two sensors on my esp8266 are the following.

SI7021 ESP
GND GND
Vin 3,3V
SCL D1(GPIO5)
SDA D2(GPIO4)

According to https://www.letscontrolit.com/wiki/inde ... 021/HTU21D and I2C Address is 0x40

For the BMP280 there is no wiring on the wiki so I googled it from some where but I can't remember the page.

BMP280 ESP
GND GND
Vin 3,3V
SCL D4 (GPIO2)
SCA D3 (GPIO0)

I2C Address is 0x76 (default) and I also tried 0x77.

I'm pretty sure that the wiring is completely wrong for BMP280 but I don't know how to connect it. I can't find BMx280 plugin on my ESPeasy. Maybe it's a very old version from 2018 (GIT version: v2.0-20180220). I only have BME280, BMP280 and BMP085/180.

You're talking that the sensors need to be parallel. So I have to connect SDA and SCL from my S7120 to the SDA and SCL from my BMP280? I made a quick wiring diagram. Did I understand right?
ESP8266 Wiring.jpg
ESP8266 Wiring.jpg (75.88 KiB) Viewed 9082 times
Sorry to ask so many questions and thank you very much for your help. I really appreciate it. It would be very very cool if I could get it up and running :-)

Greetings Manuel

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: SI7021 and BMP280 on same ESP8266

#5 Post by Ath » 18 Dec 2020, 22:37

Yes, ESPEasy only supports a single I2C bus, so the devices should both be connected to D1 and D2 in parallel, that would be enough to get it working. Each device has its own address (0x40 for the SI7021, 0x76 or 0x77 for the BMP280), and some devices, like the BMx280's, support multiple addresses, but that usually requires some soldering, or, to get really advanced, an I2C multiplexer to connect single address devices to to different channels. (ESPEasy does support I2C multiplexers, if needed, but this setup doesn't need that).

NB: The BMx280 I'm talking about is the BME280 plugin that supports both the BMP280 and BME280 sensors.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: SI7021 and BMP280 on same ESP8266

#6 Post by TD-er » 18 Dec 2020, 23:19

Just curious, to why you are using such an old build?

And like @Ath mentioned, I2C is meant to have multiple sensors on the same bus.
So just connect all equally labelled pins together (SDA to SDA, SCL to SCL, GND... well you get the idea ;) ) and use them all on the same bus.
You can try to scan for the devices via the I2C scanner (tools page on the web interface) and check the sensors can all be seen and have an unique address.

-manuel-
Normal user
Posts: 14
Joined: 26 Oct 2020, 15:37

Re: SI7021 and BMP280 on same ESP8266

#7 Post by -manuel- » 18 Dec 2020, 23:54

Hello
Thank you very much for your very fast help. I will try this for sure and connect the sensors in parallel. Do I have to use a separate GND and 3.3V for each sensor or can I connect them to the same pin?

I'm using such an old build because I didn't touch my running esp8266 for a long time (never touch a running system) and I didn't had the guts to flush it :oops:

Thank you so much.

Manuel

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: SI7021 and BMP280 on same ESP8266

#8 Post by TD-er » 19 Dec 2020, 00:26

Since those sensors do not use a lot of current, you can indeed tap their power and GND from the same pins.
Just keep in mind to not use very long cables for I2C communication.



And if it is running fine, just keep running the same build.

Eisbahn
Normal user
Posts: 14
Joined: 06 Jul 2020, 10:30

Re: SI7021 and BMP280 on same ESP8266

#9 Post by Eisbahn » 19 Dec 2020, 11:03

In best case you use for the SDA and SCL lines some kind of bus/chain/serial approach, so exactly I2C is designed for. Something like
ESP GPIO4 ----- SDA first sensor ----- SDA second sensor
ESP GPIO5 ----- SCL first sensor ----- SCL second sensor
So exactly like you showed it in your small paint figure. GND and VCC could be connected however you want, they should be just stable enough.
By this you could achieve longer cables if you also check the termination/pull-up resistors used, e.g. I'm running with a sensor after 4m and second after ~9m distance to ESP. However: this is not prooved to work everywhere (e.g. I have a separte stable supply, use a shielded cable)! Good advise is to first check it with much shorter cables, e.g. 20cm distance between each.
And try some kind of I2C scanner to scan the bus, maybe there is an update needed to get this feature. From my novice perspective: do the update ;-)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: SI7021 and BMP280 on same ESP8266

#10 Post by TD-er » 19 Dec 2020, 11:28

The I2C scanner has been in the firmware for a long time, so it should be there in that build too.
Not saying you should not update the firmware, only do things one step at a time :)

And running at long cables (> 50 cm) is really not to be adviced, unless you know what to tweak to get it working.
Most boards with I2C sensors do have pull-up resistors mounted on them, so very likely you don't need to add them yourself.

Eisbahn
Normal user
Posts: 14
Joined: 06 Jul 2020, 10:30

Re: SI7021 and BMP280 on same ESP8266

#11 Post by Eisbahn » 19 Dec 2020, 14:07

TD-er wrote: 19 Dec 2020, 11:28 Most boards with I2C sensors do have pull-up resistors mounted on them
...and that prevents maybe longer cables and more sensors or even a clean I2C as you have most times 4k7 on each sensor if you buy them on pre-soldered PCBs. I don't know why on every snesor board a pull-up is included, it's not only wasted money, it could also prevent safe operation. I2C is specified for 3mA sinking capability, so already with three sensors and each having 4k7 on it you're out of (this) spec. However: luckily most times there a bigger tolerances and it works...
If you want to dig deeper into it and have a scope, check
http://www.gammon.com.au/forum/?id=10896&reply=5#reply5
https://www.ti.com/lit/an/slva689/slva689.pdf
to get the right resisor for your sensors, cable incl. length and supply. If you want to go extra long (but just with additonal HW)
https://www.nxp.com/docs/en/application ... N10658.pdf
(but last one is hardcore, never made this. While 10m are reliable with trimming and a scope)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: SI7021 and BMP280 on same ESP8266

#12 Post by TD-er » 19 Dec 2020, 14:14

Thanks for the links, will try to read them.

And the reason they add the pull up resistors to boards is to make sure they work when mounted to a uC board.
Not many users have loads of those boards on the same uC.

ESPEasy does have a number of options to tweak I2C communication for those setups that may perform not optimal.
One of the most basic parameters to tweak is setting the I2C clock, which can be set for "low speed" and "normal speed" and you can also set it per task which one is to be used.

An I2C multiplexer can also be used to help fixing those issues even when you don't have an address conflict as each channel of such a multiplexer can be tuned for the specific needs of a sensor or set of sensors.

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: SI7021 and BMP280 on same ESP8266

#13 Post by Ath » 19 Dec 2020, 14:42

The Sensorboards with built-in pull-ups, that I've seen, had 10k pull-ups, not 4k7, so it may not be as 'bad' as you suspect.
/Ton (PayPal.me)

-manuel-
Normal user
Posts: 14
Joined: 26 Oct 2020, 15:37

Re: SI7021 and BMP280 on same ESP8266

#14 Post by -manuel- » 21 Dec 2020, 20:01

Thank you all
I managed to get up and running my BMP280 on a second ESP8266 with brand new firmware :D. I'm very happy with this. Maybe I will try to have some sensors in parallel but for the moment that's fine for me. Next project is now CCS811 Air Sensor, but it seems that it isn't supported by ESPeasy.

Greetings Manuel

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: SI7021 and BMP280 on same ESP8266

#15 Post by Ath » 21 Dec 2020, 20:31

It is absolutely possible to have many I2C sensors in parallel on a single ESP8266; when developing the I2C Multiplexer extension, I had around 10 devices connected to the same ESP, but of course in that context not all parallel (a couple of them where the same devices on the same address, the original reason to have the I2C Multiplexer ;) )

The CCS811 sensor is supported by ESPEasy, but it is currently not included in a standard build in the zip files on github, mostly because of the size of the .bin then exceeding the limits an ESP can handle.
There are a few options:
- Build your own, using a custom build and enabling that plugin (or taking a testing build, enabling this plugin and disabling some others)
- Ask someone here to build it for you, if you don't know how to do it yourself
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 13 guests