Gyro Camera for Motorcycle using Arduino

Arduino Gyro Camera

As seen in MotoGP Race, the rider is seen riding through corners while laying aside his bike to the left and right. But there is an interesting moment when the motor looks to collapse sideward, the front views remain horizontally. How could that be?
Such onboard camera applies GYRO system, where the camera will be fixed perpendicular to the gravity of the earth.

Arduino Gyro Camera

Step 1: BUILD YOUR OWN GYRO CAMERA

We could build our own Gyro Camera by using GYRO and ACCELEROMETER modules.
They are two separate modules, hence we have to use two modules simultaneously. Then we make Gyro Chip and Accelerometer Chip in one module (there are two chips in one module). In latest version they are made in one chip only, thus minimizing the distortion of movement calculation

In this article, the module is Triple Axis Accelerometer & Gyro Breakout – MPU-6050, which has 3-axis gyroscope and 3-axis accelerometer in one chip, supplied by power of 3.3volt.

In addition to module MPU6050, the following similar modules could also be applied:
• IMU Fusion Board – ADXL345 & IMU3000
• IMU Digital Combo Board – 6 Degrees of Freedom ITG3200/ADXL345

Module MPU6050 with its tiny size of 20mm x 15mm and height of 1.6mm.

If you using different board than Arduino Uno R3, SCL and SDA pins of MPU are also different:

VDD : +3.3V
VIO : +3.3V
GND : GND
SDA : Pin A4 (Arduino Uno, Ethernet) / Pin 20 (Mega2560, Due) / Pin 2 (Leonardo)
SCL : Pin A5 (Arduino Uno, Ethernet) / Pin 21 (Mega2560, Due) / Pin 3 (Leonardo)

Step 2: PROGRAMMING

After having completely assembled, it is time now to upload the program to Arduino.

This circuit is only to drive servo in axis-X only. However, data from Axis Y and Z are still required for the respective Gyroscope and Accelerometer. I tried to combine them by applying Kalman Filter calculation so as to reduce ‘noise’ output from Gyroscope + Accelerometer so that servo movement is smooth and no unwanted movement.

Arduino Gyro Camera circuit

CODE:

/*
GYRO CAMERA - saft7.com

Demonstrates auto-leveling Camera Video by using Gyro & Accelerometer with Arduino

The circuit:
Servo controlled by Arduino, using Gyro and Accelerometer as reference of movement.

Created March 12, 2013
by Firmansyah Saftari
www.saft7.com

This code and complete article can be found at:

http://www.saft7.com/

Programming Language: C++

*/

#include <Servo.h>
Servo xservo;

#include <Wire.h>
#include "Kalman.h"
Kalman kalmanX;
Kalman kalmanY;

uint8_t IMUAddress = 0x68; // MPU6050 Address

[box color=”#985D00″ bg=”#FFF8CB” font=”verdana” fontsize=”14 ” radius=”20 ” border=”#985D12″ float=”right” head=”Major Components in Project” headbg=”#FFEB70″ headcolor=”#985D00″]The components are:
• Triple Axis Accelerometer & Gyro Breakout – MPU-6050
• Arduino UNO R3
• Digital Servo (use good and powerful servo)
• Breadboard Mini
• 9v Battery + Switch
• Box and other accessories.[/box]

Step 3: Build the Camera Bracket

I use 2 mm Acrylic 2mm, bent by heating. Make the necessary holes for servo installation and for the camera bolt.

Camera bolt was taken from an unused small tripod so as to ease the camera installation.

Arduino Board is installed onto the box plate.

Arduino, Servo and MPU6050 have been installed on the box.

Video of Servo testing on box

Read more: Gyro Camera for Motorcycle using Arduino

Leave a Comment

Your email address will not be published. Required fields are marked *