logo elektroda
logo elektroda
X
logo elektroda

ESP32 unstable when using BME280 5V sensor powered at 3.3V with LED control panel

ademba 159 5
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 21540946
    ademba
    Level 2  
    I have an ESP32 and it serves as a receiver that receives a command from a transmitter (a panel written in HTML with buttons). The buttons light or turn off the LEDs hooked up to the ESP32. I also hooked up a BME280 temperature sensor (2 power wires, 2 communication wires).

    The BME280 is the 5 volt version, I don't have another for 3.3 volts, but it supposedly works connected to the power pin for 3.3 volts.

    However, after using the ESP32, the sensor and controlling the LEDs via the panel for a while, the ESP32 sort of crashes. At first I set it to receive sensor data on the ESP32 every second, then every 5 seconds, now every minute. When checking the sensor data every minute, this problem of seemingly hanging up is unnoticeable, but after testing the control and readout for a while, something doesn't seem right to me about the ESP32's behaviour. Maybe I would need to test longer to better notice the unstable operation.

    I wanted to add a temperature sensor to the panel and additionally an INA219 voltage measurement sensor, but the temperature sensor, as well as the voltage measurement sensor, use the I2C bus for communication and now I don't know too much if this is a good solution.

    INA219 current and voltage sensor module with pin header and green terminal block. BME/BMP280 sensor module on a purple PCB with four labeled pins and a separate goldpin header. .

    The voltage would be good to be tested practically every second, possibly every few seconds, because this module is to be hooked up to the battery, so there you need information about what the voltage will be e.g. when switching on some motor, so it would be good to have these results live fresh all the time.

    However, I wonder if this can be implemented. Just hooking up the temperature sensor where the temperature is tested (the sensor measures temperature, pressure and humidity) is already causing problems, but I'm not sure if the problem is the voltage being too low, so this sensor is freezing up the ESP32, or if the frequency of the results is looping up the ESP32.

    Maybe someone has dealt with ESP32 and sensors like this and observed some strange behaviour and knows why this happens or how to remedy it. I've been trying to optimise a simple program that runs on the ESP32 to control the LEDs as well as read the results from the sensor, but sooner or later when the temperature sensor is running the ESP32 hangs up, so I don't know whether to look for a solution or put the add-ons away and just focus on the control to make it possible, as the simple sensor is already crashing everything.

    Maybe someone can advise something on this topic.
  • ADVERTISEMENT
  • #2 21540993
    xury
    Automation specialist
    With me this sensor has been working for 4 years now without a single problem. Without showing the program it's hard to say anything The best thing to do is to load Tasmot into the ESP set up the sensor and test.
    .
  • ADVERTISEMENT
  • #3 21541508
    ademba
    Level 2  
    I don't have the computer I have this program on right now, but nothing special there: a function to light a few LEDs and a function to check the sensor. I've even processed this with IA tools to catch errors, but it doesn't do anything.

    I'm betting that the ESP32 loops when it has to receive data from the transmitter and on top of that handle the sensor.

    Tasmota is unlikely to, as I need to keep the program simple as much as possible to control the relays later, so this is probably a better solution - my solution. Right now I'm testing the operation on the diodes (I'm prototyping), so additional some solutions will only complicate the whole system.

    I'd have to order a version of the 3.3V sensor, also test another one that communicates in a different way and see what the effect would be.

    And you, apart from the sensor, what else do you have connected and what operations does the ESP32 perform? Because in my case, as I mentioned, it has to run as an Access Point, to which it can connect, for example, a tablet with a simple panel on it. From the panel I send commands, e.g. turn on diode 1, diode 2 (communication via webserver), the panel also gets the result from the sensor.
    With such a simple project it should work without a stutter, but I already see problems, so how to build something sensible out of it? Maybe it's the sensor's fault, maybe it's faulty, maybe the voltage isn't right for it to work properly. I don't know.
  • ADVERTISEMENT
  • #4 21541879
    xury
    Automation specialist
    I was thinking of testing whether the sensor on Tasmota would also have problems.

    Do you have pullup resistors pulling up the data and clk?

    If you add more modules to the I2C bus then remember that the pullup resistors are only supposed to be one.
  • ADVERTISEMENT
  • #5 21542062
    ademba
    Level 2  
    the sensor itself works, it's just that when I start to click buttons, switch LEDs on and off, after a while the receiver starts to react unstably to commands.

    As for the resistors, I don't have the resistors set up programmatically, but I was thrown by the information that this sensor has its resistors internally, and I guess there is something on this board, but I would have to check it more carefully.

    I'll buy some more sensors and test, maybe this one is faulty or it's the power supply that's affecting the operation. Well something is wrong because a simple program, one sensor and the ESP32 gets breathless. Alternatively, I'll build a version without sensors for now to test the performance of the whole system, because the more things, if there are problems, it's hard to guess what's creating the problem.
  • #6 21542530
    khoam
    Level 42  
    ademba wrote:
    it's just that when I start clicking buttons, turning on, turning off diodes, after some time the receiver starts to react unstably to the commands.
    .
    It's just a matter of how this "pressing" and "lighting" is done, whether there are no locking mechanisms.
ADVERTISEMENT