Go Down

Topic: current sensor (Read 4174 times) previous topic - next topic

Joablen

Hello everyone,
I'm working on a home automation project of my own and one of the things I'd like to do is to be able to determine if things (like lights or my TV) are on or off without having to hack anything. I was recommended to use a non-invasive current sensor so I built one my self using this instructable: http://www.instructables.com/id/2-Carabiner-split-core-AC-transducer/
and made an extension cable with every cable separated so I was able to place the sensor around just one of the cables as you would do with a current clamp (which I have tried and it worked)

and wired it to my arduino using this diagram
Burden = 27 ohm, C1 = 10uf capacitor, Rvd = 1k ohm


my code is just a regular analog read and output to serial
Code: [Select]
void setup() {
  Serial.begin(9600);
}

void loop() {
  int sensorValue = analogRead(A0);
  Serial.println(sensorValue);
  delay(1000);
}


but all I'm getting is 511 or 512 values both when the TV is on and off...
any ideas?

I've already tried many different resistance values, different capacitors but no results...

johnwasser

When you measure the output of your sensor with a millivolt meter (as in the instructions) what values do you get?
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

AWOL

You're reading a 50 or 60 Hz signal - why do you pause for a second between readings?
"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.

Joablen

#3
Oct 07, 2012, 12:40 am Last Edit: Oct 07, 2012, 12:48 am by Joablen Reason: 1
@AWOL: just to get a more friendly output on the serial monitor

@johnwasser: I get 0. I suppose then the problem is not the circuit with the arduino but the sensor it self... here is a pic of what I'm using
http://imageshack.us/a/img94/5191/photorbw.jpg

retrolefty

Well even if the sensor is correctly constructed (and I'm not saying it is or is not) the interface circuitry is just applying a +2.5 bias on which a small AC voltage will be superimposed on that bias. You are then just taking a random one time reading of the voltage with the analogRead() command with no idea where within the 60Hz sine wave you are. You are going to need a much more complex reading method such that you keep reading looking for the highest and lowest values within a 16.666 millsec window so that you can then calculate the RMS voltage that corresponds to the RMS current being drawn from the sensor primary. This is bound to be a very difficult sensing method to make work if at all possible. I would say look for a better AC current monitor that outputs a pure DC measurement voltage.

Lefty

Joablen

@retrolefty: thats what I thought but I tried the code from the guys at openenergymonitor.org at it didn't work either...

here's the code I got (http://openenergymonitor.org/emon/buildingblocks/arduino-sketch-current-only)
Code: [Select]
#include "EmonLib.h"                   // Include Emon Library
EnergyMonitor emon1;                   // Create an instance

void setup()

  Serial.begin(9600);
 
  emon1.current(1, 111.1);             // Current: input pin, calibration.
}

void loop()
{
  double Irms = emon1.calcIrms(1480);  // Calculate Irms only
 
  Serial.print(Irms*230.0);        // Apparent power
  Serial.print(" ");
  Serial.println(Irms);        // Irms
}

johnwasser

Code: [Select]
void setup()

  Serial.begin(9600);
  emon1.current(1, 111.1);             // Current: input pin, calibration.
}


I sure hope that '1' means analog input pin 1 (A1) and not digital pin 1, a.k.a. Serial TX.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Joablen

sorry forgot to change that to A0 before posting... the code I used was with A0 which is the pin I'm using...

dhenry

Quote
all I'm getting is 511 or 512 values both when the TV is on and off...


That value makes sense, right: it comes from Rvd dividing the 5v Vref.

The signal from your current sensor is going to be very low: how low? it depends on your ct design and likely in the mv range. You should have it amplified to be detected by the arduino. This can be done via a simple amplifier.

How to detect the amplified signal will be a matter of implementation. For example, you can detect the presence of 50/60hz voltage; or if you have rectification, you can detect the rectified dc voltage...

You should analyze the pros / cons of each approach and pick one that suits your needs.

Nunov

Hi,

Did you tested the sensor itself? How?
Are you sure it is working?

I'm working in the same project from the energy monitor website, but i bought a current sensor ( see here: http://arduino.cc/forum/index.php/topic,125863.0.html ), but i'm having a bad time to calibrate it. The value given in the datasheet doesn't give the right current value... I'm now finishing to connect a energy meter that gives me the current value to check what is wrong.. I hope.

Nunov

The piece you have is aluminium? Are you sure it works? Try it with iron.

johnwasser

I think C1 is going to be filtering out some of the, already very small, AC signal.

Looks like the AD737 chip (http://www.analog.com/en/special-linear-functions/rms-to-dc-converters/ad737/products/product.html) might be the device for you.  It converts an AC signal up to 200 mV to a DC signal.

This Application Note gives some suggested circuits:
http://www.analog.com/static/imported-files/application_notes/AN-268.pdf
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

dreggory

#12
Jan 16, 2013, 11:36 pm Last Edit: Jan 16, 2013, 11:38 pm by dreggory Reason: 1
I used to be an electrician and I know that if you clamp on your amp meter to both the neutral and the hot they will cancel out each other on your meter as current flows. on your extension cables are you sampling both conductors at the same time? if so you need to split them apart and only wrap around one conductor. either hot or neutral no difference there when current is flowing.

Go Up