November 07, 2024, 07:29:24 PM

Create a Clock / RTC / Accu

Started by steve45, February 10, 2015, 09:30:43 AM

Previous topic - Next topic

steve45

Hello everybody,

to use the PINGUINO-OTG as RTC that keeps accurate time even if not powered throw the normal power jack I need to connect a lipo accu, is that right?

What kind of lipo cell can you recomment?

To reduce power consumptions when running on accu power supply only, how it is possible to detect, that power comes from accu in order to switch off some leds etc, connected to io pins.

br, steve

kyrk.5

Hello,

Yes, you need a LiPo connected to the pcb in order to keep the time in the RTC. Of course you can connect an external RTC with a back up battery.

I was not able to figure out how to detect if the power supply is coming from the Accu or USB or power connector. You can measure the accu voltage but from that you can not tell this.
You can modify your PCB so so that you connect the voltage lines to some of the available AD channels. It is possible but then you need a modification.
If you only need RTC, then it is easyer to have an external battery backed up RTC. Depends on you requiremnts.

What kind of LiPo? I was looking here on Olimex for some LiPos. For the bigger ones. It was quite ok, but i think they do not have any low voltage protection. So i hade some problems after the accu was deepleted. One was completly broken (0V) other was around 3.7V after several hours of charge. I think they have over voltage and over current protection. So basically i broke 2 of the 6600mAh LiPos :( Ouch :( Then I looked on ebay, and found a local seller who was offering basically two types of LiPos. One for GPS and PDAs and the other type for RC cars. It is the same LiPo but differs in the protection. The type for GPS and PDAs (only called after the main application usage) are having deep discharge protection. So if you are buying a LiPo check if they have deep discharge protection. Because if you leave the LiPo on the PCB it might be discharged.

steve45

The DuinoMite manual states in chapter "battery":

The DuinoMite and DuinoMite-Mega have a built-in LiPo battery charger and the hardware is
designed to allow them to run in low power mode for battery operation.
USB-FAULT is connected to RG7 to allow the firmware to be aware that it is running on battery
instead of an external power supply. If USB-FAULT is read as 0 the board is powered by battery.
The battery charge state can be monitored by measuring the power supply on BAT port RB2.
The Lithium Polimer battery is connected via the R31/R29 voltage divider (0.319727891) to RB2 port
as RB2 can handle a maximum voltage of 3.3V but the battery voltage can go up to 4.2V when
completely charged.


Is there a possiblity to check the power source in a similiar way on the penguino?

br, steve

kyrk.5

I will check this point :) Thank you!
To be honest I did not looked explicit for this feature, because for me it was not so intresting. I was just looking, if there are some analog voltages from where it is possible to determine the source of the power supply, since I did not found such a feature and i did not needed such a feature really, I just did not look further. But in fact I think that there is such a signal on the board which might be used.

The Battery voltage can be measured very well. There are two ways to measure the voltage, since the voltage dividers lower part is connected to a pin. It can be either pulled to ground, pulled to 3V3 or left floating. I wrote a code that measures it when it is pulled to ground. You can find some tables on the internet to calculate the percentage of the battery based on the voltage. Of course this is depending on the actual battery but to tell if it is empty of nearly full any kind of table will do.
The Use case where the port pin which is connected to the lower part of the voltage divider is driven to 3V3 or left floating, I did not used. Left floating is not so interesting, since then there is no voltage divider. Pulling to 3V3 is interesting when the battery voltage level is under 3V3.

kyrk.5

Just one more thing. When the board is running on the LiPo, then the 5V rail is not 5V, but is only as much as the LiPo voltage. I did not count with this, and the LCD which I was using is simply not working well with less than 5V. Actually it is working but the contrast is very bad. So if you are building a clock like me, then keep in mind that you only have 3V3, and the 5V can be as low as the LiPo voltage!

steve45

Thanks for the reply.

I have take a look at the schematics and found the otg board has the same connections like the DuinoMite but connected to other port pins, so it should be possible to detect 5V power loss as well.

I dont want to drive the display, while running on battery. I just want to keep the RTC going.
When mains power returned, the mc switch on the display again showing the correct time.

br, Steve

kyrk.5

My one is looking like so: http://kyrk.villamvadasz.hu/_pictures/IMG_20150130_234007.jpg

The colors are not so good, in reality the LCD is looking far more better.

I am considering to add a gas sensor to the PCB. Now that i know that i can detect power loss, I can simply turn off the gas sensor (since it is consuming around 100mAmps)