Hello All
My Baseball Pitch count program is work wonderful. I would like to try to put the processor to sleep to conserve battery power
PIC16F138 - 28 pin
There is about 5 to 8 min between innings and if I can put the PIC and LCD to sleep I think I could save battery power.
My thoughts;
Press Digit 2 on the key pad ---- PIC goes to sleep and the LCD turns off --- Save battery
Press Digit 5 on the key pad ---- PIC wakes up and the LCD displays the values on the screen before it wen to sleep
Is this possible
Here a drawing
John
PICF1938 - Sleep
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PICF1938 - Sleep
Hi John,
Pressing 2 to put the micro to sleep should be fine.
The problem may come when you try and wake up again. The keypad is actively scanned so you could do one of the following.
Use a timer interrupt to wake up periodically to scan the keypad for wake presses. Waking up periodically will lower your power saving but hopefully not by much.
Use a different wake mechanism, e.g. a switch connected to an interrupt pin or the MCLR reset pin.
Pressing 2 to put the micro to sleep should be fine.
The problem may come when you try and wake up again. The keypad is actively scanned so you could do one of the following.
Use a timer interrupt to wake up periodically to scan the keypad for wake presses. Waking up periodically will lower your power saving but hopefully not by much.
Use a different wake mechanism, e.g. a switch connected to an interrupt pin or the MCLR reset pin.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- JLeith
- Posts: 537
- Joined: Wed Nov 14, 2012 7:49 pm
- Location: British Columbia Canada
- Has thanked: 146 times
- Been thanked: 26 times
- Contact:
Re: PICF1938 - Sleep
Thank you Benj
Do you expect I can save battery power ?
I think the Press 2 to sleep and then use a timer to check if digit 5 was pressed.
I have attached my Design Flowcode.
oops I have a design flaw when I press 2 My program resets the LCD.
No trouble with (5) Maybe I can use (5) to sleep and (5) to wake up
Benj if you can help me with the steps to Sleep on Digit (5) and how I can use (5) to wake up.
Would I use a Macro to have a wake up routing so I don't have to run the LCD. I could do a check in a Macro maybe ( Sleep )
I have attached a sketch
John
Do you expect I can save battery power ?
I think the Press 2 to sleep and then use a timer to check if digit 5 was pressed.
I have attached my Design Flowcode.
oops I have a design flaw when I press 2 My program resets the LCD.
No trouble with (5) Maybe I can use (5) to sleep and (5) to wake up
Benj if you can help me with the steps to Sleep on Digit (5) and how I can use (5) to wake up.
Would I use a Macro to have a wake up routing so I don't have to run the LCD. I could do a check in a Macro maybe ( Sleep )
I have attached a sketch
John
- Attachments
-
- Sleep.png
- (34.99 KiB) Downloaded 2065 times
-
- Pitcher Master 2019.fcfx
- (272.4 KiB) Downloaded 211 times
- JLeith
- Posts: 537
- Joined: Wed Nov 14, 2012 7:49 pm
- Location: British Columbia Canada
- Has thanked: 146 times
- Been thanked: 26 times
- Contact:
Re: PICF1938 - Sleep
Did some measurements
On startup
"Press 5 to start game" ( 63.7 ma )
Enter values ( Division) ( 2 or 8 )
Reset the Remote displays
-------->
Down to 42.3 ma
Press Digit 1 to advance pitch count --- ( 45.ma)
About every 2 min a pitch is taken. --- (45ma)
Sitting for 8 min with no input ( Would that be 43ma for 8 min = 344 ma battery drain )
John
On startup
"Press 5 to start game" ( 63.7 ma )
Enter values ( Division) ( 2 or 8 )
Reset the Remote displays
-------->
Down to 42.3 ma
Press Digit 1 to advance pitch count --- ( 45.ma)
About every 2 min a pitch is taken. --- (45ma)
Sitting for 8 min with no input ( Would that be 43ma for 8 min = 344 ma battery drain )
John
- JLeith
- Posts: 537
- Joined: Wed Nov 14, 2012 7:49 pm
- Location: British Columbia Canada
- Has thanked: 146 times
- Been thanked: 26 times
- Contact:
Re: PICF1938 - Sleep
More info
On my working Pitch count battery
0
9v rechargeable ( EBL Battery Model 6F22 )
I get 28.43 ma on startup and waiting for a pitch
On the transmission to the receiver for 300ms takes 35ma and the back to 28ma
By the math I can find 280ma at say 29ma = 280 / 29 = 9.6 hrs.
Odd I get about 2 to 3 hrs. Odd
Is there a way to test if the battery is able to have 280ma/HR
John
On my working Pitch count battery
0
9v rechargeable ( EBL Battery Model 6F22 )
I get 28.43 ma on startup and waiting for a pitch
On the transmission to the receiver for 300ms takes 35ma and the back to 28ma
By the math I can find 280ma at say 29ma = 280 / 29 = 9.6 hrs.
Odd I get about 2 to 3 hrs. Odd
Is there a way to test if the battery is able to have 280ma/HR
John
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PICF1938 - Sleep
Hi John,
Can you turn off the display at the moment? Do you have a FET or transistor etc connected to allow you to control the display VCC? This would be required to drop the power draw of the display during sleep.
The C code to sleep the device looks like this.
If you start a timer interrupt going just before you sleep then the device will auto wake when the interrupt fires. Maybe disable the interrupt again after you have woke up and want to continue. If you dopn't want to continue then go back to sleep from within the interrupt macro.
Your power usage does maybe seem a bit high. How efficient is your regulator? Could you use a DC2DC switch mode regulator rather than a standard low drop out linear regulator. This will certainly save you a bit of power usage.
Can you turn off the display at the moment? Do you have a FET or transistor etc connected to allow you to control the display VCC? This would be required to drop the power draw of the display during sleep.
The C code to sleep the device looks like this.
Code: Select all
SLEEP();
NOP();
Your power usage does maybe seem a bit high. How efficient is your regulator? Could you use a DC2DC switch mode regulator rather than a standard low drop out linear regulator. This will certainly save you a bit of power usage.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- JLeith
- Posts: 537
- Joined: Wed Nov 14, 2012 7:49 pm
- Location: British Columbia Canada
- Has thanked: 146 times
- Been thanked: 26 times
- Contact:
Re: PICF1938 - Sleep
Hello Benj
Thank you;
Yes I don't know why I can't get more time. I did order a 500mahr 9v battery to maybe help.
For my design I have 2 ( LM2596 ) DC-DC. ( From Sparkfun )
1. For 9V to 5V for VCC
2, 5V to 3V for the TX (NFR905)
If I drop the VCC then I would lose the Values for the Variables would I not.
I will look at the VCC for the LCD and see how I could disconnect and bring back.
I will update when I have a plan
John
Thank you;
Yes I don't know why I can't get more time. I did order a 500mahr 9v battery to maybe help.
For my design I have 2 ( LM2596 ) DC-DC. ( From Sparkfun )
1. For 9V to 5V for VCC
2, 5V to 3V for the TX (NFR905)
Not sure what the DC2DC Switch is ?Could you use a DC2DC switch mode regulator
If I drop the VCC then I would lose the Values for the Variables would I not.
I will look at the VCC for the LCD and see how I could disconnect and bring back.
I will update when I have a plan
John
- Attachments
-
- LM2596.png
- (130.07 KiB) Downloaded 2038 times