I’m just playing with JSN SR04T-2.0 ultrasonic sensor and thinking about switching it completely off between reads. I used Core module and connect sensor same way as for ultrasound example.
It looks like with Sensor module I can control VCC middle pin. This will also work for me, but I would like to keep Sensor module for another module.
I’ve checked the current consumption of the JSN SR04T-2.0
And with 8mA it is ok to power it from any Core Module GPIO. So connect the power of the ultasound sensor to for example P7 (P8 & P9 are used for sensor signals).
Then you enable this GPIO to logic 1 before you call bc_hc_sr04_measure and then you set GPIO to logic 0 in event handler to disable sensor.
It is possible that the sensor will need some time/delay after power-up and before the measurement is started. Let me know if you need any further help.
Thanks for sharing the code.
I see that you use serial debug output usign bc_log. This takes some current because UART needs to be initialized. When you do make release then the bc_log calls are ignored and binary has lower power consumption.