Batteries running SX28 don't last all night?
eagletalontim
Posts: 1,399
I have a project that requires batteries to run an SX28 through out the night, then during the day, the batteries recharge from solar panels. The batteries are 1.2V 2500mAh rechargeable NI-MH AA's. I have 8 run in series to make 9.6V. The power is then sent though a 7805 5 volt regulator then to the chip. The chip does nothing through out the night as far as running anything from any pins. The SX's only purpose is to listen for a pin to go high or low then activate 1 of 2 pins for 1 second to control an H-Bridge which turns on an electric water valve. Current draw of the entire circuit is about 30mA in "stand-by" mode, and a max of 280mA for 1 second when activating or deactivating the water valve. From what I figured, the batteries should last over 24 hours without a charge but maybe I did my math wrong or something is just not right. I can draw up a schematic if needed but it will take quite awhile and I can post my code if needed. Does 30mA sound too high for just running an SX28 DIP? I did not configure any pins except for the ones I am using if that matters any.
If I posted this in the wrong place, please feel free to move it to the correct area
If I posted this in the wrong place, please feel free to move it to the correct area
Comments
Between reducing the SX current draw except when it's needed and reducing the quiescent current it could work out.
I am trying to find good documentation on the SLEEP command and how to use it for what I am needing. It appears, from what I have read so far, that my button pin must be on one of the B pins in order for the wake up to happen. I know I can put the SX to sleep, but can't figure out how to wake it back up with RB.0
Here is what I have so far.
FWIW, this would let you run the SX at 4MHZ, as the quiescent current would be quite low during sleep, but if you don't need tight timing, the internal 32khz RC clock is even lower power.
Essentially there are two ways - an external interrupt to port B or an internal interrupt via a reset by the Watchdog Timer doing a rollover. The watchdog timer seems to be doing a reset in its normal role and a wake up when in Sleep mode. The wake up may be preceded by a reset with a delay - I am still trying to sort this out.
If you want to explore the internal interrupt, you have to turn on the Watchdog timer and set an appropriate interval (up to 2.2 seconds). Of course, once the Watchdog timer is in play, you also have to prevent it from rolling over and causing an unintentional reset.
Actually, I found the SX documentation of the feature so incomplete that I ended up reading up on the same feature in the PIC16F57 and PIC16F84 to fully understand it.
But and a very big BUT, you require a low quiescence Voltage regulator to take advantage of this. That means a regulator that provides 500ma or less and consumes less that 1ma when power is not required. Using a conventional 7805 or a 78L05 is going to use 5-6ma even when nothing is on AND a heck of a lot when on (about 30% waste).
LDO or low drop out regulators are a bit of a deception as they consume huge amounts of power as they get into the region below which a 7805 operates.
So you likely need the 3rd option - a low-quiescent regulator. If the H-Bridge can take unregulated power, a 100ma low-quiescent regulator would be idea as they use about 50uA in idle mode. Maybe you should use a dual voltage set up.
In the past, there has been a lot of discussion here about correct solar panel configuration as it is a bit counter-intuitive. There is a big difference with output under load from output without load - and this needs to be taken into consideration.
From what I can gather, you want to use the external wake up feature. You have to choose to trigger on a rise or a fall in the Port B pins that are active. That means that a positive pull would need a rise configuration and a fall from +5 to zero would need the falling configuration. Pull up or pull down resistors might be required also.
This is an interrupt that goes to $000 or a reset that goes to $fff for redirection to enter the main program. This may or may not be an issue. It depends of where you are starting your program and whether you are using an Interrupt Service Routine with the RTCC.
Apart from that, why not do an independent load test - connect a resistor load to the batteries to draw a known current, around 30 ma, and let it run for a few days to test a few charge and discharge cycles independently from the SX.
The problem is the term 'interrupt'. Is it a true interrupt that vectors to $000, is it s true reset that vectors to the reset vector (this goes usually to where Main starts the program - without an ISR this can also be $000, but it can be different by designation), or does a 'wake up interrupt' just go the next command after SLEEP?
These 3 situations depend on the watchdog counter NOT being active. When the watchdog counter is enabled, SLEEP has its behavior and wake up entangled with the WDT which may issue a reset vector that overrides SLEEP's normal behavior.
Also, I see you have Brown Out turned off. In theory, the voltage could go to near zero and never reset. Is that really what you want. My impression is it is better to enable it at least on a low setting rather than to completely disable it.
BTW, Clocking at 32Mhz requires the higher 5 volts to keep the oscillator going. Since you are NOT using RS232 that requires a crystal, the internal 4Mhz rc is likely to be better for low power, and 32Khz would be even better -- micropower.
Do I have the correct FREQ set in the header for 32Khz? I thought I had it correct. There is no need for special timing so the slower the clock, the more "juice" I save. I have also set brown out to 2.2V. The brown out off in the above posted code was a check to see if the circuitry was causing a brownout.
I do need a regulator since the batteries are 1.2V and I have 8 of them in series. I need that much power to activate and deactivate the water valve when needed. I tried just 4 batteries but it was not enough.
If anyone has any ideas on how to set up the LM317 to charge the batteries without putting a drain on them when there is no or not enough solar light to push current into them?
In any case, you generally check the pin state in the interrupt service routine. I'm also not sure about having the sleep in subroutine --- probably it's OK but seems like a less than ideal form.
If you need more battery power for the valve, you could put a tap in after the 5th battery for an LDO regulator (drop-in replacement for the 7805).
You could also use a "power-on" circuit if the sensor generates enough voltage. Then the SX could actually shut itself off completely when not in use.
The attached is an example -- this shows a pushbutton from the battery + supply, but a positive swing from a sensor would do it too. The first line of the program needs to set the "power on" pin high; the program can make that pin low at any time to shut the whole thing down. I believe Beau Schwabe first posted this.
The solar panels that I have are 2 each 6 volt 1.5 watt panels they had at RadioShack. They are run in series to give me "12V" full power. I have read that connecting the solar panels directly to NI-MH batteries, even with a resistor is a bad idea since trickle charging those batteries can cause excessive heat which can cause permanent damage to the batteries. I need to be able to shut off charging if the batteries are fully charged. I don't think my existing circuit did that anyways though.
http://www.reuk.co.uk/Solar-Battery-Charger-With-LM317T.htm
It appears to not regulate the voltage, but it regulates the current. Since I am using 2800 mAh batteries, I could charge them with a maximum of 280mA correct? If this is the case, I have 4.7K resistors handy and could rewire the LM317 to limit current. I just want to be safe and have fun without spending a bunch of money Instead of directly connecting the solar cells to the batteries with a blocking diode, I feel more comfortable having some safety measure there. If the above link would be what I should do, then I can get that set up quickly
You can always parallel several larger resistors to get a smaller value with higher power handling.
Here is the schematic I went off of :
I have my meter's negative lead connected to the common ground of the circuit and the positive lead is touched to the Adjust of the LM317T. The meter is properly set to read up to 10A. I know it is a direct short when doing this, but there is 0.00 showing on my display. The resistor value I went with is 4.7ohm which should give me 266mA output according to the website posted above.
Here is the catch..... if I touch the meter to the Vout (center pin) of the LM317, I get 0.26mA but the regulator gets extremely hot within a matter of a second or 2. I have checked the wiring 10 times to ensure it matches the above circuit to the T. Not sure what I am doing wrong
this is right ! .
Let me guess are your batts charged ? If so you should read NO amps ..
Try discharging them and then try again .
as for your resistor . If you short a PV panel you have NO volts .
NO volts = no input to Run a reg so you need some voltage to make the 317 run . its just part of the game .
EG a 7805 needs 8 V or more to work ..
by shorting the output you are inside the GRegs shuting them down to a OFF condition .
if you want to test your 317 I reg use a Real bench power supply and dial in the specs of your panel and Sim it .
EDIT : The batteries are at 6.28V currently. Full charge is 9.6V
A) blown fuse in meter
you have full batts .
unhooked what does the bat pack read ?
?
EDIT good meter fuse?
If your batts are at anything less then your V out then you Will have curent flow of Some kind ..
more then 9,6 is Fresh charge .. By law of chem you cant have a 12V bat read 20 and the same is with a 9.6V pack .
The OCV is more then 1.2V per cell.. AKA surface charge... run a load on it Like a 500 mA load for a few min . you will eat that charge right off.
Note you dont need to remove it in real life, the above was a way to show what small the surface charge is
It's not a short, you're just bypassing the current limit programming resistor and drawing full current from the cells through the LM317.
6 volts at 1.5 watts is 250 mA (0.25 A). The LM317, if it's a TO-220 type, shouldn't get very hot with only 250 mA running through it.