Using Two or More Winson WCS Hall Effect Current Sensors WCS1800 and others with Arduino

Using Two or More Winson WCS Hall Effect Current Sensors WCS1800 and others with Arduino

342 – Using Two Winson WCS Hall Effect Current Sensors with Arduino

This project extends the previous single-sensor setup by using two Winson WCS Hall-effect current sensors at the same time with the Robojax_WCS library. Each sensor operates independently, performs its own zero-current calibration, and reports its own current reading. This approach is useful when monitoring two separate loads, measuring charge and discharge paths, or comparing input and output current of a system. The same method can be extended to three or more sensors simply by defining additional sensor objects.

Understanding the WCS Sensor Family

Winson Semiconductor produces many models in the WCS Hall-effect current sensor series. These sensors measure AC and DC current using magnetic isolation, making them safe and easy to use. All sensors share the same three-wire interface (VCC, GND, and VOUT) and can be used with the Robojax_WCS library by simply choosing the correct model number.

As in the previous project, the WCS1800 is used here. It provides a linear response up to about 25A and a sensitivity of about 66mV per ampere. Any WCS model listed in the library (0 to 15) can be used. Each sensor object in the code corresponds to one physical WCS module.

Using Two Current Sensors at the Same Time

The Robojax_WCS library fully supports multi-sensor operation. Each sensor must have:

Wiring WCS: DC load
  • Its own analog input pin for VOUT
  • Its own VCC control pin (optional but recommended)
  • Its own zero-current LED indicator pin
  • A separate set of settings such as correction value and wait time

Below is the configuration for two sensors. Sensor 1 uses analog pin A0 and Sensor 2 uses A1. Each sensor has its own zero-current LED and its own VCC pin. These pins can be changed as needed for your wiring.


#include <Wire.h>
#include <Robojax_WCS.h>

// -------- SENSOR 1 SETTINGS --------
#define MODEL_1 12
#define SENSOR_PIN_1 A0
#define SENSOR_VCC_PIN_1 8
#define ZERO_CURRENT_LED_PIN_1 2
#define ZERO_CURRENT_WAIT_TIME_1 5000
#define CORRECTION_VLALUE_1 164
#define MEASUREMENT_ITERATION_1 100
#define VOLTAGE_REFERENCE_1 5000.0
#define BIT_RESOLUTION_1 10
#define DEBUT_ONCE_1 true

// -------- SENSOR 2 SETTINGS --------
#define MODEL_2 12
#define SENSOR_PIN_2 A1
#define SENSOR_VCC_PIN_2 9
#define ZERO_CURRENT_LED_PIN_2 3
#define ZERO_CURRENT_WAIT_TIME_2 5000
#define CORRECTION_VLALUE_2 164
#define MEASUREMENT_ITERATION_2 100
#define VOLTAGE_REFERENCE_2 5000.0
#define BIT_RESOLUTION_2 10
#define DEBUT_ONCE_2 true

// -------- TWO SENSOR OBJECTS --------
Robojax_WCS sensor1(
    MODEL_1, SENSOR_PIN_1, SENSOR_VCC_PIN_1,
    ZERO_CURRENT_WAIT_TIME_1, ZERO_CURRENT_LED_PIN_1,
    CORRECTION_VLALUE_1, MEASUREMENT_ITERATION_1,
    VOLTAGE_REFERENCE_1, BIT_RESOLUTION_1, DEBUT_ONCE_1
);

Robojax_WCS sensor2(
    MODEL_2, SENSOR_PIN_2, SENSOR_VCC_PIN_2,
    ZERO_CURRENT_WAIT_TIME_2, ZERO_CURRENT_LED_PIN_2,
    CORRECTION_VLALUE_2, MEASUREMENT_ITERATION_2,
    VOLTAGE_REFERENCE_2, BIT_RESOLUTION_2, DEBUT_ONCE_2
);

Once defined, both sensors are used the same way inside setup() and loop():

  • sensor1.start(); and sensor2.start(); each perform their own zero-current calibration
  • sensor1.readCurrent(); and sensor2.readCurrent(); update their readings
  • sensor1.printCurrent(); and sensor2.printCurrent(); send each sensor’s value to Serial Monitor
  • sensor1.getCurrent() and sensor2.getCurrent() provide numeric values you can use in if conditions

Using three or more sensors works the same way: simply copy the block, change the pin numbers, and create sensor3, sensor4, and so on. Each object operates independently.

Wiring the Two Sensors

Each WCS module still uses three low-voltage signal wires:

  • VDD → Arduino 5V (or controlled by SENSOR_VCC_PIN_x if powering from digital pin)
  • GND → Arduino GND
  • VOUT → Arduino analog input (A0 for sensor1, A1 for sensor2)

You also connect two indicator LEDs:

  • LED 1 on ZERO_CURRENT_LED_PIN_1 (pin 2)
  • LED 2 on ZERO_CURRENT_LED_PIN_2 (pin 3)

Both LEDs turn on independently once each sensor finishes its own zero-current calibration period. Make sure no current is flowing through either sensor for the first 5 seconds after booting or resetting the Arduino.

How the Dual-Sensor System Works

Both sensors:

  • Calibrate their zero-current offset separately
  • Read ADC values from different analog pins
  • Compute current using their defined WCS model
  • Display readings continuously

Because each sensor has its own configuration and LED, you always know which sensor has completed calibration. The code prints two values to the Serial Monitor, for example:

Sensor 1: 12.45 A
Sensor 2: 7.82 A

Using the Measured Currents

You can use each current independently:


if(sensor1.getCurrent() >= 10.0) {
  // action for sensor 1
}

if(sensor2.getCurrent() >= 5.0) {
  // action for sensor 2
}

Or compare the sensors:


float diff = sensor1.getCurrent() - sensor2.getCurrent();

This is useful in charge/discharge systems or monitoring two branches of a circuit.

Scaling to Three or More Sensors

To add additional sensors, simply:

  1. Define another set of constants (MODEL_3, SENSOR_PIN_3, etc.)
  2. Create another object Robojax_WCS sensor3(...)
  3. Call sensor3.start() in setup()
  4. Use sensor3.readCurrent() and sensor3.getCurrent() inside loop()

There is no limit other than available Arduino analog pins and I/O pins.

Conclusion

This project showed how to use two Winson WCS Hall-effect current sensors at the same time using the Robojax_WCS library. Each sensor operates independently, performs its own zero-current calibration, and provides accurate real-time current measurement. The method scales easily to three or more sensors, making this approach ideal for dual-load systems, in/out current measurement, solar or battery systems, and multi-channel power monitoring.

Изображения

Wiring WCS1800: DC load
Wiring WCS1800: DC load
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: WCS-3740
Wiring WCS: WCS3740
Wiring WCS: WCS-3740
Wiring WCS: WCS3740
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: DC Load
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: WCS 2720
Wiring WCS: WCS2720
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: DC load
Wiring WCS: DC load
346-Sensors Supported by Robojax WCS Library Sensor Model Maximum Current mv/A Sensitivity WCS38A25 0.25A 7.0 WCS37A50
Язык: C++
Скопировано!

Вещи, которые могут вам понадобиться

Ресурсы и ссылки

Файлы📁

Другие файлы