Disconnect power lines
I have a Sipy and I put a deepsleep every 15 minutes. I have a ds18b temp sensor and I saw that may be the energy is on when the pycom is in deep sleep. There is any option to power the lines via pin? I saw an example but I don't know if this line has a mosfet or something that cuts the power in deep
@ecabanas You cannot use P0, because that one is the RX pin of the UART0. Use another pin.
now is working on pin8
Thanks for your answer and sorry about the delay but I was closing year.
I connected to pin0 with the following code:
from machine import Pin import utime import time import socket import pycom import machine #Power the sensor pinPwr = Pin('P0', mode=Pin.OUT) pinPwr(True) pycom.heartbeat(False) pycom.rgbled(0x00ff00) time.sleep(2) pinPwr(False) machine.deepsleep(1000*10)
But I only have 2.20volts, and the minimum for the sensors are 3.3V, you know why I only have 2,2vlt?
@robert-hh One thing I discovered Rob is not all DS18B20s are created equal. I found my collection of several dozen, acquired over as many years of tinkering, fell into 3 groups of standby power consumption. Group1, standby power <1uA, group2 0-1uA & group3 50uA.
@ecabanas A good way avoiding that is to switch the GPIO pin to 0 or to input mode before starting deepsleep. That stops potential leakage. The current drawn by the ds18B20 is ~1 mA in active mode. So suppying it from a GPIO is not a problem.
Take care to connect the pull-up resistor for the data line to the same source.
Do you know if powering via gpio, will no have power leak? I designed a board for arduinos 2 years ago and the only way to avoid power leaks is using mosfets...
@ecabanas you can power the ds18b20 from a gpio pin, which you switch on and off as required.