How to compare two sensors with one 0-5v vs 5v-0
sport270
Posts: 82
in BASIC Stamp
Currently have a hydraulic height control thst uses 2 sensors. One on each end of a 20' header. The left sensor is 0-5v and the right sensor is reversed at 5v-0.
The left sensor controls a cylinder that tilts the header left/right.
The right sensor controls seperate cylinder that raises complete header up/down.
Wanting to change from on/off solenoids to proportional ones. Each valve has seperate coils for each movement....
Not sure how to make a variable scale with sensors going in opposite direction.
The left sensor controls a cylinder that tilts the header left/right.
The right sensor controls seperate cylinder that raises complete header up/down.
Wanting to change from on/off solenoids to proportional ones. Each valve has seperate coils for each movement....
Not sure how to make a variable scale with sensors going in opposite direction.
Comments
You could flip the 5-0V sensor to 0-5V using an op amp in inverting mode with a bias. Or, you could just feed both to an A/D (e.g. MCP3208) connected to a Stamp or Propeller and do it in software.
What you've described is a form of closed-loop control system.
https://en.wikipedia.org/wiki/Control_system
Now is time for us to understand wich type of feedback you actualy have to control it.
The first question that arises, is about the values you've used (0-5V; 5-0V) to describe the feedback.
If the sensors does a suddenly switching, from 0 to 5V (or 5V to 0, in case of the other one). it means that they are digital in nature, as logic gates transitioning from "0" to "1", then from "1" to "0", in 5v powered cmos logic.
With that kind of sensor, you can only sense two positions from each one; full stop upward/full stop downward at the lift sensor, full stop leftward/full stop rightward at the tilt sensor.
If this is the case, and your intention is to have some means of knowing "where" the cilinders are positioned, at any given moment (or position, appart from their full stop positions), then you also need to change the sensors, so they can provide enough information to your control system, to improve in the decision taking process, and get full control of the operational parameters of your equipment.
Henrique
Reason one is reversed is i used same sensor setup for both sides and when mirrored from left to right side it reverses the direction of the sensor. It will take me a little bit but I will draw out the current physical arraingment of sensor and control process, it will explain things better.
Lets assume Sensor 2 reads 4.5V at min and 2.0v at max, for a range of 2.0 – 4.5= - 2.5v. Since we are looking for the change from the zero position we can use Vmin – Vin rather than the above formula which would require either taking the absolute value of the result or multiplying it by -1.