Battery Management MKR 1010

Home Forums Arduino Battery Management MKR 1010

Viewing 3 reply threads
  • Author
    Posts
    • #23802
      Paolo
      Participant

        Hi all, I have a behaviour of MKR 1010 with a connected rechargeable battery that I cannot understand.
        1/ I start by plugging the MKR 1010 in the USB port, and attach the battery. The software initialise the batter charger BQ24195 to charge the battery, the “charge” LED happily blinks; the “power” LED happily stays solid green; the software makes the other LED blinking;
        2/ I disconnect the MKR 1010 from the USB port. The software continues running (the other LED still blinks), the “charge” LED stays off, the “power” LED happily remains solid green. So far, so good;
        3/ I reconnect the MKR 1010 into the USB port. I would expect the “charging” LED to restart blinking. No way.

        It seems that once the power management switches from USB to battery, I could not find a way to make the other transition. From battery to USB. Any idea of where the problem is?

        Here it is the sketch I use:

        #include "Arduino.h"
        #include <Wire.h>             // library to handle I2C
        #include <Arduino_PMIC.h>.    // library to handle BQ24195
        
        #define PMIC_ADDRESS 0x6B     // indirizzo I2C del caricabatterie
        
        // the setup function runs once when you press reset or power the board
        void setup() {
          // initialize digital pin LED_BUILTIN as an output.
          pinMode(LED_BUILTIN, OUTPUT);
        
            // Initialise serial port
          Serial.begin(9600);
          // while (!Serial);
        
          // Initialise battery charger
          InizializzaPMIC(); 
        }
        
        void loop() 
        
        {
          int i;
        
          for(i=0; i<3; i++)
          {
            digitalWrite(LED_BUILTIN, HIGH);  // turn the LED on (HIGH is the voltage level)
            delay(1000);                      // wait for a second
            digitalWrite(LED_BUILTIN, LOW);   // turn the LED off by making the voltage LOW
            delay(1000);                      // wait for a second
          }
          
          delay(1000);
        }
        
        void InizializzaPMIC(){
        
          if (!PMIC.begin()) {
            Serial.println("Failed to initialize PMIC!");
            while (1);
          }
         
          // Set the input current limit to 2 A and the overload input voltage to 3.88 V
          if (!PMIC.setInputCurrentLimit(2.0)) {
            Serial.println("Error in set input current limit");
          }
          
          float tensione = 3.88;
          if (!PMIC.setInputVoltageLimit(3.88)) {
            Serial.println("Error in set input voltage limit");
          }
         
          // set the minimum voltage used to feeding the module embed on Board
          if (!PMIC.setMinimumSystemVoltage(3.5)) {
            Serial.println("Error in set minimum system volage");
          }
         
          // Set the desired charge voltage to 4.2 V
          if (!PMIC.setChargeVoltage(4.2)) {
            Serial.println("Error in set charge volage");
          }
         
          // Set the charge current to 1250 mA
          // the charge current should be defined as maximum at (C for hour)/2h
          // to avoid battery explosion (for example for a 750 mAh battery set to 0.375 A)
          // In my case, 2500mAh -> 1250mA
          if (!PMIC.setChargeCurrent(1.250)) {
            Serial.println("Error in set charge current");
          }
          Serial.println("Initialization done!");
        
          // Enable the Charger
          if (!PMIC.enableCharge()) {
            Serial.println("Error enabling Charge mode");
          }
        }
      • #23809
        Renzo Mischianti
        Keymaster

          Hi Paolo,
          It’s very strange. Which battery type do you use?
          Bye Renzo

          • #23825
            Paolo
            Participant

              LiIon Polymeer Accu 3.7V, 2500mA – PKCELL LP805060

          • #23829
            Paolo
            Participant

              Hi Enzo,

              Sorry for the short answer yesterday, as I was busy trying out a lot of things to figure out where the problem is.

              In the meantime, I tried out a brand new MKR 1010 WiFi and a new battery (LP103454, 3.7V 2000mA), and the behaviour is still the same. I should be able to exclude an hardware fault of the MKR 1010 WiFi.

              I hooked up also an external Adafruit USB LiIon/LiPoly charger to bypass the integrated one (that, to me, does not do what I would like it to do). Connecting the Adafruit module to the +5V of the Arduino board, to get the input from the same USB cable that I use to load the firmware, it happily shows the “power” LED lit at point 1/ above. When I go through the 2/ and 3/, the “power” LED remains off. That is to say, not only the integrated PMIC on MKR 1010 WiFi does not charge anymore the connected battery, but it does not even provide the +5V which, according to the MKR 1010 WiFi schematic, should be connected to VUSB. Again, very strange.

              After step 3/, that is when I reconnect the board to the USB of my laptop, another strange thing is that the Arduino IDE states “not connected” on the serial monitor, while before disconnecting as in step 2/, it was happily connected.

              All of the above it is because I am willing to build a 220V detector, which would send an email message to me when the 220V fails. In my summer house I have a battery powered WiFi router that keeps working also when 220V fails. As I have lost so many freezer loads because of a power fault, I want to understand when the problem occurs. I came across your library on how to send email with MKR 1010 WiFi, which works flawlessly, and I thought that on this forum I might get some ideas on how to solve the basic HW problem.

              Ciao,

              Paolo

            • #23849
              Renzo Mischianti
              Keymaster

                Hi Paolo,
                I don’t have the same model of the battery.

                But It’s possible that in the code you use to do the test, doesn’t this line commented?

                
                  // while (!Serial);
                

                And check in “Computer management –> Device management –> Port (COM and LPT) the behavior of the COM port.

                Bye Renzo

            Viewing 3 reply threads
            • You must be logged in to reply to this topic.
            Exit mobile version