Open Source Self-balance Robot System

From Microduino Wiki
Revision as of 05:09, 22 March 2016 by Admin (talk) (Buildup Steps)
Jump to: navigation, search

Overview

  • Project: Microduino Open Source Self-balance Robot
  • Objective: To DIY your own two-wheel self-balance robot.
  • Difficulty: Medium
  • Time-consuming: 2-Hour
  • Maker:
  • Introduction:
    • This two-wheel self-balance robot integrates multiple functions. It is also the study topic that combines automatic control theory, dynamics theory and technology.
    • It can accomplish self-balance and also support several ways of remote control.
      • Remotely controlled by Joypad.
      • Remotely controlled by Bluetooth APP.
**This project is totally achieved with Microduino. Users can experience the fun of DIY. 

Bill of Material

Bill of Modules (Joypad Mode)

Module Number Function
Microduino-Core+ 1 Core board
Microduino-USBTTL 1 Download program
Microduino-nRF24 1 Wireless communication
Microduino-Motion 1 Attitude detection
Microduino-Stepper 1 Drive board

Bill of Modules (Bluetooth Mode)

Module Number Function
Microduino-Core+ 1 Core board
Microduino-USBTTL 1 Download program
Microduino-BT 1 Wireless communication
Microduino-Motion 1 Attitude detection
Microduino-Stepper 1 Drive board

Other Material

Module Number Function
2.4G antenna 1 2.4G communication
Fixation board 1 For fixation and support
M2 nylon screw 4 Plate fixation
M2 nylon column 4 Plate fixation
M2 nylon nut 4 Plate fixation
Short copper column 8 Fixate the motor
M4 metal screw 2 Fixate wheels
2S Li-ion battery(7.4V) 1 Power supply
Lithium battery balance charger. 1 Lithium battery charger
Micro-USB cable 1 Serial communication & program download
Axis connector 2 Connect the motor axis and the wheel
Wheel 2 Structure
Stepping motor 2 Drive wheels
Stepper cable 2 Connect the motor and the drive board
Balancematerial1.jpg
Balancematerial2.jpg

Program Download

Download source programs from the address below: BalanceCar_Microduino

Programming

  • Stack Microduino-Core+ and Microduino-USBTTL together.
    • Connect Microduino-USBTTL/zh with a USB cable for program uploading after that.
    • Attetnion: Please upload the program before stacking all modules.
  • Open Arduino IDE for Microduino environment. (For the buildup, please refer to: AVR Core:Getting started)
  • Click【Tool】, select the right board card(Microduino-Core+) and the processor(Atmega644pa@16M,5V) and chose the corresponding port COMX.
  • Click 【File】->【Open】, scan to the project program address, click “BalanceCar_Microduino.ino” and open it.
  • After all that finished, please click "→" and download programs the development board.

Buildup Steps

  • Step1:
  • Connect Structure-A1 and Structure-A2 as shown in Figure1-1.
Balancestep1-1.jpg
  • Insert Structure-B1 and Structure-B2 into the two sides of Structure-A1.
Balancestep1-2.jpg
  • After "Step 1", you just completed the buildup of Frame of the robot
Balancestep1-3.jpg
  • Step2:
  • Follow the Figure 2-1, connect the two stepping motors and Structure-C1, then fixate them with Copper columns .
    • Please be noted the direction of the motor interface. The interfaces of the two motors should be installed symmetrically.
Balancestep2-1.jpg
  • You just finished the installation of Motor parts .
Balancestep2-2.jpg
  • Step3:
  • Follow the Figure 3-1, insert the Motor parts to the Frame of the robot. Please be noted the motor interface needs to correspond to the gap of the Frame of the robot.
Balancestep3-1.jpg
  • After that, please insert the Structure-B1 into the slot gap to make sure the Motor parts are fixated firmly.
Balancestep3-2.jpg
  • You just finished the assembly of the Chassis of the robot
Balancestep3-3.jpg
  • Step4:
  • Fixate the Axis connector on the axis of the Stepping motor as shown in the Figure 4-1.
  • Then fixate the Wheels on the Axis connector with Screws.
Balancestep4-1.jpg
  • See the result of that in Figure 4-2.
Balancestep4-2.jpg
  • Step5:
  • Follow the Figure 5-1 and put the 2S battery into the slot of the Chassis of the robot .
  • Then, fixate Structure-C2 and Structure -C3 on the upper and lower sides of the Chassis of the robot respectively.
Balancestep5-1.jpg
  • Refer to the following Figure 5-2, use Structure-A3, Structure-C4 and Structure-C5 to fixate the structure of the robot.
Balancestep5-2.jpg
  • Check out the result here:
Balancestep5-3.jpg
Balancestep6-1.jpg
  • Connect the Stepping motor to Microduino-Stepper with Stepper cable .
    • Please be noted of the interface position of the two Stepper cables.
Balancestep6-2.jpg
BalancestepLine.jpg
  • Note: Please be noted of the installation direction when connecting the stepper cables.
Balancemotor.jpg
  • Step7:
  • Insert 2S battery into the battery interface of Microduino-Stepper, and the robot is powered on. Lift the robot and it'll stay stand up and keep balance.
Balancestep7-1.jpg

Operation Description

  • If stacking nRF24 module in Step6, the robot will enter Joypad remote control mode by default after power-on, or it'll enter BLE mode.

Joypad Remote Control Instructions

BLE Control Guide

  • Download the BLUE remote control (Android) here: File:MTank.rar
  • Make sure the phone is Android 4.3 or higher. and the Bluetooth function is open.
  • Search the Bluetooth device “Microduino” and connect.
  • Then, you can control via the APP.

Lithium Battery Charging

  • If you find the motor rotates slowly during use or the self-balance robot can't stand up. At this time, the 2S battery is under low battery, which needs to use the supporting lithium battery balance charger.
  • Follow the picture below and insert the white 3pin interface of the 2S battery into the 3pin interface of the Lithium battery balance charger and plug in the power.
BalanceCharge1.jpg
  • You can judge the charging state by the indicator of the Lithium battery balance charger as follows:
Indicator state Charging state
Green light blinks No battery connected
Red light goes on constantly The battery is charging.
Red light goes on constantly Complete charging.

Code Description

  • "userDef.h" is the config. file.
  • The code below can configure the channel under the nRF mode, which needs to be consistent with the Joypad controller.
  • For the nRF mode channel of the Joypad, you can refer to: nRF Mode Channel Configuration
#define NRF_CHANNEL 70  //nRF channel
  • You can the installation direction of the Microduino- Motion with the following code.
    • Refer to Buildup Steps / Step6 for installation direction. Microduino- Motion module need to choose PITCH direction.
#define YAW    0
#define PITCH   1
#define ROLL    2
//Attitude sensor installation direction.  
#define DIRECTION   PITCH
  • The following code can adjust the PID parameters of the self-balance robot's angle ring and speed ring.
    • Angle ring parameter setup: 
#define KP_CON 0.2 // 0.25
#define KI_CON 0        
#define KD_CON 28  // 30 28 26
    • Speed ring parameter setup:
#define KP_THR 0.065  //0.08//0.065
#define KI_THR 0.0005//0.05
#define KD_THR 0

FAQ

  • Q:What if the self-balance robot can't stand up during use?
    • A:Please refer to the following picture to judge if the Microduino- Stepper module is installed right and the Stepper cable is connected correctly.
Balancestep7-1.jpg
  • Q:What if you find the robot tilt to one side over the course and hear abnormal sound generated by the Stepping motor ?
    • A:At this time, you can toggle the robot to the other side and it'll stand up and go back to normal instantly.

Video