Pages: [1]   Go Down
Author Topic: current sensor  (Read 3735 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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...
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8856
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When you measure the output of your sensor with a millivolt meter (as in the instructions) what values do you get?
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26332
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You're reading a 50 or 60 Hz signal - why do you pause for a second between readings?
Logged

"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.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@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
« Last Edit: October 06, 2012, 05:48:14 pm by Joablen » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@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:
#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
}
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8856
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8856
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

utah
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: January 16, 2013, 05:38:37 pm by dreggory » Logged

Pages: [1]   Go Up
Jump to: