Facebook Twitter Gplus YouTube RSS
Home » Development » Programming » EV3 Balancing Robot Program in Progress
formats

EV3 Balancing Robot Program in Progress

Last night I started translating my my NXT-G balancing robot program to the LEGO EV3 software, and here’s some progress. I didn’t bother building a proper robot yet, but it works! This program should also work with Gyroboy – more on that later.

I’m using the HiTechnic Gyroscope for now, but I’ll add support for the LEGO Gyroscope, and I’ll also try to make it work with the Dexter Industries dIMU.

I’ll post the code to this blog when it’s ready, so stay tuned!

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
45 Comments  comments 

45 Responses

  1. Irvin Stafford

    Eagerly waiting for the EV3 version of the AnyWay program!

  2. Lama-mantis

    What kind of robot will be on the full version?
    The EV3RSTORM?
    Or your own LAVA R3X?
    Succes with building!

    • That’s up to you, or anyone who builds it. I designed the program in such a way that others can adapt it without worrying about the balancing task that runs in the background.

      Maybe a self balancing Christmas tree, then?

  3. fredrikvegar

    Is the program ready soon?
    I have an Gyro Boy, but I need the program.

  4. Brian Pugh

    We bought the Lego Mindstorms EV3 for our twin boys’ Christmas. I’ve been looking — unsuccessfully — for programs written for it and for building instructions that can be used other than the 5 that come with the kit.

    Can you advise, please?

    Many thanks!

    Brian.

    • Hi Brian,

      To begin, you can build the 12 bonus projects. Three of them are featured on the back of the EV3 packaging. I designed the RAC3 TRUCK model. In the EV3 software start screen, there is a tab ‘more robots’, which is where you’ll find them.

      In addition, I’m working on a book that covers building and programming with the EV3 kit, as well as instructions for several projects you can build with the set. It will be out in June – hope you can wait until then :)

      • Dan

        After trying a few IR heli’s, I bohgut the new S107G in white. I am very impressed how precision the gears are. I have the Syma S110G and though it is a great flyer too, I like the s107 better. It is slower but it flies so well I don’t mind so much. The only difference in the remote that I can find is that it supports only two channels instead of three. This is not a con to me as I can only fly one at a time. I did remove the throttle spring as I have done to my other remotes, I find it easier to control. It’s a tough little bird and can take some abuse although I haven’t crashed this one because it is so docile and predictable. I think that Syma has made a major improvement to these little heli’s judging by previous versions. You just can’t beat the Syma 107 s in my opinion. The parts are cheap if needed but by the time you may need some you will probably be ready for a new S107G! A child can pilot this bird with little practice, so if you want something that you don’t have to constantly and tediously adjust the controls, then ..wait for it . This Birds For You!

  5. Zaid

    AnyWay balancing program for EV3?!Can’t wait !

  6. Stephane

    Hello,

    I bought the giro from the education set to add it to my home set and then tried to make the same kind of simple robot to balance using it.

    While I think I am not so far from a working balancing robot, I have a problem with this LEGO part: it drifts a lot!!
    Since it’s probably the same with other sensors, I wonder how you do get the angle of the robot. The drift seams to me not constant, no drift at the beginning and it begins to drift after some movements. Can it be related to my batteries or I am completely wrong somewhere else?

    Stéphane

  7. Tom D

    I am also very interested in seeing your code on Home » Development » Programming » EV3 Balancing Robot Program in Progress

    The math is too much for my brain so please document your logic. I am sure the anyway easy to build robot will become legendary esp with ev3 gyros thank you Laurens.

  8. Michael Tonks

    Hi there how long will it be till the program is put up.I am dying to build my own.

    PS I am very new to mindstorms.

  9. steve

    Hello
    i guess you are making EV3 Gyro boy and will release the code soon.
    Am i right??
    so i have a question..
    Are you going to make it with C or just EV3 software??

  10. fredrikvegar

    I cant wait for the balance code, I have made the NXT 2.0 balance by using an color sensor, but I cant do the same with the ev3, I cant wait to see the balance code

  11. fredrikvegar

    Where can I download NXT-G?

  12. fredrikvegar

    I made my EV3 balancing today

  13. Ian

    It looks like there has been some attempt to use the new EV3 Gyro to make balancing robots, according to this site below, it looks like the LEGO Ed Gyroboy program is attached in this blog along with some other solutions that seem to be much better. I haven’t opened or tried anything from the site yet. I have been wondering if investing in the HiTech Gyro was a better choice, and from reading this blog it seems that there are issues with the EV3 Gyro. Maybe Laurens has some insight on the EV3 sensor vs the HiTech sensor.

    http://forums.usfirst.org/showthread.php?20729-Gyro-Boy-Program

    • Fatima

      Nice post. I was checking colntastny this blog and I’m impressed! Extremely useful info specially the last part I care for such information much. I was looking for this particular info for a very long time. Thank you and good luck.

  14. Tanya

    I’m a school teacher and would love to get a copy of your program.
    Thanks
    Tanya

  15. Ian

    Did you get my comment on the GYROboy programs posted by FLL it was before my comment on Feb 18?

    Thanks,

    Ian

    • Hi Ian,

      I’m a bit behind on responding to comments due to personal circumstances (good ones – nothing to worry about). I need to manually approve posts with URL’s in them in order to prevent spam. I just went back to approve your post :)

      I’ve made some more progress on this robot as well. Maybe I’ll just go ahead and share my program and write the tutorial later.

      Best,

      Laurens

      • Lan Heng

        I am hoping that you will release your program soon so I can learn how to use the gyro sensor to balance a segway.
        Thanks

  16. kokani sumbuko

    Hi, Laurens

    Am so much pleased with what your doing. My question is, “How do I make the Ev3 31313 say something” like… “Am LEGO MINDSTORM READY TO SHOW YOU WHAT AM CAPABLE OF DOING, WELCOME”

    Thanks

  17. Eric

    Hi Laurens,
    I have tried the same thing with EV3 official Gyro sensor. It’s really hard to make it stable. But I don’t have any other gyro sensor which is compatible with EV3. Have you tried official Gyro sensor to balance?

    • Hey Eric,

      Yeah, it works with the EV3 Gyro too. At the moment, though, all the time I have for MINDSTORMS is devoted to finishing my new EV3 book :)

      When it’s off to the printer in a few weeks time, I hope I can get to upload this program. Hope you can wait until then :)

      Laurens

      • Eric

        Thanks for positive answer, Laurens. I hope that I can figure out how to make LEGO gyro working in the balance robot. It’s fun to make it work on my own without peaking your solution. :)

  18. Scott

    This is awesome! Very impressive demo. Very stable. I hope you are able to post the code soon. I have started writing my own ev3 balancing PID controller, but I’ve had troubles calibrating the ev3 gyro upon initialization. It looks like you use a simple averaging schema that I may try to incorporate. Good idea.

    Do you have any future plans for automating the PID tuning to account for different physical parameters? I would like to play around with a modified Ziegler–Nichols method. Your robot is already so stable, that you must have the tuning parameters very dialed in. I doubt that automated PID tuning could make it much better.

    I’ve been using the lego mindstorms home ev3 software. I would very much benefit from being about to examine logged data. Are there any ways to pull a log from the ev3 with the home edition? Will need to flash the firmware with ev3 firmware v1.03e.bin instead of firmware v1.03h.bin?

    What undertaking in underactuated robotics will you experiment with next?

    I am so excited to see the ported ev3 code! Can’t wait. Thanks for fighting the good fight!

    • Hi Scott,

      Thanks for your comments. Yeah, feel free to exlore the NXT-G and/or RobotC programs on this blog. The EV3 program will be similar. The RobotC program may be a bit easier to read, but the NXT-G program will give you some hints to apply that code with the graphical programming language.

      For the NXT robot, I created a PC application that let me tune the controller manually while it was running, giving instant feedback. I’ve tuned this one manually by changing values and then running it each time.

      You don’t need the Education firmware or software for data logging. You can write data to a text file and process it on your computer as you like.

      • Scott

        Hey Laurens,

        Thanks for your feedback. I have written an ev3 segway program with the mindstorms home edition software. I’ve accounted for the angular position and angular velocity of the wheels, and the angle and rate of the gyroscope in the error. I am using this term in a PID controller. There are 7 constants that need to be tuned; one for each of the metrics in the error term, and then three for the PID. Tuning has been quite difficult. As you suggested, I am logging data to a file on the ev3, pulling it to my machine, plotting the results and then adjusting the inputs. I have been unable to find a stable set of constants.

        How would you recommend I tune the 7 constants? Could you provide the constants you are using, and some sample data/values for the quantities in your controller? Here’s some sample data from my program (theta is gyro, phi is wheels):

        th, dth_dt, ph, dph_dt
        -2, -5, 10, 41.6667
        -2, -13, 7.5, -66.6667
        -2, 25, 6, -158.3333
        -2, 2, 3.5, -241.6667
        -2, 26, -0.5, -300
        -1, 53, -4, -300
        0, 49, -9.5, -325
        0, 52, -11.5, -316.6667
        1, 28, -11, -283.3333

        I’m not sure where to begin tuning. How did you start?

        In your controller, it seems like the integral is the dominate term. Can you speak to this? When do you think you’ll be able to post the code? Thanks!

        • Thomas

          Hey very cool web site!! Man .. Beautiful .. Amazing .. I’ll bookmark your web site and take the feeds also…I am happy to find a lot of useufl information here in the post, we need develop more techniques in this regard, thanks for sharing. . . . . .

  19. Alexey

    Hi Laurens

    I wonder how you can use “HiTechnic Gyroscope” with EV3, which is declared at their website as “NXT Gyro Sensor” with no statements about EV3 compatibility.

    Also wonder why did you prefer Gyro variant but not “NXT Acceleration / Tilt Sensor” by HiTechnic, which seems to be more relevant for balancing. At least they published a video for NXT based balancing robot, which uses “NXT Acceleration / Tilt Sensor”

  20. range

    i have the same object but it doesn’t work can you send the program to me

  21. barry

    Would you be able to provide the EV3 code for the IR control version?

  22. barry

    Scott’s program is FANTASTIC!

  23. Ethan

    Laurens could you make a gyro bot and program out of just #31313 and a ev3 gyro sensor? It would be greatly appreciated!!!

  24. German boy

    Hello Laurens, I’m German and so i can’t very good English. I have bought a book from you about lego mindstorms nxt 2.0 and it was very good! And of course i have watched many videos from you wich were very good, too. Now i have the ev3 set and the ev3-gyrosensor not the HI-tech senor like you. I have tested a familiar segway robot like you, but after one or two seconds it fall down. I don’t know if you can help me with the ev3 gyro-sensor but it were really nice, thanks a lot.

    (Sorry, when this is very bad Englisch)

  25. Ian

    Hi Laurens,

    I have been using your NXT-G version program for a while now in my class room settings, and the kids are amazed that a robot can stand on only 2 wheels and move, great way to talk about how humans balance and how robots balance, and that the robot is more like a child just learning to balance and walk and if they go fast they fall over.

    I have decided to use your program this summer with my camps, but with my own robot frame that can be used for other robot designs to show the kids how the robot frame can easily be used for other things.

    As I started getting things ready, I noticed an interesting thing when I starting setting up my Hitech gyro sensors, the calibration value it was giving me was anywhere from -3 to +3 which didn’t make sense from the last time I did this, after about an hour of trying to figure out what was going on and doing some internet research I decided to type in 593 to see what would happen, things started to work and after some trial and error I got the right number and things now work, trying to understand why the calibration number is so low.

    I am now trying to understand the program in more detail so I can easily use other sensors instead of the ultra sonic sensor, I have partially got program running with the light sensor but it is still not doing what I want it to do. I am trying to keep it inside a box that is out lined using black tape, do you have some hints, I have changed the ultra sonic sensor to a light sensor to be triggered by the black tape and have tried adjusting the times in timers for the backup and turn part of the program.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>