Monthly Archives: April 2014

Raspberry Pi and SCT 013-030 Current Transformer

I purchased a couple of SCT 013-030 CTs for testing with my Raspberry Pi. The Raspberry Pi does not support analog values out of the box so I also purchased the Adafruit ADS1015 analog to digital converter. I got the ADS1015 working with the Pi following several examples found on the web. I then proceeded to look into getting the SCT 013-030 to work. This is turning out to be more “fun” than I expected. The SCT 013-030 includes a built in burden resistor of 38 ohms from what I’ve measured. With that in mind, hooking up a multimeter to the CT output should give us an AC voltage. I tested this and it appears working. The next step would be to measure the voltage using the Raspberry Pi and the ADS1015. Being that the voltage is AC I tried to figure out an “easy” way to grab the maximum voltage value. I put together a basic python program to sample at 128 samples per second and print the results with a time stamp. I discovered negative voltage values resulted in values over 12k but you could actually see the sine wave with the values. I tweaked the python code to ignore values over 12k then save the maximum voltage it sees for the 128 sps and figured this value should be fairly close to the right value. This value is in millivolts and needs converted to amps. To do this I took 1000mV=30A and divided both sides by 1,000. This results in 1mV = .03amps. So I took the millivolt reading from the Raspberry Pi and multiplied by .03 to get Amps.

This appears to somewhat work as I’ve tried three different loads, xbox 360, curling iron, and a halogen bulb. Unfortunately, the results seem low and high for the different loads when compared to my multimeter measurement. However, They do seem to be within maybe +- 10%. I’ll continue to troubleshoot but if anyone has any ideas I would greatly appreciate it.

Raspberry Pi – Controlling Using MySQL Database

So I set up one Raspberry pi as a LAMP server then created a test database. I then created a basic html page with a button and PHP script to modify a value in the test database from the web server. I setup another Raspberry Pi with a test loop to control an LED based on the value in the mysql database. After some tweaks, I have it working to where one Raspberry pi can pull data from the Mysql database and I can tweak it via the webpage. More work to come as I believe I can use the LAMP server as a configuration database along with a data repository for logging.