BME280 power supply problems (How can I clean VCC ?) - Page 1
Forum section: electronics / beginners

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: December 16, 2017, 10:44:26 pm
content: Hello All,I use a ESP8266 module to drive a relay using a board that has a small SMPS like this onehttp://www.electrodragon.com/product/wifi-iot-relay-board-spdt-based-esp8266/.But I encounter problems, mostly due to the power supply.The board is connected to the main, and the SMPS provides 5 V and 3.3V necessary for the ESP8266.If I power the BME280 by an external battery, everything is fine.But If I power it on the 3.3V rail of the board, I have from time to time bad measures ( spikes in the temp or humitity curve).I have tried to use the 5V rail, and lower it to 3.3V using a linear AMS1117 chip, but the spikes remain.DO you have a good solution to solve this problem ?I could add an intermediary LiPo battery that would be charged by the 5V, but I am not sure it will solve the problem,as the AMS1117 module did not solve it.Thanks for any help.

author: kripton2035
author_rank: Super Contributor
timestamp: December 16, 2017, 10:53:33 pm
content: add some capacitor like 100µF on the vcc rail of the bme280change the output capacitor of the ac-dc module for the same value or test also a higher valuewould be nice to have a scope output of the supply and the spikes ?

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: December 16, 2017, 11:07:33 pm
content: I have added this modulehttps://www.ebay.com/itm/5pcs-4-5V-7V-to-3-3V-AMS1117-3-3V-Power-Supply-Module-AMS1117-3-3/400985442255?hash=item5d5c9847cf:g:3wwAAOSwF1dUSgkDAnd a 100uF capacitor on the output of the AMS1117 module, but it does not solve the problem.For the scope view, I will have to dismount everything.

author: floobydust
author_rank: Super Contributor
timestamp: December 17, 2017, 04:41:52 am
content: The electrodragon ESP-32 relay board is kind of a disasterThe mains SMPS PC board is right on top the motherboard; The power supply is simply too close to the MCU and I/O PCB traces.So you have several hundred volts of switching millimeters away radiating to the low voltage traces and ESP right nearby.I would expect the ESP-32 to have poor WiFi range and anything nearby, like the BMP280 to have problems.

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: December 17, 2017, 05:14:19 am
content: OK,I thought also that the SMPS radiation was the problem.But it is not the case. If I leave everything as it is, and just power the BME280 with a battery, everything is fine.By the way, its ESP8266, not ESP32.

author: kripton2035
author_rank: Super Contributor
timestamp: December 17, 2017, 07:25:52 am
content: did you try to put the ac-dc module out of the esp module ?

author: floobydust
author_rank: Super Contributor
timestamp: December 17, 2017, 09:36:39 pm
content: post pics of your build, schematic. I don't know how long the cable is to the BME280 etc. Why 5V this is all 3.3V stuff.The bad (temperature, pressure humidity) readings are high or low or corrupt or what is wrong?

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: December 18, 2017, 06:54:04 pm
content: Quote from: floobydust on December 17, 2017, 09:36:39 pmThe schematic is quite simple :The electrodragon board (EB) has a connector where you can findGND5V3.3VSDA (5)SCL (4)The cable is 20 cmIn a first try I connected the 4 pins to the equivalent in the BME280(EB) (SME280)GND ---- GND3.3V ---- VCCSDA ---- SDASCL ---- SCLI had many spikes in the readings ( wrong values as 20125 instead of 20.125 but also different errors 9556 value for example)Then I put an intermediary Lipo Battery without changing the I2C cable.everything was fine but not satisfactory as the battery will discharge.(EB) (BATT) (SME280)GND ---- (-) ------ GND(+) ---- VCCSDA --------------- SDASCL --------------- SCLI then tried to use the 5V output and regulate the power voltage with a AMS1117 module(EB) (AMS1117-3.3V) (SME280)GND ---- (- IN) (-OUT) ------ GND5V ----- (+IN) (+OUT) ----- VCCSDA --------------- SDASCL --------------- SCLBut it did not solve the problem, even if I added a 100uF on the input and output of the AMS1117 module .

author: floobydust
author_rank: Super Contributor
timestamp: December 19, 2017, 05:52:22 pm
content: Many things can cause the intermittent jumbling of data. Without pics and better sch I can only guess about the problem. Some things to look at:Ensure the BME280 has nearby decoupling caps and some filtering on Vcc (0.1uF, 10uF w/100R to Vcc) ok as part uses <1ma.Ensure the I2C pull up resistors are 4k7 or lower. No idea what you are doing for VccIO, Vcc.What speed are you running this at, experiment with lower or faster. It might be WiFi chirps corrupting the I2C transfers.Your 5V SMPS is probably making a common-mode EMI problem. Measure ACV from earth-ground to circuit GND and see what you get.What are you using for a BME280 firmware? Some library routines have a bug for multi-byte transfers where they give an extra runt clock pulse every 8 bits, so a 16-bit transfer gets the last byte corrupted intermittently.I got temperature readings 2-3C higher, depending on the BME280 software library I use. Bosch, Adafruit, RPi, Cactus etc. I think some bugs there reading the CAL coefficients.The sensor is sensitive to light, and humidity sensor needs conditioning after PCB wash.

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: December 23, 2017, 10:41:11 am
content: pics :This is the setting with the AMS117 moduleQuote from: JacquesBBB on December 18, 2017, 06:54:04 pmThe AMS117 module is this oneWhere I added a 100 uF cap on input and output + a ferrite bead (120 R) on the plus output.This is the setting when you do not power the BME280 by the ESP8266 board, but by an external LiPO battery(the data wires SDA, SCL, are unchanged )Quote from: JacquesBBB on December 18, 2017, 06:54:04 pmThis is the BME280 with all necessary pullup resistors (10k) and decoupling caps-------And finally, this is the outputI am using the adafruit library for the BME280 , and blynk.As you can see, before 18:00, which corresponds to the setting with the AMS1117, the data is corrupted. After 18:00, when powered by the battery, everything is fine.Quote from: floobydust on December 19, 2017, 05:52:22 pmAll these are excluded as the sensor behaves perfectly when powered by the battery, with the same data wires.It is not either the EMI radiation from the power supply, as the wires in the Lipo setting can as well grab these EMradiations, and obviously do not affect the data.The problem seems to come from the VCC wire. If I power directly the BME280 module from the 3.3V output of the board,Quote from: JacquesBBB on December 18, 2017, 06:54:04 pmI have the same problem. This was my motivation from inserting the AMS1117 module. But it did not work.

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: December 24, 2017, 07:02:25 pm
content: I made some progress on this problem, and I understand even less.In order to better understand the problem, I used another relay board ( of a more recent design, but still from electrodragonhttp://www.electrodragon.com/product/wifi-iot-relay-board-based-esp8266/.I then made the same setting in my workshop,and everything was perfectly fine, even if I powered the BME280 directly from the 3.3V of theboard.I then switch the BME280, suspecting that it could come from the BME280, but everything was fine.I then exchange the board, putting in place the new one, and bringing back the old one to my worksop,but now everything was fine again, even with the old board.I thus dont understand anything now, but as it works, will leave it like that, but be prepared for another time.

author: floobydust
author_rank: Super Contributor
timestamp: December 24, 2017, 08:43:04 pm
content: My theory is the SMPS is making too much common-mode EMI for the long cable with (BME280) 10k pullups on SDA, SCL.This will make it work/not work depending on where the circuit is running, on the bench, your hand close to the wires etc.You can turn on pullups on the MCU I2C pins to help somewhat. A clamp-on ferrite bead on the BME cable. Earth-ground the PSU(-) and see what happens.The LiPo is higher than 3.3V

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: December 24, 2017, 09:38:09 pm
content: I was too optimistic.After a few hours without errors, the first board ( now on my workbench ) gives a lot of errors.I will thus be able to investigate more easily the sources of these errors.@floobydustDo you think than changing the pullup resistors from 10 k to 4.7k will improve the situation ?I will add a ferrite bead. I did it already without much success, but I will do it again in a more controlled environment.In any case, it seems that the new design of the eletrodragon board has improved over the previous one;What I like in this board, is that it has a full ESP-12F module, with 4 Mb memory, which allows to doOTA programming without changing the memory chip, as in the sonoff.