Learn the mechanisms of a self balancing device with this module

Makers
Updates
14 Insights
[resource] PID Library - How to write a PID library
posted 1 year, 4 months ago by Alex JV

http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/ - Awesome blog on how to write a PID algorithm

[observation] Reducing motor noise
posted 1 year, 4 months ago by Alex JV

MCU crashing was a major issue. Sorted that out by putting a bunch of capacitors across the motor. This was used as a reference - http://www.beam-wiki.org/wiki/Reducing_Motor_Noise

Setpoint
posted 1 year, 4 months ago by Alex JV

Increasing setpoint/targetAngle makes the bot move in that direction.

[observation] MPU6050 crashes when motor powered on
posted 1 year, 4 months ago by Alex JV

The MPU6050 crashes or gives erratic readings when the motor is powered on. The motor might be interfering with the i2c signal.

Dont think it is because battery is dropping ...

read more
[issue] program crashing reason found
posted 1 year, 4 months ago by Alex JV

The program is crashing because of the MPU screwing up with the whole system. Partly because of the DMU, partly because of i2c. anyway the issue is on the MPU6050.

[issue][resolved] arduino cant be programmed with bluetooth module connected
posted 1 year, 4 months ago by Alex JV

If d0 pin is connected to anything else, arduino cannot be programmed. The bluetooth module will have to be disconnected when programming the IC

[issue] The program crashes after some time
posted 1 year, 4 months ago by Alex JV

Reason unknown. It seems to be happening on every code that is accessing the MPU. Again could be loose connections.

[issue] MPU starts giving random readings
posted 1 year, 4 months ago by Alex JV

Sometimes MPU6050 starts giving really sporadic readings. Cause unknown. Typically it happens when there is a sudden jerk. Loose connects screwing up with logic?

Gyro offsets for the first sensor
posted 1 year, 4 months ago by Alex JV

accelgyro.setXGyroOffset(82);
accelgyro.setYGyroOffset(-59);
accelgyro.setZGyroOffset(30);

Code used for testing motor driver and the motors
posted 1 year, 4 months ago by Alex JV


int val=255;
void setup() {
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
Serial.begin(9600);
// pinMode(11, OUTPUT);
}

void loop() {
analogWrite(11,val);
// digitalWrite(11, HIGH);

digitalWrite(12, LOW);
digitalWrite(13 ...

read more
PWM
posted 1 year, 4 months ago by Alex JV

PWM works between 0 to 255. This motors stops moving at values below PWM value of 95.

Arduino sketch used for testing the encoders on each motor
posted 1 year, 4 months ago by Alex JV

#include <elapsedMillis.h>

elapsedMillis timeElapsed;
int val=0;
int sensorPin = A0;
int interval = 1000;
int count=0;
int ledState=0;
int dVal=0;
int pdVal=0;

void setup() {
pinMode(13 ...

read more
Tackling anticipated issues in the least time possible
posted 1 year, 4 months ago by Alex JV

Since time is our biggest constraint, to see how much can we work with backlash, we buy 3 different quality of motors and see how much backlash we can tolerate.

Anticipated issues
posted 1 year, 4 months ago by Alex JV

1) Backlash from motors
2) Lack of sensitivity of rotary encoders

2 Files
MPU6050_calibration.ino
uploaded 1 year, 4 months ago by Alex JV Download File
Code for calibrating the MPU 6050 sensor
self_balance3.ino
uploaded 1 year, 3 months ago by Alex JV Download File
Self balancing code used for robot for the workshop
0 Documentations