Introduction: Arduino-based Toothbrush Data Monitor
This Arduino-based toothbrush allows you to monitor patterns using 3-axial acceleration data.
Step 1: Step 1: Materials
Toothbrush
Arduino Nano
MPU-6050 3-axis IMU
6ft (1.8m) USB mini-B cable
Step 2: Step 2: Wiring
Connect MPU-6050 and Arduino Nano using wire soldering. See the above picture for detail.
Step 3: Step 3: Programming Arduino
#include <Wire.h>
const int MPU=0x68;//MPU6050 I2C address
int AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
void get6050();
void setup()
{
Wire.begin();
Wire.beginTransmission(MPU);
Wire.write(0x6B);
Wire.write(0);
Wire.endTransmission(true);
Serial.begin(9600);
}
void loop()
{
get6050();
Serial.print(AcX);
Serial.print(" ");
Serial.print(AcY);
Serial.print(" ");
Serial.print(AcZ);
Serial.println();
delay(15);
}
void get6050()
{
Wire.beginTransmission(MPU);
Wire.write(0x3B);
Wire.endTransmission(false);
Wire.requestFrom(MPU,14,true);
AcX=Wire.read()<<8|Wire.read();
AcY=Wire.read()<<8|Wire.read();
AcZ=Wire.read()<<8|Wire.read();
Tmp=Wire.read()<<8|Wire.read();
GyX=Wire.read()<<8|Wire.read();
GyY=Wire.read()<<8|Wire.read();
GyZ=Wire.read()<<8|Wire.read();
}
Step 4: Step 4: Hit the Serial Plotter and See the Graph
Go to Tools - Serial Plotter (or Ctrl + Shift + L), and you will see the real-time graph with 3-axial acceleration from MPU-6050
Shake toothbrush and see the difference.
for more information: please visit
blog.naver.com/roboholic84