Go Down

Topic: Float Switch Circuit Advice (Read 1 time) previous topic - next topic

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.


Osgeld

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

http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL


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.

robtillaart

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


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

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

Osgeld

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*
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

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.


Osgeld

http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

PeterH


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.
I only provide help via the forum - please do not contact me for private consultancy.

Osgeld

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.
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL


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.

#10
Jun 11, 2012, 03:13 am Last Edit: Jun 11, 2012, 04:49 am by GentlemanBean Reason: 1
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.

dc42

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


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:




Go Up