Arduino(MKR WIFI 1010) + BNO055 + BLYNK issue

Hardware → Arduino(MKR WIFI 1010) + BNO055
Communication → Wifi
Smartphone → Android
BLYNK server I Think.

Hello this is 1st time for me on this forum please pardon me if I missed anything. I am using BNO055 Absolute Orientation Sensor for calculating Heading. I am using accelerometer, Gyro, magnetometer from this sensor. For me the issue is when I comment 2 lines for BLYNK in below code, it gives me right readings from sensor but as soon as I uncomment those 2 line i start getting wrong values. 2 line are “Blynk.begin(auth, ssid, pass);” and “Blynk.run();”. So my question is why code is working fine without BLYNK code and not with BLYNK code. I believe there is some sort of conflict between BLYNK and BNO055 not sure what. I can provide output and other details if required. I am using I2C for communication between Arduino and BNO055. I can see device is online on my phone but value of sensor are not correct. Any help would be appreciated. Thank you.


#define BLYNK_PRINT Serial

#include <SPI.h>
#include <WiFiNINA.h>
#include <BlynkSimpleWiFiNINA.h>
BlynkTimer timer;
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>
#include <math.h>

Adafruit_BNO055 myIMU = Adafruit_BNO055();

char auth[] = "XXXXXXXXXXXXXXXXXXXXXX";

char ssid[] = "XXXXXXX";
char pass[] = "XXXXXX";

void setup()
{
Serial.begin(115200);
myIMU.begin();
Blynk.begin(auth, ssid, pass);
delay(100);
myIMU.setExtCrystalUse(true);
timer.setInterval(10L, Read_IMU_Sensor);
}

void Read_IMU_Sensor(){
uint8_t system, gyro, accel, mg = 0;
myIMU.getCalibration(&system, &gyro, &accel, &mg);
imu::Vector<3> acc =myIMU.getVector(Adafruit_BNO055::VECTOR_ACCELEROMETER);
imu::Vector<3> gyr =myIMU.getVector(Adafruit_BNO055::VECTOR_GYROSCOPE);
imu::Vector<3> mag =myIMU.getVector(Adafruit_BNO055::VECTOR_MAGNETOMETER);
Serial.print(accel);
Serial.print(",");
Serial.print(gyro);
Serial.print(",");
Serial.print(mg);
Serial.print(",");
Serial.println(system);
}


void loop()
{
  Blynk.run();
  timer.run();
}

What happens if you change this from 100 readings per seconds to something more realistic?

Pete.

Hey Pete,

Thank you very much for response. I have changed it to 1 reading per second still that is not working.

timer.setInterval(1000L, Read_IMU_Sensor);

Can you confirm that you are using the Blynk Legacy app?
What version of the Blynk library are you using?

Is the MKR1010’s WiFi firmware up to date?

What does your serial monitor show?

Have you tried a simple Blynk example sketch?

Pete.

Hello Pete,

Can you confirm that you are using the Blynk Legacy app?
→ Yes. installed Blynk app is Legacy app per google play store.

What version of the Blynk library are you using?
→ BLYNK 0.6.1

Is the MKR1010’s WiFi firmware up to date?
→ I have updated just now but result is still same.(firmeware 1.4.8 updated)

What does your serial monitor show?
→ Please see attached image. Output is incorrect. Expected result is “0,3,0,0”

Have you tried a simple Blynk example sketch?
→ I have tried many examples in past and now too its working fine if I exclude BNO055.

First of all, copy and paste the contents of your serial monitor using triple backticks, rather than a screenshot.

Secondly, I was wanting to see the serial monitor from boot-up, especially the Blynk connection part, rather than just a screen full of sensor readings.

Pete.

Hey Pete,

Sorry for trouble. Please find output below in required format.
Let me know if I missed anything.


11:55:16.683 -> [12853] Connecting to Marakhi
11:55:16.984 -> [13162] IP: 10.0.0.215
11:55:16.984 -> [13164] 
11:55:16.984 ->     ___  __          __
11:55:16.984 ->    / _ )/ /_ _____  / /__
11:55:16.984 ->   / _  / / // / _ \/  '_/
11:55:16.984 ->  /____/_/\_, /_//_/_/\_\
11:55:16.984 ->         /___/ v0.6.1 on MKR WiFi 1010
11:55:16.984 -> 
11:55:16.984 -> [13165] Connecting to blynk-cloud.com:80
11:55:17.084 -> [13266] Ready (ping: 29ms).
11:55:17.131 -> 0,3,0,0
11:55:17.686 -> 0,3,0,0
11:55:18.689 -> 1,3,1,0
11:55:19.693 -> 1,3,1,0
11:55:20.696 -> 1,3,1,0
11:55:21.700 -> 1,3,1,0
11:55:22.687 -> 1,3,1,0
11:55:23.706 -> 1,3,1,0
11:55:24.712 -> 1,3,1,0
11:55:25.712 -> 1,3,1,0

So you are getting the expected reading on two occasions after connecting to Blynk…

Is this always the case?

Pete.

Hey Pete,

Actually its random but after few occasions it start sending wrong value.

Is the sensor physically close to the WiFi chip on the MKR?

The sensor is prone to interference from high frequency signals, and may be that it works fine when you have no WiFi connection in your sketch, but when you connect to WiFi (as in when you are using Blynk) the WiFi signals are causing a problem.

Pete.

Hey Pete,

I have moved sensor 5 feet away from WIFI chip and result is still same. I am not electronic expert but I feel there is some sort of resource/Logic conflict which happen randomly.

Hey Pete, I now see wrong value even if I comment 2 line for BLYNK. Looks like board(MKR wifi 1010) is not producing consistent result(May be due to firmware update?). I have just completed testing on Arduino UNO and BNO055 and it is working fine on UNO and sensor is produce good result and it is not damaged. I will keep everyone posted here if I find anything for MKR WIFI 1010 but meanwhile let me know if you have any suggestion/feedback.