PID Auto level with Relays

Hi Everyone!

I'm am looking into building an auto-level for a moving platform. 1 DOF only.

The platform already has a hydraulic ram controlled by relays that are switched using a simple swinging pendulum.
The problem with the pendulum is that it gets a bit of a rock going.

My plan is to use an Arduino, an MPU6050 and br3tt's PID library to switch the relays.

Do you think that PID would be the best approach for this situation?

Appreciate any input,

Sam

It's not PID if you're switching relays. That's called bang-bang control.

Within a very limited set of parameters, it's possible. Like exactly how level do you call level?

An adjustable damper on the pendulum might get to your goal faster. Add a little friction to the pivot and see if it stops the swinging.

Hi Morgan,

My first thought was also to dampen the pendulum but I could not find a good balance between reaction speed and dampening effect.

Within a couple of degrees would be plenty accurate.

I was going to use bang-bang control (didn't know it was called this, thanks for that!) with a bit of deadzone in the middle until I saw this:

PIDLibraryRelayOutputExample

Thought it might give a better result.

This is cool:

Self-Balancing-Robot-Bang-Bang-Control

But I don't want to end up with the twitchy effect.

Thanks for the input! I may need to end up trying both.

Sam