Accelerometer Tutorial #3: Arduino Self-Balancer

Tiny9 presents the Arduino Self-Balancer just using an Arduino Nano, a servo, and the Tiny9 LIS2HH12 Module.

Step 1: Self-Balancer

Picture of Self-Balancer

In actuation systems for automated drones, hover boards, segways, etc. there is an accelerometer that helps the micro-controller tell motor or servo know what to do.

In the case of hover boards and segways they use and accelerometer as an inclinometer, a device that measures the angle you are at. The desired angle it wants to be at is 0 degree forward or backward, so straight up. If the angle is any degree backward or forward the person would fall over. Example a person balancing on top of a ball. (very hard to do) If the person on the ball leans forward or backward too much with out correcting themself then they will fall off the ball. But if the person is correcting themself on the ball, then they will stay on top of the ball.

Arduino UNO Super Starter Kit

Step 2: Materials

The materials you would need for this tutorial are:

You can find them all at this location-Kit

1: Arduino nano or arduino compatible

2: Tiny9: LIS2HH12 Module

3: 5volt Servo (mine is futaba s3114)

4: 24 AWG Wire

5: Wire Strippers

6: Bread Board

Optional items

7: Tiny9: RGB Module (Make the lights turn colors if it is in the wrong or right position)

8: PerfBoard (I used it to show an object move in the video at the end of this tutorial)

9: 1/18 drill bit

10: Drill

11: Screw driver

Step 3: SetUp

Picture of SetUp
Picture of SetUp

To get to this point in the tutorial for setup follow the instructions on these tutorials:

Tinee9: LIS2HH12 3-axis accelerometer module

Optional tutorial if you want to use the RGB Module

Tinee9: RGB LED Module

After you have set up your breadboard to this point then we can do these steps.

1: Attach a wire to the red line on the breadboard and connect the other side to the red wire socket on the servo

2: Attach a wire to the blue line on the breadboard and connect the other side to the black wire socket on the servo

3: Attach a wire to D6 on the Arduino Nano and connect the other side to the white wire socket on the servo

Whooo Hooo all done super simple.

If you are attaching a perfboard to the servo like me then her are some steps:

4: Drill in the middle of the perfboard with the 1/18 drill bit.

5: Screw the screw into the middle of the Perfboard and connect it to the servo on the other side.

Arduino Starter Kit – English Official Kit With 170 Page Book – K000007

Step 4: Download .ino

Download here from github the Tiny9: Self Balancer .ino for arduino.

Upload it to the Arduino Nano.

Step 5: Now Enjoy!!!

Now that everything is hooked up and you have the the code in the arduino, move the X axis (see video for orientation) of the breadboard and see the servo move.

Once you have played with the servo for awhile change the code and make it go faster, slower, or create a magnetic robotic arm that can move up and down and pick up things with its magnet.

Please subscribe.

Thanks everyone and keep inventing.

Disclaimer: This blog is solely Tinee9’s opinions through electrical engineering experience and does not have exact knowledge of the inner workings of DJI products that would compromise IP, or patent infringement. DJI is not a sponsor of Tinee9 but Tinee9 is apart of DJI affiliate and Amazon affiliate program to help earn revenue to keep the website going.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s