Using Arduino with Parts and Sensors – Accelerometer Part 2

Arduino accelerometer

Arduino accelerometer
In the first part, we covered the basics on how to use the accelerometer. Today, we will take the horizontal camera device we created in part 1, and create a handheld version. When dealing only with sensors, all we need is an Arduino, a breadboard, a sensor, and some electronic parts to test it. But to create a practical device, we need to think about the materials for the non-electrical circuit parts, the external appearance, and some other factors. Today, we will go over them by creating a handheld version.

Today’s Electronic’s Recipe

Expected time to complete: 90 minutes

Parts needed:

Thinking About the Design of the Device

First, let’s think about the design of the device and prepare the materials accordingly. We can use the electrical circuit from the last session for starters. Now, let’s think about how to use various materials and parts to create a handheld version.

Horizontal camera platform

Picture 1 Horizontal camera platform from part 1

When we look back at the horizontal camera platform that we created in part 1, we notice that we can probably use the extended part to create a handheld version. Try to get a brief image of the completed item in your head. Here is a rough sketch I did (Figure 1).

Design plan hand-held horizontal camera device

Figure 1 Design plan for the handheld horizontal camera device

Let’s start creating the device with this image in mind. We can decide the details first, but unless you know how to connect a servo motor with the case or know which materials/parts to choose considering strength and workability, it’s probably better if you go to a hardware store and decide the details based on the items you find there.

I couldn’t think of a specific part to fix the servo motor at this point. I went to the hardware store to find one. Ideally, I’d like to create a nice 3D model first, then create an original device. The problem is that the camera platform created by the 3D printer seemed weak, so I gave that up. There are other ways like using a CNC milling cutter to cut out iModela-like materials from a 3D design. If you want to create custom parts, it can get tricky. So for now, we will use handy parts we can find at the hardware store.

Here Are the Parts!


Picture 2 Materials I bought from the hardware store

I went to the hardware store and picked out some parts that looked useful for the device. I think connecting the servomotor will be the key in this project. Hence, I took the servomotor to the store and tried it with different parts to find the most suitable ones.

Building the Device

Let’s start building. I used wood for the handle part because it’s easy to work with. By using a jigsaw, it’s easy to cut out complicated shapes. I will use steel parts for the part that connects the servomotor because it is robust.

Steel part to connect with the servo motor

Picture 3 Steel parts that looks useful for connecting the servomotor

Servo motor and handset

Picture 4 The Servomotor which will be set on the handle

making room for the servo motor in the handle

Picture 5 Using a jigsaw to make room for the servomotor in the handle

Placing the servo motor in the handle

Picture 6 Placing the servo motor in the handle

Connecting the servo motor and the steel parts

Picture 7 Connecting the servo motor and the steel parts with screws using the holes (backside)

Connecting the servo motor and the steel parts

Picture 8 Connecting the servomotor and the steel parts with screws using the holes (front side)

Except for the middle hole, the holes on the white plastic connector part on the servo motor are small. But it will not break even if you twist the screw. So, you can insert the screw directly as shown in Picture 7.

Connecting it with the servo motor

Picture 9 Connecting it with the servomotor

Ok, the first servo motor looks pretty good. Next, let’s think about how to mount the second servo motor.

Fixation with screws and nuts

Picture 10 Fixing steel part with screws and nuts

When I connected the first servomotor, there was another steel part of a different size. Hence, to fix the second servo motor on the platform, I used this part with screws and nuts.

Using screws and nuts to fix it in place

Picture 11 Using screws and nuts to fix it, the second servomotor is now set on the platform

After building this, I checked the connecting parts by hand. There doesn’t seem to be any problem in terms of strength.

Temporary Assembling the Device

Before mounting the other parts after the servomotor, let’s assemble the device and see how it turns out.

Temporary assemble the device

Picture 12 Temporary assembling the device

Arduino UNO is too big. Even worse, we probably need 2 breadboards for wiring, which makes it much thicker…

Let’s use the Arduino Pro Mini we used in the RC car article and make it smaller.

Arduino Pro Mini and accelerometer

Picture 13 Arduino Pro Mini and the accelerometer

By using Arduino Pro Mini, we can fit all parts on one breadboard. Now, let’s build the circuits. First, we will assemble the accelerometer. The circuit is the same as the Arduino UNO from our previous article. With a Pro Mini, the connecting parts are different, so pay attention to the letters on the board when assembling.

Arduino circuit connected with accelerometer

Figure 2 Circuit that connects the accelerometer to Arduino

building the Arduino circuit

Picture 14 Building the circuit

Everything fits on one breadboard!

Mounting the circuit on the device

Picture 15 Mounting it on the device

The backside of the breadboard has a double-sided tape. So, stick it on the handle part.

Adjusting the Accelerometer Parameter

Now that we have some basis, let’s adjust the values on the accelerometer. Using the program from part 1, check the sensor value before connecting to the servo motor. Now, in this case when we hold the hand, the accelerometer will be horizontal by default, so consider that when setting up the program.

value from the accelerometer

Figure 3 Checking the values from the accelerometer

Holding the device horizontally, record the default value of XYZ. Then, tilt the device 90 degrees front/back and left/right, then record the minimum/maximum value relative to the XY axis. (The minimum/maximum is at the center of the accelerometer = horizontal value)
Use this value and reflect them to the program to move the servomotor.

Here the values we got:
X axis Min 355 – Max 751 | Center553 (Front/back198)
Y axis Min 316 – Max 758 | Center536 (220)

The servomotor SG90 we are using will rotate 90 degrees, so when parallel, it’s 45 degrees. Then, mount it with the program so that even if it tilts by 45 degrees (0 ~ 90 degrees), it will maintain the parallel status.

Arduino circuit completed

Figure 4 Completed circuit

Let’s Mount the Camera and Try It!

We are done. Let’s mount the camera and see if it works.

Putting the smartphone on the platform

Picture 16 Placing the smartphone on the platform

Let’s hope it works!

Turn On! Wow, it looks like a newborn deer!

When there was nothing on it, it was pretty smooth. But as soon as I placed the smartphone, the servo motor seemed to lack power, even though it was trying really hard. But this is all part of creating something new I guess. Regardless, it looks like the smartphone is too heavy.
To improve on this, we can use stronger servomotors or use a lighter smartphone. If we use a USB webcam or a GoPRO, it may work better. To change the servomotors, we need to get a servomotor that performs accordingly to the weight of the smartphone. When choosing a servo motor, do so by looking at the rotating angle, speed, torque, operating voltage, and size. The SG90 we used today had a torque of 1.8kgf・cm, speed of 0.1 second/60degrees, and an operating voltage of 4.8V (~5V). We didn’t have enough power today. It might be a good idea to get one with a stronger torque. The necessary torque for a servomotor can be calculated with the equation below. However, the actual center of gravity can be quite difficult to find. Try using an approximate number when using the equation.

Necessary torque for a servo motor = Center of gravity x distance x angle


Today, we mounted the horizontal camera device handheld version. In the process, we experienced many issues, including choosing the right material for the device and other technical problems after the device was assembled. This type of horizontal camera device is usually known as steadicam or camera gimbal. Recently, with the rise of quadcopters, there are many camera platforms available.
To take our platform to such levels, we need to use something called a brushless motor, because the noise made by a regular servo motor when it rotates can interfere when taking a video. We may also need a multi-axis sensor with a gyro instead of a 3-axis sensor for the accelerometer sensor to make the motion smoother. The list of improvements goes on and on.
But taking it one step at a time and learning new things about electric circuits and materials on the way is what makes working with electronics awesome.

In our next article, we will deal with “sound” using Arduino!