CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC16F73 RTC help needed.
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Sam_40



Joined: 07 Jan 2015
Posts: 127

View user's profile Send private message

PostPosted: Mon Feb 02, 2015 8:02 pm     Reply with quote

Quote:
The 10K is used as a 'pullup' or 'pulldown' load to force the pin to a known logic level. If left 'floating', every transition up, down, up, down... will consume a LOT of power.CMOS devices do NOT consume power when either high ot lo, it's the 'transitions' that require power.


I am sorry, I did not understand your comment. Would you please explain. What would you suggest for unused pins?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Feb 03, 2015 3:57 am     Reply with quote

For a quick explanation see Temtronic's answer. For some unknown reason it is listed before your question.

Thing is that a logic input should never be left unconnected. Your options are: tie it high or low, and with or without a resistor. If the port is programmable to become an output then that's the cheapest solution.

Each choice has small pro's and con's. What you choose is personal preference and based on your project requirements.
A more detailed explanation can be found here: http://www.piclist.com/techref/logic/xtrapins.htm

Any resistor value of 1k to 50k will do.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Feb 03, 2015 4:59 am     Reply with quote

The 32kHz clock is still nagging me as it conflicts with the speed required for LED multiplexing.

Now we know you are not stuck with the PIC16F73 I would choose one of the newer Extreme Low Power (XLP) series chips. Let it run on the internal 4MHz clock, this is cheap as it requires no extra components.
For an accurate day time clock use a 32768Hz crystal connected to the timer1 hardware ports as discussed before
Create your program so that the processor goes to sleep most of the time and is only awakened by a Timer1 hardware interrupt every second.

Before you start protesting that a 4 MHz clock will consume more power than your original 32kHz: Yes, but... since the processor is faster it will go back to power-saving sleep sooner too. This means that on average both clock speeds will consume about the same low battery capacity.

Advantage of the high speed clock is that your LED multiplexing will be much better looking.

On your earlier question about 4x7 segment driving I easily found some great discussions on the internet:
- A discussion on alternative methods for driving 4x7 LED segments

If you want to have some fun and save 7 resistors and 4 transistors here is a topic describing a modified 'Charlieplexing': http://www.berryjam.eu/2014/08/driving-4x7-led-with-4-resistors-only-kinda-charlieplexing/
Be sure to read the reactions on this topic though: http://www.reddit.com/r/electronics/comments/2czanv/cheapsimple_4x7_led_driver/
It requires a high clocked processor and the display will be driven at an average low 1mA, so test your display to be bright enough.

Finally, since you are going to program several event times you might consider a chip with EEPROM. The PIC16F73 doesn't have this but it would allow your customer to change the event times and store this in permanent memory.
Sam_40



Joined: 07 Jan 2015
Posts: 127

View user's profile Send private message

PostPosted: Tue Feb 03, 2015 6:34 am     Reply with quote

ckielstra,
I would like to thank you for your very helpful input. I will consider all of your suggestions,
Best regards,
Ttelmah



Joined: 11 Mar 2010
Posts: 20062

View user's profile Send private message

PostPosted: Tue Feb 03, 2015 9:13 am     Reply with quote

and one little 'extra'. On making an interrupt from 32768Hz tick 'once per second'. In the interrupt you just set bit 15 in the timer register. This effectively advances the clock 32768 counts, so the next interrupt will be one second later. Has been described here in many versions over the years.

Worth also asking if you really need the 32KHz on the PIC.
Things like RTC chips draw less power than even the PIC at 32KHz. Depending on how often you must be awake, you could use one of these, program it to send you a 'tick' at some longer interval, and put the PIC completely to sleep, yet still have accurate 'time' available when the PIC wakes, by just reading this from the RTC.
It depends whether you really do need to wake every second, or whether you are just doing this so you can keep time.
Sam_40



Joined: 07 Jan 2015
Posts: 127

View user's profile Send private message

PostPosted: Tue Feb 03, 2015 9:58 am     Reply with quote

Ttelmah,
Thanks for the reply, I do not want to add RTCC to this project. I know the RTCC would be more accurate, however for this project the LP crystal would be just fine. I think I have enough information to get creative with it Smile

Regards,
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Feb 03, 2015 4:51 pm     Reply with quote

Sam_40 wrote:
In my first post, I thought to use LM2672 Power Converter High Efficiency 1A Step-Down Voltage Regulator to drop the 12V battery to 5V for the PIC and the display. Now I have a better idea 
I am thinking instead of one 12 volt battery. I am going to use 2 X 6V battery. I am going to connect them in way to use 12V for the motor and 6V for the circuit. I will drop the 6V to a safe voltage for the PIC.

The LM2672 Simple Switcher is a good power horse but be careful, quiescent current is 2.5 to 3.6mA.
When good designed your PIC is asleep for most of the time and draws 50uA to 100uA. This means the Simple Switcher is using 25 to 70 times more power than your processor!

You didn't say how you are going to do the other design with the 6V battery, but make sure you are not discharging 1 of the 2 batteries. With some smart wiring, using a diode bridge, you can have the two 6V batteries in parallel for the PIC logic, and make it appear as two series connected batteries with 12V for the 12V motor.

As mentioned, in sleep the PIC draws about 50uA to 100uA. But when running at full 4MHz and the LEDs on it uses magnitudes of power more. A quick estimation:
20mA for the LEDs x 7 segments = 140mA maximum.
Low power PIC running at 4MHz, for example PIC16F1933 = 0.5mA
Total dynamic range: 50uA to 141mA
This is a design challenge.

I'm not a specialist in this area, but my gut feeling is that the quiescent current of the regulator in your design is more important than percentage of efficiency. Perhaps someone knows of a switching regulator that can meet the above specifications?
Otherwise I would recommend to use a Low Dropout regulator (LDO). These are available with very low quiescent currents and very well capable of fast switching from the low current to high current demands. For example the Microchip MCP1702 with 2uA Iquiescent and $0.34 in high volumes.
temtronic



Joined: 01 Jul 2010
Posts: 9634
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Feb 03, 2015 5:52 pm     Reply with quote

You should download Microchip Application Note AN606, Low Power Design Using PIC16/17.
A great basic 'how-to' article. You've got 3 different power requirements
1) sleep mode
2) LED On mode
3) Motor ON mode

You really need to 'do the math' to see how much power you need,especially for say 30,60 or 90 days. You'll be surprised !

As well as needing far less power, an RTC chip(with coin cell backup) means you do NOT have to reprogram time when main power fails( and it will...) OR if there's a glitch(motor stalls=high current surge= spike= PIC resets= NO 'RTC' anymore !) Also the RTC has battery backed RAM,can be used to store the 'on/off/duration' info.


Have you compared the cost of 4 x 7 segment LEDs + resistors + transistors + PCB layout + assembly versus a 2 x 16 LCD module? Currently I buy LCD 2 x 16 for $4, 4x20 for $6. LEDs draw a LOT of power. LCD module will give you more information to display!!

just 'food for thought'

Jay
Sam_40



Joined: 07 Jan 2015
Posts: 127

View user's profile Send private message

PostPosted: Tue Feb 03, 2015 8:08 pm     Reply with quote

ckielstra,
Quote:
With some smart wiring, using a diode bridge, you can have the two 6V batteries in parallel for the PIC logic, and make it appear as two series connected batteries with 12V for the 12V motor.


Correct, That is what I have in mind!

Quote:
20mA for the LEDs x 7 segments = 140mA maximum.
Low power PIC running at 4MHz, for example PIC16F1933 = 0.5mA
Total dynamic range: 50uA to 141mA


* I do not worry about the displays current as they only draw power during setup. I will have them turned off during operation to save power!

Quote:
For example the Microchip MCP1702 with 2uA Iquiescent and $0.34 in high volumes.


That is a nice! Mouser sell it for $0.36 in high volumes.



temtronic,
Quote:
You really need to 'do the math' to see how much power you need, especially for say 30,60 or 90 days. You'll be surprised !


I did not mention, the batteries will be charged via solar panel! If I managed to get all power saving techniques then it should run for the life of the batteries!

Quote:
Have you compared the cost of 4 x 7 segment LEDs + resistors + transistors + PCB layout + assembly versus a 2 x 16 LCD module? Currently I buy LCD 2 x 16 for $4, 4x20 for $6. LEDs draw a LOT of power. LCD module will give you more information to display!!


* The cost is about the same!
* The PCB layout is done.
* I really been considering the use of LCD. I did program a project using the LCD and you are right, it was easy all around (PCB layout + assembly + easy to code) even though the code was provided Smile
* Please help my with this just so I know:
if I use lcd hd44780 2x16 display, can I put the LCD to sleep and turn it OFF during operation?
The LCD should be fine if I use the 32768Hz?
However for this project I am just going to use the 4X7 displays as I already bought them! I do have few HD44780 2x16. I may build another project with the use of the hd44780 2x16.

Quote:
just 'food for thought'


Smile

Thank you guys,
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group