I recently decided to build a Seg-Bot, based on your specifications. I used two 24v wheelchair motors, a Sabertooth 2x60, as these motors are slightly bigger and more power-hungry than standard, an Arduino Uno, a ProtoShield, 2 5k pots, this accelerometer/gyro combo, a 24v battery, and a 9v battery to power the Arduino. Once everything was finished, I uploaded your latest code for the 5dof Accelerometer/Gyro combo, and attempted to run it. However, when I press the engage button, while the platform is sitting off the ground, the wheels just slowly spin. No amount of pot adjustment will make them change, as will no amount of tilting of the Arduino. So I'm stumped. Any help would be greatly appreciated!
My name is Mac, I have the same gyro and acc and mine is working fine. Please send me your wiring diagram and code so I can help. If you wish to try on your own then I would check if your arduino is stuck in debug mode. check to see if you have pin 12 grounded. If you do then thats what will cause that. Also v3 of the code needs to be tweaked to make the sensor work properly.
Do not use wiring diagram as per gyro pins listed they are wrong and also do you have the aref to 3.3 volt ?
x axis acc = A0 ( that is wrong compared to the code)
y axis 4.5 = A2 ( this is also wrong compared to the code)
THE WIRING DIAGRAM IS FOR REFERENCE ONLY AS FAR AS IMU GOES. EVERYTHING ELSE IS THE SAME.
( correct) below
gyro y axis(4.5) is = to analog input 1
accel x axis = analog pin 5
HOPE THIS HELPS. iF NOT THEN PLEASE REACH OUT TO ME DIRECTLY AT MAC7988@GMAIL.COM
What code are you using for your Segbot... the code from the book or the newer V3 code that is on Github?
If you are using the code from the book, it will only work with the IMU sensor also used in the book and would likely need to have the offset values tuned for your specific sensor, while the newer V3 code on github should be more forgiving as it does an autocalibration each time you turn the Segbot on and automatically determines the offset for each sensor so you don't have to tweak that.
If you do not use the same sensors as I did in either case, you might have to tweak the code to read your sensors correctly - this is generally the most challenging part as I cannot find anyone that consistently sells the same sensors for very long.
If you are using the V3 code (found here) then you can use the wiring diagram on the Segbot project page, if using the code from the book you should use the diagram from the book.
Have you looked at the values of your gyro and accelerometer on the Serial monitor of your computer to make sure they are changing at the same rate? If they are not, you will have issues getting the segbot to work. If you have verified that they do change at the same rate, let me know as you probably have a much simpler issue.
Thank you very much for all your help. My Seg-Bot is now functioning, and it turns out that the issue was that I hadn't connected Aref to the 3.3v power. I feel kind of stupid for making such a simple mistake, but it's fixed now, and my Seg-Bot now balances and drives with me on it!
Thank you all very much,