Using Multiple (3) Allegro AC and DC Current Sensors with the RoboJax Library

Using Multiple (3) Allegro AC and DC Current Sensors with the RoboJax Library

In this tutorial, we will learn how to use multiple Allegro ACS770 current sensors in an Arduino project. The ACS770 sensors can measure both AC and DC currents, making them versatile for various applications. We will set up three sensors to monitor current and display the readings on the serial monitor.

This project will guide you through the wiring and coding necessary to implement these sensors effectively. You will understand how to read current values, average them, and display them, as well as how to handle the data in your Arduino sketch (in video at 10:30).

Hardware Explained

The main component of this project is the Allegro ACS770 current sensor. This sensor uses Hall effect technology to measure the current flowing through it. It has a range of models available, measuring currents from 50A up to 200A, and can handle both AC and DC currents depending on the variant used.

The ACS770 features three pins: VCC for power, GND for ground, and VOUT for the output voltage proportional to the current measured. When current flows through the sensor, it generates a voltage output that the Arduino reads to determine the current level.

Datasheet Details

ManufacturerAllegro Microsystems
Part numberACS770
Logic/IO voltage4.5 - 5.5 V
Supply voltage5 V (typ.)
Output current (per channel)50 A, 100 A, 150 A, 200 A
Peak current (per channel)100 A (typ.)
PWM frequency guidanceNot applicable
Input logic thresholds0.8 V (high), 0.3 V (low)
Voltage drop / RDS(on) / saturation100 μΩ (typ.)
Thermal limits0 to 125 °C
PackageSOIC-8
Notes / variantsAvailable in bi-directional and unidirectional configurations

  • Ensure proper heat sinking for higher currents.
  • Use short and thick wires to minimize resistance.
  • Decouple the power supply with a capacitor near the sensor.
  • Verify sensor model and configuration before wiring.
  • Be cautious of noise in PWM applications; consider filters.

Wiring Instructions

Arduino wiring for Allegro ACS712 current sensor

To wire the ACS770 current sensors, start by connecting the VCC pin of each sensor to the 5V output on the Arduino. Next, connect the GND pin to the ground on the Arduino. For the output pin, connect VOUT of the first sensor to A0 on the Arduino, the second sensor's VOUT to A1, and the third sensor's VOUT to A2.

For the load connection, ensure that the sensors are placed in series with the load. Connect the load's positive terminal to the sensor's input, and the output terminal of the sensor to the positive side of your power source. Ensure that the wire used for the load is suitable for the current rating of the sensor.

Code Examples & Walkthrough

Below is an excerpt from the Arduino sketch that initializes the sensors and reads the current values. The identifiers VIN1, VIN2, and VIN3 correspond to the analog input pins connected to each sensor's output.

const int VIN1 = A0; // define the Arduino pin A0 as voltage input (V in for sensor 1)
const int VIN2 = A1; // define the Arduino pin A1 as voltage input (V in for sensor 2)
const int VIN3 = A2; // define the Arduino pin A2 as voltage input (V in for sensor 3)

const float VCC = 5.04; // supply voltage

This code sets up three sensors, each connected to different analog pins. The variable VCC holds the supply voltage value which is used for calculations later in the code.

In the setup() function, we initialize the serial communication to display the sensor readings.

void setup() {
    Serial.begin(9600); // initialize serial monitor
    Serial.println("Robojax Tutorial");
    Serial.println("Using 3 ACS770 Current Sensors");
}

The loop() function is where we continuously read and display the current values from each sensor.

void loop() {
    Serial.print("Current-1: ");
    Serial.print(robojax1.getCurrent(), 3); // print the current with 3 decimal places
    Serial.println("A");
    
    // Repeat for sensor 2 and sensor 3
    delay(1500);
}

This code retrieves the current from each sensor using the getCurrent() method and prints it to the serial monitor. The readings are updated every 1.5 seconds.

Demonstration / What to Expect

Once everything is wired and the code is uploaded, you should see the current readings from each sensor displayed on the serial monitor. As you adjust the load, the current values should reflect the changes accurately. Make sure to check the sensor specifications to ensure you are within the operational limits.

Common pitfalls include incorrect wiring or exceeding the current rating of the sensors, which can lead to inaccurate readings or damage. Always verify connections before applying power (in video at 15:10).

Video Timestamps

  • 00:00 - Introduction
  • 10:30 - Code explanation
  • 15:10 - Common pitfalls

图像

Allegro ACS758 current sensor with Arduino
Allegro ACS758 Current Sensor with Arduino
Wiring for Allegro ACS712 Current Sensor (AC)
Wiring for Allegro ACS712 Current Sensor (AC)
Wiring for Allegro ACS712 Current Sensor (DC- at positive)
Wiring for Allegro ACS712 Current Sensor (DC- at positive)
Wiring for Allegro ACS712 Current Sensor (DC-at negative)
Wiring for Allegro ACS712 Current Sensor (DC-at negative)
Arduino wiring for Allegro ACS712 current sensor
Arduino wiring for Allegro ACS712 current sensor
311-Using 2 or more Allegro Current Sensors
语言: C++
已复制!

资源与参考

文件📁

其他文件