3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Seg...stick.

Step 7And now, the hard part.

And now, the hard part.
«
  • stick17.gif.jpg
  • stick18.jpg
  • stick19.jpg
  • stick20.jpg
Anyone can strap wheels to a stick, right? The magic behind a self-balancing thing is in the electronics. The controller must read in accelerometer and gyro data, calculate the angle of the stick, and command the motors to take corrective action, keeping the rider upright. This process of sensing a physical variable (angle), making a decision, and executing a corrective action that will affect that variable is called feedback control

Usually, the controller is some kind of microprocessor. In some rare cases, one might be compelled for unknown reasons to do it entirely with analog circuitry. Segstick instead uses a more conventional digital controller implemented on everybody's favorite: the Arduino. Specifically, it uses the Arduino Nano 3.0 from Gravitech. But any Arduino will do.

For sensing, Segstick uses the Sparkfun Razor 6DOF IMU. Really, you only need one accelerometer axis and one gyro axis, as will be discussed in the next step, but this package is so convenient and allows you to mount the board any way you want. Since it uses all 3.3V sensors, it will need to be powered from the Arduino's 3.3V output. Each sensor outputs an analog voltage which is read in by the Arduino's analog to digital converter (ADC). More on that in the next step.

For controlling the motors, Segstick uses two Polulu High-Power 18v25 motor drivers. These are tiny but powerful reversible motor controllers capable of providing up to 25A each.  I decided to add a heat sink to them, but they seem to run cool enough without it. They do require large-gauge wiring to the battery and to the drill motor leads.

The circuit schematic is shown below. How you implement it (breadboard, protoboard, printed circuit board) is up to you. I did it on a vector board that I later cut to size. Soldered connections will generally be more reliable than breadboard-type connections on a moving vehicle, so I'd recommend using sockets for the components but directly soldering wired connections.



« Previous StepDownload PDFView All StepsNext Step »
26 comments
Mar 19, 2012. 1:10 PMprabhatnarayan says:
hi scolton.
here i got 2 18x25 pololu motor driver but the pins are
TIXN
ERR
RST
TX
RX
VIN
GND

instead of
V+
5V
FF2
FF1
RESET
PWM
DIR
as shown in your 18x25 motor driver

so plz tell me what r the PWM & DIR pin in my motor driver.
Dec 29, 2011. 4:26 PMirethedo says:
Where did you get the heat sinks for the Polulu High-Power 18v25 motor drivers and how did you attach them?

A picture would be nice...

thanks
Jan 4, 2012. 5:07 AMirethedo says:
Thanks Shane-

after a little bit of thought, I am thinking of taking the fan off an old PC CPU heat-sink and just suspending it with 4 standoffs above both Pololu controllers but without a heat sink or mechanical contact point. This should be better than nothing I hope...
Dec 29, 2011. 10:47 PMirethedo says:
Another question for you:

Your schematic shows A0 - A5 of the arduino connected to the Razor 6D0F but your code only uses A0 for the accelerometer input and A4 for the gyro input.

Is it necessary to connect the other Razor 6D0F outputs (A1 - A3 & A5) to the arduino and if so why?

(I might want to use those analog inputs for other things...)

thanks
Jan 1, 2011. 10:15 AMtheugleymonkey says:
Do you think implementing the ArduIMU +v2 would work? How much of the software and configurations do you think would need to be changed?
http://www.sparkfun.com/products/9956
Jan 5, 2011. 8:32 PMtheugleymonkey says:
So you say for the steering pot to use SDA or SCL. Why is this? Is this because I can use it as ADC 4 or 5?
Apr 17, 2011. 7:55 AMtheugleymonkey says:
So I finally obtained my ArduIMU and I am testing it out, I basically hooked it all up to one motor controller and a digital multimeter for them motor output. My question is, should I be seeing a visible change in voltage when I tilt my device? I have only hooked up a 9 volt battery for testing. Is there a minimum voltage I should be using to see results?
Apr 17, 2011. 5:00 PMtheugleymonkey says:
Strange, it is staying at a constant voltage. Could it be that the program needs to be modified for my board?
Apr 17, 2011. 5:22 PMtheugleymonkey says:
Yup it stays at a constant 9V tilted or not.
Apr 17, 2011. 7:33 PMtheugleymonkey says:
I debugged left and right and on the right it varies a little but then jumps back to -133 no matter what angle and on left I am getting the value -255 no matter what angle
Apr 18, 2011. 5:30 AMtheugleymonkey says:
Okay well I debugged most the code and it seems right when I debug
//Add/subtract steering and integerize. as well as // Clip as integer. The weirdness starts it gives me similar results as above but for both left and right they varied for half a sec and then go back to their original starting value.
Apr 18, 2011. 11:27 AMtheugleymonkey says:
If I debug with Serial.println(output_left); or Serial.println(output_right);
// Add/subtract steering and integerize. as well as // Clip as integer. both give me same results the values varies at different angles but shoot right back to its original value no matter what angle. If I debug the raw data like Serial.println(gyro_raw); Then the values vary at different angles and stay that way depending on the tilt.
Apr 18, 2011. 12:31 PMtheugleymonkey says:
Okay well for angle it shows about 27 when flat sitting on the table but if I flip it vertical in one direction it shows 0 and in the opposite vertical direction shows about 45. for rate sitting flat it is around 360 when I tilt it depending on its angle goes from 100 to 300
Apr 21, 2011. 3:46 PMtheugleymonkey says:
Okay I think I got everything working now thanks for your help!!!

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
19
Followers
1
Author:scolton