Tapatalk

i2c and sleep mode

i2c and sleep mode

15

PostOct 06, 2018#1

Hi again,

Using a capacite sensor that uses i2c.
After i setup the wire lib:
 Wire.begin();
 Wire.setClock(100000);
My deepsleep power consuption is about 0.5 mA.
I the wire lib theres no way to pause it or something like that.
Any ideas of how can i pause or disable the i2c clock?
Thanks in advance

1885
1885

PostOct 06, 2018#2

The deep sleep mode should power down everything in the MCU and stop all clocks (except Watch dog).

Are you putting all other devices, including radio and flash memory to sleep?
Have a look at the power down example from the Talk2 Library.

Do you have anything else connected to the board? 
If you do have any other device connected to the board you need a way to power it down a well. Some modules/ICs have sleep features, others you need to implement your own way to power down (for example, using a Mosfet).

15

PostOct 07, 2018#3

Hi and thanks for the answer.

Without touching the hardware setup i used the powerdown example and made the folowing:

Tested it without any change.
-> it worked as expected

Next added the folowing lines (the sensor is behing powered by pin 4):
  pinMode(4, OUTPUT);
  digitalWrite(4, HIGH);
  delay(2000);
  digitalWrite(4, LOW);
->The result was the same as the regular example.

Next i added the folowing:
  pinMode(4, OUTPUT);
  digitalWrite(4, HIGH);
  delay(2000);
  digitalWrite(4, LOW);
    Wire.begin();
  Wire.setClock(100000);
->The result was that the current never lowed under the 0,5 mA

So i was thinking that the i2c isn't stopping with the sleep command.
Do you have any ideas?

Thanks in advance

1885
1885

PostOct 07, 2018#4

The consumption is via the sensor you're connecting I guess, current flow through other pins, not only power and ground...

Try disconnecting the sensor and measuring. After that try changing the A4 and A5 to inputs before sleeping.

15

PostOct 28, 2018#5

Hi, 
The input change worked very well thanks.