Accelerometer controlling hydraulic proportional valve

The pdf you linked to indicates there are associated electronic controls available for the units. Do you also have those electronics? Also do you have the valves with two solenoid coils or just a single coil? And finally, do you have a power supply large enough to handle the current necessary for your valves?

That requires temperature control of your oil supply!

Here's how it went:

The company has been building hydraulic powered machines for many years. There's a lot of knowledge there. My colleagues have wanted to find a way to auto-level a part of the machine for many years. I recently started at the company and told them that maybe we could do it with Arduino and an accelerometer. I was tasked with looking into it / building up an experiment to see if any of this is feasible. I have a programming background but no electronics / hydraulics knowledge as yet, though I have used the machine in question.

We should have the valves delivered this week with all the bits so I'll have more of an idea how it works then.

Platform leveling projects have been done many times with Arduino, and posted on the web. Find them with a search phrase like "arduino platform leveling".

Work with your colleagues to learn how the hydraulics are controlled with voltage levels.

Oh, ok. Then you are attempting to maintain a level platform, not just make it level one time, and all the hydraulic pressure and temperature are already regulated on the machine. That should make it much easier to work with.

You can control the valve with PWM using one of these MOSFET modules. Available from many sources.

No DAC needed.
Sinple circuit and code.

Since you can code it and probably your company doesn't count pennies, forget mpu6050 and look for something better to start with. Adxl355 would be much better (expensive though), Murata has accelerometers targeted as inclinometer like SCL3300.
I personally just had good experience with LSM6DS3 (cheap sensor commonly used on cell phones) for static inclination measurements, I can sense 50um printer paper sheet under one end of 300mm long alu bar where the sensor is mounted. Not tested for dynamic approach yet.
LIS3DSH could be low cost option as well.

not used the ST LSM6DS3 but did use the ST LSM9DS1 9-axis iNEMO for person movement monitoring with good results - obsolete so would probably now use the ST LSM6DSO 6-axis IMU

Nice. Good to know that's available.

Before I go too far down a rabbit hole, can we confirm that the accelerometer only solution posted above by jremington would be suitable for my use case?

That is:

  • a machine part is positioned somewhere between -45 and 45 degrees on two axes
  • a brain reads the angles and operates hydraulic valves to move the part towards vertical on both axes or one axis at a time
  • as the part moves towards vertical, I want to read the angles multiple times in order to continue controlling the valves until they read 0 degrees (or thereabouts) on both axes
  • ideally I don't want to stop moving the part to read the angles - ideally it should be one motion after a GO button is pressed
  • once the part is vertical, that's it - the brain is turned off until the machine is physically moved to another location where the part will again need to be re-adjusted to vertical

I bought one of the ADXL 3 axis accelerometers and have been tinkering with the DFRobot code to try to get an average of readings over half a second to smooth them out but I don't want to keep going if the accelerometer needs to be still. We don't want the machine part stuttering in stages towards vertical.

My expectation is that the brain would output a voltage as a proportion of the angle. Perhaps 10V if 45 degrees, ramping down to 0 volts at 0 degrees in order to move the part efficiently depending on how much it needs adjusting.

If I need to use a 6 axis with gyroscope after all (because of the movement), if you could point to the latest and greatest library and a good chip to use with it, that would be enormously appreciated so I don't waste time working with old and discredited work like I seemingly did above with the MPU6050 and the Rowberg library.

Thank you

Then you will always overshoot the 0 degree position and the machine will always be hunting for 0.

There are dozens of different ones..

Measuring tilt of moving object is trickier, but you could slow it down/stop before last degrees.

Long before that, tell us you have investigated how the leveling was done long before computers and electronics were available?

I had a project two summers ago where I had to raise a bank of solar panels to a particular elevation angle. Client suggested an expensive inclinometer from Automation Direct but I went with a cheap Witmotion inclimometer from Amazon for $50. It has serial output and I don't know if they used sensor fusion or not but I got very stable readings as the panel pivoted.

This was for a vehicle but it was only to be used while stationary so that avoids a bunch of problems.

Could you go into more detail? This sounds like the same thing I'm trying to achieve as the machine itself will be stationary but the part will be moving like the solar panels.

Was it Arduino or something else?

Thanks

I assume a mercury switch. I came across something on a forum about there being a modern switch that might work but I didn't bookmark it and I'm fairly sure mercury switches are frowned upon nowadays.

Would this be a better way of accomplishing the project?

https://strainsense.store/product/industrial-inclinometer-dual-axis-010/

From what I understand, it outputs an true analogue voltage, shock proof, IP67 and does away with a lot of complication with the Arduino? Seems to be literally a voltage output with no "brain".

I don’t know what the potential safety risks are in case of a malfunction, but just as a general safety thought:

It might be a good idea to start the auto-level process with a multi-pole momentary switch that not only signals the MCU, but at the same time also physically enables the electrical connection to the solenoid valves.

That way, if the operator releases the switch early, it automatically behaves similar to a dead-man / emergency-stop style function, and it also adds some protection against unintended activation caused by EMI or software faults.

Yes it does.
However you will still need a "brain"
The ±45Âș unit has an accuracy of 0.3Âș, is that good enough?

Yes I've just had an hour long conversation with a very helpful guy at the company. It seems I will still need a brain of some kind to read the voltage output from the sensor (0v is -45deg, 2.5V is 0 degrees, 5v is 45 deg) and convert it to a voltage to power the valve, which I think I can do with the Uno for now for testing and move to some kind of PLC (Industruino running ladder diagram or Opta with Arduino code) later.

Any thoughts on a budget friendly PLC that could take two analog voltage inputs and output four 0-10V feeds to control the hydraulic valve? Each valve needs two feeds to operate backwards and forwards movement.

It would be awesome if that PLC was IP67 rated and not incredibly difficult to program.

Further help much appreciated.