Go Down

Topic: Trying to read voltage difference on 16V maximum garage door opener wires (Read 3 times) previous topic - next topic

drewp63

I may have the polarity wrong I don't have the board in front of me so going off memory
D1 is the LED
SW1 is the door open/close switch
SW2 is the light on/off
SW3 is the lockout


      _____________D1_________ R1_______________
     |                                                                  |
     |                                                                  |
     |     /--------------SW1---------------------------\    |
     |    /                                                         \   |
+ ----------------------SW2-------C1------------------------- -
          \                                                          /
           \___________SW3_____C2_____________/

As you can see, not much to the board.

Graynomad

Quote
test at the LED may be fine since the voltage is low enough.

Yes, the voltage across the LED should only be ~2v, that's not enough to drive a digital input HIGH though so you'll have to go back to the analog input.

Quote
Which I don't know the actual pulse rate since I don't know how fast the read loop is occurring.

Print the value of mills() every time the value changes from 1 to 0, even better remember the last mills() value and print the difference every time.

I can't figure out how it works from the schematic, but if measuring across the LED works maybe that's all you need.

______
Rob



Rob Gray aka the GRAYnomad www.robgray.com

Graynomad

Rob Gray aka the GRAYnomad www.robgray.com

drewp63

Thanks Rob.  The forum went down while I was writing up my updates.

I reviewed the actual board and found I had an error in my schematic.

             /--------SW1---------------------------\
           /                                                   \
         /-----------SW2----------C1----------------\
       /                                                         \
+ -------------------------<R1 1.6K>----------------------------------- -
       \                                                         /
        \_________SW3________C2____________/
          \                                                    /
            \____________D1________________/

I had the resistor in line with the LED. 

I then did some testing of the voltage (DC) on the line
All switches open              14.23v
SW1 closed                       14.5v
SW2 closed                      14.0v
SW3 closed                      14.0v

Based on my A/C test on the line it showed a voltage of 33V about double the DC reading.  (with my limited knowledge I think any DC signal would show up as double if you select A/C on the multimeter correct?)  The capacitors give smell of A/C based on your comments as well as what I have read on use of capacitors in A/C circuits. 

I think I am going to open up the spare unit I have and see how it is wired up.  The fact I can't see a correlation in the voltage while that LED is blinking (1second per cycle) makes no sense to me.  A/C may explain it.

drewp63

Rob, I think I have it figured out but look to your expertise.  Before I was simply using two resistors of different resistance to divide the voltage to 4.2v from 16v.  That worked as designed however, it didn't work for the purpose of sensing voltage change.  I was getting a lot of noise. The signal bounced all over the place.

Based on the possibility that this line was A/C and not D/C I googled around and found this link:
http://openenergymonitor.org/emon/buildingblocks/measuring-voltage-with-an-acac-power-adapter

It is for monitoring A/C voltage.  It basically is a voltage divider with additional capacitor and two resistors on the Arduino 5V line to reduce that voltage to 2.5v.  I applied this to my circuit and bam.  I am now getting a signal value that relates to the LED flash.  I also took your advice and coded my monitor to say the value is HIGH when > 500 and LOW <= 500.  If my assumptions and conclusions are correct, I can test the analog pin for HIGH (>500) for > 6 cycles.  If it is, the lockout is active.  If not, (it usually only has 2 cycles HIGH) then it is inactive.

Your comments are appreciated.

Graynomad

This is all a bit analog for me but looks clever.

So now you are getting pulses at some frequency that are in bursts of about 1/2 sec on/off. Like this ?

_____!_!_!_!_!___________!_!_!_!_!____________!_!_!_!_!____________!_!_!_!_!_____

Quote
it usually only has 2 cycles HIGH

Why is it only > 500 for 2 samples? Is the frequency that fast? (or are you sampling that slow?)

What's you current code?

I'm having trouble working remotely and without any proper test equipment I have to say. This really needs a scope so we can see what's going on.

OTOH if you are getting reliable results maybe that's all we need for a one-off home job.

______
Confused

Rob Gray aka the GRAYnomad www.robgray.com

drewp63

Agreed that a scope would be nice but lacking one I am doing a lot of trial and error.

I made some adjustments to get a status result that was 100% accurate.  I had to increase the sampling and added a delay.  I am sure I can reduce the delay to improve performance but I have what I needed for this particular project V1.  As I learn more about circuit principles I am sure I can make improvements.  But for now it works.  Here is the simple code I used.  I have not incorporated it into my overall door management code yet. 

void loop() {
  int No_High_States = 0;
  for ( int x = 0; x < 12; x++) {
   
    int sensorValue1 = analogRead(A0);
   
    if (sensorValue1 > 500)
      No_High_States = No_High_States++;
    delay(50);
  }
  if (No_High_States > 4)
    Serial.println ("Active ");
  else
    Serial.println ("Inactive ");
 
}

With the new enhanced divider circuitry, I eliminated most of the noise.  What I found was there is always a pulse much like when manipulating a LED to blink slow or fast.  When the LED is "solid" on, it actually has a fast pulse.  When the LED is flashing, the pulse is about 1 second for a full on/off cycle. 

I am sure there is a much simpler divider circuit I can use as it was designed for AC monitoring.  I am using exactly the one in the diagram on the web page I listed previously.

Graynomad

All you need to monitor low-voltage AC is a diode (schottky would be best I think), that will half-wave rectify the signal and give you pulses which then have to be reduced to 5v.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Go Up