How it gets out of control, so fast.


I am making a piece that will self level itself. So in theory, it’s all simple. Read an accelerometer, see what the values are for the x and y axis, ignoring the z axis, update a servo motor and see if all is level. I did something based on this a long time ago, using other peoples software libraries. Now I am writing my own library and all the code.

The hardware is pretty simple on this one. I am using the Arduino Uno platform and a off the shelf carrier board for a freescale accelerometer. So as I am playing with it, I realize that a servo motor isn’t my favorite, since it typically has no holding torque when not powered or being told to be in a certain position, no problem, I’ll use a servo motor. So I dug around in my parts box and found one. It’s important to know whether the servo is unipolar or bipolar. Web searching the part number on the motor was a bust, so you have to work a bit to make sure what it is. It has a little gear on it that comes out and will be helpful later. Turns out that stepper motors are called that because they make little steps to more. This means that each step is a certain percentage of a circle. Turns out my motor is 7.5 degrees each time or 1/48 of circle. That’s not going to be good enough for leveling something, unless it’s already level. So now we get to complexities. I have to make a carrier that will hold my accelerometer and tilt it some percentage of a degree and do it accurately.  That means I have to add gearing and divide that number down quite a bit. Which leads to these next photos.

Front view showing tray for accelerometer

Front view showing tray for accelerometer

Rear view showing motor and gearing. Also a nifty dinosaur at the top...

Rear view showing motor and gearing. Also a nifty dinosaur at the top…

So this worked. And it worked ok. But I can’t seem to ever leave ok alone. I had time on the laser cutter at MakerPlace, so I did some design work and then did a little CNC mill work too.  And that gets me to what I have to tell me what is going on with my accelerometer.

Front view :note the scale on the bottom. There's three lines so you know you are even with it.

Front view :note the scale on the bottom. There’s three lines so you know you are even with it.

Top view. And I did make an etch line and fill it with paint to make it nicer...

Top view. And I did make an etch line and fill it with paint to make it nicer…

And that’s how it all gets out of control. Now I have a ocean of software to write to get it all working. I did get the stepper motor running and it swung back and forth in time to a Nina Simone song, which I was very amused by.

 

 

 

 

Comments are closed.