Arduino Detecting 24 vac via HCPL3700 not working at all. Need Help

Hello all. I have been working for weeks on a large architectural lighting control system. I have finished the workbench portion of the system minus one piece. I decided to add Open/Closed circuit detection on the system. When a Light is on, a solenoid emits a 24vac signal out. I purchased enough HCPL3700 chips to finish the project. I cannot get these to do anything. I have also tried connecting a 0.2uF ceramic capacitor between pins 5 and 8 (I didn't have a 0.1uf handy which the data called for) and removing it. The Most current i could every get out of Vo was somewhere around 0.4 Volts no matter what i did with the circuit. The Data sheet shows that Vo should be "HIGH" if the input current appears to be off. Even when I completely disconnect the input wires from pins 1 and 4 Vo never appears to go high. I have also tried 12vdc into the Vcc of the chip and the Vo results were the same.

If someone could help me understand what is going on, I would be grateful. I am at a loss.
Thank you in advance

This is the chip:

These are the data sheets that accompany this chip:
http://www.fairchildsemi.com/ds/HC/HCPL3700.pdf
http://www.slottechforum.com/slotinfo/Techstuff/CD2%20Diodes%20and%20Transistors/Opto%20and%20LED/Optoisolators/HCPL3700%20app%20note.pdf

board-layout.png

It is a open-collector output. You have to use a resistor to make the level 'high'.
You can start by using the internal pullup resistor : pinMode (pin, INPUT_PULLUP);
I think a value of 4k7 is a good value. Connect that from Vo to 5V.

Are those two resistors of 10k to the 24Vac not too high ? I don't understand the datasheet very well, but I think the value should be lower. What is the lowest value for the 24Vac ? If it is 20Vac, the resistors need to be 2k7 each.

The Most current i could every get out of Vo was somewhere around 0.4 Volts no matter what i did with the circuit. The Data sheet shows that Vo should be "HIGH" if the input current appears to be off. Even when I completely disconnect the input wires from pins 1 and 4 Vo never appears to go high. I have also tried 12vdc into the Vcc of the chip and the Vo results were the same.
If someone could help me understand what is going on, I would be grateful. I am at a loss.

Uh, you're not an electronic person are you ? I mean anyone can BUY electronics but usually it's a good idea to ask someone about it if you don't have any experience. The problem basically in a nutshell is that you don't know what "OPEN COLLECTOR " means.
I say that because you linked the datasheet for the device which means you looked at it and didn't notice it is an Open Collector device. What that means is that your circuit is missing a pullup resistor. The output of the device, pin -6 is supposed to SINK the current for an led. At the same time it could be used to send a LOW to a uController. Your circuit is missing the pullup resistor so of course you won't measure any voltage. If you connect a led and resistor and use the pin-6 output of the chip for the GND of the led/resistor (220 ohms) it will light when there is AC on the input of the chip and your arduino will see a HIGH with NO AC and a LOW WITH AC.

@Caltoa,
The 10k resistors are current limiting resistors for the bridge rectifier inside the chip. It is very sensitive and doesn't need much current.

raschemmel, the led is a good idea.
From the 5V a resistor of 220 ohm to a led and the led to Vo. Instead of the 4k7 that I mentioned.
And Vo also to Arduino input.
The application note tells how to calculate the value for the resistor. There seems to be a 5.1V offset and I get 2k7 out of that formula.

I read the application note again, but I still don't understand it :frowning:

If you plan to add the led , don't use 4.7 k ohm. If you don't plan to use the led then that value is fine.

SEE FIGURE -9 on PAGE 7 ,
the PULLUP resistor is called R (L) (for LOAD)

FYI,
If you replace the 10k ohm resistors on the input of the chip with 47k ohm resistors, you can use it to detect 120VAC, so that if the power goes off a car battery powered $3 Pro-Mini can turn on some flood lights and sound an alarm. When the power comes back on a trickle charger can charge the car (or motorcycle) battery

What application note ? (I just looked at the test circuit on page 7)

PS- I guess the OP doesn't need help anymore....(or he's mad at me)

Thank you all for the help. And to respond to @raschemmel, I'm not an electronics guy by trade. I'm in IT. This project was definitely a side project that sparked an interest to learn. I have been careful and studied as i worked through the project. However, at every turn, i am learning something new.

So to add a question... I have hooked a 4.7K resistor between Vcc and Vo. I then connected Vo to Pin 8 on the arduino and set 8 to "INPUT". Because i was externally resisting it did not seem like I needed to set pin 8 to INPUT_PULLUP. Is this correct?

I then stuck an LED in pin 13 (Like on the basic "blink" demo for arduino) and told the controller when PIN 8 goes HIGH turn on the LED, When pin 8 goes LOW turn it off. Instead of turning of the LED, it is simply dimming it. Because I had 10k resistors, I hooked 3 up in parallel on each leg of the 24 vac. this gave me a total resistance of 3k3 on each leg. I was hoping to get down to the suggested 2k7 but ran out of resistors. Before reducing the resistance, the LED in pin 13 always stayed on. It was after I reduced the resistance that it began to dim.

Does this mean I need to continue to reduce the resistance? when I monitor the 24 vac with a voltmeter, it is actually metering around 27 vac.

If you connect a led and resistor and use the pin-6 output of the chip for the GND of the led/resistor (220 ohms) it will light when there is AC on the input of the chip and your arduino will see a HIGH with NO AC and a LOW WITH AC.

This is what I said:

your arduino will see a HIGH with NO AC and a LOW WITH AC.

This is what you did:

and told the controller when PIN 8 goes HIGH turn on the LED, When pin 8 goes LOW turn it off. Instead of turning of the LED, it is simply dimming it.

Listen to me. Forget the arduino. Just forget it. You don't need it right now. You need to do exactly what I tell you.
First of all , your program logic is backwards but don't worry about that. You need to stop doubting the chip and see it work
BEFORE you EVEN think about connecting it to the arduino.
Connect pin-8 of the chip to +5V from the arduino to power the chip. Connect pin-5 from the chip to the GND on the arduino. Get a 220 ohm resistor and an led and connect it like I told you do with the resistor connected to +5V and the other end of the resistor to the anode (+) of the led and cathode (-) to pin -6 of the chip. Connect the 10k resistors on each leg of the chip on pins 1 & 4 (leave 2 & 3 unconnected). Turn on the arduino (or plug a USB cable into it ). Leave the 24VAC OFF . The LED should be
OFF. Now turn on the 24V. If you have not damaged the chip with any of your previous experimentation the led should come on .
Now re-read what you wrote and what I wrote above to see where your logic is backwards. You need the arduino to look for a LOW (like I said above) in order to turn on an indicator led.

raschemmel

Thank you. I have went home from the office for the night but will try it when I get in tomorrow.

Out of curiosity. Even though my logic was backwards (which I was iintentional, Iwas hoping to see the state of the output as the arduino saw it) why did the LED pulse with modulate instead of just go off? To verify the modulation, I setup the serial to output the state of pin 8. When I would turn on the 24 vac, the serial monitor would print HIGH,LOW,HIGH,LOW..etc

When I would turn off the 24 vac, it would just continue to print HIGH.

I orderd a few extra chips just incase i damaged any, so of this one is infact damaged, i will chock it up as a loss and start over foowing your instructions to a T.

Once again thank you for the guidance. I'm sure this is petty and simple to you but it is def on the fringe of understanding for me

Read the datasheet.
Pin -8 is Vcc , not output. Pin -6 is the output. and both pin -8 (Vcc) and pin -5 GND) must be connectED to arduino +5 & GND.
Like I said FORGET ABOUT THE ARDUINO UNTIL YOU SEE THE CHIP WORK.
Trust me ok. The arduino is not your problem right now. Your problem is understanding how to use the chip. (which is more important than understand how it works)

To verify the modulation, I setup the serial to output the state of pin 8. When I would turn on the 24 vac, the serial monitor would print HIGH,LOW,HIGH,LOW..etc

You lost me. What modulation ? There is no modulation . Period. Repeat, no modulation. So what are you talking about ?

I was talking about monitoring pin 8 on the arduino, not on the chip. I guess, amongst other things i dont fully grasp, i thought when you got an LED to "dim" this was due to pulse width modulation because LEDs don't actually dim but change the frequency of there cycle.

Like I said I'm sure iI'm not fully grasping everything. I am a self learner through this all and have tried to learn and study as much as I can. I will follow your instruction tomorrow. Looking forward to seeing the chip act as it ahoudl

Thank you again for all of your help through this

Did you connect Pin-5 of the chip to the arduino GND ?
Did you connect +5V to pin 8 of the chip ?

I came in this morning and tested with no success.

Here is howiI set it up:
pin 1&4 on chip to 10k resistors and then those to each leg of the 24 vac
Pin 5 on chip to GND on arduino
Pin 8 on chip to +5 on arduino
Resistor from pin 8 (5+) to + side of LED.

  • Side of LED to pin 6 on chip

with the 24 vac off, the LED would be off. With the 24 vac on the LED blink once and shut off. I cycled the 24 vac power on and off and this time the LED didn't even blink.

I plugged the LED into a known good source to make sure it was not burnt. It lit right up.

I traded chips and put in a new one. Still the exact same result.

What in the world am I missing?

The chip is working. What WE missed before is the purpose of the chip. It's not an ac voltage detector. It's an AC transient detector. The attached app note explains how it outputs a brief LOW (could be less than 1 ms) if the 24VAC drops BELOW the
threshold. Because it is so brief, you wouldn't see the led blink most of the time. It detects a DROP in the AC voltage (as in when
there is a sag in the voltage due to heavy load on the line) . It is used to monitor a loss of power on the line. If you program the arduino to look for a LOW, and then turn on led 13 when detected, it should work.

int HCPL_sensepin = [dn]; // dn= arduino pin #

  if (HCPL_sensepin == LOW)
                           {
                              digitalWrite(led_13,HIGH);
                            )

Read the stuff about adjusting the input resistance to set the threshold level.
The most IMPORTANT THING TO DO IS INCREASE THE VALUE OF THE CAP FROM THE PULLUP RESISTOR TO GROUND !
This INCREASES THE LOW PULSE WIDTH.
Make it more than 1 uF.
see fig-9, page 7 of chip datasheet for schematic.

HCPL3700 app note.pdf (147 KB)

read this forum post about the HCPL3700
http://forum.arduino.cc/index.php?topic=175780.0

google: "arduino HCPL3700 example circuits tutorial"

This is starting to make more sense. and also makes me concerned I selected a very complicated route for a simple solution. I used the 2 bottom links you provided to determine that this was the chip i wanted. I had not seen the first link provided.

in the Code snippet below, you provided a way to detect voltage drop. This would be able to tell me if the power had switched off on the 24 vac. How do I detect and then clear that when it turns back on? Or is the only purpose of this chip to detect each time voltage drops below a certain threshold and thats it. I guess that could be useful in terms of logging if looking for power condition issues but it is not useful in the context I need.

  if (HCPL_sensepin == LOW)
                           {
                              digitalWrite(led_13,HIGH);
                            )

Your on your own until I get off work.