SCT and reading values advice please


I hope this is the correct place to post this. If not, I will move/delete the post.

I have recently bought a Raspberry Pi and a few DS18B20 sensors. I want to monitor their values via Domoticz (which will be running on the Pi).

I should note that I have no background in electronics, so for now I will rely heavily on tutorials and examples available online.

I also want to add energy monitoring to my Domoticz system. I’m okay with assuming a constant voltage, lets say 230 V. I have Googled and came upon the SCT-013 sensors.

The question is how to get the values from the sensor to the Pi. The sensor will not be near the Pi, by the way.

I now have the following options I can think of and would like your help deciding which to use in the end:

  1. Connect the SCT to the Pi via an ADC (wired?)
  2. Connect the SCT to an Arduino clone and send from that to Pi
  3. Connect the SCT to ESP8266 and send from that to Pi

I would like for the chosen option to be as cheap as possible.

I would prefer that the values be sent to the Pi wirelessly, since one of the DS18B20’s will be maybe about 1 meter from there (fish tank). I can also maybe add a room temp+humidity sensor and then send all three values together using the same device? 3 birds with one stone.

From what I’ve found Googling, it seems that if I use an Arduino/ESP8266, I might have to use an ADC, especially if using ESP.

I have read the following writeups:


ADC example:

A lot of the information in them are the same, but there are some differences.

From that, I gather that I need two 10kΩ resistors (though in the last tutorial, there is not…)
I also need a 10 μF capacitor (always)

Then, the burden resistor will depend on what I choose to use in the end.

I do not know what the tolerance (that is the ±, right) on the resistor should be. Same goes for wattage

1 Like

According to the ESP8266 data sheet, it contains an ADC, whose input pin accepts a voltage in the range 0 - 1 V. Therefore, if you’re measuring the voltage across the CT’s burden, you need to set the quiescent voltage bias to 0.5 V, and the peak to peak swing of the burden resistor voltage must never exceed 1 V (and in practice the design target should be about 5 - 10% less to allow for component tolerances etc). The why and wherefore of this is in Building Blocks - but the detail won’t fit your usage case.
You won’t be able to use two equal resistors to set the midpoint voltage because, unlike the Atmel device we use, the ADC input does not cover the whole range of the supply voltage (e.g. the emonTx runs on 3.3 V, therefore our input quiescent voltage is 1.65 V - if your supply is say 3.3 V also, you would need your resistors to be in the ratio 0.5 : 2.8, as that is the ratio of the voltages across each, so perhaps 10 kΩ and 56 kΩ would be suitable in that case).
The purpose of the burden resistor is to turn the output of the CT, which is a current, into a voltage. The closer the tolerance of your burden resistor, the more accurate that will be. We normally use 1% resistors as they are not significantly more costly than 5% or 10% types. The maximum dissipation, therefore the minimum power rating of the resistor, will be the rms current in it - the CT secondary current - at the maximum current you want to measure, multiplied by the voltage across it, which we know won’t exceed 0.354 V.
You’ll need to write, or find, software to read the ADC output many times each mains cycle and convert that into a meaningful current or power to transmit to your Pi.

As you’re looking for the cheapest, the ESP8266 is possibly that as with an Arduino, you need to add a radio module at one end, possibly at both ends, of the link, and if you use a piggy-back ADC module on your Pi, you will have a wired connection which you say you don’t want.

Thank you!

After a lot of reading and thinking, this is what I came up with:

Mains voltage: 230V
SCT-013-000: 100A-50mA

Max I to be measured: 60A

Using an ADS1115 and ESP8266 powered with a 3.3V breadboard power supply,
( +

I’m using an ADS1115 instead of the ESP8266’s onboard ADC.

Ideal burden resistance = (3.3 * 2000) / (2*SQRT(2) * 60) = 38.89087297Ω

I can use two 18Ω±1% resistors in series (or another combination getting as near as ideal as possible)

Using a 5% safety adjustment on the voltage gives:

Ideal burden resistance = (3.3 * 0.95 * 2000) / (2*SQRT(2) * 60) = 36.94632932

I can still use two 18Ω±1% resistors (or another combination)

As with the last writeup, I will be using the ADS1115’s differential mode to simplify the circuit and do away with the bias resistors.

Do you agree with what I did? Do you have any suggestions?

Two points regarding that:

  1. The sampling rate is quite low (but from memory somewhat better than the ESP8266 and certainly not as good as the Atmel328P), so you’ll only get about 17 samples per cycle. That’s good enough if you have well-behaved sine waves, but if you have a not-very-friendly switched-mode load that has a particularly badly shaped current wave, you will have inaccuracies.
  2. You will still need to bias the input. Just because the input is differential doesn’t mean that it can accept voltages that go below the GND potential. The input voltage range is limited to the supply range - from the data sheet “Analog input voltage to GND –0.3 to VDD + 0.3 V”. So you’ll still need to sit the quiescent voltage to VDD/2.

If you have a 3.3 V supply, you should aim for slightly less that 3.3 V peak-peak swing across the burden, to allow for tolerances in the CT and burden as well as in your supply. I aim for 1.1 V rms - allowing 6% in total, so with your chosen CT (which has a 3% tolerance anyway) 36 Ω is just about right.

Thanks for the insight. The ADS1115 is a 16bit ADC. There is also an ADS1015 that is faster than ADS1115, but 12bit. Would you rather suggest to use that one?

Regarding the biasing, I will point the writer of that blog post here - he suggested to not use biasing.

I guess I should then use biasing, but that will depend on which ADS I use?

Which ADC you use is a decision for you to make. As with most engineering, you have to make a judgement and in this case balance speed against precision. I have not compared the data sheets in detail, but apart from speed and resolution, the two look broadly similar. Certainly, you’ll still need the input bias.

see xkcd: Duty Calls :innocent:

Hahahah LOL at your XKCD!

Thanks. As far as I read, that is the basic difference between them, yes.

I will try to see if I can get information regarding using both ADCs with an SCT-013 sensor. Maybe from that I can decide.
Because at this stage I have no idea how perfect my sine wave is… For me it’s just picking at random now, so I’ll try to see what other people found

If mostly you have ‘well-behaved’ loads like heaters, then the shape of your current wave should not be a problem. But if you have many switched-mode supplies - computer, digital TV, etc, and these together are the main load on your supply, then it is possible that your current wave will be badly distorted. There are pictures over on the old forums. In that case, the more measuring points that you have in each cycle, the more accurate your rms calculation will be.

On balance, I think I would use the 1015 because with the Atmel328P, which is only 10 bits, we can measure with reasonable accuracy to and below the point where the CT errors are becoming the biggest error in the system. Remember, the CT’s linearity of ± 3% is only over the range 10% - 120% of rated current (10 A - 120 A for the -000).


I will then go for the 1015, which will be an improvement over the ESP own ADC in any case

Interestingly, on eBay, the ADS1015 is roughly 3x as expensive as ADS1115

But the other way round from Adafruit (US).

The cost of the ADS’s is dependent on the production volumes. 1015 is produced less. Another interesting differential is between the cost of the IC’s and the pre-made boards. The ADS1115 costs $9-10 for me in single volumes and the breakout is $6.

The ADS uses switched capacitor based conversion and can take floating negative voltages in differential mode. It also has an internal reference. I performed a test by placing my multimeter in diode test mode and got -0.7 , + 0.7 readings via the ADC in differential mode without a resistor ladder to apply bias. Good luck with the design.

Also consider dedicated energy monitor DSP’s such as the ATM90E26, which are much cheaper than the ADS ($2).

The problem with many of the dedicated energy-monitoring devices is that they require a galvanic connection to the supply, which means that they are unsafe except in skilled hands and when the proper precautions for safety and isolation are observed.

This is why all OEM designs use approved and certified isolating transformers for both current and voltage inputs. You should not balance price against the safety of yourself and those around you.

None of the ones I’ve experimented with do. They all support (almost assume) CTs on the current side and leave it to the meter designer to decide how to deliver the voltage signal. I’m not familiar with the Atmel devices that Tisham referenced, but a quick check reveals:

  • Current sampled over shunt resistor or Current Transformer (CT)
  • Voltage sampled over resistor divider network or Potential Transformer (PT)