Pages: [1]   Go Down
Author Topic: Float Switch Circuit Advice  (Read 1307 times)
0 Members and 1 Guest are viewing this topic.
UT, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I am creating a auto top off circuit for my aquarium. I will using a float switch with a ATTiny85 to drive a relay that will control a water pump running of mains AC. I'll be using a NPN transistor to amplify the current from the ATTiny85 and a diode to protect against inductive current. The float switch is represented by a simple push button.

I have included a Fritz diagram of the circuit and I am hoping someone more knowledgable can review it and point out any flaws. Thank you in advance.

Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you want some caps on the voltage regulator to smooth out any wonkyness from the wall supply and to filter out noise, and to prevent oscillation

you also need a resistor on the base of the transistor, and one end of the coil is connected to the diode and nothing else

finally I dont really know why you even need a micro controller, I have a similar setup with just a low current float switch and a relay

Logged


UT, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you want some caps on the voltage regulator to smooth out any wonkyness from the wall supply and to filter out noise, and to prevent oscillation

you also need a resistor on the base of the transistor, and one end of the coil is connected to the diode and nothing else

finally I dont really know why you even need a micro controller, I have a similar setup with just a low current float switch and a relay



Thanks so much for the help! I will post an updated schematic with your changes.

I am only using the ATTiny to prevent the circuit from oscillating rapidly between on and off due to surface agitation. I also want it to turn off and stay off in the event that the switch is closed for more than 5 minutes.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 170
Posts: 12483
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
finally I dont really know why you even need a micro controller

Maybe for the future: measuring water usage, temperature, conductivity, smutziness, etc ?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

SE USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

eh what do I know, my original idea was just to cut the pump cord and let the two ends of the neutral wire sit in water, so when it got too low it would shut off the pump (I am watching too low of a level in a rank with a submersible pump pretty much same idea in different direction)

but noooo, the managers wouldn't let me do that, we had to spend money *snark*
Logged


UT, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is an updated diagram with caps and a resistor. Did I wire in the caps correctly? Or should the negative from the caps go to ground?

Thanks again.

Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

they should go to ground
Logged


UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11197
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

eh what do I know, my original idea was just to cut the pump cord and let the two ends of the neutral wire sit in water, so when it got too low it would shut off the pump (I am watching too low of a level in a rank with a submersible pump pretty much same idea in different direction)

but noooo, the managers wouldn't let me do that, we had to spend money *snark*

Wire ends in water doesn't sounds like a very durable solution, to be sure. But I don't get why you're going to all the bother of using a microcontroller when you already have a switch and a relay. Why not just wire the two together? I mean you could put an Arduino in there, or maybe two or three connected via GSM or ethernet or whatever else catches your eye, but it's really just Rube Goldberging your solution.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

SE USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thats what I am doing wire, switch and a relay, but the op has a good point as his situation involves a surface in motion (ie air bubbles and fish) so it would probably click on and off a bunch, with the avr in the mix you can use time delays and whatnot to dance around this problem.
Logged


UT, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thats what I am doing wire, switch and a relay, but the op has a good point as his situation involves a surface in motion (ie air bubbles and fish) so it would probably click on and off a bunch, with the avr in the mix you can use time delays and whatnot to dance around this problem.

Correct. That was my thinking with the ATTiny. Additionally, the avr will function as a failsafe. If the pump has been on for more than 2 minutes, it will shut off until the circuit is reset.
Logged

UT, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks everyone for your help.

I added a couple of LEDs to indicate error condition and pump status.

Here is the finished PCB.




Also attached svg.

* single-sided-ato_pcb.svg (56.32 KB - downloaded 11 times.)
« Last Edit: June 10, 2012, 09:49:52 pm by GentlemanBean » Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

From your Fritzing diagram, it looks to me that you've connected the switch between +5v and one of the Attiny input pins, but you have no pulldown resistor. Either add a pulldown resistor from the pin to ground, or else connect the float switch between ground and the pin, then you can enable the internal pullup resistor.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

UT, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Either add a pulldown resistor from the pin to ground, or else connect the float switch between ground and the pin, then you can enable the internal pullup resistor.

Thanks I have modified my switches to use ground instead of +5v. Thanks for catching that.

Updated breadboard and pcb layout below:




* single-sided-ato_pcb.svg (55.58 KB - downloaded 6 times.)
Logged

Pages: [1]   Go Up
Jump to: