tarekza3tari

goodnight,i have a questionI measure the lamp current (200watt) -> (0.9) from ct sensor and I put a relayfor lamp, i want when the current greater than 0.6 then turn off lamp.When upload algorithm to arduino, current flows from 0.3 to 0.9 then 0.3 etc and does not remain fixed.

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.Do not send technical questions via personal messaging - they will be ignored.I speak for myself, not Arduino.

draythomp

I believe there are two things going on here. The first is that the light is changing resistance as it heats up and the current is going down over time until it stabilizes. That's what happens with my light bulbs anyway. The other is that the library uses a software high pass filter to both remove transients and to equalized the 2.5 volt offset that you must have to measure AC current; this high pass filter tends to wander a bit in the first minute until the algorithm settles out. Also, there is often a problem with using a CT to measure low currents. The devices tend to be noisy, which isn't a problem when you're measuring 15A, but you may have to add a capacitor to filter out some of the trash to work reliably at lower levels.

Give it a little time, at least 10 seconds to a minute to settle in and then see what happens. This will mean keeping the relay out of the circuit until you understand the operation over time.

Of course, there is also the possibility of some hardware problem, but I suspect you've set that up correctly.