# Need idea for voltage threshold switch solution

Hello all,

I have a simple LED blinky-toy that's controlled by an ATtiny85. It operates just fine off of two AA batteries. I've recently hooked it up to a 7V solar cell, and the circuit behaves normally with the cell in broad daylight... however I've noticed that in the morning when the sky is gradually getting brighter, and the solar cell gradually produces more voltage, there's a threshold where there's barely enough power to light the LEDs but not enough voltage for the ATtiny to behave correctly (the blinking pattern I programmed isn't being executed probably because I'm under-powering the MCU). I bootloaded the ATtiny85 at 8MHZ with BOD disabled.

I'm curious if there's a circuit I can insert between the solar panel and the blinky toy that behaves as a voltage switch, such that the board will only turn on when the panels are producing 3.3V or more. I'd prefer something I can build myself.

I attempted to follow the instructions at the link below but couldn't get it to work... wondering if anyone has a simpler solution. I can think of a lot of applications for a voltage-threshold switch.

Thanks,
Tom

A transistor with a suitable biasing setup would do the trick wouldn't it? Pick a couple of resistors for a voltage divider that will turn the transistor on when the voltage is high enough for your load to operate correctly.

I like the idea - I'm not super familiar working with transistors. Would the voltage divider be on the base side? I'm trying to picture what the schematic would look like.

How is it that the LEDs light at all if there’s not enough power for the ATtiny to run your program? The LEDs probably draw much more current than the ATtiny. Maybe in weak sunlight, the sketch starts running, switching on the LEDs, then the current drawn by the LEDs drags the panel’s voltage down to the point where the ATtiny program freezes.

Also do you really need 8MHz for the sketch? 1MHz would draw less current, preventing the ATtiny from dragging down the panel’s voltage so much in weak sunlight.

You could try using one of the ATtiny’s pins as an analog input, comparing the panel voltage to its internal voltage reference. When there isn’t enough power, keep the LEDs off so the sketch can keep running. Of course, that would use a precious pin, but you could maximise the number of LEDs you can blink with Charlieplexing.

Paul

The attiny85 doesnt have a brown out reset?

They make voltage detector ICs that look likea transistor, and turn on a pin when theor vc is above the internal threshold.

I run the chip at 8MHz because that's required by the DS18B20 temp sensor I'm also using.

The ATtiny85 does have BOD, but out of simplicity I usually use the boot loader (from the ATtiny core) that disables BOD. Now, if I can find the right code to set BOD to around 3V, that could do the trick. I'll take a look at the data sheet to see what that setting would look like.

Thanks,
Tom

The transistor is the way, instead of a voltage divider, a zener diode placed backwards on the base pin would keep the transistor off until the reverse breakdown voltage takes place switching your circuit on, a darlington transistor or possibly a schmitt trigger to keep a clean transition between off and on.

Its essential to have enough hysteresis on such a switch otherwise the load
causes the voltage to sag, switching the switch off, then the voltage recovers,
then the switch turns on, then the load causes the voltage to sag, ad infinitum.

Standard method is a low power comparator with a positive feedback resistor
to set the hysteresis, and its output driving a pMOS high-side switch directly.