MultiWii based balancing robot (Segway)

Post Reply
mahowik
Posts: 332
Joined: Sun Apr 10, 2011 6:26 pm

MultiWii based balancing robot (Segway)

Post by mahowik »

Hi guys!

http://www.youtube.com/watch?v=U8bBna9iWCU

This is the demo/draft version of balancing robot based on modified/extended MultiWii 2.3 firmware.

Hardware:
- arduino nano (atmega328p)
- mpu6050 gyro-accelerometer (GY_521)
- any RC receiver with CPPM (ppmsum) output
- A4988 motor drivers
- nema 17 stepper motors
- 1/8 Buggy Wheels

p.s. Will be shared on github soon ;)

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: MultiWii based balancing robot (Segway)

Post by shikra »

damned cool

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: MultiWii based balancing robot (Segway)

Post by Crashpilot1000 »

Nice little faceplanter. I wonder if segways are absolute faceplant proof...

o_lampe
Posts: 117
Joined: Sat Nov 02, 2013 5:09 pm

Re: MultiWii based balancing robot (Segway)

Post by o_lampe »

Amazing!
Could this also be done with a brushless gimbal controller and brushless motors?
My bet is, they run smoother and faster too?!

mahowik
Posts: 332
Joined: Sun Apr 10, 2011 6:26 pm

Re: MultiWii based balancing robot (Segway)

Post by mahowik »


kukizz
Posts: 3
Joined: Wed Jun 04, 2014 9:03 am

Re: MultiWii based balancing robot (Segway)

Post by kukizz »

Hi.
Is it possible to launch The robot without RC? How to do it?

mahowik
Posts: 332
Joined: Sun Apr 10, 2011 6:26 pm

Re: MultiWii based balancing robot (Segway)

Post by mahowik »

yes, it's possible with ez-gui android tool. see experimental features there...

User avatar
ezio
Posts: 827
Joined: Sun Apr 01, 2012 11:03 pm
Location: Paris
Contact:

Re: MultiWii based balancing robot (Segway)

Post by ezio »

mahowik wrote:yes, it's possible with ez-gui android tool. see experimental features there...

I will add later today better possibility of control. It will be released as beta as it is not finish yet and very experimental.

mabaka
Posts: 21
Joined: Thu Oct 17, 2013 12:03 pm

Re: MultiWii based Segway -> on real RC 1/18 circuit

Post by mabaka »

http://youtube.com/watch?v=s30CMZcGZ_8

On a real 1/18 circuit, driven by Barbie Harley-Davidson, 1080p.

Not too fast: HTML5 slow motion mode not recommended (better use 2x).
Attachments
Balancing Wii driven by Barbie Harley-Davidson
Balancing Wii driven by Barbie Harley-Davidson

mahowik
Posts: 332
Joined: Sun Apr 10, 2011 6:26 pm

Re: MultiWii based balancing robot (Segway)

Post by mahowik »

Autumn... More time to keep soldering iron and do something cool! So let's continue! :)
Now it's stable 1.0 release of balancing robot.

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

GitHub:
https://github.com/mahowik/BalancingWii

Blogs:
http://forum.rcdesign.ru/blogs/83206/blog19661.html

Enjoy! ;)
Last edited by mahowik on Mon Nov 24, 2014 4:09 am, edited 1 time in total.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: MultiWii based balancing robot (Segway)

Post by copterrichie »

Kudos, job well done.

mahowik
Posts: 332
Joined: Sun Apr 10, 2011 6:26 pm

Re: MultiWii based balancing robot (Segway)

Post by mahowik »

Thanks! :)

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: MultiWii based balancing robot (Segway)

Post by copterrichie »

Believe it or not, I have a power wheelchair that I am going to try this on. Will keep you posted. :)

mahowik
Posts: 332
Joined: Sun Apr 10, 2011 6:26 pm

Re: MultiWii based balancing robot (Segway)

Post by mahowik »

No no no! Please don't do it! :)
Seriously it too dangerous to trust life to the toys like this!

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: MultiWii based balancing robot (Segway)

Post by copterrichie »

No one will ride on the thing, it will be a robot.

LOL, as a point of reference, this is a toy also. ;)

hot_rod-t2.jpg

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: MultiWii based balancing robot (Segway)

Post by copterrichie »

You may find this instructable interesting.

http://www.instructables.com/id/Raleigh ... g-scooter/

User avatar
dialfonzo
Posts: 62
Joined: Sun Nov 20, 2011 3:18 pm
Location: Quebec, Canada

Re: MultiWii based balancing robot (Segway)

Post by dialfonzo »

That's a very nicely done project.
I will have to try it myself.. ;)

Thanks a lot for the hard work.

Eric Nantel - DiaLFonZo

mabaka
Posts: 21
Joined: Thu Oct 17, 2013 12:03 pm

Re: MultiWii based balancing robot (Segway)

Post by mabaka »

mahowik wrote:...
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).
...


Excuse me; I can't see any difference in the GUI from the 2.3 distribution configuration. I can't find above boxes.
Moreover, 'fc' shows that your GUI files don't differ from those in the 2.3 distribution.
Maybe I'm losing something.

Question: I have steppers with 5:1 reduction. How can I adapt the software for using them?

kukizz
Posts: 3
Joined: Wed Jun 04, 2014 9:03 am

Re: MultiWii based balancing robot (Segway)

Post by kukizz »

Hi

I did everythink as you described but only mpu and beeper working, HC-06 and motors are not :( .
Sorry my eng.

regards

mabaka
Posts: 21
Joined: Thu Oct 17, 2013 12:03 pm

Re: MultiWii based balancing robot (Segway)

Post by mabaka »

kukizz wrote:Hi

I did everythink as you described but only mpu and beeper working, HC-06 and motors are not :( .
Sorry my eng.

regards


Try first the steppers alone.

Code: Select all

//simple A4988 connection
//jumper reset and sleep together
//connect  VDD to Arduino 3.3v or 5v
//connect  GND to Arduino GND (GND near VDD)
//connect  1A and 1B to stepper coil 1
//connect 2A and 2B to stepper coil 2
//connect VMOT to power source (9v battery + term)
//connect GRD to power source (9v battery - term)
/*
Motor driver pins:
- D5 - STEP1 (PORTD 5)
- D6 - STEP2 (PORTD 6)
- D7 - DIR1 (PORTD 7)
- D8 - DIR2 (PORTB 0)
- D4 - ENABLE (for both)
*/

#define LED 13
#define STEP1 5
#define STEP2 6
#define DIR1 7
#define DIR2 8
#define ENABLE 4
#define DELAY 100
#define STEPO 16   // 1, 2, 4, 8, 16
#define STEPS 400*STEPO
#define STEPS2 200*STEPO
int a1, a2;   // separate if used simultaneously

//#define ESPERA delay(DELAY)
#define ESPERA delayMicroseconds(DELAY)

void setup()
{
   pinMode(LED, OUTPUT);
   pinMode(STEP1, OUTPUT);
   pinMode(STEP2, OUTPUT);
   pinMode(DIR1, OUTPUT);
   pinMode(DIR2, OUTPUT);
   pinMode(ENABLE, OUTPUT);
   digitalWrite(LED, LOW);
   digitalWrite(STEP1, LOW);
   digitalWrite(STEP2, LOW);
   digitalWrite(DIR1, LOW);
   digitalWrite(DIR2, LOW);
   digitalWrite(ENABLE, LOW);
}

void stepa1(void)
{
   digitalWrite(STEP1, HIGH);
   ESPERA;
   digitalWrite(STEP1, LOW);
   ESPERA;
}

void stepa2(void)
{
   digitalWrite(STEP2, HIGH);
   ESPERA;
   digitalWrite(STEP2, LOW);
   ESPERA;
}

void loop()
{
   a1 = 0;
   while(a1<STEPS)
   {
      if (a1==0)
      {
           digitalWrite(LED, LOW);
           digitalWrite(DIR1, LOW);
      }
      else
      {
         if(a1==STEPS2)
         {
              digitalWrite(LED, HIGH);
              digitalWrite(DIR1, HIGH);
         }
      }
      stepa1();
        a1++;
   }

   a2 = 0;
   while(a2<STEPS)
   {
      if (a2==0)
      {
           digitalWrite(LED, LOW);
           digitalWrite(DIR2, LOW);
      }
      else
      {
         if(a2==STEPS2)
         {
              digitalWrite(LED, HIGH);
              digitalWrite(DIR2, HIGH);
         }
      }
      stepa2();
      a2++;
   }
}

kukizz
Posts: 3
Joined: Wed Jun 04, 2014 9:03 am

Re: MultiWii based balancing robot (Segway)

Post by kukizz »

Thanks mabaka for your answer.

Your example works perfect.
Additionally i connected HIGH to MS1 and MS2, you didn't write this, without this it is not working.
But I still don't know why The whole of mahowik's finaly product does not work for me.

sorry my eng.

regards

mabaka
Posts: 21
Joined: Thu Oct 17, 2013 12:03 pm

Re: MultiWii based balancing robot (Segway)

Post by mabaka »

kukizz wrote:Thanks mabaka for your answer.

Your example works perfect.
Additionally i connected HIGH to MS1 and MS2, you didn't write this, without this it is not working.
But I still don't know why The whole of mahowik's finaly product does not work for me.

sorry my eng.

regards


Note requirement:
A4988 motor drivers with 1/8 microstepping configuration (see http://www.pololu.com/product/1182/ for details)

Above example is only a wiring test. You can modify MS1, MS2 and MS3 connections and lines:
#define STEPO 16 // 1, 2, 4, 8, 16
#define STEPS 400*STEPO
#define STEPS2 200*STEPO
and check influence in total motors rotation each time.

For the real thing, first check if feedback is correct. If the thing falls at the front, motors should move it forward to compensate. If they move it backwards it will fall immediately (invert motors connection or exchange connections).

Then check if the thing follows transmitter sticks. Play with transmitter inverters or connections.

Finally, calibrate accelerometers and stabilize it (level PID). This depends heavily on weights and wheels diameter. In general:
P -> stability.
I -> precision.
D -> speed.

argotera
Posts: 17
Joined: Sun Oct 20, 2013 1:40 pm
Location: Athens, Greece

MultiWii based balancing robot (Segway)

Post by argotera »

I d like to build a smaller version. Would I have to change anything In order to use smaller nema motors? I mean besides re tuning pids.

P.s. Thanks Mahowik. Really nice project.

lokesh
Posts: 1
Joined: Sat Feb 16, 2019 5:25 am

Re: MultiWii based balancing robot (Segway)

Post by lokesh »

Hello,

It is a cool project. I am trying to recreate the entire thing but connections between Bluetooth module (HC05) and arduino nano are unclear, I am confused where to connect the TX and RX pins from HC05 to nano. Please provide some clarity on this.

Veteranton
Posts: 2
Joined: Wed Dec 25, 2019 9:13 pm

Re: MultiWii based balancing robot (Segway)

Post by Veteranton »

Здравствуйте. Кто может помочь с прошивкой ?

Veteranton
Posts: 2
Joined: Wed Dec 25, 2019 9:13 pm

Re: MultiWii based balancing robot (Segway)

Post by Veteranton »

Здравствуйте. Помогите пожалуйста разобраться. Перерыл все форумы и не могу найти ответ на свой вопрос.
Я залил в ARDUIO NANO прошивку BalancingWii не чего не меняя. Работает всё кроме шаговиков. "Смотрел" осциллографом на пинах 5,6,7,8 нет сигнала, На пине 4 (Eneble) есть. Драйвера шаговиков проверял проверочным скетчем, Все крутиться как нужно. В приложении EZ-GUI сделал все по инструкции(установил OUTы как на скрине, откалибровал акселерометр, зашел в управление, подергал джойстик и на пине 4 появился сигнал Eneble, а на 5,6,7,8 нечего(( Подскажите куда копать.
Спасибо.

songbird
Posts: 2
Joined: Sat Aug 29, 2020 2:33 pm

Re: MultiWii based balancing robot (Segway)

Post by songbird »

Hi, I'm trying to find where the HC-05 bluetooth is used in the code. Can some point me in the right direction?

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: MultiWii based balancing robot (Segway)

Post by PatrikE »

The Bluetooth is just used for connecting it to Gui normally.

songbird
Posts: 2
Joined: Sat Aug 29, 2020 2:33 pm

Re: MultiWii based balancing robot (Segway)

Post by songbird »

Yes, where can I change it? The android app does not seem to be supported so I wanted to change it to Dabble. However I cannot seem to find it in the source code.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: MultiWii based balancing robot (Segway)

Post by PatrikE »

It's done in the serial communication.
And it's based on MSP protocol.

mahowik
Posts: 332
Joined: Sun Apr 10, 2011 6:26 pm

Re: MultiWii based balancing robot (Segway)

Post by mahowik »

Veteranton wrote:
Sat Dec 28, 2019 12:40 pm
Здравствуйте. Помогите пожалуйста разобраться. Перерыл все форумы и не могу найти ответ на свой вопрос.
Я залил в ARDUIO NANO прошивку BalancingWii не чего не меняя. Работает всё кроме шаговиков. "Смотрел" осциллографом на пинах 5,6,7,8 нет сигнала, На пине 4 (Eneble) есть. Драйвера шаговиков проверял проверочным скетчем, Все крутиться как нужно. В приложении EZ-GUI сделал все по инструкции(установил OUTы как на скрине, откалибровал акселерометр, зашел в управление, подергал джойстик и на пине 4 появился сигнал Eneble, а на 5,6,7,8 нечего(( Подскажите куда копать.
Спасибо.
Извините, редко захожу сюда.
Вы скорее всего не сделали арм, т.е. не запустили его.

dsgeorgiev90
Posts: 1
Joined: Fri Jan 29, 2021 4:05 pm

Re: MultiWii based balancing robot (Segway)

Post by dsgeorgiev90 »

Hello all,

I have strange problem. After i upload the the code successfully it is able to connect to bluetooth trough the app. BUT when I try to control it all I do is hearing this loud beeeeeping sound. The motors are not moving at all. Also when I turn it on there is no action from the motors.

In order to complete the project I have used the custom PCB provided here: https://secureservercdn.net/198.71.233. ... 9/HGHG.jpg

The PCB was designed according to this diagram:
https://secureservercdn.net/198.71.233. ... 24x759.jpg

Here are the used parts:

--- Stepper motor:
NEMA 17 - (https://www.benselectronics.nl/stappenm ... ma-17.html)
Electrical Specification:
Motor Type: Bipolar Stepper
Step Angle: 1.8 deg.
Holding Torque: 40N.cm (56oz.in)
Rated Current/phase: 1.7A
Phase Resistance: 1.5Ohm±10%
Insulation Resistance: 100MΩ¸ Min, 500VDC
Insulation Strength: 500VAC for one minute


--- Controller:
A4988 Stepper Motor Driver Carrier
(https://opencircuit.shop/Product/A4988- ... er-Carrier)

--- Battery:
TATTU FUNFLY 1800MAH 11.1V 100C 3S LIPO ACCU
(https://droneshop.nl/catalog/product/vi ... o-battery/)


Please let me know if you have experienced that :)



Regards,
dsgeorgiev
Attachments
pcb.jpg
diagram.png

atlas
Posts: 1
Joined: Sun Feb 28, 2021 8:32 pm

Re: MultiWii based balancing robot (Segway)

Post by atlas »

Hey dsgeorgiev90, I have the exact same problem you described! It's driving me crazy!
Were you able to figure it out?

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: MultiWii based balancing robot (Segway)

Post by PatrikE »

Hi,
Witch firmware are you using?
Original MultiWii don't support the stepper motors!.
You need to use BalancingWii branch.
https://github.com/mahowik/BalancingWii

Tiger_one
Posts: 1
Joined: Thu May 13, 2021 12:52 pm

Re: MultiWii based balancing robot (Segway)

Post by Tiger_one »

Just finish building the balancing robot using PCB by Alper Kayar. I have SPEKTRUM DX6i using Satellite to control robot.

Cannot arm the robot. I have set the Spectrum to go from HIGH to LOW with AUX1 (flaps).
Tried BT with HC-05 and Samsung app EZ-GUI, connects but no controls or ARM??
20210511_162737#1.jpg

jimmygg
Posts: 1
Joined: Mon Aug 14, 2023 9:46 am

Re: MultiWii based balancing robot (Segway)

Post by jimmygg »

Hello!

I am very late to the party but am also attempting this project :) Unfortunately, since EZ GUI groundbase isn't maintained anymore, it no longer seems to work (It is not receiving data from the robot), so I cannot set the AUX pins. I've tried loads of other apps but have not figured it out! Has anyone managed to fix EZ GUI or found another app that works? What is the solution? Thank you all!

FYI I am loosely following Mr Innovative's tutorial (same as dsgeorgiev90 above)

Post Reply