Comparator or Microcontroller

Thread Starter

ciscoasanchez

Joined Jan 26, 2016
32
First off, I am a mechanical engineer, yet I am the most electrically minded at my company which does not have an electrical engineer. So I have become the unofficial electrical engineer.

I am working on redesigning a mechanical hydraulic controller. I want to use two position sensors (A and B) that operate on 0.5V to 4.5V

This is what I want to happen:
When A = B, Switch 1 and 2 are off. (I also want to have a tolerance here)
When A > B, Switch 1 is on.
When A < B, Switch 2 is on

I know how to program this into a arduino, I only know very little of Comparator Circuits so I am not sure how to even proceed with something like that. This will be a hydraulic controller that will be installed on fishing boats and work boats so it needs to be resilient.

If this is possible without using a microcontroller that would be ideal, but I need help.
 

ebeowulf17

Joined Aug 12, 2014
3,274
Sorry I don't have time to write more or explain better, but this sounds to me like it would be pretty straightforward with a comparator. The first "real" circuit I put together was a dual comparator circuit and it went quite well. I knew nothing of op amps or comparators when I started, but the data sheet and app notes got me through:

http://www.microchip.com/wwwproducts/Devices.aspx?product=MCP6542

There may be better chips for your application, but I feel a tiny bit of loyalty to this particular one just because its above-average documentation taught me what I needed to know about hysteresis, etc. Regardless of chip selection, I think a comparator will get you through. I'm pretty sure you can adjust the hysteresis of each side of the comparator to create the desired tolerances for a dead zone with all outputs off. I'd have to sit down with pencil and paper to be sure, but I think that's right...
 

AnalogKid

Joined Aug 1, 2013
8,487
The circuit is called a window comparator. In your case all outputs are off when the input is within the window. For example, if you declare the input range to be 0V to 5V, and the "=" zone to be centered around 2.5V, and wrap a +/-0.5V tolerance window around "=", then the two comparators' trip points are 2.0V and 3.0V. Any input between them means both outputs are off. Above 3V turns on one output, below 2V turns on the other output. Something to consider is noise on the input and slowly-changing inputs. These can cause the outputs to chatter, making an output voltage burst of swinging from on to off rapidly. Depending on the characteristics of the input signal, there are several solutions that can be applied to help prevent this.

A classic part for this is the LM393 dual comparator with open collector outputs. Another option is the LM358 dual opamp acting as a comparator, with push-pull outputs. What are the comparator outputs driving/controlling?

ak
 

Brownout

Joined Jan 10, 2012
2,390
It's possible. What technologies are available for this project? i.e. FPGA, ASIC, logic chips... What other components are on the board which have spare resources? Is the output of the position sensor digital or analog?
 

Thread Starter

ciscoasanchez

Joined Jan 26, 2016
32
The circuit is called a window comparator. In your case all outputs are off when the input is within the window. For example, if you declare the input range to be 0V to 5V, and the "=" zone to be centered around 2.5V, and wrap a +/-0.5V tolerance window around "=", then the two comparators' trip points are 2.0V and 3.0V. Any input between them means both outputs are off. Above 3V turns on one output, below 2V turns on the other output. Something to consider is noise on the input and slowly-changing inputs. These can cause the outputs to chatter, making an output voltage burst of swinging from on to off rapidly. Depending on the characteristics of the input signal, there are several solutions that can be applied to help prevent this.

A classic part for this is the LM393 dual comparator with open collector outputs. Another option is the LM358 dual opamp acting as a comparator, with push-pull outputs. What are the comparator outputs driving/controlling?

ak
The outputs control the direction of a hydraulic pump via relay.
Right now I have two induction type proximity sensors that go through an amplifier then to a relay.

The inputs would be a controller and the feedback for the position of the hydraulic actuator.
 

Thread Starter

ciscoasanchez

Joined Jan 26, 2016
32
It's possible. What technologies are available for this project? i.e. FPGA, ASIC, logic chips... What other components are on the board which have spare resources? Is the output of the position sensor digital or analog?
The output of the sensor will be analog.
 

GetDeviceInfo

Joined Jun 7, 2009
1,729
are you looking for absolute or variable positioning from your actuator? Is your pump controlled via direction of rotation, or other means?
 

Thread Starter

ciscoasanchez

Joined Jan 26, 2016
32
Hello,

Are A and B both variable?

Bertus
We are using this device to control the position of the opening for a water jet, If the door is full open we get (4.5V), if the door is full closed we get (0.5V).
Both A and B are variable, they position sensors we currently use are essentially throttle position sensors.

The Hydraulic Pump goes either FWD or REV, Rev closes the door, FWD opens the door. I need control of how open or closed the door is to control the thrust of the water jet.
 

GetDeviceInfo

Joined Jun 7, 2009
1,729
How do you currently set the desired positions? How would you like to set the positions? Back to the pump, is the pump continuously running ( ie clockwise) while a control valve reverses the flow, or does the pump itself actually stop and reverse rotation? Describe the applicable hydraulic circuit in technical terms, ie pump type, valving, actuator, etc. I know it's not what you asked, but it gets to the solution much quicker. Are you redesigning the hydraulic circuit or utilizing what you have?
 
Last edited:

Thread Starter

ciscoasanchez

Joined Jan 26, 2016
32
How do you currently set the desired positions? How would you like to set the positions? Back to the pump, is the pump continuously running ( ie clockwise) while a control valve reverses the flow, or does the pump itself actually stop and reverse rotation? Describe the applicable hydraulic circuit in technical terms, ie pump type, valving, actuator, etc. I know it's not what you asked, but it gets to the solution much quicker. Are you redesigning the hydraulic circuit or utilizing what you have?
Currently it is controlled by a mechanical means,
upload_2016-1-26_11-29-22.png
The system is in series with another actuator that reflects the position of the actuator doing the work. A cable connected to the control lever on the helm moves the bar. When the bar moves away from the respective prox sensor the motor either goes fwd or rev and the 2nd actuator moves with the work actuator, when it matches the position of the control bar the prox switch turns the motor off. Not sure if that helps explain the current design.

The Hydraulic pump does is not continually running, the pump has two directions which change the flow of fluid to move the actuator.
 

dl324

Joined Mar 30, 2015
10,938
Yes, I think that would work, now I will expose my ignorance, What should I use for R1, 2, 3, 5, and 6?
Can't say without you defining your requirements.

To implement the values mentioned by AK, R1=R3=20K and R2=10K; assuming a 5V supply. When the input voltage is above 3V, the top comparator will be on. When it's below 2V, the bottom comparator will be on. When it's 2-3V, both off.

Same for the circuit I posted as the two are basically the same, except I included a description of circuit operation.
 

Thread Starter

ciscoasanchez

Joined Jan 26, 2016
32
To implement the values mentioned by AK, R1=R3=20K and R2=10K; assuming a 5V supply. When the input voltage is above 3V, the top comparator will be on. When it's below 2V, the bottom comparator will be on. When it's 2-3V, both off.

Same for the circuit I posted as the two are basically the same, except I included a description of circuit operation.
I hope I am understanding this, (btw, you have all been very helpful, thank you for all your information) in your diagram, will Va be compared to Vb or Vin?
 

GetDeviceInfo

Joined Jun 7, 2009
1,729
Yes, I think that would work, now I will expose my ignorance, What should I use for R1, 2, 3, 5, and 6?


Exactly.
Or is it the other way around, where you cable the prox against the falcrum and the pump then runs until the prox is moved off the falcrum by the second actuator. That configuration would provide the 'window'. I'm probing here because I can't see how a comparator will help you. It looks to me that you have a simple off/on with a mechanical 'hysterisis' built in.
 

bertus

Joined Apr 5, 2008
20,567
Hello,

I would try 10K for R1,R3,R5 and R6.
R2 determines the dead band, try a value between 100 Ohms and 1K.

Bertus
 
Top