Saturday, August 11, 2018


Welcome back to my first blog after long break, greetings from Saudi, where the sun meets the sand





Really, there is more to Saudi Arabia than just sand, in the pictures above you see mountains, sea,......Having told you my where about, there is plenty of sun here to harvest. In next few posts you will go throught some projects regarding harvesting the sun's energy in different ways.

One way to harvest energy from the sun is through a solar charger, it will help you obtain a steady output from the solar panel when there is enough sun, an output that is used to charge a battery. Main driver for a solar charge is an algorithm called maximum power point tracking (MPPT), one that has many flavors but its main theme:collecting maximum output power from a solar panel. Please refer to this excellent presentation by Texas Instruments (TI) on MPPT algorithm. You will find in the presentation a reference to Ti's bq25895 IC, which is a solar charger that implements MPPT algorithm.


In this post we will look at a similar solar charger based on LTC3652 IC, it was made by linear technology and the PCB was designed by sparkfun and named The Sunny Buddy. LTC3652 implements MPPT in its simplest form, which drives the solar panel at 90% of solar panel's open voltage value at which the LTC3652 will reduce its current draw to maintain peak power input from the solar panel. You can reference post below from voltaicsystems for comparison of different solar chargers.
  
To let you know more about solar chargers, let us choose Sparksfun's Sunny Buddy board, plug-in couple of solar panels, and hook up a micro controller to watch solar charger in action, charging a Lipo battery. Well, the first thing was to setup the system,

Solar charger ---->Sunny buddy V1.3 based on LTC3652
Solar panels---> 2X2W Si-Silicon based solar panels
Lipo Fuel gauge---> Lipo fuel gauge based on MAX17043G+U IC
Mcu---> Arduino Mini Pro 16Mhz, 5V.
Battery---->  Lipo 3.7V, 750mAh
Circuit schematic

Let us's do the calculation of power delivered from the solar panel, and how much power needed by Mcu, and how much is the safe charging current for Lipo battery. Start with last item on the list: Lipo battery safe charging current is 1/C which is equal to 750mAh, i.e. it is safe to set the charge current on the sunny buddy to 750ma or less. Mcu chosen for this demo is Arduino mini Pro, running at 5V and 16Mzh, typical power consumption values can be found in this post, which assumes that Mcu will go to sleep and wake up via watch dog timer.

Indeed, taking the Mcu into sleep is recommended to reduce the power consumption and reduce the load on the solar charger, allowing it to do its job, charge the battery. In this demo, we will let Mcu sleep for 8 second and wake up to check the battery state of charge using information provided by LiPo Fuel Gauge plus information like charge/idle state provided by the solar charger. This means the Mcu is sleep 83% of the time and active for 27% of the time, using the information found in the above post, we can multiple %sleep
*Power consumption during sleep + multiply %awake* active power consumption.

The rest of circuit component:
Lipo Fuel gauge consume 50Mu A on active status and can be sent to sleep state via I2c interface commands
Lipo Boost Converter used to convert voltage level from 3.7V. to 5 V. with efficiency curve shown below
A level shift is needed to convert LTC3652's pin logic levels, which are pulled to Vbat=3.7V as per sparkfun design.

 
Curtsy:TI's TPS61200 datasheet (SLVS577B)
Note that the code snap shoot below reference low power library and Lipo Fuel gauge library which can be find online

#include <Wire.h>
#include <LiFuelGauge.h>
#include "LowPower.h"
void lowPower();
// Use pin 2&3 as wake up pin
const int wakeUpPinINT0 = 2;
const int wakeUpPinINT1 = 3;
const int DigiPin4 = 4;

int CHC_val=0;
int FAULT_val=0;
// LiFuelGauge constructor parameters
// 1. IC type, MAX17043 or MAX17044
// 2. Number of interrupt to which the alert pin is associated (Optional) 
// 3. ISR to call when an alert interrupt is generated (Optional)
//
// Creates a LiFuelGauge instance for the MAX17043 IC
// and attaches lowPower to INT0 (PIN2 on most boards, PIN3 on Leonardo)
LiFuelGauge gauge(MAX17043 , 0, lowPower);

// A flag to indicate a generated alert interrupt
volatile boolean alert = false;
volatile boolean flag_charge = false;
volatile boolean flag_fault = false;


void setup()
{
    // Configure wake up pin as input.
    // This will consumes few uA of current.
    pinMode(wakeUpPinINT0, INPUT);
    pinMode(wakeUpPinINT1, INPUT);
    pinMode(DigiPin4, INPUT);
    //pinMode(12, INPUT);
    //pinMode(13, OUTPUT);   
    Serial.begin(9600); // Initializes serial port
    // Waits for serial port to connect. Needed for Leonardo only
    //while ( !Serial ) ;
    
    gauge.reset();  // Resets MAX17043
    delay(200);  // Waits for the initial measurements to be made
    
    // Sets the Alert Threshold to 10% of full capacity
    gauge.setAlertThreshold(10);
    Serial.println(String("Alert Threshold is set to ") + 
                   gauge.getAlertThreshold() + '%');
}

void loop()
{
    Serial.end();
    
    attachInterrupt(wakeUpPinINT1,wakeUp3, CHANGE);
    // Enter power down state with ADC and BOD module disabled.
    // Wake up when wake up pin is low.
    LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF); 
    // Disable external pin interrupt on wake up pin.
    detachInterrupt(1); 
    // Do something here
    Serial.begin(9600); // Initializes serial port
    if (gauge.sleeping())
    {gauge.wake();
     gauge.reset();  // Resets MAX17043
     delay(200);  // Waits for the initial measurements to be made
     
}
    if (flag_charge)
    {
      CHC_val=digitalRead(wakeUpPinINT1);
      FAULT_val=digitalRead(DigiPin4);
    Serial.print("SOC: ");
    Serial.print(gauge.getSOC());  // Gets the battery's state of charge
    Serial.print("%, VCELL: ");
    Serial.print(gauge.getVoltage());  // Gets the battery voltage
    Serial.println('V');
    if (!CHC_val)
    {if(FAULT_val)
      {Serial.println("Charghing");
      }
      else
      {Serial.println("Fault");}
    }
    if (CHC_val)
    {if(FAULT_val)
      {Serial.println("Idle");
      }
      else
      {Serial.println("Bat. Fault");}
    }
    CHC_val=0;
    FAULT_val=0;
    }
        
    if ( alert )
    {
        Serial.print("SOC: ");
        Serial.print(gauge.getSOC());  // Gets the battery's state of charge
        Serial.print("%, VCELL: ");
        Serial.print(gauge.getVoltage());  // Gets the battery voltage
        Serial.println('V');
        Serial.println("Beware, Low Power!");
        Serial.println("Finalizing operations...");
        gauge.clearAlertInterrupt();  // Resets the ALRT pin
        alert = false;
        Serial.println("Storing data...");
        Serial.println("Sending notification...");
        Serial.println("System operations are halted...");
        gauge.sleep();  // Forces the MAX17043 into sleep mode
     }
    
    //delay(2000);
}

void lowPower() { alert = true; }
void wakeUp3()
{
    // Just a handler for the pin interrupt.
    flag_charge=!flag_charge;
    
}

This code ran on the Mcu for 12 hours, where battery S.O.C dropped from 96% to 12%. In the first three hours, no charging was being done and then 8 hours of charging did not help to raise the S.O.C of the battery. From log of Lipo Fuel gauge, it is noted a 6.25% drop of battery S.O.C. each hour which amounts ~49mA power consumption per hours.



From the above first run of the system, it was clear that a path forward with this setup was not possible; the amount of energy consumed versus the charging speed of the battery will cause the battery to be depleted before the sun of the next day. It was necessary to check the amount of current delivered by the solar panel and the solar charger at hand. After examining the amount of current delivered by each solar panel at full sun irradiance, it was found to be a humble of 50mA, which far less than 2Watt, claimed by the supplier. The Sunny Buddy, was faithful in delivering the full amount of energy produced by 2X2Watt panels, a combined sum of 100mA.

The solution was one of the below:

1- A: Replace Solar panel with more powerful or more efficient solar panel
     B: Replace the Micro-controller or its voltage, and/or clock speed, which reduces the power                   consumption and remove some of the unnecessary components.
2- Use an auxiliary power supply that is made of a second battery useful to maintain system until the first battery is fully charge, i.e. System will be supplied from a DC bus, with a redundant power source. Auxiliary power supply should have a mechanism to recharge its battery when not in use.
Option (1-A) Replace Solar panel with more powerful or more efficient panel


Keep tuned, in the next post we will explore all solutions (1 & 2), waiting to see you in the next post.


3 comments:

  1. Here you will find best Latest Ghana music where you can download videos about culture lifestyle of nigerian people african citizens and much more. Thanks for visiting this website

    ReplyDelete
  2. The UK's most visited estate agents.Our Experts can help you buy, sell, rent and let property with branches across the UK. largest online letting agent uk .We will list your property on the main property portals such as Rightmove, Zoopla & PrimeLocations.let your property within the first 48 hours.largest online letting agent uk.

    ReplyDelete
  3. No matter, if you do not have cash, use cryptocurrency to buy top up phone with bitcoin , amazing and easy way to recharge mobile online international sim card number.

    ReplyDelete