Loading...

You have no items in your shopping cart.

 
 
 
×

Registration

Profile Informations

Login Datas

or login

First name is required!
Last name is required!
First name is not valid!
Last name is not valid!
This is not an email address!
Email address is required!
This email is already registered!
Password is required!
Enter a valid password!
Please enter 6 or more characters!
Please enter 16 or less characters!
Passwords are not same!
Terms and Conditions are required!
Email or Password is wrong!
Captcha is required!
Captcha is wrong!

Making a Mini Self-balancing Car Only Two Steps

The newest Self-balancing Car Starter Kit is on sale now!

A self-stabilizing motor that will never fall sounds great. Many geeks playing arduino has come out of many self-stabilizing projects like self-stabilizing platform, motorbike etc. In this blog we will introduce an amazing arduino shield that can help you make self-stabilizing project easily. The stabilizer shield use L298P chip that is a high voltage, high current dual full-bridge driver designed to accept standard TTL logic levels and drive inductive loads such as relays, solenoids, DC and stepping motors. Besides, stabilizer shield has a standard XBee socket, so that you can use Bluetooth to control a self-balancing robot car project or something like that.

Things we use in this tutorial:

Hookup

Stabilizer is a plug-and-play arduino shield. Plug the shield in Iteaduino UNO mainboard, after assemble the car, you just need to connect motors to stabilizer shield by wires. Then the hardware hookup is done.

Debug

Download stabilizer shield demo.

Just upload the Stabilizer.ino to UNO only, I2C.ino is a support file when Stabilizer.ino compile.
After we upload the demo to Iteaduino UNO, the rest work is to debug the hardware and software problems. Now we will list some common problems we meet when we are making this project.

Hardware Problems

Stabilizer shield has been test strictly, so seldom hardware problems occur. But there are some tips when you use stabilizer shield.

1. The attitude data read normally, but motor doesn’t work. If this problem occurs, you’d better check the motor wire connection order. Please see the following picture to learn what exactly each pin is.

When you use one pulse output signal, you can only measure the motor speed. If you use two pulse output signals, you can measure the motor speed and direction in the same time.

2. You can’t upload the demo to UNO when the XBee and jumper have already plugged in stabilizer shield. Since the serial ports have been taken, you’d better unplug jumper first, and then upload the demo.

3. When you want to make the XBee communicate with PC, you should plug jumpers in the B side. Since the serial ports have been taken, you’d better upload an empty application to arduino, and then they can be communicated normally.


Software Problems

Software debugging is very important. It divides into four parts. 

  • First, read the MPU6050 accelerometer and gyroscope data through I2C to get the attitude data. 
  • Second, Kalman filtering, namely integrate the data from accelerometer and gyroscope and reach to the real angle of inclination. 
  • Third, calculate the speed and direction of wheels respectively. We use PID algorithm to calculate and control car’s movement, so that the car can keep self-balancing.
  • Forth, motor driver. The results of PID algorithm will turn in commands to drive the motor moves.
  • You can see more codes details in the demo.

Tips for software debugging

1. Pay attention to data filtering of accelerometer and gyroscope. We use three-axis accelerometer and three-axis gyroscope. Refer to the following picture of our project, X is the car movement direction, Y is the direction of wheel and axle. The accelerometer data shall be collected between the X axis and Z axis, and turn the radian into angle. The direction of gyroscope shall keep in Y.

2. The angle direction calculated by accelerometer must be in accord with the angle direction calculated by gyroscope, if not, the car can’t be self-balancing.

3. When calculate the position of wheels, you should pay attention to the direction as well.

Note:

To debug the parameter of PID is the most important thing in this project. A decimal point or a number will decide whether the car can be self-balancing moved forward.

Meanwhile, the Bluetooth function has been written in the demo, but here we didn't show up. Welcome more makers to hack this shield.

Last, I would like to say something about the short video. The self-balancing car looks so stumble. I think maybe it has a very gentle temper, like Baymax. 😛  

What do you guys think? Hope you enjoy this project.

Main contributor: Yun Li, hardware engineer from ITEAD Studio