Software control of output VCC

Hi here,

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.

Is there a way how to do it with Core module?

Thank you for any advice,
Pavel

Hi expee,

I’ve checked the current consumption of the JSN SR04T-2.0
image

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.

Martin

Hi @hub.martin ,

this sounds really good. I will check today’s evening and will update you with result.

Thank you!
Pavel

1 Like

Hi @hub.martin,

works as expected. I did not have enough time to test it longer period of time and also to make code better that just some dirty hacks :slight_smile:

Thank you for good advice.

Best regards,
Pavel

1 Like

I made it finally (somehow) running :slight_smile:

https://bitbucket.org/xpjninja/bigclown-water-tank-sensor/src/master/

It needs some refactor, but it works.

P.

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.

1 Like

Thank you for this advice, I will use it for my “production” :slight_smile:

I’m planning to use battery module and maybe also solar panel, but it depends on whether I find suitable placement for it.

P.

1 Like