I have an arduino controlling some home appliances (220v) with some relays, via I2C.
When each relay is closed, these appliances may be consuming power or not, because each one of them have their own switch (some are floodlights with presence detector, water boiler with its own thermostat, etc.).
I'd like to know when the appliances are really on (consuming power), because turning it on with the relay cannot tell me for sure (their internal switch may be on or off). For each appliance I have an output port, driver and relay, and will have an input port that should tell if the appliance is consuming or not.
I used some ACS712 kits connected to a PCF8591 (I was planning to know if the appliances were on/off by reading the value on each ADC port). There are kits of 5, 10 and 20A. I tested a 5A kit, the datasheet says it will increase 185mv per Ampere. The appliance I tested is a 20w Led floodlight and therefore consumes around 90mA (220v AC). This means the ACS712 would increase 16mV when ON, which is difficult for the PCF8591 to notice any difference (8 bits). Also, since my appliances are AC, the output of the ACS712 is also variable (50 Hz).
So I gave up of detecting if the circuit is closed by current sensors, and I believe I need to approach this problem differently.
Basically I need a circuit that detects that the appliance circuit is closed (relay and internal switches) and then puts a digital pin at "1". I saw some ideas in the web with phototransistors, like the TLP620, but I'm not sure it could support voltages like 220V AC.
One way you may consider to detect if you device is drawing power on an ac load is to use a current transformer in series with the load.
It is like a shunt resistor used in current meters. These have just a few turns of wire in the primary that wont effect your load (be it a light or heater etc.) . You can also use non-contact current transformers that clamp over the wire and produce a small ac voltage when the device is drawing current. To get a go / no go signal from that to your monitor circuit, you can connect a (resistor and optocoupler) to the output wires from the transformer.
jtech's advice is spot-on... especially since you're working with AC line voltages.
If this was a low voltage application, you can use a 0.1ohm resistor and read the voltage drop across it, using some ohms law compute for current. But this is not advisable if you'll be doing this with high voltage AC.
Mouser sells current transformers starting at $1 each, and going up from there. They have 20A primary rated costing less than $2.50 each.
Yes, current transformers are much less noisy than the hall-sensor ACS712 - however you must be careful with
current transformers, they must have the secondary correctly terminated to prevent high voltages. Many home electricity
monitors come with optional / spare current transformer sender modules - probably available on eBay too.
I was thinking having a voltage detector rather than a current sensor, because I want a circuit that can be suitable for currents from 90mA to 2A AC. Anyway, this solution based on the current transformer seems good.
Would it work with any type of transformer? Could I use a led driver like this?
I have found on ebay a cheap non-contact voltage detector. http://img.inkfrog.com/pix/gomepls/18252_3.jpg
I ordered one and it actually works: The led turns ON whenever its close to a wire with electrical current, and goes back OFF when its far away.
So I though: I'll just open it and re-use the circuit in my project, so I can detect whenever the relays are ON or OFF. I can measure the voltage drop on the LED in order to know if the detector circuit its detecting voltage or not.
I dismantled it and powered it with 3V to test (equivelent to the 2XAAA batteries that it uses).
However, when is not fed by batteries, the LED is always ON, making the detection circuit useless. I tried back again with the AAA batteries and it works fine!
Am I missing something here? Any idea why is working with batteries and why is not working with a wired power supply?
joaoabs:
However, when is not fed by batteries, the LED is always ON, making the detection circuit useless. I tried back again with the AAA batteries and it works fine!
Am I missing something here? Any idea why is working with batteries and why is not working with a wired power supply?
Use optocoupler to replace LED, this will be isolated between. Use isolated dc supply or wireless power module to power up the board. Use decouple cap at 3 V power. put small cap at input of IC for low pass filter.
Thanks for your reply. Yes, the circuit seems the same as the one you show. In my case, the IC is the 74HC14D.
sonnyyu:
joaoabs:
However, when is not fed by batteries, the LED is always ON, making the detection circuit useless. I tried back again with the AAA batteries and it works fine!
Am I missing something here? Any idea why is working with batteries and why is not working with a wired power supply?
Use optocoupler to replace LED, this will be isolated between. Use isolated dc supply or wireless power module to power up the board. Use decouple cap at 3 V power. put small cap at input of IC for low pass filter.
What I don't understand is why should I replace the LED by an optocoupler. The circuit itself is contactless (It should only touch the plastic of the wire, not the metal), so why the need to isolate?
Also, could you please provide more details on "Isolated DC supply or Wireless power module"? In my test I used a 220VAC/12VDC power supply, and then on the breadboard I used a step-down to 3V based on LM2596, like this one:
So I think the 3V already have decouple capacitors, right?
How can I isolate further the power supply?
And finally, what is a wireless power module?
Do a search on ebay for Arduino Current Sensor. I was actually just looking for Arduino stuff and saw the current sensor modules. I thought about getting this one:
mrmonteith:
Do a search on ebay for Arduino Current Sensor. I was actually just looking for Arduino stuff and saw the current sensor modules. I thought about getting this one:
Yes, I already tried similar sensors based on that same Allegro ACS712. However, for AC currents, the output will also be AC, and what I need is a logical "1" (or equivalent) so I can detect on a digital port. Check my initial post:
joaoabs:
I used some ACS712 kits connected to a PCF8591 (I was planning to know if the appliances were on/off by reading the value on each ADC port). There are kits of 5, 10 and 20A. I tested a 5A kit, the datasheet says it will increase 185mv per Ampere. The appliance I tested is a 20w Led floodlight and therefore consumes around 90mA (220v AC). This means the ACS712 would increase 16mV when ON, which is difficult for the PCF8591 to notice any difference (8 bits). Also, since my appliances are AC, the output of the ACS712 is also variable (50 Hz).
So I gave up of detecting if the circuit is closed by current sensors, and I believe I need to approach this problem differently.
Basically I need a circuit that detects that the appliance circuit is closed (relay and internal switches) and then puts a digital pin at "1". I saw some ideas in the web with phototransistors, like the TLP620, but I'm not sure it could support voltages like 220V AC.
sonnyyu:
There are a lot ways detect AC, but OP's way is the most coolest way.
I had seen some schematics with similar approaches, but never quite understood how it works. Is it connected in series or in parallel? I have the feeling its in series...
My AC detectors should be able to detect if a 20W lamp is ON or OFF (low current), but also the same for an 2000W water-boiler resistor (~10A). Can these optocouplers handle such high currents? If they can, I believe I have my problem solved....
Looking at the datasheets of the PS2501 and PC817 (used on the board from ebay) there is the value of "forward current" and is ~1A....
sonnyyu:
sure, use small opto triac drive big one.
Thanks,
That seems a schematic to control 220VAC from an arduino/ucontroller, right?
What we have been discussing in this topic is the opposite: To make the arduino/ucontroller aware when the a 220VAC/2000W device is ON or OFF. For that, one possibility would be using an optocoupler, but since my devices can be form 20W to 2000W, the optocouplers need to handle 10A.