I have an ultrasonic sensor (JSN-SR04T) connected to an Arduino. In order to achieve low power consumption i decided that i want to switch the Ultrasonic sensor off for 8 seconds intervals in between , I connected the sensor via a transistor and used a signal from the Arduino to the npn base to control the switching (ON/OFF) of the transistor.
My problem is that the sensor remains on even when i switch of the signal to transistor base. Does anyone know how to solve this. I suspect that the sensor finds its way to ground even somehow
may be go for a High Side transistor switch (PNP BJT or P-Channel MOSFET) and cut the 5V supply
alternatively, if it is a common HC-SR04, it only draws about 6/8 mA so you can power it from a digital output pin that you would put to LOW when you want to turn it off.
I did that, I have noticed that sometimes the arduino pin outputs 1.1V when i power and the sensor then does not power on sometimes it outputs 5V, I literally have to manually disconnect and connect back the sensor vcc in order for the arduino to start giving me 5V output
The HC_SR04 draw so little power that you can power it directly from an Arduino pin. That's what I do because it lets me plug the four pins into four consecutive Arduino pins. Set the Vcc pin to OUTPUT, HIGH and the GND pin to OUTPUT, LOW to turn it on.
No, the sensor is the only thing connected to the board. The 1.1V does not always happen but it does sometimes during power up.
I do set the pinmode to output on setup() which means it should always
output 5v. So I am not sure what may be pulling the voltage down, The quick fix is to disconnect the sensor VCC from Arduion output pin and reconnect it then ot starts giving the right 5v.
a UNO in deep sleep does still consume a lot of current (at least 6mA if I remember correctly). if you really want to conserve power you probably want to move to something else.
regarding the battery, there are lots of moving parts, may be you can read this article. It's in French bug I guess google translate can help.