Arduino charged led blinking

Good morning,

I'm working with an Arduino MKR 1010. I uploaded a simple sketch that I attach below: it is just a code to controll through the IoT Cloud a relay connected to a waterpump for a future Smart Garden project. My question is: I connected the Arduino for all night with a USB to a socket and the morning after I saw that the charged LED blinked at 1Hz.
I saw in the manual (https://support.arduino.cc/hc/en-us/articles/360016119199-What-is-the-meaning-of-CHRG-LED-different-states-in-MKR-boards-) that could be related to a "Charge suspend" issue and in particular due to several reasons:

  • Input over-voltage
  • TS fault (temperature fault)
  • Timer fault
  • Input or system over-voltage

How can I debug this problem? Should I care about it or it is not important?

Thanks in advance.
Lorenzo

My code:

/* 
  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  String message;
  String message_2;
  bool pump_state;

  Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
  which are called when their values are changed from the Dashboard.
  These functions are generated with the Thing and added at the end of this sketch.
*/

#include "thingProperties.h"
const int relay = A5;

void setup() {
  Serial.begin(9600);
  
  delay(1500); 

  // Defined in thingProperties.h
  initProperties();

  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
  
  pinMode(relay, OUTPUT);
  digitalWrite(relay, HIGH);
}

void loop() {
  ArduinoCloud.update();
  
  Serial.print("Pump state:");
  Serial.println(pump_state);

  delay(1000);
  
}

/*
  Since PumpState is READ_WRITE variable, onPumpStateChange() is
  executed every time a new value is received from IoT Cloud.
*/
void onPumpStateChange()  {
  
  if (pump_state == false) {
    digitalWrite(relay, HIGH);
    message = "Pump OFF!";
  }
  else {
    digitalWrite(relay, LOW);
    message = "Pump ON!";
  }
  
}

Schematic
What does the final function do in this sketch (onpumpstatechange)

It is the function "connected" to the IoT cloud. From the Dashboard you can change the status of the boolean variable "pump_state" and open/close the relay. In the "InitProperties.h" file, included at the beginning of the code, you have the definition of the function:

// Code generated by Arduino IoT Cloud, DO NOT EDIT.

#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>

const char SSID[]     = SECRET_SSID;    // Network SSID (name)
const char PASS[]     = SECRET_PASS;    // Network password (use for WPA, or use as key for WEP)

void onPumpStateChange();

String message;
String message_2;
bool pump_state;

void initProperties(){

  ArduinoCloud.addProperty(message, READ, ON_CHANGE, NULL);
  ArduinoCloud.addProperty(message_2, READ, ON_CHANGE, NULL);
  ArduinoCloud.addProperty(pump_state, READWRITE, ON_CHANGE, onPumpStateChange);

}

WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project or board :wink: See About the Installation & Troubleshooting category.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.