Reading from a CT Sensor pin affected by Seven Segment Displays switching on and off

Re: screen shots

The screenshots were generated using my test rig (see previous photo) with a soldering iron as a load. 48W, so well below the load permitted for the current transformer.

I’ve attached a further screenshot showing the type of interference I experience. You may be able to see from the photo of the rig that I have two circuits attached to the load. To create the spikes I switch the switch on the circuit not being used to measure the current off and on.

I’ve purposely attached the CT Sensors directly to the Nano, so you get the raw output. For the TA12-100, I’ve connected to an analog pin and GND. For the ZMCT103C module there’s an extra connection to 5V, as it needs power to function.

It looks to me that the TA12-100 output is a sine wave, offset with voltage always greater than zero (not sure how this offset is achieved). The ZMCT103C module output appears to be amplified (this amplification can be adjusted with the onboard trimpot) and a half sine (rectified). Is that your reading?

Re: Code

Aarg, The whole process; reading the voltage change, opening the blastgate and turning on the dust extractor needs to be sub-one sec, particularly on startup. The RF code / transmission to the dust extractor relay and the physical opening of the blastgate both take some time, so the sample should be max 0.5 sec. A bit quicker would be better.

I have yet to test the Jack Christensen code. As you would appreciate to test completely new code properly for a specific application is quite a job and I would first like to be convinced that I’m on the wrong track with the code I’m using and an alternative is likely to do a better job.

My concern is that (6v6gt) you are saying this code requires a sine wave signal and works on averaging. This would require using the TA12-100 with an output many times smaller than the larger spikes. Even with averaging, a random event may get through. Aarg, similarly for the code you posted. Have I got this right?

The code I’ve written, bypasses one-off spikes. I have tested this and it works. It would be good if I could get some feedback on this code, as I don’t want to throw everything away and start again unnecessarily.

Restatement of the problems

Although on my test setup I seem to bypass the spikes, I still get random events in the workshop environment. These can be generated when a device is switched on or off (which I’ve observed) or for no apparent reason (I’m presuming due to activity in adjacent premises) or really strangely, with some mechanical activity, say when I hit something with a hammer.

From what I see there are two possibilities.

The code doesn’t bypass all spikes. Even if it works as I expect it to, if there are two spikes close together it could pick up one of these. Possible, but I should be bypassing the vast majority of spikes.

Interference is coming via the unprotected power supply. For the hardware setup at the workshop I have Opto isolation between the solenoid and Nano, but nothing between the 12V and Nano.

In my latest version, I have added to the problem by getting interference from the seven segment displays.