Accelormeter Reading
Week 8 Input Devices
Project Description
I am planning to use Accelormeter for final project. I mainly want the oreintation of a moving part.
I mainly need to get the orientation for accelormeter.
I used the MPU 6050 after a series of research and a lot of recommendation online for it.
I am planning to use twelve of these so I have to get something that is of reasonable price too.
Test Results
Testing Accelormeter at different angles to see if the values changes
Testing Accelormeter at different angles to see if the values changes
Testing Accelormeter at different angles to see if the values changes
Testing Accelormeter at different angles to see if the values changes
Testing Accelormeter at different angles to see if the values changes
What didn't work
Somehow failed with my XIAO PCB, so the above I plugged the accelormeter directly to my XIAO RP2040. a spare one that I have
Somehow it works on my spare XIAO board, but not on my PCB one. I actually don't know the reason why, however, I need to look more into it.
Wiring
Connecting the 3v3, Ground, SDA, SLC. I learn the SDA is for the data, and SLC is for the clock
Another angle of this. To do this I pulled up the data sheet of the MPU 6040 and also the xiao board.
Coding in Arduino
Arduino Code -> this was one of the example files to get the angle of the x y and z . I uploaded the example code and it work.
#include "Wire.h"
#include
MPU6050 mpu(Wire);
unsigned long timer = 0;
void setup() {
Serial.begin(9600);
Wire.begin();
byte status = mpu.begin();
Serial.print(F("MPU6050 status: "));
Serial.println(status);
while(status!=0){ } // stop everything if could not connect to MPU6050
Serial.println(F("Calculating offsets, do not move MPU6050"));
delay(1000);
// mpu.upsideDownMounting = true; // uncomment this line if the MPU6050 is mounted upside-down
mpu.calcOffsets(); // gyro and accelero
Serial.println("Done!\n");
}
void loop() {
mpu.update();
if((millis()-timer)>10){ // print data every 10ms
Serial.print("X : ");
Serial.print(mpu.getAngleX());
Serial.print("\tY : ");
Serial.print(mpu.getAngleY());
Serial.print("\tZ : ");
Serial.println(mpu.getAngleZ());
timer = millis();
}
Group Project with Danny Griffin
connecting the oscilloscope to the ground and I/O pins of the ESP32-CAM
connecting the oscilloscope to the ground and I/O pins of the ESP32-CAM