-
Notifications
You must be signed in to change notification settings - Fork 148
/
Copy pathBalancingWii.ino
129 lines (84 loc) · 3.65 KB
/
BalancingWii.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
* Welcome to MultiWii.
*
* If you see this message, chances are you are using the Arduino IDE. That is ok.
* To get the MultiWii program configured for your robot, you must switch to the tab named 'config.h'.
* Maybe that tab is not visible in the list at the top, then you must use the drop down list at the right
* to access that tab. In that tab you must enable your board or sensors and optionally various features.
* For more info go to http://www.multiwii.com/wiki/index.php?title=Main_Page
*
* Have fun, and do not forget MultiWii is made possible and brought to you under the GPL License.
*
*/
/***
########## Extended for balancing robot by Mahowik ############
===================================
BalancingWii rev 1.0
===================================
Autumn... More time to keep soldering iron and do something cool! So let's continue! :)
This is stable 1.0 release of balancing robot (based on modified/extended MultiWii 2.3 firmware).
New features:
- Fall down?! New auto rise (stand up) function! (can be activated via box in GUI).
Now it's also possible to stand up manually when it's fall down.
- Position hold (can be activated via box in GUI).
Try to play, how it returns when you are pushing/kicking the robot.
- Possibility to control/steer from Android device by MultiWii EZ-GUI tool (go to Config -> Advanced -> Model control New)
- More stability and speed accordingly (see in video!)
- Predefined PIDs
- Simple mode for newcomers
- Set of code refactorings and cleaning.
New video:
http://youtu.be/038e2j9nE3M
Blogs:
- http://forum.rcdesign.ru/blogs/83206/blog19661.html
- http://www.multiwii.com/forum/viewtopic.php?f=7&t=4787
Enjoy! ;)
===================================
BalancingWii rev 0.1
===================================
Hi all!
This is the balancing robot based on modified/extended MultiWii 2.3 firmware.
Video:
http://youtu.be/U8bBna9iWCU
Blogs:
- http://forum.rcdesign.ru/blogs/83206/blog18515.html
- http://www.multiwii.com/forum/viewtopic.php?f=7&t=4787
Hardware:
- Arduino nano (atmega328p)
- mpu6050 gyro-accelerometer (GY_521)
- any RC receiver with CPPM (ppmsum) output OR serial Bluetooth module like HC-05
- A4988 motor drivers with 1/8 microstepping configuration (see http://www.pololu.com/product/1182/ for details)
- Nema 17 stepper motors
- 1/8 Buggy Wheels
- Buzzer
Pinout for Arduino nano (atmega328p):
- A0 - V_BATPIN: after the resistor divisor we should get [0V;5V]->[0;1023] on analogue V_BATPIN with R1=33k and R2=51k,
i.e. (+12v)~51k~(A0 pin)~33k~(GND)
- A2 - BUZZERPIN
I2C:
- A4 - SDA
- A5 - SCL
RC control:
- D2 - CPPM (PPM_SUM)
Motor driver pins:
- D5 - STEP1 (PORTD 5)
- D6 - STEP2 (PORTD 6)
- D7 - DIR1 (PORTD 7)
- D8 - DIR2 (PORTB 0)
- D4 - ENABLE (for both)
If you look to the tail of the robot:
- right motor = STEP1 & DIR1
- left motor = STEP2 & DIR2
Also see for new defines added with this project for robot setup:
#define CURRENT_AXIS PITCH // possible to choose ROLL or PITCH axis as current.
//#define INVERT_CURRENT_AXIS // invert current axis sign, i.e. instead of turning sensor board
//#define REVERSE_MOTORS_DIRECTION // reverse both motors direction
#define MAX_SPEED 400 // should be <= 500
#define MAX_TARGET_ANGLE 120 // where 10 = 1 degree, should be <= 15 degree (i.e. <= 150)
#define MAX_STEERING 90 // should be <= 100
//#define GY_521_INVERTED_BY_Z // Chinese 6 DOF with MPU6050, LLC, inverted/reversed by Z
Big thanks for the projects:
- MultiWii - my favourite to start robotics and become in love with this! :)
- B-Robot https://github.com/JJulio/b-robot
Enjoy! ;)
***/