Step 19: Electronics
See my comment on intro page regarding use of a 6dof "Razor" IMU from Sparkfun instead as this 5dof one is becoming difficult to obtain any more.
Original text:
There is a 5 degree of freedom inertial measurement unit (IMU) from Sparkfun.
This is cheapest one they do that will do the job - a situation that is always changing by the way.
It has a 3 axis accelerometer. We will only use one of these.
It has 2 solid state gyroscopes. One is used with the accelerometer (using a "combination" filter) to make the thing balance.
The other is used to allow machine to resist sudden changes in direction (one wheel hitting a pebble for example) so it does not spin you off. This is easier and more reliable possibly than using wheel speed encoders which is the other way to do this.
I like ribbon cable as it is neat. I also use blu-tack when doing this sort of soldering as it holds wire in exactly the right spot as well as holding the little circuit board still.
I tin the wire ends then solder them to the holes.
NOTE: Someone has already found a cheaper (different) IMU here:
www.gadgetgangster.com/find-a-project/56.html
You would have to work it out for yourself and modify code perhaps but it also looks ideal for a project like this. It is amazing how these things have come down in price. The one-axis gyro in my monowheel was about £100 ($150) on its own.
Remove these ads by
Signing Up























































































Visit Our Store »
Go Pro Today »




Do you have any spare anlalog IMU-5DOF or 6DOF that I can purchase from you? Please advise.
Do you have the software code for the whole project using the digital 6DOF, and the full schematics diagram for the whole project. If not the connections between the digital 6 DOF and the Arduino. I will greatly appreciate for your help.
I just purchased the New replacement of IMU -5DOF from SparkFun and this one already have building Reg for 3v . Can I use the same code that you have ?
I believed the same of your configuration.
Thank
I would check the data sheet but presumably you can run it from the arduino 5v line without blowing it up.
Check the datasheet first as the old one would definitely not work any more if you connected it to 5v supply. It would blow the gyro leaving you just with accel values!
John
http://www.sparkfun.com/products/11072
Features:
Full Scale Gyro Range: 500°/s
Full Accelerometer Range: +/-3g
On-Board Voltage Regulation
Input Voltage: 3-16V
Analog Output
Breadboard Friendly
But I already connect with 5V from Arduino and got the Acc.
Nimth
thanks to share your arduino segway like project. Because I also think to make a segway like but my knowledge is limited in electronic. I am sure I can do it with an arduino and I enjoy to read your project.
Just two thinks I need to ask you and may be that will upgrade your project :
1) At 1:19 on this video we can see that a segway use five gyros : http://www.youtube.com/watch?v=OVCzB1AZPA0
may be for front to back + left to right + one wheel up or down the other.
What do you think about this ? I mean if your "segway" like have one wheel a little a bit up the other does it continue to run anyway ? If well what the need of five gyros on the real segway ?
2) to answer to your question concerning the fact to reduce the cost of your segway like I just discovered this gyro reduction. In place of paying it 100$ you can build it to 8$ (as he said) : http://underfinished.blogspot.com/
May be can you give us your project with this use.
3) Do you think that overclocking the arduino can help for the answer time or unneeded ?
4) Can the one chip arduino be cheaper and or more useful (consumption with some LiPo battery in place of weight battery) ?
Sincerely thanks for your informations and have a nice day.
Miguipda ;-)
http://www.geocities.jp/arduino_diecimila/obaka/project-2/index_en.html
A real segway will probably work with some of the gyros failed. It is designed with redundancy in mind (2 motor windings for each motor for example) for safety where the users are not at all interested in how it works.
2) I use 1 gyro with 1 accel to balance. This is the minimum. If they fail you fall off.
3) Also there are starnge situations that can occur such as tuening while on a slope or with one wheel on a slippery surface while truning while on a slope, and so on. The 5 gyros help with the "calculations" for such situations I suspect.
4) Why overclock the arduino? My software at present only works for about 1/3 of the time, the rest is a delay, and that gives you 100 program loops per second which is ample for the balance algorithm
5) One chip arduino? Not sure what you mean, maybe the tiny versions of the arduino's you can get. They will save you space for sure if space is tight I suppose. Perhaps will use a little less power if powering them from a small battery perhaps. Marginal gain therefore.
6) $8 "gyro" is not a gyro. It has a wheel with a weight on it that "will always be closest to the ground" which is then connacted to a sort of optical position sensor. Well no actually, if you braked hard, the weight would swing forwards. It would give you a "I am tilting" reading when in fact you were not. My gyro in 2008 cost be about $200. Now sparkfun do a board with 2 gyros and 3 accels all for about $50 so to be honest I am not complaining about price of gyros any more. You can even use a WiiMotionPLus module which has gyros inside to save money, but you need to understand all the code required to decode the data from these.
Therefis already plenty to go wrong in these machines, don't make life even harder for yourself just to save a couple of dollars.
Best wishes
John
http://www.sparkfun.com/products/9250
I have no idea really but think it will be fine without the capabilty of resisting sudden turns?
I got a few things for this project underway now,
I got my motors, motor controller, IMU and arduino.
Using your examples I got the accel and gyro to give me usable figures....
Using the motor example I got my motors to run fine.
Using your balancing only code and a few tweaks I have gotten the IMU to spin the motor depending on its orinetation. however the motor controller seems to cut out after the motor reaches 100%, i am not sure why this is. I can post a video for you if it would make it easier.
Thanks,
Kriogenic.
This turned out to be a bug in the code. The "Integral" value of the PID accumulates indefinitely if you hold it tilted on a bench rig for a long time for example. Eventually it flips back around to 1 again!
I now have put a limits check on it so it cannot do this any more.
John
Not sure what batteries you are using but if the current draw exceeds what batteries can give, voltage across them will drop. If it goes too low the sabertooth will shut down. I am not sure at what voltage this happens but might be worth measuring voltage across batteries and seeing how low it goes when you are running both motors at 100%.
In the motor testing sketch they only go to 50% each then decrease again.
John
thanks
adrian
Minimum needed to balance is one accel and one gyro
rhydolabz.com
I put some notes on reading and scaling these here on my original website:
sites.google.com/site/onewheeledselfbalancing/Home/software-with-all-explanatory-notes-removed
The nunchuk / wiimote+ combination looks pretty complex to me. I put a link to it on page 1 of this instructable - good luck if this the way you really want go. I am no expert on that combination.
is this code robust that if i keep the electronics same it will work with any low CG configuration ? I was thinking to build a prototype with DC motors, what rpm or voltage should i use ?
Also one more thing , can i make segway with it ?
Thank you for your valuable time.
Here is a page I made with links to every single amateur built self balancing skateboard / segway and other oddities I can find on the net. Plenty of people have built segway style vehicles along these lines (i.e. 2 x cheap 24V scooter motors from China).
Link:
sites.google.com/site/onewheeledselfbalancing/Home/links-to-other-self-balancing-projects
So my answer is a) probably with some adjustments to code, b) 2 x 24V cheap scooter motors 250W or above, but on level ground may be OK with lower power motors c) Yes.
Best wishes
John