open source selfbalance robot system · 22/06/2016 open source selfbalance robot system microduino...

13
22/06/2016 Open Source Selfbalance Robot System Microduino Wikipedia 1/13 Open Source Selfbalance Robot System Contents 1 Overview 2 Bill of Material 2.1 Bill of Modules (Joypad Mode) 2.2 Bill of Modules (Bluetooth Mode) 2.3 Other Material 3 Program Download 4 Programming 5 Buildup Steps 6 Operation Description 6.1 Joypad Remote Control Instructions 6.2 BLE Control Guide 6.3 Lithium Battery Charging 7 Code Description 8 FAQ 9 Video Overview Project: Microduino Open Source Selfbalance Robot Objective: To DIY your own twowheel selfbalance robot. Difficulty: Medium Timeconsuming: 2Hour Maker: Introduction: This twowheel selfbalance robot integrates multiple functions. It is also the study topic that combines automatic control theory, dynamics theory and technology. It can accomplish selfbalance 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)

Upload: others

Post on 28-Jun-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Open Source Selfbalance Robot System · 22/06/2016 Open Source Selfbalance Robot System Microduino Wikipedia 2/13 Module NumberFunction MicroduinoCore+ 1 Core board MicroduinoUSBTTL1

22/06/2016 Open Source Self­balance Robot System ­ Microduino Wikipedia

1/13

Open Source Self­balance Robot System

Contents

1 Overview2 Bill of Material

2.1 Bill of Modules (Joypad Mode)2.2 Bill of Modules (Bluetooth Mode)2.3 Other Material

3 Program Download4 Programming5 Buildup Steps6 Operation Description

6.1 Joypad Remote Control Instructions6.2 BLE Control Guide6.3 Lithium Battery Charging

7 Code Description8 FAQ9 Video

Overview

Project: Microduino Open Source Self­balance RobotObjective: To DIY your own two­wheel self­balance robot.Difficulty: MediumTime­consuming: 2­HourMaker:Introduction:

This two­wheel self­balance robot integrates multiple functions. It is also the study topic that combines automaticcontrol 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)

Page 2: Open Source Selfbalance Robot System · 22/06/2016 Open Source Selfbalance Robot System Microduino Wikipedia 2/13 Module NumberFunction MicroduinoCore+ 1 Core board MicroduinoUSBTTL1

22/06/2016 Open Source Self­balance Robot System ­ Microduino Wikipedia

2/13

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

Page 3: Open Source Selfbalance Robot System · 22/06/2016 Open Source Selfbalance Robot System Microduino Wikipedia 2/13 Module NumberFunction MicroduinoCore+ 1 Core board MicroduinoUSBTTL1

22/06/2016 Open Source Self­balance Robot System ­ Microduino Wikipedia

3/13

Program Download

Download source programs from the address below: BalanceCar_Microduino(https://github.com/Microduino/BalanceCar_Microduino_PID)

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 thecorresponding 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.

Insert Structure­B1 and Structure­B2 into the two sides of Structure­A1.

Page 4: Open Source Selfbalance Robot System · 22/06/2016 Open Source Selfbalance Robot System Microduino Wikipedia 2/13 Module NumberFunction MicroduinoCore+ 1 Core board MicroduinoUSBTTL1

22/06/2016 Open Source Self­balance Robot System ­ Microduino Wikipedia

4/13

After "Step 1", you just completed the buildup of Frame of the robot

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 installedsymmetrically.

You just finished the installation of Motor parts .

Page 5: Open Source Selfbalance Robot System · 22/06/2016 Open Source Selfbalance Robot System Microduino Wikipedia 2/13 Module NumberFunction MicroduinoCore+ 1 Core board MicroduinoUSBTTL1

22/06/2016 Open Source Self­balance Robot System ­ Microduino Wikipedia

5/13

Step3:Follow the Figure 3­1, insert the Motor parts to the Frame of the robot. Please be noted the motor interface needs tocorrespond to the gap of the Frame of the robot.

After that, please insert the Structure­B1 into the slot gap to make sure the Motor parts are fixated firmly.

You just finished the assembly of the Chassis of the robot

Page 6: Open Source Selfbalance Robot System · 22/06/2016 Open Source Selfbalance Robot System Microduino Wikipedia 2/13 Module NumberFunction MicroduinoCore+ 1 Core board MicroduinoUSBTTL1

22/06/2016 Open Source Self­balance Robot System ­ Microduino Wikipedia

6/13

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.

See the result of that in Figure 4­2.

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.

Page 7: Open Source Selfbalance Robot System · 22/06/2016 Open Source Selfbalance Robot System Microduino Wikipedia 2/13 Module NumberFunction MicroduinoCore+ 1 Core board MicroduinoUSBTTL1

22/06/2016 Open Source Self­balance Robot System ­ Microduino Wikipedia

7/13

Refer to the following Figure 5­2, use Structure­A3, Structure­C4 and Structure­C5 to fixate the structure of the robot.

After Step5, it is as shown in the figure 5­3 :

Page 8: Open Source Selfbalance Robot System · 22/06/2016 Open Source Selfbalance Robot System Microduino Wikipedia 2/13 Module NumberFunction MicroduinoCore+ 1 Core board MicroduinoUSBTTL1

22/06/2016 Open Source Self­balance Robot System ­ Microduino Wikipedia

8/13

Step6:Fixate theMicroduino­Stepper with nylon screws, nylon columns and nylon nuts on the top of the Chassis of therobot.

Note: Please refer to the installation procedure strictly as shown in the picture to assemble the base board ofMicroduino­Stepper.

Then stack the following modules on the base of Microduino­Stepper.Core Module: Microduino­Core+Attitude Module: Microduino­MotionCommunication Module:

Under Joypad mode, the communication module is Microduino­nRF24(Please firstly install 2.4G antenna)Under BLE mode, the communication module is Microduino­BT

Connect the Stepping motor to Microduino­Stepper with Stepper cable .Please be noted of the interface position of the two Stepper cables.

Page 9: Open Source Selfbalance Robot System · 22/06/2016 Open Source Selfbalance Robot System Microduino Wikipedia 2/13 Module NumberFunction MicroduinoCore+ 1 Core board MicroduinoUSBTTL1

22/06/2016 Open Source Self­balance Robot System ­ Microduino Wikipedia

9/13

Note: Please be noted of the installation direction when connecting the stepper cables.

Step7:Insert 2S battery into the battery interface of Microduino­Stepper, and the robot is powered on. Lift the robot and it'll stay

Page 10: Open Source Selfbalance Robot System · 22/06/2016 Open Source Selfbalance Robot System Microduino Wikipedia 2/13 Module NumberFunction MicroduinoCore+ 1 Core board MicroduinoUSBTTL1

22/06/2016 Open Source Self­balance Robot System ­ Microduino Wikipedia

10/13

stand up and keep balance.

Operation Description

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

Joypad Remote Control Instructions

Refer to the link for the buildup: Joypad User Guide (https://www.microduino.cn/wiki/index.php/Microduino­Joypad_Getting_start)

Joypad Communication Mode Configuration*For the mode configuration, you can refer to: Communication Mode Configuration(https://wiki.microduino.cc/index.php/Microduino­Joypad_Getting_started#Communication_Protocol_Configuration)

When we use Microduino­nRF24 as the Communication module, for the Joypad, you can choose nRF mode.Joypad Battery Use*Battery Use Instruction (https://www.microduino.cn/wiki/index.php/Microduino­Joypad_Getting_start/zh#Step­3_.E7.94.B5.E6.B1.A0.E9.80.9A.E7.94.B5)

BLE Control Guide

Download the BLUE remote control (Android) here: File:MTank.rarMake 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 underlow 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 batterybalance charger and plug in the power.

Page 11: Open Source Selfbalance Robot System · 22/06/2016 Open Source Selfbalance Robot System Microduino Wikipedia 2/13 Module NumberFunction MicroduinoCore+ 1 Core board MicroduinoUSBTTL1

22/06/2016 Open Source Self­balance Robot System ­ Microduino Wikipedia

https://wiki.microduino.cc/index.php?title=Open_Source_Self­balance_Robot_System 11/13

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(https://www.microduino.cn/wiki/index.php/Microduino­Joypad_Getting_start/zh#nRF.E6.A8.A1.E5.BC.8F.E9.80.9A.E9.81.93.E9.85.8D.E7.BD.AE)

#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 PITCHdirection.

#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

Page 12: Open Source Selfbalance Robot System · 22/06/2016 Open Source Selfbalance Robot System Microduino Wikipedia 2/13 Module NumberFunction MicroduinoCore+ 1 Core board MicroduinoUSBTTL1

22/06/2016 Open Source Self­balance Robot System ­ Microduino Wikipedia

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 Steppercable is connected correctly.

Q:What if you find the robot tilt to one side over the course and hear abnormal sound generated by the Steppingmotor ?

A:At this time, you can toggle the robot to the other side and it'll stand up and go back to normal instantly.

Page 13: Open Source Selfbalance Robot System · 22/06/2016 Open Source Selfbalance Robot System Microduino Wikipedia 2/13 Module NumberFunction MicroduinoCore+ 1 Core board MicroduinoUSBTTL1

13/13