cancel
Showing results for 
Search instead for 
Did you mean: 

What do you think about not responding of the sensor after resetting or unplugging enp8266 nodemcu v

khaledeisa
Associate II

Screenshot (5).png

Hi how are you …i bought a new esp8266 (also I bought logic level shifter and 74125 IC) and built the project from the beginning as the schematics in the beginning it works fine the rgb ring lights up and the sensor responds and performs the interruption function BUT when I reset the esp nodemcu v3 or unplug the replug the usb to pc the sensor didnot respond …do yoou think that because I still didnot connect the logic level shifter or the ic between the ring and the esp ?
note :I connect the shdn pin on the sensor to 3.3v but that part nit in schematics

1 ACCEPTED SOLUTION

Accepted Solutions
John E KVAM
ST Employee

Well, congratulations on getting it to work the first time. 

I can't zoom in enough to which sensor you are using, so this has to be just a guess.

(I'm a software guy, so you are only going to get guesses from me.)

When you reset the MCU it's possible to leave an I2C operation in progress. That makes a mess. 

You can check it. By default, the I2C CLK and SDA lines should be high. Bus-stuck-low is a common problem.

But you have a handy debug mechanism. Consider lighting the LEDs if something goes wrong - or right. 

LED stuck on, means your I2C never started communication for instance.

The XShut is kind of sensitive. And a glitch will partially reboot your sensor. Consider a Cap. 

And maybe that is what is causing your issue. Do you have an GPIO pin so you can toggle it?

Resetting the sensor with the XShut line is the right way to do it!

 


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.

View solution in original post

5 REPLIES 5
John E KVAM
ST Employee

Well, congratulations on getting it to work the first time. 

I can't zoom in enough to which sensor you are using, so this has to be just a guess.

(I'm a software guy, so you are only going to get guesses from me.)

When you reset the MCU it's possible to leave an I2C operation in progress. That makes a mess. 

You can check it. By default, the I2C CLK and SDA lines should be high. Bus-stuck-low is a common problem.

But you have a handy debug mechanism. Consider lighting the LEDs if something goes wrong - or right. 

LED stuck on, means your I2C never started communication for instance.

The XShut is kind of sensitive. And a glitch will partially reboot your sensor. Consider a Cap. 

And maybe that is what is causing your issue. Do you have an GPIO pin so you can toggle it?

Resetting the sensor with the XShut line is the right way to do it!

 


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.

Hi....thank you for reply....okay if the bus get stuck low i should reboot using shdn pin but I couldn't understand the way so (what do you mean by glitch and a cap ?)

Also I have gpio pin and i connect it to d6 in esp but what do you mean by toggle it and how I do that ?

How i reset sensor using shdn pin

Sorry for bothering you but I feel that is the issue of my project so can you tell me how i do that in steps or even refer a source to lesrn that solution to me

John E KVAM
ST Employee

think of the Xshut as a light switch giving you an on/off. You could do the same thing by controlling the power, but it's easier to just lower the Xshutdown pin for a few ms, then lift it back up. Does the same thing as unplugging it an plugging back in .

I2C is basically a very poor bus design. But it's cheap. A bit is clocked whenever the CLK goes high. But in the presence of noise, you might get the CLK pin to go up a little bit as it's dropping. And this can cause the sensor to clock an extra bit. Once the MCU and the sensor get out of sync, the bus will hang. 

By resetting the sensor, you can get the MCU and the sensor to re-synchronize.

In your MCU manual you will find the ability to lift and lower a GPIO output pin.

Connect that pin to the Xshut input. 

A bootup lower the GPIO, wait a few ms, then lift it. Wait a few ms for the sensor to boot, and carry on.

Should fix you right up. 

 

- john 


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.

You know...I connected shdn pin wrong ...I only connect it to 3v ...I donnot know I should connect it to gpio pin to be in sync with mcu ....know I get it I will connect it to gpio pin 

Thank you I appreciate your help 

 

@John E KVAM Dear eng john

another colleague answered me in facebook and gave me a piece of code all I have to do is modifying it as it is used for BME sensor (

 

It is a reset method for BME I use the below. My code is also prepared for hardware error (handled elswhere, by a simple if. ). So if really not able to start it and variable Emergency_stop_all goes over 3 all functionality will be stopped for safety. (Is controling a 120L electric water heater. it has 2 BME280, using different address, on one almost 2m wire and still reliable. 1m of it is inside of  a metal tube inside of the water heater, that acts as a shield. (

  

 if (BME.getMode() != 3)     {        

 BME.reset();       

 szenzor_1_error++;      

  sensor_start();       

 if (BME.getMode() != 3) Emergency_stop_all++;   

    } 

if (two_sensor_is_present[0] && BME2.getMode() != 3)      {    

     BME2.reset();  

      szenzor_2_error++;  

      sensor_start();     

   if (BME2.getMode() != 3) Emergency_stop_all++;      

 }

 

So what do you think ? Is that the kind of code I should develop to build the feature I asked for (brute reset )? Is that what you mean by your first part of your answer ?