Yes I think you're right. I measured voltage on the input pin that is looking for the closed valve signal while I opened the valve. For some reason, the voltage turns negative with real low value.
I would expect to always have 3.3 V, except when the valve is fully closed or fully opened.
Maybe it's time to begin playing with the ossilloscope I got from my father so I can measure voltage on every pin at the same time.
Hi,
Can you post a picture of your project please,so we can see your component layout?
It sounds like you have a gnd connection missing or faulty.
The voltage on pins D5 and D6 are supposed to change only when you reach either end of the value travel.
The fact that it drops immediately you operate the motor is worrying.
What point on your project are you using for gnd reference for the DMM?
The motor power is coming from a small bread board power supply, which is connected to a 12 V Lithium battery. The power supply gives 5 V to a H-Bridge I built. There is no proper L298 board, I just did not think a schematic with my four NPN was worth it for the current situation.
When I measured with the multimeter, I used the ground coming from the 5V power supply. But, as you can see on my breadboard, all the grounds are connected together. It is the right thing to do right?
One thing I want to clarify: the voltage on the input pins D5/D6 does not drop immediatly when I operate the motor. I would say there is roughly one second delay. I read around 3V, and all of sudden it drops to around 0.007 V.
Below are more pictures of my project.
Thanks again!
I also attached a more Hi-Res picture to the post if you want to download it. As high as I could get with 1 MB.
Mhhh... I am pretty sure the issue is in my code. For some reason it gets out of the while loop I think.
Also, the IP adress does not respond after a while in the browser and I have to reset the board. All the Wi-Fi code I not understand completely as I used one from another person... I guess I will look more deeply into the code itself...
I tried with a 5VDC 2 amp PSU and got the same result.
I looked at it again and I really think there is something in the loop that makes the board stops its process. But the board only resets when I send a command. I can see the blue LED blinks, and at that point the valve stops moving. But there is still 3.3 V on the Input pin. You can see this on the video below.
It really seems the sketch is in a loop because the valve starts to move again after a while.
This makes no sense to me. But I solved the issue by adding a delay of 10 seconds after the command is sent. I do not understand why I had to do this, but it works... And the "limit switches" action prevent the solenoid to be actionned for 10 seconds. So I guess this is viable for use...
Thanks for your help on this guys!
if (request.indexOf("/relay=ON") != -1) {
// digitalWrite(closePin, LOW);
// digitalWrite(openPin, HIGH);
// delay(1000);
while (digitalRead(valveOpenedPin) == HIGH) {
digitalWrite(openPin, HIGH);
delay(10000);
}
digitalWrite(openPin, LOW);
value = HIGH;
}
if (request.indexOf("/relay=OFF") != -1) {
// digitalWrite(openPin, LOW);
// digitalWrite(closePin, HIGH);
// delay(1000);
while (digitalRead(valveClosedPin) == HIGH) {
digitalWrite(closePin, HIGH);
delay(10000);
}
digitalWrite(closePin, LOW);
value = LOW;
}
Hi.
You have 4 transistors in your pictures, where are they on your circuit diagram?
Please include your power supply , limit switches and motor, not terminal blocks.
The valve has a stroke time of about 10 seconds according to the paper work. So by adding the delay you have told the valve that open is run 10 seconds one way, closed is 10 seconds the other way.
It works but its not really correct. With out opening the valve to look at the style if inputs inside the head its hard to tell what is really going on. If this was a expensive industrial valve I would say that the cams inside the head had not been adjusted to set the open and closed points but I do not see a note on how to set the end points on this valve.
The transistors are four NPN that serve as a H-Bridge.
The power supply is wathever I find that provides 5 VDC. I ran tests with USB from PC; with the small Bread Board Power Supply connected to a 12V Lithium Milwaukee battery; and with a 2 Amp 5VDC phone charger connected to 120 VAC.
I do not understand your comment about the limit switch and the motor. They are all built in within the valve and I connect the valve directly to the terminals as you can see on the above pictures.
gpop1:
Yes the stroke is approximatively 10 seconds. So I need the delay to be at least 10 seconds. I tried just for fun putting 20 seconds and it worked as well.
The delay is within a while loop. So the way I read my code is:
As long as (while) the input pin for the limit switch does not read 0 V
Turn the motor ON
Delay of 10 or 20 seconds
Exit the loop as soon as the input pin of the limit swith reads 0V
I think this ensure that the valve does not keep trying to move while it already reached its end position. And to my ears it works. Because I can hear the solenoid being activated if I apply directly voltage. But I do not hear it with my code. Even if I put in a 20 seconds delay, the valve stops as soon as it reachs its end position.
This is not the perfect solution as if the valve takes longer than the delay to open, then the board will reset (which can be seen on the above video). I think the root cause of my issue is the board resetting.
As far as calibration, I think everything is correct internally. I have 3 wires for the limit switches acting as dry contacts. So on common, and one each for the fully opened or fully closed positions. I can confirm you those dry contacts are NO and only closed once the valve reaches its final position.
Below are pictures of the final board I did. The only negative I have is I do not have 5VDC directly to the valve. I seems the impedance of the transistors is too high. What is strange though is that I tried just for fun to apply 5 VDC to the the base of the NPNs instead of the 3.3 VDC from the D1 Wemos. And the valve went faster??? I thougth the voltage applied to the base was only to turn the NPN "on" and the the 5 VDC from the collector was supposes to go to the emitter...
The transistors are four NPN that serve as a H-Bridge.
The power supply is wathever I find that provides 5 VDC. I ran tests with USB from PC; with the small Bread Board Power Supply connected to a 12V Lithium Milwaukee battery; and with a 2 Amp 5VDC phone charger connected to 120 VAC.
I do not understand your comment about the limit switch and the motor. They are all built in within the valve and I connect the valve directly to the terminals as you can see on the above pictures.
So the L298 does not exist, why is it in your circuit diagram?
Please post an accurate schematic of your project.
Thanks.. Tom..