Go Down

Topic: Voltage controlled switch with an ATtiny85 (Read 2335 times) previous topic - next topic


I just wanted to share my latest HomeCSP.com project with the Arduino community. I've created a little voltage controlled switch using an ATtiny85, and of course tried to incorporate all the best practices that I could pickup from this forum. This circuit is primarily intended to be used in solar power applications. For example you might want to monitor battery or panel voltage and then trigger a relay at a set voltage to send power to some power hungry device as long as the voltage doesn't drop.

Part of the fun was using a couple LEDs to flash out the voltage set-point value, and just a couple buttons to handle all the functionality. The voltage divider portion of the circuit has a 4.7v zener protection diode, and uses a small capacitor for ADC impedance balancing with the 100K input resistance. I've built some with a 24V range, and some with a 50V range. A PNP TIP127 switches the positive supply voltage for the output circuit and should have adequate current capability for most relays or directly driving small fans and motors less than 2A. A small diode provides at least some protection to the microprocessor from the output circuit in the case of transistor failure (Ha! looking close at the picture I see I cheated and used a short jumper wire instead of the protection diode on this board!), and a 3A blocking diode prevents damage from reverse polarity power connection. The 78L05 regulator handles a wide input range allowing the board to work on any supply voltage from 6 to 35VDC.

On this first version I tried to use the RESET pin for an adc input since the diagram I had looked like that was possible, and I'm still not sure of that would work, but I didn't want to set the fuses to try it. So this version doesn't have any hysteresis control or an inverted mode option. The next version will feature a 4bit R-2R resistor network to read all four switches with just one analog input, and leave the RESET pin open.


Feb 02, 2013, 10:41 am Last Edit: Feb 02, 2013, 10:58 am by tytower Reason: 1
So the voltage sensor is connected to the panel and when it reaches say 18 Volts the attiny switches power to say the battery bank is that so?

So what is the 6-35V connection for ? Is this the boards power supply If so where is the solar input then , through the sensor?
I take it also that the voltage regulator takes voltage to 5 volts to drive the ATTiny85 . Does the regulator get hot at all ?

Is this your web site  ?http://experiment-savetheplanet.blogspot.com.au/
This one too?http://homecsp.com/
Governments should do what they were designed to do only.
Manage the larger issues best done by Government.
My Family and my Property are no


It works basically like you described.
The 6-35v connection is for driving something like a relay, or a small dc pump. Maybe you want a 12v relay, maybe you want a 24v relay. Whatever the input voltage is gets applied to the output. The 78L05 provides power for the ATtiny85, which draws such little power that it doesn't matter that a linear regulator is taking it down to 5v from 24V. The regulator doesn't get hot at all.

Depending on your application you might choose to connect your PV voltage (pre-charge controller) to the Input, or perhaps your battery voltage (post-charge controller).

HomeCSP.com is my active web site.


Feb 02, 2013, 09:12 pm Last Edit: Feb 03, 2013, 05:53 am by tytower Reason: 1
I am still not clear on this . Can you just explain where the solar panel connects. Which terminal and where the battery connects ,which terminal.

I take it this is a MOSFET device controlled by the voltage input top left,and ATtiny , that makes a connection between the 6-35 Volt connection and the output terminals but its use with solar panels is not clear.

Will you supply a schematic and code ?
Governments should do what they were designed to do only.
Manage the larger issues best done by Government.
My Family and my Property are no

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131