Power a sensor on or off via arduino logical state

Hello all,

I would like to set up a project to detect water level in my well, and send the information wirelessly to my Raspberry Pi4.

I have an arduino Nano that I'd like to use in the sender part, along with a Maxbotix MB7052XL ultrasonic sonar.

The Maxbotix MB7052XL ultrasonic sonar does not have a sleep mode function.
Even though it only draw a few mA, I'd like to keep the consumption of the sensor as minimal as possible, as the sender part will be battery powered through a buck converter.

Is there a way to power the sensor on and off via a logical output of the Arduino Nano ?
0 > no power
1 > power.

And what If I put the Arduino in sleep mode ?

Thanks for your answers.
P.

You can switch any wire on or off (open/close circuit) using an arduino and various circuitry but would help to have the usual details of your project such as schematic

1 Like

You can use a N-Channel MOSFET to do that. You need to post an annotated schematic of your project so we can get the information we need to help you. Frizzy wire diagrams are basically useless as they do not have the needed information. Also links to Technical information on the hardware devices you are using. Links to market places such as azon are usually missing needed information.

1 Like

How will you use a nano for wireless communication

will wireless communication work when its down a well?

Is there a way to power the sensor on and off via a logical output of the Arduino Nano ?

It only draws 3.4 mA, so yes, certainly. Just like you mentioned.

However, it may not be a good idea:

To know how much it draws on startup, ask Maxbotix. Or use a scope.

Edit to add:

If this were my hobby project, I'd probably just go ahead and power the thing from the Arduino pin, keeping @MarkT's warning in the back of my head, in case of trouble in the future.

But, if you'd rather be on the safe side, then use a transistor (and one resistor...total 2 items) or MOSFET (and two resistors...total 3 items) to turn it on and off. See the excellent guide by @LarryD for this (start in upper left... the Q2 or Q4 circuits... replace motor+diode with your sensor): https://europe1.discourse-cdn.com/arduino/original/4X/f/0/9/f093ab657f7064396f471ba2aa0028003de274fb.jpeg

I suppose you could also put an inductor (one item) between the Arduino pin and the sensor, but you'd need more information to be able to size it.

Thank you for all your kind replies.

I'd like to make 2 or 3 measurements per day.

As it will run on batteries, everything else must be in sleep mode the rest of the time.

Here is what I imagine:

  • Arduino wakes up

  • Ra-02 and Maxbotix wake up by being powered with the "?" mechanism (N-Channel MOSFET ??), triggered by a logical high on the Pro Mini pins D2 and D3.

  • Water level is measured and transmitted via LORA.

  • Ra-02 and Maxbotix are brought down by being unpowered with the "?" mechanism (N-Channel MOSFET ??), triggered by a logical low on the pro Mini pins D2 and D3.

  • Arduino goes to sleep mode

  • Timer (4 hours for example)

  • Repeat ...

As asked, here is a schematic design:

sch

Maxbotix documentation (including MB7052)

Lora module Ra-02

Is all this feasible ?

For the MOSFET you connect the port pin to a 100 Ohm resistor connected to the gate of the MOSFET. Add another 10K resistor from the port pin to ground. Connect the source of the MOSFET to ground. The load goes on the drain. When the port pin is high the MOSFET will turn on and drive the drain to ground.

Not knowing the your setup I would suggest adding a small solar cell to charge the battery as you do not have power.

Keep us updated on the project.

To eliminate the chance of phantom powering, I'd switch output pins (to the Maxbotix and LoRa) to inputs before turning the devices off with the MOSFETs. And leave them as inputs until after turning the devices back on. Same upon initial start of the Pro Mini.

Edit to fix Arduino name.

And be sure you use a 3.3v logic level MOSFET

Thank you Dave for this answer and the switch from output to input trick.

I just bought this circuit:
https://www.gotronic.fr/art-module-a-mosfet-5-a-gt1168-26147.htm

And I'm not sure it is OK for a 3.3V logical high. I read on another forum that I would need a IRL520 based-circuit rather than the IRF520N. I can't seem to find the information anywhere.

Link to the IRF520NPbF specs:

Can you help ?

Although the website says the device is suitable for use with 3.3v processors, the IRF520 is not suitable for that use unless driven by a transistor, and I don't see one. Maybe it's on the back side, but I doubt it.

Something like the IRF3708 would be a better choice for 3.3v operation.

Hello Dave,

The IRF520 won't properly work at a 3.3V level. Information advertised for that device is wrong on gotronic.fr, and a waste of money.

Thanks for the IRF3708 tip. It think it will suit my needs: Vgs(th) is 0.6V min and 2V max on the specs.
From what I understand about Vgs values:

  • Below 0.6V, the MOSFET acts as an off switch
  • Above 2V (eg 3.3V), the MOSFET is fully on, and acts as a very low resistance.

Correct ?

Do I need resistors as mentionned above ? And why ?

Thank you.

Not quite.

In the paper below, the paragraph below Table 1 on the first page has a very good explanation of Vgs(th) and why it is only tangentially related to MOSFET operation as a switch.

The paragraph on page 2 describes operation as a switch. Note the sentence about the resistive (or ohmic) region. By the way, Figures 2 and 3 are shown with linear scales on each axis, whereas datasheets often use log-log scales, which look different. Same info, tho'.

By the way, the IRF3708 seems to be available only from Amazon, eBay, etc. so there is risk of getting counterfeits, but there are plenty of reports on the internet by people who have had good luck.

Another through-hole choice is the IRLZ44NPbF. It also works fine with Vgs=3.3v, and is readily available from more traditional suppliers (Digikey, Mouser, etc.) For example, with Vgs=3.0v, at currents between 100mA and 500mA, I measured an "on" resistance of about 25 to 30 milliohms, and the behavior was essentially "ohmic."

Yes, you need the two resistors. The one from the pin to ground (around 10k) keeps the MOSFET off while the Arduino is off and in the short time between Arduino turn-on and pin pinMode(), when the pin is in high-Z state.

The resistor from pin to MOSFET (around 100 or 150 ohms) keeps the pin 40 mA max limit from being briefly exceeded when the pin switches from 0v to 3.3v (the uncharged MOSFET input capacitance will briefly act as a short circuit) and in case there's a boo-boo and the gate gets shorted to ground for some reason.

I have found another Buck Converter that has a pin (SHDN pin, stands for SHUTDOWN) to turn it off and on:

Would this be a convenient solution to replace a buck converter + MOSFET + resistors ?

Unless you have another SPI device in use, you dont need to use a power switch for the LoRa module.

You can put the LoRa module to sleep with software, it uses less than 1uA in that state.

FQP30N06L is what I found that works very well with 3V3.

Make sure the part number has a "L" on the end or its not the 3V3 version.

I use them to turn off the analog components in my solar powered weather station.

Also, the Maxbotix MB7052XL operates from 3.0 to 5.5 v, so why have a 5 v buck converter? (Refer to your figure in Post #6.) Why not just use a 3.3v converter for everything?

Also, why use a buck converter at all? The Pro Mini and Maxbotix can handle the fresh charge of a single cell (4.2v-ish). And you could power the LoRa module with a 3.3v low drop-out regulator (or buy one that has a 3.3v LDO regulator...Adafruit has one, I think).

Edit to add: if the Pro Mini's 3.3v regulator has enough oomph for the LoRa (not sure...check it), then no additional regulator would be needed.

Thank you for the MOSFET instructions.

You said: "Add another 10K resistor from the port pin to ground."
Please look at my drawing: That would mean to put R2 in the "1" position. Many others suggest putting the R2 resistor in the "2" position. Can anyone confirm ?
Apart from that, is my schema correct ?

arduino2

You said R1 value is 100 Ohm and R2 value is 10 KOhm. Could you explain why those values, and the usefulness of those resistors ?

https://www.gammon.com.au/motors

Thanks Wawa !

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.