Home | Links | Contact |

Printed from www.nzmeccano.com

Top Home Bottom

Meccano Segway

(Author: Andre Theberge)

Instructions

Introduction:

This section covers the assembly and fine tuning of the Meccano Segway. The Arduino code is available in another subtitle. The meccano assembly instructions and parts are not covered, because it is a rather simple model and the photos reveal much of the details. Also, depending on the size of the battery used, the motors and the overall assembly to ensure balancing, the details of the construction may vary.

I hope you find here enough info to build your own version, should you have any questions, you can send me an e-mail at : atheberge2@videotron.ca and I will try my best to help you. Please keep the questions pertaining to this project, if your question is more general in nature (How do I use an Arduino?.. How does a gyroscope works?), please consult the Arduino forum or the sources below:.

Arduino Robotics Book, chapter 11: Construction of a Seg-bot
http://www.starlino.com/imu_guide.html
http://web.mit.edu/scolton/www/filter.pdf
And check my videos on YouTube:

https://www.youtube.com/watch?v=q2zABfuq_js
https://www.youtube.com/watch?v=7zf7FvSPPzU
https://www.youtube.com/watch?v=Iow2Z7bhaws
Have fun!

Parts list (non meccano items)

2 x 80RPM geared motors. I bought them locally for $13 CDN. There are plenty of vendors available on the internet, so pick your favourite.

1 x 9DOF accelerator/gyroscope combo stick. Bought at HobbyKing for $25 US. Adafruit has also a great selection of these parts, built on a 'breakboard'. I wrote the code to be compatible with the AXDL345 and IGT3200 chips, which are fairly common. I also support the L3GD20, which is a better gyroscope in my opinion.

1 x Arduino module. Bought at Adafruit for $30US.

1 x Motor driver shield, bought at Adafruit for $15US. Mine is the older version, which is now obsolete. They have a more recent model, which is compatible. You will have to assemble the board, as it comes in a kit.

1 x 1K potentiometer. You may also use any value between 1 and 10K.

1 x power switch and battery connector. The battery connector was purchased at HobbyKing.

1 x LiPo battery, 4S, 1600mAh (14.8V nominal), bought at HobbyKing for $17US. Or equivalent You will need to buy the charger if it is your 1st battery of this type.

Some wires to interconnect everything

Electronic connections

Arduino to 9DOF

Analog 5 (SCL) to SCL
Analog 4 (SCA) to SCA
GND to GND
+5V to VCC (the 9DOF used has a voltage regulator taking it down to 3.3V). Be sure that if you use anothe model, it has also the 3.3V regulator)


Potentiometer to Arduino

Left pin to GND
Center pin to Analog 3
Right pin to +3.3V


Motors to Adafruit motor shield

The code is written to support M1 and M2 on the arduino shield. Wire them the same way (one will turn CW, the other CCW, that's OK, the software compensate for this and send reverse intructions to the motors to make then go in the same direction. If the Segway is unstable or goes in the opposite direction, reverse the wires.


Trips and tricks when building the Segway

Use the #52 meccano base as a support, and bolt the motors firmly to it. See the photo, I was able to support my motors in 3 points.
Try to lower the center of gravity of the Segway by putting the wheel/motor combo as high as possible.
The unit must be balanced (front and back) at all times (during testing and in the final prototype). In other words, the X-Y center of gravity must be on the center of the #52 base. If you add weight in the back (like the LiPo battery, you must add an equivalent weight at the front, at about the same distance. One trick I used for temporary weight is a bunch of 11 holes strips bolted together, and held temporary to the chassis with strong magnets. Just FYI, a #2 strip weighs 10g.
The accelerometer/gyroscope combo must be mounted at the X-Y center of gravity of the chassis. With my model, the X axis of the acceleometer and the Y axis of the gyro (Pitch) both tilt with the chassis. This is how my code is written. BEWARE: The proper axis and directions are crucial for the stability, I spent a lot of time trying to tune the accelerometer on the Y axis when I found it was the X axis that was in play. As well, the accelerometers I used had a terible offset when put flat on the table, that must be compensated. Read the next section below on how to do it.
When building the top section, try to use plastic rather than metal plates, because of the weight and also because some of the plates may touch the electronics, causing a short-circuit. In doubt, use transparent tape (I have done this at a couple of places)


Software tune-up

Depending on your choice of components, these adjustments will have to be performed. Do not take them lightly, they make the difference between a working Segway or a non-working project.

Accelerometer:

You must find the offset of your accelerometer, on the X axis. Put is flat on a levelled table, and set the accel_offset constant to 0. Read and print the accel_raw variable (un-comment it in the serial_print_stuff() subroutine). The value read is the offset, make the accel_offset equal to it, and check if the accel_angle becomes 0. Note, with the Adafruit accelerometer, my offset was 0, with the 9DOF stick from HobbyKing, I had offsets of -160 and 98, which are huge (almost 60 degrees). You pay for quality!


Gyroscope:

About the same thing as the accelerometer, except the variables are gyro_offset and gyro_raw. The gyro only gives a value when turned, it measure the spead of rotation instead of the position.
If your gyro is super sensitive, you may want to play with the gyro_weight and accel_weight variables. Their sum must always equal 100. Try values for gyro_weight between 2 and 10.
The code is written to support 2 types of Gyro, as-is it is for the ITG3200. If you want to use the more stable Adafruit Gyro, just un-comment the portions of code. Search for the pattern %%% to help you find them.


Motors:

The 1st parameter to adjust is m1_start_offset (and m2_start_offset), which is the minimum PWM value to make the motor turn. This parameter is motor dependant When the chassis is tilted slightly, the PMW value should be high enough to make the Segway move, but not too high to make it jerk. Adjust it by putting low values first; you will notice a 'dead-spot' (motors not moving) when you tilt the Segway from a level position back and forth. Then increase the value until the dead-spot dissapears. As you add weight to the Segway (by putting the top part on the chassis), you may have to fine-tune this parameter.
The second parameter is the gain_val. It affects how the motors react when the Segway is tilted. Try different values to achieve stability when stationnary and reasonnable speeds when tilted.


Steering:

When testing the Segway for the 1st time, set the steer_val to zero, to discard the potentiomer reading. Once stability is achieved, comment the steer_val =0; statement and adjust the values of steer_range and the values in the map command (just after the AnalogRead, in the read_pots() function) to achieve proper steering. This is another 'trial and error' setting.

 

If you have any interesting information or comments about this page, please add them here:


Your name:
Your message:
Security check: (Please type in the text to prove you're a person!)
 
Login status:  You have not yet entered your user name and password. You cannot create or edit documents until you do.
Enter your user name and password to log in

Remember me

If you click on the box marked 'remember me next time', you will not have to log in again on this computer for three months.

If you don't have a user name yet, please click here

Latest documents:

 
(Neil Bedford and Richard Smith)
Midlands Meccano Guild
Model Report 
97th Meeting 
 
The Arduino Sketch 
and how to upload a Youtube or Vimeo video to the Gallery 
(Paulo Kroeff de Souza)
"Homemade" Screwed Rods
 
(Paulo Kroeff de Souza)
The Meccano driving band problem
 
(Paulo Kroeff de Souza)
Meccano Cord Reproduction
 
(Paulo Kroeff de Souza)
Substitutes for parts 142 and 155
 
(Philip Drew & Richard Smith)
Midlands Meccano Guild
105th Model Report 
92nd Model Report 
(Neil Bedford and John Rogers)
Midlands Meccano Guild
104th Model Report 
91st Model Report 
 
103rd Meeting Model Report 
by Peter Stuart, Meccano Modellers Association Sydney Inc 
(Richard Smith and Neil Bedford)
Midlands Meccano Guild
102nd Meeting Model Report 
(John Rogers & Colin Bull)
Midlands Meccano Guild
101st Meeting Model Report 
Spanner Challenge 
(John Rogers and Neil Bedford)
Midlands Meccano Guild
100th Meeting Model Report 
 
A G gauge model 
(Colin Bull & Richard Smith)
Midlands Meccano Guild
99th Meeting Model Report 
98th Meeting Model Report 
 
97th Meeting Model Report 
(David Couch)
The Little Tram
An introductory Arduino project 
(G. Eiermann and M. Schild)
A Short History of MARKLIN Metall
 
96th Meeting Model Report 
83rd Meeting Model Report 
 
82nd Meeting Model Report 
Picks up three golf balls 
(Roger Marriott)
Midlands Meccano Guild
95th Meeting Model Report 
The Spanner Challenge 
 
 
94th Meeting Report 
(Andre Theberge)
Meccano Segway
Instructions 
(Andre Theberge)
A Meccano Segway
Arduino code 
(Andre Theberge)
A Meccano Segway
Assembly instructions 
(Michael J. Walker)
Meet the new MMG President
Geoff Wright 
The Spanner Challenge 
(Michael Walker)
Midlands Meccano Guild
93rd Model Report 
Report by Michael J. Walker. 
92nd Model Report 
(Stan Knight)
Minimal Meccano
Pocket Meccano Sets of the 1970s 
Little Lever, Bolton 
The Spanner Challenge 
91st Model Report 
(Bob Thompson)
Back to the beginning
Shop Display Model 
90th Meeting Report 
(Old Blue Gold)
Getting Old
A screwy story 
The Spanner Challenge 
Model report written by Michael J. Walker 
76th Meeting Report 
Exhibition in Nelson, New Zealand 
(Barry Gerdes)
Meccano Radio
 
 
How to flatten  
(Rod Socket)
Dear Mrs Spanner
Survival techniques for the Meccanoman's wife 
(Stan Knight)
The Top Ten Tools
Indispensable Tools for the Meccanoman 
A call for help 
The Spanner Challenge 
 
For small brass and nickel parts. Also for stripping paint and rotted zinc plating. 
(Stephen Heafield)
Waterslide Transfers
Refurbishing 0 & 00 Aero Models 
Construction details 
or Put Your Hammer Away 
Mobile Morris Crane from 1968 MM 
Bert Love's Blocksetter in colour 
The dangers of internet auctions 
(Rob Thompson pp Terry Bullingh)
BlockSetter Tower
Built by Terry Bullingham 
(Rob Thompson pp John Reid)
Captain Robert Falcon Scott
1912 Polar Sledging Party 
(Niels Gottlob)
Bucket Wheel Excavator
Transcribed from typed document with photos 
Selected Spanner messages 18th to 24th January 
Selected Spanner messages 11th to 17th January 
Selected Spanner messages 4th to 10th January 
 
(Norbert Klimmek)
Hulett Ore Unloader
A 1 to 32 Scale Model 
 
(Joe Attard of Malta)
A model ship
 
 
 
(Arup Dasgupta (ISM 652))
My E15R Motor
A repair story 
(Charles)
About Meccano
What is Meccano? 
Thoughts about modern Meccano 
Some hints and tips 
Not many in this condition I'll bet! 
 
 View all | Chat | Models | Hints and Tips | Opinion | Reviews | Mine