18F14K22 Self-Balancing Platform

Well, it’s not finished but this is what I’m working on:

Balancing platform on a breadboard
Balancing platform on a breadboard

Ta-da.. yet another balancing something-or-rather.. except this one isn’t so great at it’s balance. This was a big old fail. I went wrong with steppers… I should have just used DC motors and maybe the next version I will. I used Pololu A4988 stepper motor drivers (A4988-based)  to control my steppers while attempting to use variable speed step resolution control. This worked okay but really while trying to drop holding current while balanced was a nightmare. Also the current usage was above what I consider useful… either backing the current limiting off to save some power (and your driver) then loosing control or you’re just cooking your motor driver and the current isn’t useful other than for a cute demonstration or a non-battery powered application.

I’m not dropping code, you can request it directly if you want it but it’s nothing magical. It has my own hacked up version of a PID loop. I didn’t use derivative. I think far too many cycles are wasted on it when PI will probably work for you. I haven’t fine tuned it because I’m unhappy with my results.

I was a little bummed out on past-Chas’ selection of an MMA7361 accelerometer;  I had gotten it from Sparkfun who-knows-how-long-ago. The link leads to the retired product. It’s just plain voltage output per axis. I must have still been shying away from I2C at the point? The board shown below:

Accelerometer break-out board
Accelerometer break-out board

For a micro I used a PIC 18F14K22 on the TAUTIC dev board with some AtomSoft breadboard goodies for troubleshooting, power and the serial interface (Breadboard Buddy).  <– that link will probably die soon. Tindie updates a lot and products are replaced with newer versions.. if you sniff around you’ll find it.

I’ll move along to another project now, perhaps order some parts and revisit this one again. If you run along this and you’ve done this with steppers I’d be interested in knowing how it worked out for you.


  • December 28, 2014 - 3:10 pm | Permalink

    Awesome even tho it was kinda a fail. Its progress! Cant wait for you to get it working. Will you post code and etc?

    • Chas
      December 29, 2014 - 4:35 pm | Permalink

      Once I swap motors types, try again, and it mostly work yep.. I just hate to drop code when it’s not functioning-ish; that’s no fun.. like people who publish schematics that don’t work! boooo! 🙂

  • Leave a Reply