Check if a circuit is still live

Hi,

I'm building an project where I need a pump which is controlled by the arduino but also has a float switch in case the water runs low. This all works, I can switch the pump on and off in software as needed and the float switch overrides the software control.

This is basically my system:

How can I get feedback from my circuit that tells me when the float switch is off, i.e. the circuit isn't closed? I would like to trigger an event if the float switch is off?

I can get this working on it's own, but cannot integrate it into my system:
https://itp.nyu.edu/physcomp/labs/labs-arduino-digital-and-analog/digital-input-and-output-with-an-arduino/

Explanations for dummies, please, I'm new to this :wink:

Cheers
M.

This is basically my system:

Sorry, that doesn't cut it here. This is because we need to know your exact system before we can offer good advice.

So where does the float switch feature in that schematic? Is it across collector and base of the transistor?
Is it in line with the motor's power? And what voltage is the motor running on, that link showed it was 5V from the Arduino.

Once we know these things we can tell you how to use the float switch as an input to the Arduino.

Hi,

My apologies, I'll try and clarify.

The float switch is in line with the motor power. I tried illustrating (attached).

It's a 6V motor. The power is coming from the Arduino, so 5V.

Cheers
M.

So, when the float switch is open there is no power to the motor and you can't override it with the Arduino. When the float switch is closed then the Arduino decides if the motor is running or not. Is that correct?

Connect the motor end of the switch to an Arduino input and add a 10K pull down resistor, that is one going from the input to ground. That will read LOW when the motor is off and the float switch is open.

Many thanks, I will try that tomorrow.

Cheers
M.

OK just to note that if it goes crazy or resets the Arduino then the motor is kicking out interference that needs to be suppressed, but try it first.

Hi,

Thanks, that works really well to tell me if the motor is running, i.e. I get a 1 on my Arduino pin when the float switch is on. When it's off though it switches from 1 to 0 and back again every few seconds?

This is something I can deal with, but I was wondering what causes this issue. Wiring as I understood it attached.

Cheers
Martin

Hi,

It's synced with the arduino control;

if float switch off:

  • arduino on - low
  • arduino off - high

Cheers
Martin

The diode should go across the motor after the float switch, otherwise the voltage on the motor
terminals will have inductive spikes that could be damaging to your pin sensing the voltage to
the motor.

The 10k across the motor is doing nothing AFAICT.

It will really help to learn to draw a circuit diagram, not a Fritzing wiring diagram, since
clear circuit diagrams (aka schematics) are the language electronic circuits are communicated in.

A wiring diagram is merely for the construction step, its not intended to communicate function to
humans, just to allow physical wiring up of a given circuit.

Hi,

You are right, the 10k doesn't do anything, it was put there based on previous advice.

I've moved the float switch and volt sensor to before the diode too.

For the moment I am reliant on practical wiring, I don't pretend to understand what I'm doing. Once I understand more I'll look at wiring diagrams.

Cheers
M.

It was put in the wrong place, the previous advice was fine. The fact that it was not placed where you were told to place resulted in the problems you had with the signal reading high and low randomly. This is known as a floating input and he resistor, if correctly placed, cures his.

Hi,

Thank you for your comments, I have now got it working as I expect it based on the combined comments (diagram attached, Fritzing again, I'm afraid).

Cheers
Martin

OK, now take that Fritzing layout and click on the Schematic tab. Spend some time making the wires look tidy, like having them all horizontal or vertical and minimizing the wire crossings, and you will have a passable schematic that everyone can respect.