manfred12717
Published © LGPL

Monitoring Device

This project aimed at designing and fabricating a highly reliable, user-friendly device.

IntermediateFull instructions provided790
Monitoring Device

Things used in this project

Hardware components

SparkFun Triple Axis Accelerometer and Gyro Breakout - MPU-6050
SparkFun Triple Axis Accelerometer and Gyro Breakout - MPU-6050
×1
Grove - Round Force Sensor (FSR402)
Seeed Studio Grove - Round Force Sensor (FSR402)
×1
Cytron Technologies Infrared Obstacle Sensor
×1
ESP8266 ESP-01
Espressif ESP8266 ESP-01
×1
Cytron Technologies Arduino Uno
×1
SparkFun Logic Level Converter - Bi-Directional
SparkFun Logic Level Converter - Bi-Directional
×1
Breadboard (generic)
Breadboard (generic)
×1
Cytron Technologies resister 3.3k ohm
×1

Software apps and online services

Blynk
Blynk
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
10 Pc. Jumper Wire Kit, 5 cm Long
10 Pc. Jumper Wire Kit, 5 cm Long
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires

Story

Read more

Schematics

schematic circuit diagram

Code

Arduino Coding

C/C++
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <Wire.h>

char auth[] = "jaSb-TjpYDLncLborLVE7IMo7A2xBl8i";  // enter your authentication token from your email
char ssid[] = "AndroidAP";                         // enter your wifi name
char pass[] = "mzfx7476";                          // enter your wifi password

#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX

#define ESP8266_BAUD 9600       // change your ESP8266 baudrate here

ESP8266 wifi(&EspSerial);

const int MPU_addr = 0x68;      // I2C address of the MPU-6050
int16_t AcX, AcY, AcZ, Tmp, GyX, GyY, GyZ;

//coding for MPU-6050
void GetValues()
{
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)
  Wire.endTransmission(false);
  Wire.requestFrom(MPU_addr, 14, true); // request a total of 14 registers

  AcX = Wire.read() << 8 | Wire.read(); // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)
  AcY = Wire.read() << 8 | Wire.read(); // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)
  AcZ = Wire.read() << 8 | Wire.read(); // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)
  Tmp = Wire.read() << 8 | Wire.read(); // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)
  GyX = Wire.read() << 8 | Wire.read(); // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)
  GyY = Wire.read() << 8 | Wire.read(); // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)
  GyZ = Wire.read() << 8 | Wire.read(); // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L)
  
  Blynk.virtualWrite(3, AcX/16384.);
  Blynk.virtualWrite(4, AcY/16384.);
  Blynk.virtualWrite(5, AcZ/16384.);
  Blynk.virtualWrite(6, GyX/131.);
  Blynk.virtualWrite(7, GyY/131.);
  Blynk.virtualWrite(8, GyZ/131.);
  Blynk.virtualWrite(9, Tmp/340.+36.53);

}

WidgetLED led1(V1);    //register to virtual pin 1
BlynkTimer timer;      // blynk timer delay
int ir = 7;            // declare ir sensor to digital pin 7
int x = HIGH;          // declare variable initally as high
int fsr = A3;          // declare fsr as A3
int fsrRead;           // initialize fsrRead
// coding for IR Sensor
void LedWidget()
{
x = digitalRead(ir);
if(x == LOW)
{
  led1.on();
}
else
{
   led1.off();
}
}



// Coding for FSR
void FSR()
{
 fsrRead = analogRead(fsr);
 Blynk.virtualWrite(V2,fsrRead);
}
void setup()
{
  Serial.begin(9600);
  pinMode(ir,INPUT);
  EspSerial.begin(ESP8266_BAUD);
  delay(10);
  Blynk.begin(auth, wifi, ssid, pass);
  Wire.begin();
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x6B);                       // PWR_MGMT_1 register
  Wire.write(0);                          // set to zero (wakes up the MPU-6050)
  Wire.endTransmission(true);
  timer.setInterval(1000L, LedWidget);
  timer.setInterval(1000L, FSR);
  timer.setInterval(200L, GetValues);
}
void loop()
{
  Blynk.run();
  timer.run();
}

Arduino codes

C/C++
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <Wire.h>

char auth[] = "jaSb-TjpYDLncLborLVE7IMo7A2xBl8i";  // enter your authentication token from your email
char ssid[] = "AndroidAP";                         // enter your wifi name
char pass[] = "mzfx7476";                          // enter your wifi password

#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX

#define ESP8266_BAUD 9600       // change your ESP8266 baudrate here

ESP8266 wifi(&EspSerial);

const int MPU_addr = 0x68;      // I2C address of the MPU-6050
int16_t AcX, AcY, AcZ, Tmp, GyX, GyY, GyZ;

//coding for MPU-6050
void GetValues()
{
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)
  Wire.endTransmission(false);
  Wire.requestFrom(MPU_addr, 14, true); // request a total of 14 registers

  AcX = Wire.read() << 8 | Wire.read(); // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)
  AcY = Wire.read() << 8 | Wire.read(); // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)
  AcZ = Wire.read() << 8 | Wire.read(); // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)
  Tmp = Wire.read() << 8 | Wire.read(); // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)
  GyX = Wire.read() << 8 | Wire.read(); // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)
  GyY = Wire.read() << 8 | Wire.read(); // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)
  GyZ = Wire.read() << 8 | Wire.read(); // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L)
  
  Blynk.virtualWrite(3, AcX/16384.);
  Blynk.virtualWrite(4, AcY/16384.);
  Blynk.virtualWrite(5, AcZ/16384.);
  Blynk.virtualWrite(6, GyX/131.);
  Blynk.virtualWrite(7, GyY/131.);
  Blynk.virtualWrite(8, GyZ/131.);
  Blynk.virtualWrite(9, Tmp/340.+36.53);
}

WidgetLED led1(V1);    //register to virtual pin 1
BlynkTimer timer;      // blynk timer delay
int ir = 7;            // declare ir sensor to digital pin 7
int x = HIGH;          // declare variable initally as high
int fsr = A3;          // declare fsr as A3
int fsrRead;           // initialize fsrRead
int reset = 8;         // declare esp8 to digital pin 8

// coding for IR Sensor
void LedWidget()
{
x = digitalRead(ir);
if(x == LOW)
{
  led1.on();
  digitalWrite(reset, LOW);
}
else
{
   led1.off();
}
}

void FSR()      // Coding for FSR
{
 fsrRead = analogRead(fsr);
 Blynk.virtualWrite(V2,fsrRead);
}
void setup()
{
  Serial.begin(9600);
  pinMode(ir,INPUT);
  pinMode(reset,OUTPUT);
  digitalWrite(reset,HIGH);
  EspSerial.begin(ESP8266_BAUD);
  delay(10);
  Blynk.begin(auth, wifi, ssid, pass);
  Wire.begin();
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x6B);                       // PWR_MGMT_1 register
  Wire.write(0);                          // set to zero (wakes up the MPU-6050)
  Wire.endTransmission(true);
  timer.setInterval(1000L, LedWidget);
  timer.setInterval(1000L, FSR);
  timer.setInterval(200L, GetValues);
}
void loop()
{
  Blynk.run();  
  timer.run();
}

Credits

manfred12717

manfred12717

0 projects • 0 followers

Comments