Current Sensing

I have a WCS1750 current sensing device which is a Hall Effect Base Linear Current Sensor.
The datasheet states that the device outputs a voltage proportionate to the current consumed at 33mV/A.
On preliminary test, using a 741 OpAmp to amplify the signal, I get the following:
at OA Load - Output is 43mV AC
at 4.65A Load - Output is 1.54V AC
at 1.62A Load - Output is 0.57V AC
Can anyone point me in the right direction as to how:
I would read this into a analog input of the Arduino
Calculate the amount of current (kWh) is consumed while the load is above 0A.
Best Regards

The simplest way is to connect sensor Vdd to +5v, sensor ground to Arduino ground, and sensor output to an Arduino analog input. The analog reading will be around 512 at zero current and will change by 1 per 0.15A current. So the resolution is only 150mA.

It's not clear to me from the datasheet whether the 33mv/A sensitivity is constant or varies with supply voltage. If it's independent of supply voltage, then you could improve the resolution to 100mA by using 3.3v as the sensor supply and Vref instead.

If you need better resolution than that, you will need to use an op amp to amplify the signal first, or alternatively an external D to A converter with higher resolution.

A couple of suggestions:

  • Determine the maximum voltage you may be measuring. Add a safety factor (I use 25%) and then see if you can either use the internal voltage reference (1.1VDC, 2.56VDC, etc. depending on the model of your Atmel microprocessor) or whether it makes sense to apply an external voltage reference to the AREF pin. The latter approach is preferable, IMO, especially if you use a voltage reference or a small voltage regulator because variability in the power supply voltage won't propagate into your measurements as easily. However, many people use a cheaper approach using voltage divider networks that also do the trick (but which are more prone to be influenced by other devices attached to your Arduino).
  • Keep in mind: Once you set a alternate AREF voltage (through software or hardware) do not try to sample a higher-voltage signal on a analog input channel or you will blow your ADC. Here, the software approach of setting the internal reference is more flexible, you can easily switch back and forth between reference voltages though you have to add some settling time between measurements.
  • Consider using decimation for your signal. Keep the analogread results in their original integer format, oversample, decimate, and enjoy results of up to 16 bits or so. Atmel has a nice paper on this topic, just google atmel and decimate.

This is a mains-frequency only sensor, so you either have to sample often enough to be able to directly calculate the RMS current, or use a op-amp exact-rectification circuit to yield a DC value proportional to the signal amplitude.

If the waveform is nice and sinusoidal then they should provide the same answer.

Beware the fact that the amplitude and rms currents are not the same value :wink:

Also since this is a mains-connected device it sounds like you are contemplating connecting an Arduino to a board that carries mains voltage. This is basically dangerous and to be avoided if at all possible. The clamp-on style current sensors used in domestic after-market mains power monitors are double insulated and therefore safe.

Would it make sense to use an opto-isolator between that sensor and Arduino? There are linear opto's?

GoForSmoke:
Would it make sense to use an opto-isolator between that sensor and Arduino? There are linear opto's?

With what purpose? Hall effect current sensors already provide isolation.

If getting an accurate kWh measurement is important, this approach will not work for you. You would be far better off using a chip designed for this purpose:

Can't beat that price, right? It's a simple serial communication with Arduino, and voila! You get really accurate energy measurement!

On the other hand, you can try to simulate what it does with the Hall effect sensor and code - you will get close for purely resistive loads, but you'll be way off for inductive/capacitive loads.

GuitarBuilder:
If getting an accurate kWh measurement is important, this approach will not work for you. You would be far better off using a chip designed for this purpose: Can't beat that price, right? It's a simple serial communication with Arduino, and voila! You get really accurate energy measurement! On the other hand, you can try to simulate what it does with the Hall effect sensor and code - you will get close for purely resistive loads, but you'll be way off for inductive/capacitive loads.

I tried going that route. For example, Olimex offers a shield with a like chip to do the work. They even have a library that should making measurements easy. However, the devil is in the details.

Not as simple as I would have hoped, the calibration methods are difficult at best unless you have a nice benchtop power supply that can (among other things) provide voltage and power out of phase with each other. In the end, I stuck with the Arduino ADC. Simple to understand, easy to debug, easy to calibrate via the openenergy software. If the power signal is steady enough you can even take advantage of decimation to increase your power measurement accuracy to close to 16 bits with the measurements you can make across a second of time (20MHz Atmel, 128:1 pre-scaler, using direct analog reads = 5,500+ samples per second on each channel).

If I ever want to go to something more sophisticated/accurate, I'll opt for a dedicated ADC instead, the MAX1169 is one example of a easy-to use I2C device that gets me 58ksps with 16 bit resolution. Put a 2 channel MUX in front and you get over 24ksps per channel and you still have a input that is drop-in ready for the openenergymon routines. With this sort of ADC, you can get a theoretical 22bit resolution through decimation if you need the data on a second-by-second basis (i.e. sample 24k => average six times of 4096 samples = base ADC resolution + 6 bits).

dc42:

GoForSmoke:
Would it make sense to use an opto-isolator between that sensor and Arduino? There are linear opto's?

With what purpose? Hall effect current sensors already provide isolation.

Because of what MarkT's reply and my ignorance.

Also since this is a mains-connected device it sounds like you are contemplating connecting an Arduino to a board that carries mains voltage. This is basically dangerous and to be avoided if at all possible.