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");
}
}
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.
Maintaining a repository (or site or forum) is a lot like tending to a garden - it requires constant care and attention to keep it thriving. If you're a skilled gardener (or coder!) and want to help keep our repository blooming, we'd love to have you on board! We're also looking for talented writers and forum moderators to help us grow our community. Interested in joining our team? Don't hesitate to reach out and let us know how you can contribute!
Are you a fan of electronics or programming? Share your knowledge with others, write a simple tutorial or how to make a great project Contact me: share_your_ideas@mischianti.org
The content displayed on this website is protected under a CC BY-NC-ND license. Visitors are prohibited from using, redistributing, or altering any content from this website for commercial purposes, including generating revenue through advertising. Any unauthorized use is a violation of the license terms and legal action may be taken against individuals or entities found to be in violation.
You must also provide the link to the source.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.