Ultrasonic sensor ON/OFF switch with transistor

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.

Im powering the arduino with a battery so the output pins are not generating enough current to power the sensor

an HC-SR04 will work @ DC 3.0-5.5V. what Arduino are you using?

Arduino Uno powered by 3 X 1.5V AA batterries via VIN on arduino

when off: set trig/echo as input pins. Then this should work.
(else parasitic currents is powering the unit)

I don't see why a pin would not be able to provide enough current / voltage

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

weird (at that 1.1 voltage the 328P no longer functions at 16Mhz). (It's also recommended to supply more than 7V to the regulator)

Do you have other power requirements through the board drawing much power from the 5V regulator?

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.

what type of batteries are they?

Energizer 1.5v MAX Alkaline AA Battery

OK, their voltage drops pretty quickly to 1.3V depending on current draw and of course how old they are

You are at risk of under powering your arduino pretty quickly and instability will occur.

They are about a week old now, which ones would you recommend ?

I put the the board to deep sleep mode and wake it every 8 seconds to check if there's any object detected by the sensor

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.

The plan is to move to running a bare minimum Atmega328 without the regultors and other added components

Move power in directly to 5V-pin (not Vin)

Iv connected power directly to the VCC pin of the Atmega328, I have built a bare minimum arduino as a way to save more power