when implementing the DC offset circuit, the voltage is shifted by 2.5 volt, this is when we use the (YHDC SCT-013-000) current sensor:
and this is what I get when I send the data through the serial port and the offset circuit is working and everything is fine
I ran another experiment from the function generator that generates a sinewave, and I expected to get the same sine wave (shifted by the DC offset circuit ) as the sensor but that didn't happen and I got the signal trimmed (the offset circuit didn't work )
what is the difference between this sensor and the function generator ? aren't they both just produce an AC signal ? and the offset circuit is suppose to act on both of them ?
what if I want to use another sensor that produces negative values ? will I be able to use this offset circuit ?
Re: why is the DC offset circuit working with the current sensor (YHDC SCT-013-000) but not with the function generator!
what is the difference between this sensor and the function generator ? aren't they both just produce an AC signal ?
One possible difference is isolation. The CT will be a totally isolated AC signal. Is there any chance there's a DC path between your signal generator and your Arduino GND? It may even be via a safety earth. Put a DC voltmeter on your mid-point and see how it reads with and without the signal generator connected. Also what R value are you using for R1 and R2?
I assume the Y-axis isn't actually "Volts" bur rather A/D readings? If you have managed to ground your mid-point, then you probably are inflicting the negative half of that swing on your Arduino input, which is not good for it.
Re: why is the DC offset circuit working with the current sensor (YHDC SCT-013-000) but not with the function generator!
all out of a sudden it decided to work for some minutes and then stop working again ?
this is strange and driving me crazy!
the voltage is 2.4 V
yeah that is correct, its the analog readings not the voltage !
Re: why is the DC offset circuit working with the current sensor (YHDC SCT-013-000) but not with the function generator!
My bet is as dBC says, your signal generator output must be floating, that is, it must have no connection to the 0 V (GND) rail of the Arduino (and that could be via mains earth, your laptop power supply, the USB cable and the programmer!).
You broke that connection and then it suddenly started working.
If your signal generator is capable of generating the 1 V or thereabouts alternating voltage on top of 2.5 V dc (that is, it generates exactly the waveform in the illustration from Building Blocks that you copied), then it will work properly when you connect to signal generator between the GND and input pins.