Jump to content

DIY saddled EUC and Segway-clone source code


esaj

Recommended Posts

Found this:  http://www.instructables.com/id/Electric-unicycle-Arduino-DIY/

It's a homemade 20" saddled electric unicycle that uses Arduino board, 600W DC brushed motor, separate motor controller, gyroscope, 22V/222Wh LiPo and some miscellanous parts. It's actually chain-driven, as the motor isn't in the wheel hub.

What was of more interest to me, was the link to a open source Segway-clone sources: https://github.com/ovaltineo/SegwayClone . It's a complete C source for driving two dc-motors (one motor per wheel), with support for many different controllers, and including 4-level battery alarm, temperature/speed alarms, soft acceleration options, locking, max speed limitations, Bluetooth etc. I wouldn't be THAT surprised if some manufacturers actually used earlier versions of it as a base for creating their own software for single wheeled vehicles :D  (Yes, it hasn't been in github since March, but since it was already v7.2 or 7.3 at that point, it or different versions of it have been floating around for a lot longer somewhere else). Modifying this to support only single motor should be fairly straightforward, as it pretty much requires only removing the steering logics and fine tuning the single motor drive logics (input ranges for different types of sensors, pwm frequencies etc) with real-world tests.


This is a program for a self-balancing two wheeled vehicle which was popularized and pioneered by the Segway. Segway is a trademark of Segway Inc which holds many patents for this type of vehicle.  The term "Segway Clone" is used very loosely -- the code here is not a copy, in any shape or form, of the Segway firmware. The real Segway is robust, well-engineered and has many safety features.  This "Segway Clone" is not.

This code is comprised of original and open source code from other authors.  It uses well known concepts of balancing an inverted pendulum by using a complementary filter for combining accelerometer and gyro data to measure the angle of tilt and a PID algorithm to apply a counter-acting motor-to-wheel movement in an attempt to bring the angle to zero.
 

Skimming through the source, it uses PWM (Pulse Width Modulation) output-pins to control the motors with filtered gyro and steering data (both balancing and steering, as Segway-type vehicle is steered by running one motor faster and the other slower, or backwards, depending if you want to just turn in place or while moving) with many options for different type of "softening" and some rudimentary safety features (like limiting motor power, reading voltage values for low battery alarms, high temperature alarm or starting a separate cooling fan on high temperature, softening speed up/slow down to prevent oscillating, rider weight sensor to see if anyone is on top of the vehicle etc.).
I'll be interested to see if we'll have home made EUCs one day (well, basically the saddled one above already is one, but I mean one with direct-drive wheel hub motor and no saddle). ;)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...