hi friends,
i am working on a project - self balancing robot using mpu 6050. details i gathered from http://www.instructables.com/id/2-Wheel-Self-Balancing-Robot-by-using-Arduino-and-/
having sorce code also. from that code i got some idea for wiring the robo. but still missing few connections.
few lines i mentioned in red - here i have some doubts in connection.
can anyone help me with the schematic?
main source code:
#include <Wire.h>
#include "I2Cdev.h"
#include "MPU6050_6Axis_MotionApps20.h"
#define LED 13
#define PWM_L 10
#define PWM_R 11
#define DIR_L1 6
#define DIR_L2 12
#define DIR_R1 8
#define DIR_R2 9
#define SPD_INT_L 3//1
#define SPD_PUL_L 4
#define SPD_INT_R 7
#define SPD_PUL_R 5
#define MPU_INT 2//0
#define K_AGL_AD A0
#define K_AGL_DOT_AD A1
#define K_POS_AD A2
#define K_POS_DOT_AD A3
MPU6050 mpu; // AD0 low = 0x68
// MPU control/status vars
bool dmpReady = false; // set true if DMP init was successful
uint8_t mpuIntStatus; // holds actual interrupt status byte from MPU
uint8_t devStatus; // return status after each device operation (0 = success, !0 = error)
uint16_t packetSize; // expected DMP packet size (default is 42 bytes)
uint16_t fifoCount; // count of all bytes currently in FIFO
uint8_t fifoBuffer[64]; // FIFO storage buffer
// orientation/motion vars
Quaternion q; // [w, x, y, z] quaternion container
VectorFloat gravity; // [x, y, z] gravity vector
int16_t gyro[3]; // [x, y, z] gyro vector
float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector
double K_angle,K_angle_dot,K_position,K_position_dot;
double K_angle_AD,K_angle_dot_AD,K_position_AD,K_position_dot_AD;
double position_add,position_dot;
double position_dot_filter;
int speed_real_l,speed_real_r;
int pwm,pwm_l,pwm_r;
int Turn_Need,Speed_Need;
float angle, angular_rate;
bool blinkState = false;
int rx_count=0;
byte buf_tmp=0;
uint8_t i2cData[14]; // Buffer for I2C data
volatile bool mpuInterrupt = false; // indicates whether MPU interrupt pin has gone high
void dmpDataReady()
{
mpuInterrupt = true;
}
void setup()
{
init_cal();
init_IO();
Wire.begin();// join I2C bus (I2Cdev library doesn't do this automatically)
TWBR = 24; // 400kHz I2C clock (200kHz if CPU is 8MHz)
// Serial.begin(9600);
// initialize device
Serial.println(F("Initializing I2C devices..."));
mpu.initialize();
// verify connection
Serial.println(F("Testing device connections..."));
Serial.println(mpu.testConnection() ? F("MPU6050 connection successful") : F("MPU6050 connection failed"));
delay(2);
.
.
.
code goes like this..
pls refer http://www.instructables.com/id/2-Wheel-Self-Balancing-Robot-by-using-Arduino-and-/
thanks in advance...