I2C lines through Pytrack headers drawing current.
I am using an external accelerometer running i2c on p10 and p11 of the pytrack external headers. I am experiencing a larger current draw from the accelerometer when my lopy4 is in deep sleep. I have found that the LoPy is drawing current back through the I2C lines when the lopy enters deep sleep. Is there a way to set the pins so that they wont draw current (fix them at 3.3v?) or something i can do electrically with the I2C line to stop this from happening?
This is for an ultra low power operation so every uA counts
@joelmarini I hadn't seen this discussion back then... What type of deep sleep are you using? The "native"
machine.deepsleepor the Pytrack-controlled deep_sleep (
Did you find a solution for your problem?
How much current did the I2C lines take in deepsleep?
And in which mode was the ULP processor?
I will try the same test with lopy4 on extension board with extra 4k7 pull-ups, I will do tests soon.
There isn't much documentation on I2C and the ULP.
Thanks heaps Robert, ill try setting the pins as inputs and see if that gets me anywhere, if not then I might have to just have to look into some other options.
I will let you know how the input option goes.
Thanks again for the help.
@joelmarini Addtional note: Using a level shifter with the TXB0104 chip may be an option, even if you do not need that for level shifting. If I understand the data sheet right, the off state current (one side w/o power) is about 1 µA. I faintly recall to have such a unit here, but a trip through my drawers did not reveal it.
@joelmarini You could try to de-init I2C and set the SDA and SCL pins to Input mode, before going to sleep. But I have doubts that this will work. I assume that the current flows through the ESD diodes of the GPIO pins into the ESP32 Vcc. You could test by measuring the voltage on SDA and SCL in deepsleep. If it is the diode, it should be around 0.7 V. The go_to_sleep() deep-sleep of the Pytrack board switches the ESP32 completely off. Machine.deepsleep() is different. It keeps the ESP32 powered, but the current consumption is much higher in this mode.
Yes the Accelerometer is powered during deep sleep, both VDD and OI_VDD are attached to the external power source on the pytrack. The Pull Up resistors are located in the evaluation board for the accelerometer, shown in the image below. I have attached some photos for reference, one is the circuitry for the evaluation board and the schematic for the diode in the eval board. The unwanted current is running from the accelerometer back into the two I2C pins of the LoPy4. I can confirm that the source of the current is IO_VDD just not sure why. I presume the issue is with the circuit, which isnt really a pycom issue. If anyone has any ideas about possible pin configurations with .hold() or if this needs to be resolved electrically.
@joelmarini Is it that
a) the external accelerometer is powered during deep sleep? And
b) at which side are the pull-up resistors located? LoPy or external sensor.