Electrical Engineering Asked by Dean on December 18, 2020
I have 16-bit Thunderbird12 Microcontroller, similar to the Freescale 68HC12.
I’m currently working on a project to monitor and control the level of water. Everything is working fine except for the input ports which have floating pins and they are randomly reading low and high. I did some research here and found that pull-up or pull-down resistors are the solution, but my set up is different.
There are 5 “sensors” that feed into the input ports. Each sensor is connected with 2 wires; one wire goes into the pin, and the other into VCC, then both are inserted into the container with both ends exposed. When the water level goes up, it touches both ends and completes the circuit and setting the input to 1.
The problem I have is that the input pins still read High even if the wires are not connected yet. What can I do do prevent this high impedance? I can’t ground the wires or set them to 1, because the latter is supposed to happen only when the circuit is completed (when water touches them).
Any help would be appreciated, thank you!
Since your GPIO pin has extremely high impedance, you need a pull-up or pull-down (as most people have said). I am working with a TI microcontroller right now, so I quickly wrote code for a quick test. I also didn't make any assumptions on the resistance of water, I used my tap water in a tiny cup for a test. It works with a 100k, so a 1M would provide good margin (for my water).
Your water may vary. The resistance of water is dependent on the impurities, really pure water has a very high resistance.
Finally, if your water container is really large and the water may already be grounded, you should use a pull-up resistor, not a pull-down.
simulate this circuit – Schematic created using CircuitLab
Answered by Mattman944 on December 18, 2020
There are 5 "sensors" that feed into the input ports. Each sensor is connected with 2 wires; one wire goes into the pin, and the other into VCC, then both are inserted into the container with both ends exposed. When the water level goes up, it touches both ends and completes the circuit and setting the input to 1.
ok, there is some challenges here, first we have a simple sensor that completes an electrical circuit for a water level sensor. I see this part of the circuit is going to be weak for switching cleanly the micro-controller.
I would normally solve it by low power Schottkey inverters (74ls04) in series to clean up the signal going in. But since you need to trigger on a voltage, instead of completing a ground, then a nor gate (74ls02) circuit like the one below would work if you just use the "B" input for the sensor, nothing connected to "A" but the resistor to ground.
https://www.electronics-tutorials.ws/wp-content/uploads/2018/05/io-io81.gif
You could try high gain transistors, trasistor arrays (uln2003) or even a darlington comparator (that you can include a threshold adjustment)
Answered by drtechno on December 18, 2020
Data Pin-->|GND--(10k)--SensorPin|
If your problems are not resolved, then post your schematic, sensor, microcontroller part number, source code
Also, you could use an ADC
simulate this circuit – Schematic created using CircuitLab
Answered by Amir Mahdi Poorat on December 18, 2020
You still need a pull-up or pull-down resistor as appropriate. If the sensor connects between Vcc and the input pin, and if the sensor is open-circuit when off, then it would be a pull-down resistor. If the sensor connects between ground and the input pin, you need a pull-up resistor.
The resistor needs to be chosen so that it has a substantially higher resistance than the sensor.
Answered by Simon B on December 18, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP