DIY Segway: Fast, Silent, And Open

This is a picture of the guts of a diy Segway project (translated). Everything fits into a tiny space under the platform upon which the rider stands. It’s tight, but makes for a sleek look when the diamond plate is covering up all of the internals.

An ATmega644 controls the vehicle. It does so by using a PID control scheme to monitor a gyroscope, driving the wheels to maintain the center of balance. Electronically, the most complicated part of the build is the motor controller. It seems to be an original design, using an ATmega48 and several other integrated circuits. It was hard for us to figure out how this was implemented, but with some intensive study of the three schematics that go into the module we’d bet you can get to the bottom of things. We certainly like the outcome, as this personal transport is whisper quiet. Take a look at the clip after the break to hear for yourself.

Note: Be careful if you’re reusing the code from the translated link at the top. Google translator also translates the variable names in the code and might break how it works due to inconsistencies in the translation.

[youtube=http://www.youtube.com/watch?v=YAuZ9zhxNV8&w=470]

[Thanks Daniel]

35 thoughts on “DIY Segway: Fast, Silent, And Open

    1. Hey Max, thank you for the offer! If you would be willing to take a stab at the very last section on how he modified the motor’s hall effect sensors, I would greatly appreciate it.
      http://rn-wissen.de/index.php/Rutscherle_-_selbstbalancierender_Elektroroller#Motorumbau

      I find this part of the design the true innovation, and shows me that he knows a thing or three about brushless motors. I think the google translation is lacking proper context and it might actually be one of those things that can’t be translated unless you know exactly what he’s talking about. If you could try to improve the google translation I would be very appreciative. Thanks!

      1. Here’s a BLDC 16 inch hub motor ready to rocket a kid’s bike for cheap!
        http://bit.ly/pCH1Ic

        I’m sure you can find what you are looking for over there.

        I’ve ordered some stuff off of Alibaba in the past, and it will eventually get to you… shipping is slow usually. Also, if you buy some electronics they may be hand soldered… even SMT. But you get what you pay for… be prepared to do some work.

  1. Parts are too expensive and wasteful, BASECOM code is too bloated and buggy(look at the GPIO loop).

    The motor is the only thing that should break $30 USD..

    These are one of those things you wish someone with talent would just come in, properly engineer and document, and be done with it..they are cool and useful

    1. These are one of those things you wish someone with talent would just come in, properly engineer and document, and be done with it.

      … And this is one of those things where you wish someone would just do what they’re complaining about, instead of complaining.

      1. I pay bills and don’t make six figures like all these people forcing their ‘hacks’ in the name of traffic revenue..

        Maybe you should..

        It can be done for $200 without special suppliers, and get better mileage at acceptable stability and speed. Does it really need brushed metal and polished wheels with all brand name parts?

      2. The guy seems to have used the cheaperst 1KW brushless motors that you can find, build his own motor controllers as well as everything else by hand (and he shared all this)I quote “It was ensured that everything is produced with simple tools”.

        So what special suppliers are you on about?

        He even went for lead acid batteries for the cost and because you can charge them with a regular car battery charger.

        Since each motor is at least $200 how would you beat the whole segway for that much. I for one would love to see you build one even for $400. I’d be first in line to buy a kit or emulate you.

    2. xorpunk : I would say that this is a really nice build. It was surely a pretty big job building all this. My guess is that 80% of the fun was building it and 20% joyride. Personally I am very impressed with it. I could never do it my self even if I wanted to (I do). Please give the man some credit and respect. As I see it, he really deserves it. He definitely got mine!

      1. Last I checked 1KW brushless motors were $85+ and you only actually need one, if you know about physics and coefficients you know why..

        What’s really annoying is anything remotely critical on HaD these days is immediately classified as trolling, no matter the technical level and clarifications..

        How I’d do it(sorry I don’t spend what little money I make helping other people brand and market stuff published in open domains or share-licenses..):

        *Better motor for better cells(more efficient brushless solution and cheep gel cells or embedded type) ~$90+$50+s&h

        *actel or propeller chip+breadboard and gyro solution for controller ~$30

        *polymer based structure and aluminum based mechanics(JCwhitney anyone?) ~$80

        sorry I’m not cool like the engineer who drove a ten cent nail with a million dollar hammer.. I’m just a troll cause I criticized something..

      2. XORpunk – I see you are trying to make some kind of a point, but the truth is… you could never build one of these if you tried. I design motor controllers for a living and this is a very nice home-brew design. A lot of thought has gone into the packaging. The electrical design looks very nice. I see things that I would do, that most people that just hack something together wouldn’t think to do.

        If you think it would be a good idea to build this on a protoboard, you are very uneducated in electronics or are just lazy. The author created a hand etched board and it still looks a little scary to me. When dealing with high current and voltage, you don’t just want to solder it all together point to point and pray for the best. This is a fairly complicated assembly, and if it keeps breaking you will get annoyed pretty quickly. It must be designed for shock and vibration, humidity and temperature swings. A protoboard? uh… no. Actually, you said “breadboard” and if you meant the type where you plug wires into instead of soldering them – to which I would reply, are you smoking crack? Even worse!!!!!!

        This guy modified his brushless motors to provide better rotor position sensing… which is VERY interesting. If you think you can just go BUY one of these motors for $85 you will be wrong again.

        I see you want to make it cheaper… yeah great… make it all out of plywood, wheels and all. I won’t hold my breath for your version.

        @HAD – as far as the circuit goes… it looks to be a fairly basic straight up 3-phase H-bridge design with hall-effect sensor monitoring and zero-crossing detection. You can see the IRF fet driver IC’s. Thermal management looks very adequate. I’m not sure what through you for a loop. The code is not a language I’m familiar with though, and it’s unfortunate it wasn’t done in C.

      3. Breadboard is cheap compared to even a RS etching setup, and all possible solution are low emissions, so you could even wire-wrap while prototyping..

        I was a computer engineer for 3 years before being recruited as a senior software engineer by a fortune 500 company..I’m not here to try and one up people who have nothing better to do than pseudo-correct me with statement they’re not even remotely capable of validating..

        I’m genuinely interested in the function and affordability and am well aware of design concepts and restrictions, even on the emissions and efficiency levels. Feel free to enlighten me as on your technical reasoning behind the PCB etching claim..

      4. I’m genuinely interested in the function and affordability and am well aware of design concepts and restrictions, even on the emissions and efficiency levels. Feel free to enlighten me as on your technical reasoning behind the PCB etching claim..

        XORpunk – well you still didn’t clarify what your interpretation of a breadboard is… the kind you solder to or the kind you plug wires into… but I’ll discredit both for this application so hang on.

        I would normally consult the motor datasheet, but working with what I have if you do a rough calculation 1000W/36V*0.85(worst BLDC efficiency)=23.6A. This is the low end. Now look at the pictures… I don’t see three 12V batteries for each motor, do you? So 1000W/24V*(0.9 decent mid efficient BLDC)=37.5A.

        Now tell me, how the exactly are you going to get 23.6 to 37.5 amps of current through some 30awg wirewrap wires? How about telling me how many 30awg wires in parallel you would need to carry that kind of current… and how many wires can you fit on a wire wrap pin? Is it EVEN possible to distribute the wirewrap wires amongst several pins? Any answers yet? Well the same line of logic applies to 22awg solid wires in a plug in breadboard that can handle 5 wires per “node”, or if you did use a solder-able protoboard do you really think it’s smart to solder 10awg wires directly to the FET terminals? Now you can sit and think about how you would do it all, but you would just be avoiding the fact that the PCB is the cheapest and most reliable method. I like to say, just “get dumb” and use a PCB… it’s the only sensical thing to do.

        Current aside, the plug in type bread board has tons of distributed capacitance that will wreak havoc when you hypothetically in a dream state push 30A of Pulse Width Modulated current through it. Say goodbye to any chance of your 5V logic operating correctly with all of the noise that will be running through the circuitry. I’m probably the only person I know who has wire wrapped a board like I was doing a PCB layout, keeping sensitive signals away from switched high voltage and so on. Not that a wire wrapped board would even be a good idea. Most people would wirewrap the board point to point all over the place and the noise would creep in everywhere.

        I was a computer engineer for 3 years before being recruited as a senior software engineer by a fortune 500 company..I’m not here to try and one up people who have nothing better to do than pseudo-correct me with statement they’re not even remotely capable of validating..

        Like it or not, you yourself are trying to one-up people in a very abrasive way. I can’t stand people like you so the gloves are off. I’m very capable and have been designing power electronics (motor controllers, battery chargers, medical devices) and supporting test equipment for the last 16 years. This is a very ambitious project and even though I am capable of doing it, I have no desire to emulate it.

      5. “Breadboard is cheap compared to even a RS [radio shack] etching setup, and all possible solution are low emissions”

        Almost forgot, just because it’s cheap doesn’t mean it’s right. Also, you can get VERY cheap PCBs professionally done… $5 per square inch shipped and you get 3 copies of your design here:
        http://dorkbotpdx.org/wiki/pcb_order

        Breadboards are not that cheap either… just make a PCB, the software is FREE (Eagle / KiCAD).

        All possible solutions are NOT low emissions… not even close. Just because the motor isn’t arcing and sparking doesn’t mean there are zero emissions. Squarewaves have harmonics and parasitic inductance and capacitance will resonate at high frequencies. And at high current… good luck… it’s a pain in the ass. I’ve spent thousands of hours working on military compliance standards to get things to PASS emissions. BLDC controller on a breadboard? You can build it and ride it right off a cliff if you’d like to.

  2. Wow, great project, I’d get started immediately if I’d have time and money. Thanks for sharing!
    Well, if you have problems with the google translation, it doesn’t have to be you or google. I’m german and I’m not understanding this document to the fullest. Some sentences are a tiny bit uncommon.

  3. did anyone else read “DIY Segway: fast, silent, ” and hope the next part was “deadly”. ;)

    anyway, really cool but i would be hesitant to put my life in the hands of visual basic software.

  4. Criticisms aside, it is a cool effort. I have a feeling the prices he paid are because where he lives. In the USA we are very fortunate to not have to pay a VAT on everything we buy, even mail-order. Heck, if you buy something on Amazon from a different state you don’t even have to pay sales tax!

    Any ways, I think the method he chose was the one he knew best. And, it was probably a learning experience at the same time. So, he chose what was easiest and most effective for him but necessarily the most efficient implementation as far as materials and code is concerned. It’s a novice effort at best and there is nothing wrong with that. In fact, it’s pretty awesome and I myself would have never though to take on a DIY segway myself. If he was some 12+ year engineer that’d be a different story but he is not.

    Good job dude, keep it up and you will surely have a very nice job in the future! I wouldn’t be surprised if Segway would hire you someday.

  5. xorpunk : Even if you do have a point on what you say, the way you do it is negative and really bad. You got to respect the time and effort that the guy invested in this build. If you were to teach anybody like how you write, then you would fail. My guess is all you would gain is distance and fear. Who would ask you for advice if all you do is flame. But I am sure you get my point. Just not sure you really understand it. Never the less i hear you and i agree, there are room for improvement. But at the end of the day, I still think that build rocks.

  6. The original HaD post mentioned that the motor control system was a bit obscure. I’ve had a look and it seems to be a three-phase drive for a BLDC motor with Hall effect sensors.

    Before anyone asks, it’s not practical to do this kind of drive system without the Hall effect sensors. This is because the standard low-cost sensorless scheme of looking at the back EMF waveforms does not work at low/zero speed. There _are_ fancy methods around which can calculate differences in the phase inductances during operation and infer the position that way, but these methods require additional high-quality sensors and a much bigger microconroller.

    As there seems to be a bit of a cost debate going on, I’d like to make a comment: any project costs time and money. How you choose to spilt the cost is up to you.

    The skill level of the developer is also a consideration: maybe he already knew BASECOM, but not C.

    1. Yeah, I was also a little suprised that the HaD summary didn’t know what a 3 phase BLDC looked like. To be fair I have spent the last five years of my career reverse engineering and designing sensored BLDC motor controllers…

      Although I was curious why there are four hall sensor inputs. I’ve only ever seen BLDCs with three before. Is the fourth for something other than the motor? Or is it just an unusual motor that really does have four hall sensors? My German is a little non-existant…

      1. There are actually 6 Hall-effect-sensors. Three were there, when he bought the motors and the other three he added himself and and wired their outputs to be one. And yes, he can not determine, which one senses something, but i think it wasn’t needed.

        He did this like that, because when sensing it with the three sensors he could only drive them with block commutation (Don’t ask me what that is supposed to be). When driving them like that against an obstacle (e.g. the ramp in the video), he had the problem that the whole thing would move a tiny bit forwards, commutate, then roll back and need to commutate again. This resulted in the motors just making noises and not moving at all. After installation of the 3 additional sensors, he could drive the motors with sine waves and also doubled the resolution of the BLDC.

  7. Wunderbar! Schön!

    The builder and the build deserves huge kudos and respect!

    I had dreams about building one myself but I am not good enough for the project yet.

    For people complaining the price:
    * when you design a prototype not intended for serial production the cost of hardware may be marginal
    * time may be the tightest constraint (imagine a successful engineer having enough money but little spare time)
    * you may use parts that you have by hand even when they are overkill for the project (eg. Arduino to control one single pin)
    * Politeness improves the results of your communication.

  8. I am looking for some BLDC motors(500-600Watts). Most the the cheaper ones($50-80) that I have found are designed for airplane props. Anyone know where he got these or have a good supplier?

    Thanks,

    1. Seth – Here’s a BLDC 16 inch hub motor ready to rocket a kid’s bike for cheap!
      http://bit.ly/pCH1Ic

      I’m sure you can find what you are looking for over there.

      I’ve ordered some stuff off of Alibaba in the past, and it will eventually get to you… shipping is slow usually. Also, if you buy some electronics they may be hand soldered… even SMT. But you get what you pay for… be prepared to do some work.

  9. The workmanship here passes one test above all.

    It works.

    The next time anyone reading of “anything” Hacker built and NOT the result of a design team starts to slag it, they need to think before posting.

    Anyone can be part of a design team and it is NO disgrace to be a team member..quite the opposite as that’s often an “ego deferral required” situation. Where someone else gets compounded interest upon a team’s “ego deferral” so to speak.

    There’s a greater reward in design of something like an IC or a Brushless motor.

    All the people who designed such parts whether solo or team players- enable us to have that incredible ego boost when we solo build things like this balancing scoot.

    And being part of the community called Hackerdom is an ego boost to us all. Let’s not tarnish that by pointless and needless petty stuff, eh?

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.