Unable to use NPN as switch for ultrasonic sensor

Hi,

Since the HC-SR04 sensor consumes power even if ground is not connected. I am unable to use NPN as switch to control the power in sensor. I am using arduino pro mini, this project should run on battery for years.

Please provide a wiring diagram of your current setup. If you don't connect any ground where does the sensor gets it's power from? How did you measure that it's consuming power anyway?

Connect powerpin/trig/echo to I/O-pins. Switch all to inputs to turn sensor off.