As electric vehciles go, the Segway is certainly a unique way to get around and to the casual observer, the way the device operates might seem to defy gravity. There are quite a few DIY projects around the Internet including standard two-wheeled upright versions, unicycles and one wheeled skate boards that operate on the same self-balancing principle. Now a kind soul named Geoffrey Bennett has released an open source version of the firmware required to operate a ride on robot free, allowing anyone with basic mechanical ability and some electronics skills to build their very own self-balancing transport.
The ride-on robot named "Meta" was built by Geoffrey who openly admits that “hardware isn't my thing” so mechanically it’s of fairly simple construction with dimensions based around the choice of motors and batteries used. It couldn’t be simpler, two pieces of wood, one broomstick some duct tape and miscellaneous parts from the local hardware store.
The basic requirements are two wheels driven by motors, a platform to stand on, batteries to provide power, sensors to detect leaning, electronics to drive the motors and software to drive the electronics. The motors selected for this project are off a used electric wheel chair. The motors come complete with a hub, wheel and gearbox all in a single unit. Some rudimentary brackets can be used to mount these between the two wooden boards. The batteries used are six 12 volt sealed lead acid batteries chosen because they are cheap, heavy for ballast and easy to recharge. These are mounted between the motors on the wood platform.
The sensors used in are an accelerometer, which measure gravity or G and a gyroscope that detects changes in angle. These components may sound exotic and something you might only find in a spacecraft. With many thanks to the auto industry these components have been in mass production for quite some time to be used in safety features such as airbags and stability control. Both the accelerometer and gyroscope chips can be bought for as little as UDS$115 on a small circuit broad from robotics hobby stores.
Next on the list of electronics is something to drive the motors. This project uses something called the Open Source Motor Controller (OCMC) and again robots enthusiast web sites come to the rescue with a 50 volt 160 amp DC motor controller being available for USD$169 in kit form. This is a simple H Bridge type motor driver and it uses one for each wheel.
The electronic fun starts with building a circuit to drive those two motor control boards. This circuit needs to take inputs from the accelerometer, gyro and steering joystick, do some calculations and send pulse width modulation signals to drive the motors. To do this we need some computer power but not the kind of PC you are no doubt reading this story on but something with a small faction of the power. This DIY project uses an Atmel 8-bit processor that only has 1kb of ram and 16kb of memory.
Most people are familiar with how a self-balancing ride on robot operates but lets review the basics. The original Segway is a 2-wheeled self-balancing vehicle. To move forward the rider leans forward, to go faster he/she leans forward more. Lean back to slow down, stop and go backwards. To turn twist the handlebars (a joystick in this case). The primary function is to remain upright. If you lean forward, the circuitry moves the wheels forward to try and make the vehicle upright again. The rider is in fact in a controlled fall towards the ground with the vehicle catching the fall. To do this with software requires some complex mathematics called Proportional Integral Derivative (PID) and that’s where the ‘open source’ part of this project comes in very handy. PID is a very well known and often used software technique but well beyond anyone with only a casual interest in mathematics or software development. Luckily there are many free examples available that are no harder to burn onto a small processor than burning a CD.
So if you want a Segway-like steed but don’t want to pay the price and don’t mind the DIY, then join the legion of high schools kids around the world who have made their own for a fraction of the cost and learned a great deal into the bargain.
Follow this link for video, code and a slide presentation on Meta.