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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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 ?
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 ?