Pages: [1]   Go Down
Author Topic: getting position of mixing valve lever  (Read 892 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

i have a mixing valve (hope you call it like this in english) with a lever.
The lever moves from left to right and vice versa.
The valve is driven by a 230V motor.

I need some ideas how i can log the leaver position.
Is there some tension sensor or something like this out there?

I attached some pictures.


* l1.jpg (70.3 KB, 504x756 - viewed 19 times.)

* l2.jpg (67.91 KB, 504x756 - viewed 18 times.)

* l3.jpg (91.5 KB, 504x756 - viewed 22 times.)
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 631
Posts: 50115
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I need some ideas how i can log the leaver position.
To what level of accuracy? Perhaps a collection of mini lasers and LDRs that get interrupted as the level moves. Or one laser and a series of LDRs in a ring around the lever.

What is the range of motion of the lever? Would a ultrasonic sensor give you enough accuracy?

Can you modify the level in any way? Like adding a linkage that turned a potentiometer?
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From left to right its 170mm (6.7in).
So 20 LDRs every 8.5mm (0.35in) would give me 0%, 5%, 10%...

I also thought about ultrasonic on the side of the lever. But at 0% and 100% the lever is tilted.
So i have no idea how to do it.

The linkage/potentiometer solution would be very precious. But where to mount the potentiometer
and also there is the tilt problem.

So looks like a infrared LED/laser on the lever and a semicircle with LDRs in front is the easiest way.
Maybe i can count in 2,5% steps - the positions when the laser is between two LDRs?

Some tips on laser and LDRs?
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would use a rotary potentiometer with a lever the same length as the lever on the valve, positioned so they are parallel and in the same plane, and just connect the ends with a pushrod linkage. Use a potentiometer designed to be panel mounted, and stick a flat sheet to the back of the valve assembly to give you something to mount it on. That should be a ten minute job with parts costing about a quid.

(Or you could go with the laser range finder and so on - that sounds like a lot more fun but might end up costing a little more!)
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A hole in the top of the valve lever and a servo linkage would not be a problem.
But what to use as lever on the potentiometer, hm?

What would be the best value for the potentiometer - 10K ?
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

But what to use as lever on the potentiometer, hm?

Surely you're joking?

What would be the best value for the potentiometer - 10K ?

Yes, that would be fine.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not joking. Never so a lever on a poti - only knobs.
I mean are there some to buy?

If not need some aluminum square and need to make a thread from the side for a screw.
Logged

Dallas, TX
Offline Offline
Sr. Member
****
Karma: 10
Posts: 318
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Check out one of the sites that has servos and servo accessories: http://www.servocity.com

They might have the parts you need to adapt a potentiometer.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, sometimes I think to complicated.
It's a lot easier. There is a shaft inside until the cover.
On that shaft is a disc and this disc is just pinned. You can see the
disc in the image. The blue one with the red that is there to show
the heat. So i just need to drill a hole in the cover, remove the disc
and couple the potentiometer with a shaft coupling: http://www.reichelt.de/Potiknoepfe/ACHSKUPPLUNG-2/3/index.html?;ARTICLE=42133
I make pictures when it's done.

But how is the calculation done.
It just turns 90°. So i think i need to open and close my valve and need to check the digital value (max and min) and at them to
the code.This is what i have for the hole range:
Code:
int valvePin = A0;
int valveValue = 0;
int valvePercentage = 0;

void setup() {
  Serial.begin(9600);
}

void loop() {
  valveValue = analogRead(valvePin);
  float voltage = valveValue * (5.0 / 1023.0);
  valvePercentage = valveValue / 10 / 1.02;

  // now print it

  Serial.print("percentage: "); Serial.print(valvePercentage);
  Serial.print(", volts: "); Serial.println(voltage);
  delay(1);
}
But how do i set 400-800 as 100 percentage range?
Logged

Norfolk UK
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2568
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
But how do i set 400-800 as 100 percentage range?
When it is built and you know the analogRead values for both extents of the levers movement then program them into a map() function http://arduino.cc/en/Reference/Map
Logged


Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah map is the thing to look for.
So i also need no calculation.
And constrain that i don't get minus values or more the 100.
Code:
void loop() {
  valveValue = analogRead(valvePin);
  valveInDig = valveValue;
  valveRange = map(valveValue, 400, 800, 0, 100);
  valvePercentage = constrain(valveRange, 0, 100);
  float voltage = valveValue * (5.0 / 1023.0);

  // now print it
  Serial.print("Dig: "); Serial.print(valveInDig);
  Serial.print(", Range: "); Serial.print(valveRange);
  Serial.print(", Percentage: "); Serial.print(valvePercentage);
  Serial.print(", Volts: "); Serial.println(voltage);
  delay(1);
}
But now i start to think about the potentiometer and resolution if i have only a 90° range.
I also want to log the data to SD. But only if there is change that it's not to much data.
So it don't need to be sensitive and that there is not a change just from vibration. I think
logging 5% steps is enough. It's a mechanical valve from the 80s so anyways it's not the
most exact device in the world smiley
Logged

Norfolk UK
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2568
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think your better to constrain the value from AnalogeRead before mapping. If data going into map is within range then you should always get the desired result.
Logged


Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi-de-ho, neighbor.
Home improved and tested and works:
Code:
valveRange = constrain(valveValue, 400, 800);
valvePercentage = map(valveRange, 400, 800, 0, 100);
Logged

Pages: [1]   Go Up
Jump to: