I am building a garage door opener using arduino uno R3 with an ethernet shield. I have the basic open/close working fine and I have the door status sensors working fine. What I want to do with my project is also control the lockout feature of my craftsman opener that disables remotes from opening the door when activated. Now there are two wires that go from the opener to the button panel. The voltage on these wires is 16V when the lockout feature is not active. What happens when the lockout button is pushed, it closes the circuit but has a capacitor that changes the voltage as well as a holding the button closed for more than 2 seconds. This activates the lockout and it then changes the signal form steady 16V to a pulse on/off (which I can see on the LED on the button panel.)
What I am interested in is monitoring the voltage on these wires and when it goes from steady 16V to pulse on/off I set the status of the lockout to active. Any ideas or can you point me to a source I can leverage for this?
Thanks Rob, I figured that out. I believe this is the formula: 5V = R2/(R2+R1)* 16V which comes to 11:5. Tested it out and I think that works. I get 5V at max. Now the question changes to the best way to sense the pulse change. I could simply sample it a number of times and if the voltage is below 5V (or some lower threshold) at any given point it is pulsing. Is there a better way?
Then by definition the first LOW read on the wire is the start of the pulse. After detecting that I would wait for say 10-20mS and read again to verify.
Thanks Rob, I just learned my assumption that the two states were 16V steady and 16V pulse. I did a simple analog read and output to serial. At first it was 1023 for many test states (I put no delay in) then suddenly I saw reading of 0 to others (I think the others is i am catching right at the state is changing). So I know know that the difference between the states is a different pulse rate.
Do you or anyone have suggestion on how to determine the pulse rate? I am thinking I just have to sample it a bunch and figure it out.
Is there any bounce in the signal? If so you need to take a couple of readings a few mS apart and only accept the value if they are the same.
Note that if you are using an analog input a slight difference in readings should be considered "the same", in fact in your case anything > 500 is a HIGH, < 500 is a LOW. But why wouldn't you use a digital input?
What is driving this signal? A mechanical switch or some electronics?
To determine the period/frequency just time between two consecutive rising (or falling) edges, you could use an interrupt for this or just poll the input
Rob good point on the digital signal. I think that may be the way to go. I will try that today. I did notice that there is a large variance in analog values even on a constant signal from the arduino's 5V pin to the analog. I did make this less when I put the adjacent pin to ground. There seems to be a bit of cross talk on the analog pins.
OK tested my signal using digital pin and traced the resulting pulses using the simple digitalread example in arduino. I got the results in groups of 8, 1s and 8, 0s. Unfortunately, I saw no change in the pulse rate in either condition which puzzles me.
There are two states on the line. One when the lockout is inactive (the LED on the button panel is solid on) or active (the LED blinks). I figured that the pulse would be different. Any ideas as to how to identify the difference would be greatly appreciated.
I am thinking of tapping the LED as there has to be a difference there or else how could it be solid/blink?
Rob,
OK what this wire is is the Garage Door Opener has two wires that run to the entrance door and connected to the button panel used to open/close, turn on/off the light and lock out the wireless remotes. The circuitry of the panel is quite simple as you expect. I has 3 buttons. one simply closes the circuit which triggers the garage door to open and close. The other two buttons have a capacitor each of different levels which when closed send I would expect a different voltage level to the unit which in turn interprets that and performs the action requested. The LED just connects to both wires + and - with a resistor.
So, I tested the voltage with my tester and found that it normally produces 16V. I also test it when the lockout was active (LED flashing) and the volts are all over the place which is what triggered me to assume there was a pulse to when it was active and solid HIGH (LED on not flashing) when inactive. This turned out to be a bad assumption because I followed your advice and tested the signal on a digital pin and there definitely is a pulse in all cases. I indicates a steady pulse that does not vary no matter what state the lockout is in. What makes no sense is the LED is either steady on or flashing on/off. The only source of power to the LED is the wires running from the unit.
What I am thinking of doing now is test the signal right at the LED and see what I am getting. I still assume I need to reduce the voltage because I am sure it is 16V at that point.
Just so you know why I am attempting this. For the door status I simply have magnet contact sensor switches at the closed position as well as at the fully open position to give me that status. I am trying to also be able to know the status of the lockout. Is it active or inactive? The reason for this is extra security so when we are away I can make sure the remotes are not active since we have issues with people breaking into cars and then using the remotes to open the garages.
The other two buttons have a capacitor each of different levels which when closed send I would expect a different voltage level to the unit
Capacitors can't really be used to give you a different voltage level, they could provide different ramp up/down times for the button press but that would be weird thing to do.
It sounds to me that they are using resistors to provide three levels on two wires. There would be a pullup resistor in the main box and X, Y and Z ohm resistors on the three buttons.
The LED just connects to both wires + and - with a resistor.
This I don't really get but maybe they reverse the polarity of the main box input to drive the LED.
I also test it when the lockout was active (LED flashing) and the volts are all over the place which is what triggered me to assume there was a pulse to when it was active and solid HIGH (LED on not flashing) when inactive.
A reasonable assumption.
This turned out to be a bad assumption
Or not.
If they are doing all this with only two wires there's something clever going on that will take a lot of deep thought (or a proper schematic) to figure out.
What I am thinking of doing now is test the signal right at the LED and see what I am getting. I still assume I need to reduce the voltage because I am sure it is 16V at that point.
If you just test across the LED the max voltage will be about 2v regardless of the 16v as LEDs have a fixed Vf more or less and the resistor takes up the rest. That may be the best thing to do.
I could maybe come up with a circuit to do as you say using resistors and reversing the polarity to flash the LED but I don't think that helps.
Four questions
a) What is the approx frequency of the LED flash?
b) Do you have to hold the buttons for a while before they register? IE at least one LED flash.
c) If you give the buttons a very quick press when the LED is off do they work?
d) Can you properly trace the circuit and produce a schematic?
Are you sure you don't have some diodes in that controller as well?
IIRC, my Liftmaster garage door opener (Craftsman is just a re-badged Chamberlain unit) has a diode on the lock button and another on the lights button. This allows the main unit to sense which half of the cycle is blocked by the diode and know which button you pressed.
J, the button panel board is really simple to deconstruct. I have the schematic on paper. I will try and create it in a post here shortly.
Rob,
a) What is the approx frequency of the LED flash?
I will get an approximate rate on that.
b) Do you have to hold the buttons for a while before they register? IE at least one LED flash.
Yes, only on the lockout. The button for the open/close which has no capacitor triggers immediately. The light which has a capacitor triggers the light immediately. The button for the lockout has a capacitor of a different value as the light button requires depressing the button for about two seconds or more to activate.
c) If you give the buttons a very quick press when the LED is off do they work?
I will check to make absolutely sure the door and light do. The lockout, no it has to be pressed for an extended time.
d) Can you properly trace the circuit and produce a schematic?
I can type in the schematic of the button panel here shortly. The unit itself will take some time if I need to do that. I have a spare unit I can tinker with if I need to. I didn't expect this was as complicated to hack so never thought I would need to go there.
So I think I understood your comment on my plan to test at the LED may be fine since the voltage is low enough. I will test it before applying it to the micro pin.
FYI,,, the pulse of the wires was 11111111000000001111111100000000
using the code:
void loop() {
int sensorValue = digitalRead(2);
Serial.print(sensorValue);
}
Which I don't know the actual pulse rate since I don't know how fast the read loop is occurring. But in any case, this does not change based on the state of the lockout. It does as you would expect when you depress any of the buttons as the signal bypasses the voltage divider. It goes LOW while the button is depressed.
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
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.
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.
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.
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.
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.