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:

- 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();andsensor2.start();each perform their own zero-current calibrationsensor1.readCurrent();andsensor2.readCurrent();update their readingssensor1.printCurrent();andsensor2.printCurrent();send each sensor’s value to Serial Monitorsensor1.getCurrent()andsensor2.getCurrent()provide numeric values you can use inifconditions
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:
- Define another set of constants (MODEL_3, SENSOR_PIN_3, etc.)
- Create another object
Robojax_WCS sensor3(...) - Call
sensor3.start()insetup() - Use
sensor3.readCurrent()andsensor3.getCurrent()insideloop()
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.
图像
/*
* Using two or more Winson Current Sensors
* Read the current Winson WCS Current sensor and display it on the Serial monitor
* This is Arduino code based on the Robojax WCS library
* for Winson WCS Current Sensor to measure current
*
* Watch video instructions for this code: https://youtu.be/z-s8UvCWGxY
* Written on July 26, 2020 by Ahmad Shamshiri in Ajax, Ontario, Canada
* www.Robojax.com
Model of the sensor to select
//direct wiring series
0 "WCS38A25",//0
1 "WCS37A50",//1
2 "WCS2801",//2
3 "WCS2702",//3
4 "WCS2705",//4
5 "WCS2810",//5
6 "WCS2720",//6
7 "WCS2750",//7
8 "WCS3740",//8
//through hole sensor
9 "WCS1500",//9
10 "WCS1600",//10
11 "WCS1700",//11
12 "WCS1800",//12
13 "WCS2800",//13
14 "WCS6800",//14
//AC to DC Current sensor
15 "WCS2202",//15
* Get this code and other Arduino codes from Robojax.com
Learn Arduino step by step in a structured course with all material, wiring diagrams, and libraries
all in one place. Purchase My course on Udemy.com http://robojax.com/L/?id=62
If you found this tutorial helpful, please support me so I can continue creating
content like this.
or make a donation using PayPal http://robojax.com/L/?id=64
* * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.*
* This code has been downloaded from Robojax.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <Wire.h>
#include <Robojax_WCS.h>
#define MODEL_1 12 //see list above
#define SENSOR_PIN_1 A0 //pin for reading sensor
#define SENSOR_VCC_PIN_1 8 //pin for powring up the sensor
#define ZERO_CURRENT_LED_PIN_1 2 //zero current LED pin
#define ZERO_CURRENT_WAIT_TIME_1 5000 //wait for 5 seconds to allow zero current measurement
#define CORRECTION_VLALUE_1 164 //mA
#define MEASUREMENT_ITERATION_1 100
#define VOLTAGE_REFERENCE_1 5000.0 //5000mv is for 5V
#define BIT_RESOLUTION_1 10
#define DEBUT_ONCE_1 true
#define MODEL_2 12 //see list above
#define SENSOR_PIN_2 A1 //pin for reading sensor
#define SENSOR_VCC_PIN_2 9 //pin for powring up the sensor
#define ZERO_CURRENT_LED_PIN_2 3 //zero current LED pin
#define ZERO_CURRENT_WAIT_TIME_2 5000 //wait for 5 seconds to allow zero current measurement
#define CORRECTION_VLALUE_2 164 //mA
#define MEASUREMENT_ITERATION_2 100
#define VOLTAGE_REFERENCE_2 5000.0 //5000mv is for 5V
#define BIT_RESOLUTION_2 10
#define DEBUT_ONCE_2 true
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
);
void setup()
{
Serial.begin(9600);
Serial.println("Robojax WCS Library");
sensor.start();
Serial.print("Sensor: "); Serial.println(sensor.getModel());
}
void loop()
{
sensor1.readCurrent();//this must be inside loop
sensor2.readCurrent();//this must be inside loop
sensor1.printCurrent();
sensor2.printCurrent();
//does something when current in sensor1 is equal or greater than 12.3A
if(sensor1.getCurrent() >= 12.3)
{
// does something here
}
delay(500);
//sensor1.printDebug();
//sensor2.printDebug();
}
|||您可能需要的东西
-
亚马逊从亚马逊购买WCS1800霍尔电流传感器amzn.to
-
易趣从eBay购买WCS1800霍尔电流传感器ebay.us
-
全球速卖通从AliExpress购买WCS1800霍尔电流传感器s.click.aliexpress.com
资源与参考
-
外部Datasheet for WCS1500winson.com.tw
-
外部Datasheet for WCS1600winson.com.tw
-
外部Datasheet for WCS1700winson.com.tw
-
外部Datasheet for WCS1800winson.com.tw
-
外部Datasheet for WCS2702winson.com.tw
-
外部Datasheet for WCS2705winson.com.tw
-
外部Datasheet for WCS2720winson.com.tw
-
外部Datasheet for WCS2800winson.com.tw
-
外部Datasheet for WCS2801winson.com.tw
-
外部Datasheet for WCS2810winson.com.tw
-
外部Datasheet for WCS3740winson.com.tw
-
外部Datasheet for WCS37A50winson.com.tw
-
外部Datasheet for WCS38A25winson.com.tw
-
外部Datasheet for WCS6800winson.com.tw
文件📁
其他文件
-
Download RoboJax WCS Library
robojax_Winson_WCS_library.zip0.04 MB