Monday, March 6, 2023

Solar Shed-Close

 

I am closer to having a working system, but some further "compromises" may still be in order. 😕

The new PIC processor came in.  It did not take long to swap out the PIC18F4525 for the PIC18F46K40.  Went through some configuration issues, but finally got it working.  Since this was a minimal part design, there is no oscillator.  The PIC18F46K40 has an internal Oscillator that runs up to 64MHz.  Nothing I am doing needs that kind of speed.  Thus 8MHz was the compromise speed.  What I did do was up the SPI clock rate to 2MHz.  The MIKROE OLED C will run much faster, but that is good enough.  

Then I started working on the SLEEP routine.  I have not done any very low power work since working on the T-DUST module.  Spent a few minutes reading the data sheet on SLEEP and Watchdog Timers, as well as reviewing what I did in T-DUST.  

On the PIC18F46K40 the way it is implemented on the Solar Shed PCB, nothing runs when it goes to sleep, except the Watchdog Timer (WDT).  And in this configuration, it can only run from one of the low frequency oscillators, whose frequency is about 31KHz.  The WDT has pre-scaler that will give a maximum time of about 256 seconds or a signal about every 4 minutes.

In the main loop, the code will look at the Solar Panel voltage each time through the main loop.  If the voltage is above about 8VDC (subject to change when the system is tested), the code will continue in the main loop.  If it is below this threshold, the PIC will go start the WDT and then go to SLEEP.  When the WDT expires (about 256 seconds), the PIC will wake up.  At this point it will look at the Solar Panel voltage, and if it is above 8VDC, the code will wake up and continue with the main loop, until which time the solar panel voltage falls below 8VDC.  If the solar panel voltage is below 8VDC, the PIC will restart the WDT and go back to sleep.  At this point the SLEEP process starts all over.

I do check to make sure the WDT is the wake up source, if not, then a reset of the entire system is executed.

This led to taking current measurements.  Without making some changes, I can only measure the input to the DC-DC converter that makes the 5VDC, that then is transformed to 3.3VDC by an LDO.  So assuming 100% efficiency in the DC-DC converter, these numbers are the best one would expect.  Reality is they are somewhat worse at 5VDC.

  • Run w/o OLED on  4.5mA @12VDC = 10.8mA @5VDC
  • Run w/ OLED on 12.0mA @12VDC = 28.8mA @5VDC
  • Sleep (OLED is powered but display not on) 2.25mA @12VDC = 5.4mA @5VDC
  • Sleep (OLED module removed) 275uA @5VDC = 600uA @5VDC

There is a 7.5F super cap that is suppose to power the system through the night if the battery is too low.  At 600uA this might happen, but a 5.4mA I have my doubts.  This leaves me with three choices:

  1. Remove the OLED.  It is nice to have to see voltages, but for the 80%+ of the time no one is inside the shed, it serves no purpose.
  2. Do some cutting of traces and install a high side switch on the OLED.  Thus it is only on when voltage display is requested.  Cutting the ground traces will problematic since there is ground plane on both sides of the PCB.  Also not sure there won't be leakage through the SPI and other control pins.  This option is not appealing.😞
  3. Do nothing.  Maybe at 10.8mA, the battery will last long enough to get to the charging opportunity.

So this is a testing processing to see what happens.  Right now it is snowing, so nothing will happen until the sun comes out again.

An interesting note is what happened to the PCB when I removed the PIC18F4525 with the hot air gun and then cleaned the pads with solder wick.  The combination of the two seems to have rubbed off some of the solder mask.  Nothing is critical, but these pictures show the issue.  Not going to complain, paid $5 for five PCBs.  It is a one off.





 

No comments:

Post a Comment