(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

## Overview

Make a uniaxial Steadicam with motor module and motion module, and control the motor to spin through leaning the platform right or left.

## Module List

### Module

 Module Number Function mCookie-Core 1 Core board Battery box 1 Program download and power supply mCookie-Hub 1 Sensor adapter plate Servo 1 Servo Servo Connector 1 Servo connector Motion module 1 Detect motion, equivalent to a gyroscope

### Other Equipment

• USB cable*1
• Building blocks or other fixation structures

## Module Setup

### Setup

• Assemble modules and sensors together:
• Connect the servo to pin 6/7 of Hub through servo connector, note that connect it to the lower pins of the connector;
• Stick the red core module, green Hub and yellow motion module to the yellow battery base;
• Plug one end of the USB cable into the battery base and connect the other to the computer;

## Programming

### Programming Thought

Pitch: when the X axis arrow points to the horizontal direction, the pitch degree is 0; when it points to left horizontally, the pitch degree is 0; when it points to top vertically, the pitch degree is 90; when it points to bottom, the pitch degree is -90.

When the base of the platform is level, the servo should be kept at 90 degrees, at this moment, the pitch degree is about 0 degree.

When the base leans up (the arrow of X axis of the motion module points to top), the pitch degree is between 0-90, the degree of the servo is the sum of 90 degrees and the pitch degree. The degree of the servo is between 90-180.

When the platform leans downward (the arrow of X axis of the motion module points downward), the pitch degree is between 0-90 degrees, the degree of the servo is the sum of 90 degrees and the pitch degree. The degree of the servo is between 90-0.

### Start to Program

Motion DMP solution, the degree of pin 6 servo is the sum of pitch degree +60

Test the result
After powering on, keep the motion module level for 5s, lean the platform at pitch direction, and the servo can make the platform level always.

Q: If the motion sensor is stuck to the other end of the battery base, what will happen?
A: Under that situation, the pitch degree of the motion module is just opposite to the original one, you can change the 90+pitch degree in the code into 90-pitch degree.

Send the pitch degree to the serial monitor