Electron not charging on VIN/LI+ (Solar power)

Hi,

I’m in the midst of building a solar-powered probe with the Electron and the Sparkfun Sunny Buddy MPPT charger, however I’m having difficulties actually getting the Electron to charge from the Sunny Buddy board (now refered to as SB). As far as I can tell, the sunny buddy uses the same chip as the former Solar Shield for Electron, but it’s difficult to tell how the solar shield actually powers the electron. According to the solar shield schematic (https://github.com/spark/shields/blob/master/electron-shields/solar-shield/pdfs/solar-shield-sch.pdf) , it seems to be powered off the 3V3 port, but that leaves the PMIC (and therefore the GSM module) out of the loop, which can’t be the case - I’m guessing LI+?

I’ve tried hooking up the solar panel to the SB, then from SB to VIN with a battery connected to the Electron, but it’s not powering, nor drawing any current. I’ve tried hooking up a battery directly to the SB, which works, but the Electron still does not power on using VIN pin.

Also, can the solar panel damage the battery by being connected directly to the LI+ pin? Or does it charge it, as it was connected to VIN?

Hopefully somebody can make sense of this, all in all, I’m just trying to power the electron off a 3.5W 6V solar panel (which will be increased to multiple panels later), but I’m failing in getting the Electron to charge off VIN, LI+ and so on.

All the best,
Chris

Hi @claursen,

Good Questions! Definitely don’t directly connect a lithium polymer battery to anything other than a special li-po charging circuit. Those batteries have uh, lets say, explosive chemistries ( https://www.youtube.com/watch?v=coX0SwubG4A ), but are perfectly safe when using the correct equipment.

The Electron likes to draw a lot of current when it’s starting up and charging the battery, and your 3.5W 6v panel is probably only supplying a few hundred mA’s of current at best. Try throwing a bunch of supercaps or something on the supply line before it hits the VIN of the electron to ride out that current spike. That’ll also make it happier when shade rolls over your panel. You might also want your firmware to startup the electron in MANUAL mode with the radio off to save power, and wait until the battery is above say, 30% before getting online, etc, etc.

(Hopefully someone who knows more about EE and solar can chime in and add some wisdom. :slight_smile: )

Thanks,
David

@RWB might have some advice here.

@claursen

The Electron never used the same Linear Technologies chip that the Sunbuddy is based on.

The Sunbuddy has an adjustable Maximum Power Point setting that basically keeps the solar panel from operating below a certain voltage and that setting usually is set to 70% of the solar panels VOC rating and Voc stand for Open Circuit Voltage. The VOC is the voltage that the solar panel provides in good sunlight with no load attached.

The Sunbuddy is not working probably because you do not have the MPPT setting set correctly which is keeping it from charging. If the MPPT setting is set above the voltage of your connected solar panel, then it will not begin charging.

I read that Sparkfun added a potentiometer to the board to make it easy to adjust the MPPT setpoint but they do not show this in the current product images.

Ideally, the Sunbuddy will connect to the LiPo battery, and the battery will power the Electron as normal.

If you use a 5v solar panel, you will have no need for the Sunbuddy since the built-in charging chip can charge at the same rate and you can get the same type of MPPT setting to keep the 5v solar panel from operating below it's Maximum Power Point which is what I do. I just set the solar input limit to 4.8v, so the solar panel will not operate below this voltage which keeps it in it's maximum power point range which provides maximum charging current under all conditions.

Can you let us know what type of solar panel your working with?

1 Like

Hi all,

Thank you so much for taking the time to explain how it can be done. I’m going to skip the Sunny Buddy for now, trying to do the same as @RWB - this way, I can control the input voltage limit dynamically without having physical access to the device and I can use the fuel gauge. Currently I have one 3.5W 6V Voltaic solarpanel, however within next week I will upgrade to 3 x 3W 6V panels. I’ve set a 1000 uf capacitor in place on VIN+GND, but due to an especially gray week with overcast, I’ve tested it indoors where it almost charges (the red LED blinks one time a second). Do you recommend a larger capacitor, e.g. a 10F 2.7V? or does the voltage need to be larger? Hopefully, with the three panels It can generate enough current during overcast days to charge the electron just a little bit. Denmark sadly does not have that many hours of sun during winter time.

Currently I’ve employed a adaptive publishing approach, the less power on the battery, the more it sleeps with NETWORK_STANDBY and the less it publishes the SoC. During startup it turns off the cellular modem until a certain battery percentage has been reached.

Again, thank you all for providing much needed feedback and help - looking forward to put it outside and watch the SoC graph going upwards :wink:

@claursen I’m pretty sure you can not use a Cap instead of a battery on the Electron because the PMIC is not designed to manage capacitors but LiIon batteries instead. The fuel gauge would not work correctly either with a Cap.

I have a setup like this with a 3w solar panel for testing:

Here is my latest code for keeping the battery from going to far below 20% which prevents the Electron from completely loosing power and possibly failing. It’s been working for weeks during very cloudy weather and it always comes back online once the battery recharges:

SYSTEM_MODE(SEMI_AUTOMATIC);
//SYSTEM_THREAD(ENABLED);
// This #include statement was automatically added by the Particle IDE.
#include "Ubidots/Ubidots.h"

#define TOKEN "YoruToken"  // Put here your Ubidots TOKEN
#define DATA_SOURCE_NAME "ElectronSleepNew"

SerialLogHandler logHandler(LOG_LEVEL_ALL);  //This serial prints system process via USB incase you need to debug any problems you may be having with the system.

Ubidots ubidots(TOKEN); // A data source with particle name will be created in your Ubidots account


int button = D0;         // Connect a Button to Pin D0 to Wake the Electron when in System Sleep mode. 
int ledPin = D7;         // LED connected to D1
int sleepInterval = 60;  // This is used below for sleep times and is equal to 60 seconds of time. 


void setup() {
 //Serial.begin(115200);
 pinMode(button, INPUT_PULLDOWN);  // Sets pin as input
 pinMode(ledPin, OUTPUT);          // Sets pin as output

 ubidots.setDatasourceName(DATA_SOURCE_NAME); //This name will automatically show up in Ubidots the first time you post data. 
 
 PMIC pmic; //Initalize the PMIC class so you can call the Power Management functions below. 
 pmic.setChargeCurrent(0,0,1,0,0,0); //Set charging current to 1024mA (512 + 512 offset)
 pmic.setInputVoltageLimit(4840);   //Set the lowest input voltage to 4.84 volts. This keeps my 5v solar panel from operating below 4.84 volts.  
}

void loop() {
    
FuelGauge fuel; // Initalize the Fuel Gauge so we can call the fuel gauge functions below. 
 
    
if(fuel.getSoC() > 20) // If the battery SOC is above 20% then we will turn on the modem and then send the sensor data. 
  {
   
   float value1 = fuel.getVCell();
   float value2 = fuel.getSoC();
   
  ubidots.add("Volts", value1);  // Change for your variable name
  ubidots.add("SOC", value2);    

  Cellular.connect();  // This command turns on the Cellular Modem and tells it to connect to the cellular network. 
  
   if (!waitFor(Cellular.ready, 600000)) { //If the cellular modem does not successfuly connect to the cellular network in 10 mins then go back to sleep via the sleep command below. After 5 mins of not successfuly connecting the modem will reset.  
    
    System.sleep(D0, RISING,sleepInterval * 2, SLEEP_NETWORK_STANDBY); //Put the Electron into Sleep Mode for 2 Mins + leave the Modem in Sleep Standby mode so when you wake up the modem is ready to send data vs a full reconnection process.  
    
}  
  
     ubidots.sendAll(); // Send fuel gauge data to your Ubidots account. 

     digitalWrite(ledPin, HIGH);   // Sets the LED on
     delay(250);                   // waits for a second
     digitalWrite(ledPin, LOW);    // Sets the LED off
     delay(250);                   // waits for a second
     digitalWrite(ledPin, HIGH);   // Sets the LED on
     delay(250);                   // waits for a second
     digitalWrite(ledPin, LOW);    // Sets the LED off
  
     System.sleep(D0, RISING,sleepInterval * 2, SLEEP_NETWORK_STANDBY); //Put the Electron into Sleep Mode for 2 Mins + leave the Modem in Sleep Standby mode so when you wake up the modem is ready to send data vs a full reconnection process.  
    
  }
  else //If the battery SOC is below 20% then we will flash the LED 4 times so we know. Then put the device into deep sleep for 1 hour and check SOC again. 
  {
      
  //The 6 lines of code below are needed to turn off the Modem before sleeping if your using SYSTEM_THREAD(ENABLED); with the current 0.6.0 firmware. It's a AT Command problem currently. 
  //Cellular.on();
  //delay(10000);
  //Cellular.command("AT+CPWROFF\r\n");
  //delay(2000);
  //FuelGauge().sleep();
  //delay(2000);
  
  
  digitalWrite(ledPin, HIGH);   // Sets the LED on
  delay(150);                   // Waits for a second
  digitalWrite(ledPin, LOW);    // Sets the LED off
  delay(150);                   // Waits for a second
  digitalWrite(ledPin, HIGH);   // Sets the LED on
  delay(150);                   // Waits for a second
  digitalWrite(ledPin, LOW);    // Sets the LED off
  delay(150);                   // Waits for a second
  digitalWrite(ledPin, HIGH);   // Sets the LED on
  delay(150);                   // Waits for a second
  digitalWrite(ledPin, LOW);    // Sets the LED off
  delay(150);                   // Waits for a second
  digitalWrite(ledPin, HIGH);   // Sets the LED on
  delay(150);                   // Waits for a second
  digitalWrite(ledPin, LOW);    // Sets the LED off
  
  System.sleep(SLEEP_MODE_DEEP, 3600);  //Put the Electron into Deep Sleep for 1 Hour. 
  
  }
}    
    
1 Like

Thank you for showing the code @RWB . Regarding the capacitor, I did like Dave wrote, adding a capacitor on the VIN+GND for dealing with spikes, when charging the LiPo battery.

You wrote: “*… from going to far below 20% which prevents the Electron from completely loosing power and possibly failing. *”. However, is there anything wrong with letting the battery hit 0% if we have a especially grey/overcast week? Shouldn’t it be able to start charging and if programmed, start the cellular modem when it’s hit around 15-20% SoC, deep-sleeping until that point?

Really appreciating learning solar!

All the best,
Chris

That makes sense and is perfectly fine.

People have had issues with letting the Electron drain to 0% SOC where the Electron fails for some reason and is no longer functional for good, and we have no solid reason why it happens. So leaving 10-20% in the battery allows you to get through mutiple days of inclement weather without the battery draining to 0% while waiting for the next sunny day.

If you set the SOC cutoff to low, the Electron has more of a chance of hitting 0% and causing a unrecoverable failure. 20% has gotten me through 5 days of dark cloudy winter weather in deep sleep mode waking up every hour to check SOC.

Does the red charging LED turn on when you are using this solar setup and the USB is not plugged in?

I am having an issue where the device charges via USB, but the red LED does not come on when I have a solar setup (5V 2W panel plugged into adafruit lipo charger - Adafruit Universal USB / DC / Solar Lithium Ion/Polymer charger [bq24074] : ID 4755 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits , lipo battery pack plugged into adafruit charger and “load” output (measured at 4.2V) going into Vin on Electron) and USB not plugged in.

I tried changing input voltage limit lower with PMIC, but no change.

If I’m reading this correctly, the LiPo is attached to the Adafruit charger, so the Electron charge LED will never come on, since there isn’t a battery connected to the Electron being charged.

I’m a bit confused why you have the second charger, however. You can just connect a 6V solar panel directly to VIN on the Electron and plug the LiPo into the Electron, no external charger required. Depending on the wattage of your panel you may need to adjust the input current limit on the Electron PMIC.

Thanks for the reply, @rickkas7 . Much appreciated.

To answer your question:
The adafruit charger has a “load out” output that I have connected to the Vin on the electron. It seems that it is regulated to 4.4V out though. I measured the output of the Vout with a voltmeter with no solar connected (to adafruit charger), only a LiPo battery plugged into the charger, and it is in fact near that value.
**edit to clarify: there is still a LiPo plugged into the JST input of the electron. So there are 2 batteries in use.

My thinking was that I could have the second battery (being charged by solar) be the one charging the electron battery through Vin versus just the solar panel directly to Vin, so that the secondary battery could charge the primary even at night. I also thought I would be able to get more current through using the second battery as well, but I could be wrong on that.

Is that clear what I’m describing?
When the primary battery went below 4 volts, though, even with my setup as described (2 batts), the red charging LED didn’t come on and the primary battery continued to drain - even though I was giving 4.4V to Vin.
I can try just plugging the solar panel directly into Vin as well, and just putting a larger capacity LiPo as the primary battery. (and using appropriate PMIC code).

Thanks for the help.

The default charge voltage is 4.112V so it should be charging at 4.4V on VIN. It’s not clear to me why it isn’t charging.

However the ideal solution is to put a bigger battery on the Electron, the Adafruit 6000 mAh battery is good, and put a 6V solar panel directly to VIN.

Thanks @rickkas7 , will do that.
You reccomend using PMIC code to change InputVoltageLimit to 4840 with this setup, right?
would you setChargeCurrent at (0,0,1,0,0,) as well for 1024mA?

(6V 2W panel)

You can leave the input voltage limit the default. You’ll have to try it and see for the charge current.

What can happen with solar panels if the charge current is too high is this:

The panel voltage exceeds the input voltage limit and charging begins. But if the panel cannot supply the charge current, the voltage drops and falls below the input voltage limit and charging stops. Once charging stops, the voltage rises above the input voltage limit and the process repeats every few seconds.

If you see the charge LED blinking every few seconds, that’s probably what is happening and the charge current is too high.

yeah, that’s one thing I was afraid of so I thought having the external solar charge controller with a second battery and smooth output would be a good idea.

If the secondary charger really maxes out at 4.4V the other option it to put a big battery on the external charger and feed the output of the external charger into Li+ on the Electron instead of VIN.

This makes sense if the external charger is smarter, like a MPPT charger. And feeding into Li+ makes sense if the device also uses sleep modes.

The bq24195 PMIC always enables its internal buck regulator when fed by VIN. But when powered by Li+, it does not need to, which saves some loss. It’s small relative to normal operating current, but if the device is asleep most of the time the loss adds up.

You should probably disable charging if powering by Li+ from a non-battery, just in case you also connect to USB.

@rickkas7 --I’m trying going into Vin directly with the solar panel (6V 2W).

In direct sunlight, red stat charging light either blinks very rapidly or if I move the panel a bit blinks in the slightly less than 1hz range. Battery doesn’t seem to be charging.

Any thoughts?

You need to reduce the battery charge current. 2W at 6V is 333 mA.

The default charging current is 896 mA and when charging begins it’s drawing more current than the play can supply, which causes the voltage to drop, which stops charging. This is why the charge LED blinks.

2 Likes

Thanks!

Looking at the docs, (Charge current control reg - PMIC (Power Management IC) | Reference | Particle) I see that

The total charge current is the 512mA + the combination of the current that the following bits represent

  • bit7 = 2048mA
  • bit6 = 1024mA
  • bit5 = 512mA
  • bit4 = 256mA
  • bit3 = 128mA
  • bit2 = 64mA

Is there a way to set below 512 mA then?

pmic.setChargeCurrent(0,0,0,0,0,0); would still be 512mA, right?

Ok, I see the SystemPowerConfiguration explanation.

I am trying this:

SerialLogHandler logHandler;

void setup() {
    // Apply a custom power configuration
    SystemPowerConfiguration conf;

    conf.batteryChargeCurrent(330) 
        .batteryChargeVoltage(4210);

    int res = System.setPowerConfiguration(conf); 
    Log.info("setPowerConfiguration=%d", res);
    // returns SYSTEM_ERROR_NONE (0) in case of success

    // Settings are persisted, you normally wouldn't do this on every startup.
}