Let me start by saying that I'm not an engineer, so my schematic or understanding of electronics knowledge might be a bit... lacking.
That being said, I have an underground water tank, and I want to have some way of measuring the level of water inside it.
I previously tried with a time-of-flight sensor, but i had mainly two issues :
the distance between the sensor and the arduino (a few meters), which was too big for I2C.
This might have been solved with some I2C extender, but...
the sensor was exposed to humidity, cobwebs, ... which was impacting its readings.
I could have created a waterproof enclosure, but it seemed like more work.
After more research, I'm now considering using a submersible pressure sensor.
I could drop it in the bottom of the tank.
Most of them use a 4-20mA current loop, which could solve the distance issue (not sure yet what AWG I should use, or if I should use an electric sheath or something).
I tried to make a schematic with KiCad, and I'd like to have your feedback.
A few points :
I opted for an arduino nano 33 IoT, so I can send data through WiFi
It apparently supports up to 24v (I'll use a 12v wall wart) for power
It only supports 3.3v for I/O, so I'm using two voltage regulators :
-- one to drop from 12v to 5v for an oled display
-- from where I drop again from 5v to 3.3v for I/O (a button)
I thought so initially, but then I saw in the datasheet :
Also, as opposed to Arduino Nano boards that support 5V
operation, the 5V pin does NOT supply voltage but is rather connected, through a jumper, to the USB power input.
From what I can see, the nano 33 IoT has a SAMD board, so I could set the analogReference to AR_INTERNAL1V0 (a built-in 1.0V reference) or AR_INTERNAL1V65 (a built-in 1.65V reference).
Maybe AR_INTERNAL1V65 to be sure ?
So my sensor would be between 0,2V (4mA) and 1,02V (20mA).
Doesn't make sense.
The button doesn't need 3.3volt if you wire it between pin and ground, and use internal pull up.
The oled should have a 3.3volt pin, so you can power it from the 3.3volt pin of the Nano.
Leo..
If your sensor has a short circuit you have 12V at A0, 'cause you do not have a voltage divider from sensor-out to A0. Should be be ~ 1/3.6 at a total of 600 Ohm.
Nop, that diode is there for cosmetic reasons, but not for functionality. If that were a 3V zener diode than it had reason to be there - but it would most likely burn when the sensor wires short.
The diode is there in case you accidentally connect a negative voltage to the sensor input.
This is sometimes seen on other circuit diagrams, but maybe not needed here.
If you set Aref to 1volt, then you can still safely have 3.3volt (VCC) on the MCU pin.
Which oled (link), because you still power it externally.
Leo..
I think it was inspired by one of your suggestion in another topic
I'll remove it as it isn't indeed needed here, and put a voltage divider there.
For the oled, I had one lying around that I bought from ebay, but I can't find the datasheet anymore.
I think I'll just order another one that I can power from the 3.3v from the arduino.
That way I can get rid of the buck converter as well.
Maybe I can just move it between the sensor and A0 ? Or should I put something else in case the sensor shorts to avoid frying my arduino ?
I'm still not completely understanding how to protect the MCU pin from a potential short causing an over voltage.
From what I understand so far, the current loop operates at 12v.
Data is then sent through the output with a current varying from 4 to 20mA, which is converted to voltage with a resistor (51ohm in my case).
In case there's a short somewhere, I could receive 12v instead of the 4-20mA, is that right ?
And I need to protect against that ?
Where do I put the voltage divider then ? At the sensor end, before the resistor ?
So instead of receiving between 4 and 20mA at 12V, I receive it at 3.3V for instance ?
Or do I need to go back studying electricity for a while ?
When the sensor is faulty or the wires to/from the sensor have contact then snsor-out is +12V. The schematic from jim-p solves all the problems. If you do not understand how it works: I=U/R ... insert values and observe.