Voltage monitor of BS2 power source
orendacl
Posts: 44
I was wondering if it was possible to measure the battery voltage (of the 9 volt battery) that powers the basic stamp 2.
Reason:
I want to flash some led’s or turn an alarm when the 9 volt supply to the bs2 goes below a certain (set-point) level.
(I am operating a device that is sensitive in that battery failures and will cause disruptions in operation of the device causing me problems I wish to avoid!)
·
The other thing I have in mind is: I integrated the bs2 into a device that uses 4 double A Batteries. I would also like it if the bs2 could·monitor those batteries, and consequently flash led’s or turn on an alarm when that battery set goes below a set-point level.
·
Could you please advise your thoughts on what might be a way on how to do this?
- schematic,· program, or simply a link to reference work within this forum or online so I can review it.
·
Thanks in advance -·"we can make the world a better place using electronics!"
Reason:
I want to flash some led’s or turn an alarm when the 9 volt supply to the bs2 goes below a certain (set-point) level.
(I am operating a device that is sensitive in that battery failures and will cause disruptions in operation of the device causing me problems I wish to avoid!)
·
The other thing I have in mind is: I integrated the bs2 into a device that uses 4 double A Batteries. I would also like it if the bs2 could·monitor those batteries, and consequently flash led’s or turn on an alarm when that battery set goes below a set-point level.
·
Could you please advise your thoughts on what might be a way on how to do this?
- schematic,· program, or simply a link to reference work within this forum or online so I can review it.
·
Thanks in advance -·"we can make the world a better place using electronics!"
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
I came across this link http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol6/col/nv120.pdf
However, the code appears to be for a bs1, not a bs2. Also, the other thing is the pot command does not work.
I have in mind, to use an LCD display to warn a user that their battery is low. The display will be a simple 3 pin connected to pin 0. What are your guys thoughts?
So, to summarize, what I want to do is to still be able to measure a low voltage condition, but to output it to an lcd display. Can we still use the optocoupler method in the attached link?
What about the lcd panel as both devices say that you tie·into pin 0.
Please advise what you think about the link, and also if a work around can be found for pot command, would you say that the pin 0 issue can be resolved by using a different pin.
Thanks again.
I posted the wrong link. It should have been:
http://www.arttec.net/Press/Battery/BatteryMonitor.pdf
Now, the above question applies. Oops.
So, can we replace pot command with rctime?
Maybe something like...
high 0
pause 1
rctime 0, 0, batt
Note:
If I use this device I am going to try to incorporate it into an LCD such as the simple 3 pin unit. I will try and display text low voltage on the display. What say you guys?
Good or not?
summary of problem: Using BS2 parallax, came across old link article from 1995 that uses an neat optocoupler but code is old. Need help to fix code for bs2, want to be able to display low voltage warning on parallax 3 pin lcd display
My thoughts on the LCD is it is going to be a power hog and won't run very long if you are powering your circuit with a 9v batery.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
http://www.parallax.com/Portals/0/Downloads/docs/prod/stamps/BS1nBS2ConvTips.pdf
http://www.emesystems.com/BS2rct.htm
cheers, David
Also, I will try to implement the led and sound warnings first. I have one of thoselccd displays already in transit. I may implement something other than a 9 volt battery...The idea behind the display was maybe not necessary. Wasted money.
Anyway, I like the optocoupler all in one device and wish to give that a go like the link in the article. My code looks like this:
'Low Battery Warning
· 'Use CDS optocoupler CLM6000
· 'Uses 47K resistor across cell and .1uF cap to gnd
· 'Uses a high value resistor in series with optocoupler in series w/ battery
· 'When voltage drops, Cds resistance increases
· 'Set scale of pot function under the low bat condition
· 'Determine setpoint using a power supply and dmm
· 'Ref website http://www.arttec.net/Press/Battery/BatteryMonitor.pdf
CheckBatt:
·Batt······ VAR····· Byte
·LoBatt··· VAR····· Byte
·HIGH 0
·PAUSE 1··············· ' 1 is the time in mS...may need to experiment and change this '
·RCTIME 0, 0, Batt····· ' represents 0...may need to be a 1, the pin number, and the variable name
·IF Batt > LoBatt THEN GOTO Alarm
··· ' if less than established value
·GOTO CheckBatt
·Alarm:
··· HIGH 10······································ ' turn on a red led at pin 10
··· PAUSE 1000··································· ' stay on for 1000mS
··· LOW 10······································· ' turn off the red led at pin 10
··· FREQOUT 8, 250*/ TmAdj, 1500 */ FrAdj········ ' sound the
··· FREQOUT 8, 350, 1250························· ' alarm
··· GOTO Alarm
··· 'send a messsageto the lcd display "low voltage"
In terms of using a LCD, the current drain can be very low, particularly if you get a non-backlit device. The backlight draws most of the current. This one draws only 2-3mA: www.seetron.com/bpk216_1.htm.
Thank you.
Also for discussion, here is an analog photocoupler:
http://www.cel.com/pdf/datasheets/ps8501.pdf
cheers, David
i had tried this in a different way and it worked.. but in a slight different way..
i used the LM3914 Dot/Bar display driver IC..
check this link:
http://www.biltek.tubitak.gov.tr/gelisim/elektronik/dosyalar/21/LM3914.pdf
it's an ic which can accuratly indicate a DC voltage level in a TTL output which can be represented with leds..
hope that helps,,
momed,,
CMOS LSIs for Voltage Detection
media.digikey.com/pdf/Data%20Sheets/Panasonic%20Semiconductors%20ICs%20PDFs/MN1380S%20Series.pdf
I haven't used one but it looks like you could monitor the out put.
I haven't used one of these so I'm just throwing out ideas.
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am new to the forum so I typically won't reply until I have the problem solved. I will initally say that I am very glad to be on this forum. Impressed by the support, and just pleased you guys are helping. I have reviewed the ideas and from the simplicity standpint and low current draw, use of an lcd display makes sense to go with a non-backlit. To display voltage, etc... The issue of a low voltage alarm is easily resolved with the rctime command, and some resistor cap components. I breifly reviewed the other links and liked the ideas. Later in my career (from days to years from now) - this gives me the mindset to look at all opportunities, and could resolves cost impact, or reduction, and make a person meet their goals. I am not doing a work project by the way, but was recently laid off. We were constanty on cost reduction efforts, and I see now that knowing all the possible methods to do soemething allows you to make smart decisions. I am working on a differerent issue on my project, and will return to this one with an update on what I have done and although I kind of know which one I will use do not wish to speculate until it is assembled and actually working!
Thanks so much you guys
I arbitrarily from a tip used LoBatt CON 741
This came from our tech line but I may not have explained clearly, that I am using a 9 VOLT source!!! (Not the 12V source used in the nuts and volts column).
I know this plan I used is/was not the ideal concept, but I happened to have 20 of these exact optocouplers on hand, and everyhting else I needed. I breadboarded the circuit, and it works all "too well". It comes on, and will not turn off it's alarm...no matter what voltage I sweep.
I built the circuit with a series resistor as described in the "nuts and volts" column # 5 listed a few posts up. It is a little confusing to my why it says that the series resistor is (Source Voltage - LED voltage Drop)/ Expected current...then they use an entirely different resistor??
Example:
They wrote in the article "So in the case of a 9 volt battery, a 1.9V led drop, and a 10mA current we have"
(9-1.9)/10e-3 = about 700 ohms resistor.
What confuses me is that the author said that he built the circuit for a 12 VOLT system, and he says I used a 100K series resistor??
I am not building the basic RCTime cct we all should have used...I know, I know - Should have listened but wanted to try this anyway so please don't suggest abandon it...or at least just yet.
My questions are:
1. What should the scaling factor be for a 9 Volt system?
2. What should the series resistor be for a 9 volt system?
3. How is it you arrive at that value, is there a formula to show us how to calculate this?
Note:
The CON 741 (value of 741 came from a call I made into tech support but I might have missed exactly stating I was at 9Volts, and I did not ask how they arrived at that number)...
Summary of problem:
I built circuit in the nuts and volts colum exactly as figure shows, using the exact p/n optocoupler in the article. The alarm instantly turns on and will not turn off no matter what I do with the variable bench power supply (between the ranges of 4 volts and 12.5 volts it stays on). I did not crank it higher.
Here is my BS2 code that I came up with as the original article was written for BS1:
LoBatt CON 741 'Provided by tech support
'LoBatt CON 220 ' The bs 1 value was 220.
Batt VAR Word
HIGH 0
PAUSE 1
RCTIME 0, 1, Batt
DEBUG DEC ? Batt
IF Batt > LoBatt THEN
GOTO Alarm
ENDIF
Alarm:
FREQOUT 2, 250, 1150
FREQOUT 2, 350, 1250
HIGH 10
PAUSE 1000
LOW 10
GOTO Alarm
END
I was wondering if anyone has had a chance to review my previous post question and provide and answer?
Note:
I have been working with Parallax tech support, and they have not been able to come up with an answer.
As mentioned, I built the optocoupler circuit as referenced in my above post.
The alarm comes on and won't turn off no matter what voltage between 4.0 volts and 12.5 volts.
My guess is I built the circuit as described for a 12 volt system but I am supplying only 9 volts.
As I asked tech support:
What should the series resistor be, and what value would we assign to·CON, and how did you arrive at that value.
Above listing provided my sample code, and was for a BS2.
I built this circuit as I happen to have on hand 20 or so the exact optocoupler. Thre rest was basic resistors, a .1 uF cap, some basic breadboarding. Convert BS1 program to BS2, and I am stuck with the series resistor and what CON value should be.
Thanks.
I noticed that your alarm routine has you returning to the alarm; thus the alarm continues.··Whereas it should return to the beginning of the main routine; in order for the alarm to stop.
The main routine·does not have a looping directive. Therefore the program goes through the voltage checking process only once and, regardless of the outcome of the voltage comparison, always goes into the alarm routine.
hopes this helps. cheers, David
two things; Number 1:
There is an error in my code. First off, I told it that if Batt > LoBatt
THEN Goto Alarm.
LoBatt = 1052
This should have been If Batt < LoBatt then goto Alarm.
Number 2: There is still a problem.
In my code I added a line to ouput the value of Batt (which is declared as Batt VAR Word) to the DEBUG and also on my LCD display.
I saw that the value of my RCTime Batt is always = to 0. It never comes up with a tangible value to compare with LoBatt ????.
Can someone please advise (and this should apply to any type of RCTIME application). JUST HOW IS IT THAT THE RCTIME VALUE GETS CREATED IN THE MICROCONTROLLER IN A BUILT up CIRCUIT SO THAT IT CAN COMPARE THE Batt VALUE WITH LoBatt?
It logically makes sense to me that if Batt is registering, then the microcontroller can perform the logic. Example. Say it finds Batt is equal to a tangible RCTIME value of 750. upon comparison it would see this is less than LoBatt and not sound an alarm.
The reason even after fixing my code, that the alarm stays on all the time is that the RCTIME is not working. It finds my declared variable name BATT to be equal to zero all the time.
What could this be???
So this can use one adjustable pot or two fixed resistors as a voltage divider. And you can monitor 9V, 6V, 3V, 12V, anything. Just tie all of your grounds together, and make sure you never feed more than 5V to a Stamp pin.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."