Let's Make Robots!

SegWii

Self balancing robot remote controlled directly by a wiimote via bluetooth
AttachmentSize
Segwii.zip4.72 KB

Hello I am Tijmen Verhulsdonck 17 years old and come form the netherlands. In the past six months I have been working on a self Balancing robot that you can control with a Wiiremote. I got the idea from Ara Kourchians he was thought of the idea to remote control a self balancing robot with a Wiimote. He never succeeded in connecting the wiimote to an Arduino and a Couple of other things.

Hey thats the great thing about open source someone else could pop up and finish your idea.

So I got the idea from Ara Kourchians and around the same time I found a youtube clip of someone controlling a servo with a Wiiremote connected to an arduino. So it was possible to connected and exchange data with a wiimote. On that point the theory said it was possible. Yes you can make a Self balancing robot with an Arduino and yes you can connected a Wiimote with an arduino.

As always it was a lot harder than assumed by me. I ran in to problems like unstable bluetooth code and had to use 2 arduino's instead of one. Because the code for connecting tot the wiimote was extremely sensitive that when you added to many lines of code it would drammaticly slow readings down and eventually become unusable. But arduino's aren't that expensive and with a sponsor backing me I decided to use 2 Arduino's. This solved the problem of the instable code and made programming the balancing part and all the other functions easier.

Okay back to the robot as I said it is self balancing, this was achieved using a IMU 5 DoF sensor from sparkfun coupled with 37D 1:29 pololu motors with encoders. The data from the IMU is filtered using a kalman filter to make a very nice smooth line. The encoders are tracked using interrupts and direct port manipulation. The connection with the wiimote was made using a Arduino clone with an atmega 328, a usb host shield form circuits@home and a csr2.3 bluetooth dongle from Sweex.

If you want more information about how a balancing bot works check out x-firm.com which has a great tutorial section for balancing robots. Oh yeah and it is a lot harder to build one than you would think (I found out the hard way).

You can find the code in the attached file and on the github link Below I will post my void loop code:

void loop() {
// ********************* Sensor aquisition & filtering *******************
  LCD();
  getMotion();  
  updateSensors();
  ACC_angle = getAccAngle();                                                 // in Quids
  GYRO_rate = getGyroRate();                                                 // in Quids/seconds
  actAngle = kalmanCalculate(ACC_angle, GYRO_rate, lastLoopTime);            // calculate Absolute Angle


// *********************** PID and motor drive *****************
  drive = updatePid(setPoint, actAngle);                                     // PID algorithm
  if(abs(actAngle-setPoint) < 100)                   Drive_Motor(drive);
  else                                               Drive_Motor(0);         // stop motors if situation is hopeless
//************************update Serial***********************
              if (b == 1) {b = 0;}else {b = 1;}
              digitalWrite(21, b);
// *********************** loop timing control **************************
  lastLoopUsefulTime = millis()-loopStartTime;
  if(lastLoopUsefulTime<STD_LOOP_TIME)         delay(STD_LOOP_TIME-lastLoopUsefulTime);
  lastLoopTime = millis() - loopStartTime;
  loopStartTime = millis();
}

In the end I want to thank:                                                       

X-firm.com For the great tutorials on balancing bots.

Ara Kourchians For the idea

Circuits@home For the usb host shield

And my sponsors:

Tu Delft

Helenparkhurst almere

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hello,

I'm Brecht and 17 years old, I also make a self balancing robot (http://letsmakerobots.com/node/36820).

At the moment, it's very hard for find the PID values, have you any tips/formulas?

The deflection of my wheels is increasing, isthat normal?

Hi Timen,

Great job with the Segwii balbot. Any chance you could post the schematic. thanks a lot

 

Hi, Wow this is such a fantastic little SegWii!

something that I/ve been wanting to build for ages, I think this might just be the inspiration I need to get it started.

 

I just have one question.. 

Would you be able to make a block diagram of how you have joined the arduino(s)/gyro/motors... together?

 

Thanks!  anazing work!

 

Nice to see that someone has hade some help from the homepage.. I'm still workig on my bot and i will try to use fuzzy logic to controll it and it has been alot more tricky to learn and finding a simple way off using fuzzy logic.. I made a simple sketch in processing using Fuzzy logic to control a object true some obsticles. See here

Can I add this bot to my homepage under "Robots built using this guide or from parts of it."

Hope I get some more time soon for my bot so I can complete the project...

Nice to speak to you I have learned a lot from your webpage!

And sure you can use it in that section, I am curious of your fuzzy logic take on balancing but I will keep checking your website.

 

 

Nice work Tijmen, it's a fast little guy. I've been work a balancing robot for the past while too so I know it not the easiest thing to do (http://letsmakerobots.com/node/25532). Have you got any more plans for SegWii?

Thanks yeah the learning curve is a pain in the ass but hey nobody said it was easy. And I actually would love to make a second bigger version that can bring beer:D. okay not only for that purpose but also the bigger the more stable it is so I can do other things with it(yet to think of). And offcourse more sensors and maybe controllable with an iPhone via bluetooth or Wifi. Also gsm and GPS would be nice but those are all dreams. For now it is done and maybe I will continu developing it in my first year of university next year(if all goes to plan).

But i have seen your robot on youtube a couple off time while looking for information and inspiration. Yours is balancing way better than mine I believe because of all the weight in the top and its bigger size. But I would reccomend looking into Wiimote control its fun and not a lot of people use it so far.

Great looking SegWii, it was great learning about the progress with Bluetooth HID and the possibility of use with $2 USB dongles!

Great project my friend, your robot looks very stable and good looking too. Also very well documented on your videos. Thanks for sharing with us and keep up the good work :-)