Hello, I bought a MKR IoT Carrier last December 2022, and a month later it arrived.
We uploaded a sketch for humidity, temperature, light, and weather station. The web editor successfully verified and uploaded the code on the MKR WIFI 1010. The problem is the IoT Carrier doesn't respond, the LCD doesn't light up and the sensors doesn't send readings.
Here is the code:
// BSEC Software Library - Version: 1.6.1480
#include <bsec.h>
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/3cd71424-ed50-407c-affe-783e581eee97
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
String weather_report;
float humidity;
float temperature;
int light;
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"
#include <Arduino_MKRIoTCarrier.h>
MKRIoTCarrier carrier;
int modeSelect = 0;
int previousMode = 0;
int refreshCount = 0;
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
//while (!Serial);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
//Get Cloud Info/errors , 0 (only errors) up to 4
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
//Wait to get cloud connection to init the carrier
while (ArduinoCloud.connected() != 1) {
ArduinoCloud.update();
delay(500);
}
delay(500);
CARRIER_CASE = false;
carrier.begin();
carrier.display.setRotation(0);
carrier.display.fillScreen(ST77XX_BLACK);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(3);
carrier.display.setCursor(60, 80);
carrier.display.print("Aether");
//carrier.display.setCursor(60, 120);
//carrier.display.print("Station");
delay(2000);
carrier.display.fillScreen(ST77XX_BLACK);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(2);
carrier.display.setCursor(70, 80);
carrier.display.print("Connected");
carrier.display.setCursor(50, 110);
carrier.display.print("To IoT Cloud");
delay(2000);
}
void loop() {
ArduinoCloud.update();
carrier.Buttons.update();
while (!carrier.Light.colorAvailable()) {
delay(5);
}
int none;
carrier.Light.readColor(none, none, none, light);
temperature = carrier.Env.readTemperature();
humidity = carrier.Env.readHumidity();
if (carrier.Button0.onTouchDown()) {
modeSelect = 0;
} else if (carrier.Button1.onTouchDown()) {
modeSelect = 1;
} else if (carrier.Button2.onTouchDown()) {
modeSelect = 2;
} else if (carrier.Button3.onTouchDown()) {
modeSelect = 3;
}
if (modeSelect != previousMode) {
updateDisplay();
previousMode = modeSelect;
refreshCount = 0;
} else if (refreshCount >= 50) {
updateDisplay();
refreshCount = 0;
}
if (humidity >= 60 && temperature >= 15) {
weather_report = "It is very humid outside";
} else if (temperature >= 25 && light >= 700) {
weather_report = "Hot and sunny outside";
} else if (light <= 100) {
weather_report = "It is dark outside";
} else if (temperature >= 15 && light >= 700) {
weather_report = "Warm and sunny outside";
} else if (temperature <= 16 && light >= 700) {
weather_report = "A little cold, but sunny outside";
} else if (humidity >= 90 && temperature <= 15) {
weather_report = "It is wet and rainy outside";
}
refreshCount++;
}
void updateDisplay() {
if (modeSelect == 0) {
carrier.display.fillScreen(ST77XX_RED);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(4);
carrier.display.setCursor(70, 50);
carrier.display.print("Temp:");
carrier.display.setCursor(40, 110);
carrier.display.print(temperature);
carrier.display.print(" C");
} else if (modeSelect == 1) {
carrier.display.fillScreen(ST77XX_BLUE);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(4);
carrier.display.setCursor(70, 50);
carrier.display.print("Humi:");
carrier.display.setCursor(40, 110);
carrier.display.print(humidity);
carrier.display.print(" %");
} else if (modeSelect == 2) {
carrier.display.fillScreen(ST77XX_GREEN);
carrier.display.setTextColor(ST77XX_BLACK);
carrier.display.setTextSize(4);
carrier.display.setCursor(60, 60);
carrier.display.print("Light:");
carrier.display.setCursor(80, 120);
carrier.display.print(light);
}
else {
carrier.display.fillScreen(ST77XX_BLACK);
}
}
Is it a hardware or software anomaly? Thank you for the feedback. I need to submit this project by next week.
// BSEC Software Library - Version: 1.6.1480
#include <bsec.h>
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/3cd71424-ed50-407c-affe-783e581eee97
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
String weather_report;
float humidity;
float temperature;
int light;
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"
#include <Arduino_MKRIoTCarrier.h>
MKRIoTCarrier carrier;
int modeSelect = 0;
int previousMode = 0;
int refreshCount = 0;
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
//while (!Serial);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
//Get Cloud Info/errors , 0 (only errors) up to 4
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
//Wait to get cloud connection to init the carrier
while (ArduinoCloud.connected() != 1) {
ArduinoCloud.update();
delay(500);
}
delay(500);
CARRIER_CASE = false;
carrier.begin();
carrier.display.setRotation(0);
carrier.display.fillScreen(ST77XX_BLACK);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(3);
carrier.display.setCursor(60, 80);
carrier.display.print("Aether");
//carrier.display.setCursor(60, 120);
//carrier.display.print("Station");
delay(2000);
carrier.display.fillScreen(ST77XX_BLACK);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(2);
carrier.display.setCursor(70, 80);
carrier.display.print("Connected");
carrier.display.setCursor(50, 110);
carrier.display.print("To IoT Cloud");
delay(2000);
}
void loop() {
ArduinoCloud.update();
carrier.Buttons.update();
while (!carrier.Light.colorAvailable()) {
delay(5);
}
int none;
carrier.Light.readColor(none, none, none, light);
temperature = carrier.Env.readTemperature();
humidity = carrier.Env.readHumidity();
if (carrier.Button0.onTouchDown()) {
modeSelect = 0;
} else if (carrier.Button1.onTouchDown()) {
modeSelect = 1;
} else if (carrier.Button2.onTouchDown()) {
modeSelect = 2;
} else if (carrier.Button3.onTouchDown()) {
modeSelect = 3;
}
if (modeSelect != previousMode) {
updateDisplay();
previousMode = modeSelect;
refreshCount = 0;
} else if (refreshCount >= 50) {
updateDisplay();
refreshCount = 0;
}
if (humidity >= 60 && temperature >= 15) {
weather_report = "It is very humid outside";
} else if (temperature >= 25 && light >= 700) {
weather_report = "Hot and sunny outside";
} else if (light <= 100) {
weather_report = "It is dark outside";
} else if (temperature >= 15 && light >= 700) {
weather_report = "Warm and sunny outside";
} else if (temperature <= 16 && light >= 700) {
weather_report = "A little cold, but sunny outside";
} else if (humidity >= 90 && temperature <= 15) {
weather_report = "It is wet and rainy outside";
}
refreshCount++;
}
void updateDisplay() {
if (modeSelect == 0) {
carrier.display.fillScreen(ST77XX_RED);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(4);
carrier.display.setCursor(70, 50);
carrier.display.print("Temp:");
carrier.display.setCursor(40, 110);
carrier.display.print(temperature);
carrier.display.print(" C");
} else if (modeSelect == 1) {
carrier.display.fillScreen(ST77XX_BLUE);
carrier.display.setTextColor(ST77XX_WHITE);
carrier.display.setTextSize(4);
carrier.display.setCursor(70, 50);
carrier.display.print("Humi:");
carrier.display.setCursor(40, 110);
carrier.display.print(humidity);
carrier.display.print(" %");
} else if (modeSelect == 2) {
carrier.display.fillScreen(ST77XX_GREEN);
carrier.display.setTextColor(ST77XX_BLACK);
carrier.display.setTextSize(4);
carrier.display.setCursor(60, 60);
carrier.display.print("Light:");
carrier.display.setCursor(80, 120);
carrier.display.print(light);
}
else {
carrier.display.fillScreen(ST77XX_BLACK);
}
}
I tried it out and it worked perfectly for me. So your code is fine.
Try this:
Connect the MKR IoT Carrier to your computer with the USB cable.
Open your Thing in Arduino IoT Cloud.
Select the "Sketch" tab.
Just to be sure you have the correct sketch on the Device, click the rightward pointing arrow button ("Verify and Upload") on the Sketch toolbar.
Wait for the upload to finish successfully.
Click the magnifying glass icon ("Open Serial Monitor") on the Sketch toolbar.
A separate window will now open.
Press the button marked "RST" on the MKR WiFi 1010 board that is plugged into the bottom of the MKR IoT Carrier. ⓘ This reset is done so you can see all the serial output from the very beginning of the sketch starting to run.
Now watch the Serial Monitor window. You should see some information about the board initializing, connecting to your WiFi router and to Arduino Cloud.
The successful output looks something like this:
***** Arduino IoT Cloud - configuration info *****
Device ID: 9ab0c2b0-374e-425f-bb68-30a96014ecfb
MQTT Broker: mqtts-sa.iot.arduino.cc:8883
WiFi.status(): 0
Current WiFi Firmware: 1.5.0
Connected to "my_ssid"
Sd card not detected
Connected to Arduino IoT Cloud
Thing ID: b56bfc49-3ca2-4f32-9548-8586be95a253
Some of the first lines might be missing because there is a bug in the Arduino Cloud Serial Monitor that makes it too slow to initialize, so even when you reset the board some of the first serial output is missing. You can fix that by adding a delay to the setup function of your Thing sketch:
Serial.begin(9600);
delay(2000); // Give Arduino Cloud Serial Monitor time to initialize
Then upload the Thing sketch to your board again and check Serial Monitor to see all the output.
Hopefully the output shown in Serial Monitor will give you some information about the problem.
This is very unexpected. There is nothing in the sketch you shared that would print sensor data to Serial Monitor. Are you certain you uploaded this sketch to your board?:
We actually just tried a simple code, if it shows on the dashboard of the IoT Cloud, yet still doesn't show on the dashboard. But the serial monitors shows the data
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/6f159185-14f8-4a43-8c8a-922dfc437057
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
float humidity;
float temperature;
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"
#include <Arduino_MKRIoTCarrier.h>
MKRIoTCarrier carrier;
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
carrier.withCase();
carrier.begin();
}
void loop() {
ArduinoCloud.update();
// Your code here
temperature = carrier.Env.readTemperature();
humidity = carrier.Env.readHumidity();
Serial.print("Temp: ");
Serial.println(temperature);
Serial.print("Humid: ");
Serial.println(humidity);
}
The truth is that, although I own the MKR IoT Carrier, I haven't had the opportunity to work with it very often. So I can't speak authoritatively on the reliability of the button. But I can say that after quite a bit of use of the first sketch you shared over the last few days, I have not experienced any problems at all with the buttons.
Arduino has other people assigned to providing support on Discord so it would not be appropriate for me to connect with you on the platform that is outside the scope of my work, but they should definitely be able to help you out over there: