Hi, I want to realize a circuit, connected to analog/digital input of arduino, that put arduino output to high if a lamp (powered with 220vac) became broken (even if 220vac is present. Can anybody help me? Thanks.
What sort of lamp?
lamp with filament
What about an ldr? That would test the most important thing: "is the lamp generating light?"
If that would work, you don't need an Arduino. An analog comparator would work, and they don't need any code.
petamel: I'm sorry Paul for my delayed reply. I want to know if the lamp is broken both cases (switched on and off). Thank you for your attention
Wow! 20 months later!
Well, this is a trifle tricky. :grinning: When the lamp is powered, you want to monitor whether it is drawing current, so you want a current sensor. Let's see - this one should probably do. The 5 Amp ACS712 gives an analog output of 1 V per 5 Amps, so you need to figure how much current your lamp draws to get an idea of how critical the ADC reading will be; you may want to add an op amp or comparator as per the application notes to make detection easier.
To check the lamp when it is not powered - well, you have to actually power it! Basically, an opto-coupler across the switch which controls the lamp feeds a few mA through the lamp without lighting it, checking if the filament is OK. If there is no mains supply at all, then you simply will not be able to determine whether the lamp is intact. :astonished:
The previously mentioned current sensor will do it when on, then put an optocoupler across the lamp driver portion of the circuit. When it is off and the filimate is good you will get an output from the optocoupler, if it is bad you will not. Since you have control of the lamp you know when it is off or on. When on you will not have an output from the optocoupler. The resistance levels etc will be relative high, but you still have to maintain the minimum current required on the photo side. this way everything can be in one enclosuer.
Good Luck & Have Fun! Gil