Hello from NL

Moderators: rtenklooster, Voyager, BertB, Stuntteam

Post Reply
Message
Author
dawauz
New user
Posts: 8
Joined: 13 Aug 2017, 09:43

Hello from NL

#1 Post by dawauz » 13 Aug 2017, 09:55

Hello from the netherlands.
I am new here :)

I've bought some nice things to try, and has already something working. A nodemce v3 board with a BH1750, it is controlling lights in combination with a presence detection in domoticz.
My domoticz server is a rpi 3b, but before I had it running on my nas, a self build single drive nas on a hp t620 thin client with omv on top. Because of some difficulties in my new house I had to change it to rpi.

Now I am searching for a example how to drive 2 sensors on my nodemcu esp-easy board, I have a BH1750 is working fine, but would like to add at least a bme280 an maybe another sensor.
How do I have to wire it, because the sda an scl are already used. And do I have use a rule / script?

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Hello from NL

#2 Post by Shardan » 13 Aug 2017, 11:32

Hello dawauz

and welcome aboard.

I²C is a so called "Bus System" - it can connect a lot of sensors.
Even mixing 3,3V and 5V sensorsand actors is possible if a level shifter is used.

For a basic I²C explanation you may visit the ESPEasy Wiki.
Have a look:
https://www.letscontrolit.com/wiki/inde ... he_I²C_Bus

If you search the wiki for "Basics" you will find some text about basic things.

Maybe i should mention that the wiki is undergoing many changes at this time
as the step from the older R120/R147 version to ESPEasy V2.0.0 is going on.

Regards
Shardan
Regards
Shardan

dawauz
New user
Posts: 8
Joined: 13 Aug 2017, 09:43

Re: Hello from NL

#3 Post by dawauz » 14 Aug 2017, 06:49

Ok but will there be changes in the design as from the link you provided?

So connecting wires together is no problem?
by reading it triple times, it seams to be needed, 2 10kohm.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Hello from NL

#4 Post by Shardan » 14 Aug 2017, 12:30

You can just connect SDA to SDA and SCL to SCL with several modules.
I²C devices have an address (imagine the street number of a house) so the the ESP-Chip can manage them.
As you wrote you have a BH1750 running - just connect the BME280 in parallel, it should work.
If you run into problems, first check if SDA/SCL are swapped on the new sensors,
then use two resistors as described.

Things to mention:

- Keep I²C wires short! It was made for connecting Circuits together inside a TV or DVD-Player. It should stay at 0,5m or below.
As explained in the wiki, with one sensor and short wires the pullup-resistors inside the ESP-8266 are sufficient.
If you use several sensors and / or longer wires the two resistors are necessary.

- Do NOT mix sensors running on 5V with sensors running on 3,3V without a level shifter!
The ESP uses 3,3V and can't take 5V.

- Do not use two sensors with same I²C address.
Same addres on two sensors will lead to collisions an the data line, the ESP can't read data then.
As a sensor box will usually have different sensors which have different addresses by default it is not the biggest problem but it occurs now and then.

Regards
Shardan
Regards
Shardan

dawauz
New user
Posts: 8
Joined: 13 Aug 2017, 09:43

Re: Hello from NL

#5 Post by dawauz » 14 Aug 2017, 12:44

OK so I can already try first without resistors?
I don't have any yet.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Hello from NL

#6 Post by Shardan » 14 Aug 2017, 12:52

Be sure you put your connections right, switch the nodeMCU off while plugging....
Then restart, go to "Advanced" --> I²C-scan and lookup the connected devices.
It should show two used I²C addresses like "0x47" or similiar.
Don't worry if you see several devices shown behind the addresses, that is usual.
Regards
Shardan

dawauz
New user
Posts: 8
Joined: 13 Aug 2017, 09:43

Re: Hello from NL

#7 Post by dawauz » 14 Aug 2017, 21:57

Hi, I connect both devices and both showing different address in the i2c scan.
My bme280 is working fine, but my lux sensor is now giving wrong data. It is giving the full lux.
It was working before. I am sure I connected the same wires on the same gpio.

Edit, with only the bh1750 connected, it gives also bad value 54612.50
The 12C is showing an address and bh1750
Maybe the sensor is faulty now, is that possible? I tried so witch sda and sdl no suc6.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Hello from NL

#8 Post by Shardan » 15 Aug 2017, 13:15

Did you reset the ESP after connecting/disconnecting, or even better power down and restart?

Usually the I²C modules are not very sensitive. Just without restart it might not work due to missing initialisation.

But be aware of one point:
All these devices, the ESP itself and nearly all these breakout boards are sensitive to ESD (electrostatic discharge).
You know this "tick" and slight shock if you touch a door knob? The voltage of such a shock is unbelieveable high, several thousand volts,
just with somewhat low energy so it is not dangerous.
If you touch such devices, a static voltage of 20..50 Volt at your fingers is enough to possibly kill the chip.
You won't see, feel or hear anything. But the chip is gone.....

Anyways, if that would be the case, i assume the chip won't say anything. That it answers for address but wrong values...
well, not totally impossible but same ranking as winning a jackpot.

I'll do some testing when back home, i should have the sensors at hand.

Regards
Shardan
Regards
Shardan

dawauz
New user
Posts: 8
Joined: 13 Aug 2017, 09:43

Re: Hello from NL

#9 Post by dawauz » 15 Aug 2017, 14:54

When the temp sensor connected, it is working well, so the ESP board seems to be ok (same gpio and 3v/g pins used)
I shall check the soldering of the pins, maybe is something not that good.

dawauz
New user
Posts: 8
Joined: 13 Aug 2017, 09:43

Re: Hello from NL

#10 Post by dawauz » 15 Aug 2017, 16:59

Hi, it's working again. I resoldered the pins, the ground pin looked fragile.
But, still, should I connect both again without resriors or?

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Hello from NL

#11 Post by Shardan » 15 Aug 2017, 19:56

For short cabling it should work without as you can see from the photo, I just tested it.
Anyways, just try. In worst case it just won't work, it will not break anything.
Testcircuit_with_Tasklist_c.jpg
Testcircuit_with_Tasklist_c.jpg (444.77 KiB) Viewed 9357 times
Regards
Shardan
Regards
Shardan

dawauz
New user
Posts: 8
Joined: 13 Aug 2017, 09:43

Re: Hello from NL

#12 Post by dawauz » 15 Aug 2017, 21:35

alright thanks, I will give it a try again.
Also mailman dropped an aliexpress envelope with a dht22 am2302 sensor.
The bme230 was almost 2 degrees warmer then it real was, maybe its own heat? Will the DHT22 more accurate? And which gpio can I use, just D2, I dont have it in use. And does that gpio port needed the high setting?

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Hello from NL

#13 Post by Shardan » 15 Aug 2017, 21:47

If the BME shows too high values you may correct it via the formula field:

Code: Select all

%value% -2
for example, to reduce by 2 degrees.
The DHT22 uses a DS18B20 internally which has a tolerance of +/- 0.5°C.
For more info about accuracy and calibrating sensors take a look into the Wiki:
https://www.letscontrolit.com/wiki/inde ... d_Accuracy

The DHT22 can use nearly any GPIO. D2 is used as SDA for I²C usually.
With the resistor it is same as with I²C. Try without a resistor activating the pull up inside the settings.
If it works it's fine, if not add a 10KOhm resistor from 3,3V to the data wire.

Regards
Shardan
Regards
Shardan

choiminzi
New user
Posts: 1
Joined: 24 Nov 2017, 20:33

Re: Hello from NL

#14 Post by choiminzi » 24 Nov 2017, 20:36

Ok but will there be changes in the design as from the link you provided?

So connecting wires together is no problem?
by reading it triple times, it seams to be needed, 2 10kohm.

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests