Action on brown-out ?

avner

Senior Member
Hello.

I would like to be able to run a command (pulsout) on absence of power supply (at the moment of dis-connecting power)
it can have some delay, and I don't care at what voltage it triggers, i just need a non-accurate way to send a pulse before there is no more power at all.

The problem is: I'm with a 08M2 and no spare pins.

Is there any function to trigger a command on brown out ?
any function to read the supply voltage ?

Thanks for any ideas !
software only, please
 

srnet

Senior Member
Is there any function to trigger a command on brown out ?
No, the PIC\PICAXE has a brownout detect, but that triggers a reset.

any function to read the supply voltage ?
yes

software only, please
There are some combinations of software and hardware that would allow this to work, but we cant tell you about them as they are not software only solutions.
 

crazynight

Senior Member
this might help http://www.picaxe.com/BASIC-Commands/Advanced-PICAXE-Configuration/calibadc10/
set line 6 to the critical voltage possibly triggering a latching relay.

I have just used example 2 to build a voltage meter within my project when a button is pressed it returns the voltage of the 3xAA's using a i2c device which is normaly used to display the times. seems to be 0.03 volts out but my meter is old and uncalibrated.
 
Last edited:

MartinM57

Moderator
The normal way of racing a collapsing power supply is to isolate the processor from Vcc with a diode and a fat capacitor on the diode/processor Vcc side - when Vcc collapses the processor will keep going for a certain amount of time (not that long), powered from the capacitor.

Then, you would regularly measure the Vcc value at a rate faster than the time that the capacitor will keep the processor going e,g cap powers the processor for 1 second, so measure Vcc say 4 times per second.

When Vcc is detected as collapsed, send out your pulse, go into a long pause/infinite loop and wait to die - or just set a pin high and long pause/infinite loop and wait to die.

The trick is, of course, especially with no spare pins, to have some way of periodically and quite often measuring Vcc - maybe CALIBADC will do it, but it doesn't look like it to me (normal way is a potential divider from Vcc into a ADC pin)
 

avner

Senior Member
Good ideas everyone -
the calibadc10 would work, on a separate circuit i built,

The problem is that it's a ready PCB i've made and I didn't take things into account when designing it.
so the bypass capacitor I have on the PCB is not even enough for the picaxe to live past the calibadc.

I have a 12v supply, then a 78L05 voltage reg., and a 10uF ceramic capacitor on the picaxe.
When i connect a 2200uF capacitor in parallel with the existing 10uF PCB capacitor, it works.

but i'm looking for a neat solution without adding parts on the neat PCB...
That's why i challenge you guys :)
 

srnet

Senior Member
but i'm looking for a neat solution without adding parts on the neat PCB...
That's why i challenge you guys :)
I can suggest a way of doing it without adding parts to the PCB, you re-design the PCB to take a bigger capacitor.
 

Dippy

Moderator
All the above ideas are fine but, from the sounds of it, (no spare pins) can't be built into a ready-made board.
Nick's suggestion, whilst true, is an after-the-event option. It has been mentioned before (by me) on this Forum.


And a comment which may or may not be applicable here; some regulators don't like having the O/P higher than the input V.
The solution is a reverse diode. Data sheet reading is required. Usually overlooked and and sometimes important.
And also, further to hippy's comments re his example of EEPROM; the reservoir needs to be generous as significant droops during an EEPROM write can cause corruption.



Maybe if avner posted his circuit someone could suggest a simple add-on to help... otherwise it's re-design time.
And before the Mk2 is finalised sit down and think of ALL the things you might want it to do.
These sorts of things happen to all of us at some stage and sometimes you just have to 'bite the bullet'.
 

AllyCat

Senior Member
Hi,
I have a 12v supply, then a 78L05 voltage reg., and a 10uF ceramic capacitor on the picaxe.
Do you really mean a ceramic? Can you put in a somewhat larger value (electrolytic)?

Another problem with the regulator (when using calibadc) is that the 12 volt supply will fall to about 6 volts before the PICaxe has any chance of "knowing" that its supply rail is about to vanish. What you might be able to do is connect a suitable value of capacitor (perhaps 10% of the "10uF") from the 12 volt to 5 volt rail (but beware of all the current surges, reverse polarities, etc. that might occur under all possible power up / power down situations). Then, when the 12 volt rail starts to fall, you might be able to arrange an adequate "twitch" on the 5 volt rail for the PICaxe to detect when polling calibadc(10).

Cheers, Alan.
 

hippy

Ex-Staff (retired)
The idea of measuring the regulator / PICAXE supply voltage to see if input voltage is there seems sound enough.

The only requirement is to not have that power rail collapse too quickly; it must hold up long enough to have allowed the PICAXE to do its CALIBADC, have determined it's below what it should be, and have issued its PULSOUT. So all you probably need is a larger cap on the regulator output.

Plus, as noted, avoiding any issues when the regulator output voltage is higher than its input voltage; a blocking diode on the output could suffice.
 

avner

Senior Member
The only way would probably to put a large electrolytic cap.
since on the 10uF ceramic (yes ceramic) it probably dies too fast.

I dont mind losing the 12v much earlier than the picaxe would notice.
I just need to send the pulse out when the unit is disconnected.
this can happen within 0.5 second, 1 second or 2 seconds after power lost, i don't mind.
 

SAborn

Senior Member
Lets put this into context, firstly the OP didn't want a hardware solution, and its a simple hardware solution required, not even involving the picaxe.

As there has to be a second power supply to the monitoring circuit to receive the requested brown-out pulse/signal, why not just use a pullup resistor on the second supply and a garden varity NpN transistor (BC 337, BC547, BC548, BC549 etc) between Gnd and the pullup resistor, with a 1K resistor between transistor base and 5v picaxe supply.

The signal line to the monitoring circuit will be held low while there is 5v on the picaxe circuit, and pulled high when the 5v fails.
 

westaust55

Moderator
The problem is: I'm with a 08M2 and no spare pins.
Does that include the use of C.5 (Serial In) already for an input?

As Dippy suggests, a schematic may make things much clearer and give/allow more positive answers.

Is there any function to trigger a command on brown out ?
Short answer - NO, not as a brown out starts to occur.

software only, please
possibly none available without some hardware change.
 
Last edited:

MartinM57

Moderator
OP asked for a (pulsout) pulse, so I'm assuming a 0-1-0 (or 1-0-1) pulse is required (of unidentified duration as well)...but maybe that can be relaxed to just a 1-0 or 0-1 level change.

Only the OP can tell us.....
 

SAborn

Senior Member
In that case. would a AC coupled capcitor (in series) on the signal out line not give a high / low pulse.
I still think its a hardware solution and not a picaxe solution.
 

besupreme

New Member
*think* There is no input and no output left. Since I haven't seen any schematic, my only suggestion may or may not help. That is, when brown out is detected, all outputs go high-z, am I right? So for any output that should switch on when power goes off, you'd only need one pull up resistor for that output. I know that's a design change. I only see no better option without the design online here.
 
Top