The latest project I have been working on was for an abomination of an SE class called “Performance Real-time and embedded systems” Sounds interesting, right? Nah. It was really bad, but we’ll not get into that. Anyway, for the term project Crawford and I wanted to make some kind of physical system controlled by a control system. We ended up trying to build a “balancing robot.”
I say try because we had a lot of wrenches thrown in. The first problem was that we had to use the PC/104 stack x86 boxes that were used in the class, meaning that this project couldn’t actually be “embedded.” We ended up piping sensor and control data over a ribbon cable and ran the code remotely. Motor current running through the same ribbon cable ended up messing up a lot of the measurements.
Also, a more fundamental flaw with our project was we were trying to do it with just a single accelerometer and no gyro. This made the task pretty impossible, as the noise from the motors accelerating would cause sensor readings to run away. We did a decent job considering what we were trying to do, but it didn’t end up
Anyway, I really enjoyed working on the project so I have moved the code over to a teensy microcontroller and got a nice digital gyroscope to try to make a better control scheme for it. Here is the source code. I haven’t spent much time tuning it, but I can get it to balance without falling over for a good 20-30 seconds. I pretty much just need to add in the wheel encoders so I can make it stay in a single position and I should be pretty well off. After that, I’d like to add remote control to the device so I can drive the platform around by changing the position and rotation setpoint, but we’ll see if I have enough time in the next few months.