Cytron Esp Wifi Shield + MPU6050 + Blynk

Discussion on how to get started with various type of IoT projects

Cytron Esp Wifi Shield + MPU6050 + Blynk

Postby daniel » Mon Mar 02, 2020 12:00 pm

my project is basically just read the acceleration X, Y and Z from MPU6050 using Blynk. my tools:

    1. Arduino Uno
    2. Cytron Wifi Shield
    3. MPU6050

mpu6050 coding: https://github.com/Tockn/MPU6050_tockn

the task is simple, MPU gives data to Arduino, Arduino sends to Blynk through Wifi Shield. but if it try to use shield and MPU together, the shield seems to unable to retrieve any readings from the MPU. but the shield do connected to Blynk.

here is my code:

CODE: SELECT_ALL_CODE
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <SoftwareSerial.h>

#include <MPU6050_tockn.h>
#include <Wire.h>

char auth[] = "1oMINWmxjv0acmBUFB_TmGkbUlTEG9Jz";
char ssid[] = "SALTECH";
char pass[] = "soleh123";

SoftwareSerial EspSerial(2, 3); // RX, TX

#define ESP8266_BAUD 9600

ESP8266 wifi(&EspSerial);

MPU6050 mpu6050(Wire);

long timer = 0;

BlynkTimer timero;

void mpu() {
  mpu6050.update();
  int accx = mpu6050.getAccX();
  int accy = mpu6050.getAccY();
  int accz = mpu6050.getAccZ();
  Blynk.virtualWrite(V5, accx);
  Blynk.virtualWrite(V6, accy);
  Blynk.virtualWrite(V7, accy);
  }
 
void setup() {
  Serial.begin(9600);
  Wire.begin();
 
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  Blynk.begin(auth, wifi, ssid, pass);
 
  mpu6050.begin();
  mpu6050.calcGyroOffsets(true);
  timero.setInterval(1000L, mpu);
}

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


can anyone point out solutions?
daniel
Greenhorn
 
Posts: 2
Joined: Sat Feb 29, 2020 2:50 pm

Re: Cytron Esp Wifi Shield + MPU6050 + Blynk

Postby Idris » Tue Mar 03, 2020 8:36 am

Hi daniel, try to print out the sensor's reading on Serial Monitor first. If you don't mind, you can share a few clear photos of your hardware setup here. Thanks
Cytron Technologies invest time and resources providing tutorial, training and support for STEM education and maker movement. We need your support by purchasing products from Cytron Technologies. Thanks.
http://www.cytron.com.my
User avatar
Idris
Moderator
 
Posts: 409
Joined: Thu Mar 22, 2012 5:28 pm
Location: Pulau Pinang


Return to Getting Started - IoT

Who is online

Users browsing this forum: No registered users and 12 guests

cron