Measuring Current Using an Allegro ACS758 Current Sensor with an SSD1306 OLED Display for Arduino
This tutorial will guide you through the process of measuring current using the Allegro ACS758 current sensor and displaying the results on an SSD1306 OLED display. The project will involve reading the current flowing through a circuit and visually representing that data on the OLED screen, allowing for easy monitoring. You'll learn how to connect the components, write the code, and understand how everything works together.


If you're looking to understand the code and its functionality, be sure to check the video for more detailed explanations (in video at 02:45).
Hardware Explained
The main components of this project include the Allegro ACS758 current sensor and the SSD1306 OLED display. The ACS758 is a Hall-effect current sensor that measures the current flowing through a conductor with high accuracy and provides an output voltage proportional to this current. It can handle currents up to 200A and operates at either 3.3V or 5V.
The SSD1306 OLED display is a compact, low-power display that communicates via I2C. It is commonly used in Arduino projects due to its ease of integration and ability to display graphics and text clearly. Together, these components create a powerful tool for monitoring current in various applications.
Datasheet Details
| Manufacturer | Allegro Microsystems |
|---|---|
| Part number | ACS758ECB-200U |
| Logic/IO voltage | 3.3 V / 5 V |
| Supply voltage | 5 V |
| Output current (per channel) | 200 A |
| Peak current (per channel) | 200 A |
| PWM frequency guidance | N/A |
| Input logic thresholds | 0.3 V (low), 2.7 V (high) |
| Voltage drop / RDS(on) / saturation | 0.05 V |
| Thermal limits | -40 to 125 °C |
| Package | SOIC-8 |
| Notes / variants | Bidirectional and unidirectional models available |
- Ensure proper orientation of the ACS758 sensor for accurate readings.
- Use a heat sink if operating near maximum current limits to prevent overheating.
- Decouple the power supply to the sensor for stable operation.
- Check wiring connections to avoid floating inputs that may lead to erroneous readings.
- Calibrate the sensor output to ensure accurate current measurements.
Wiring Instructions

To wire the Allegro ACS758 current sensor and SSD1306 OLED display, start by connecting the power. Connect the VCC pin of the ACS758 to the 5V output on your Arduino, and connect the GND pin to the ground (GND) on the Arduino. The output signal pin (Vout) from the ACS758 should be connected to the analog input pin A0 on the Arduino.
Next, for the SSD1306 OLED display, connect the VCC pin to the Arduino's 5V output and the GND pin to ground. Connect the SDA pin of the OLED to the Arduino's SDA pin (A4 on most Arduino boards) and the SCL pin of the OLED to the SCL pin (A5 on most Arduino boards). Ensure all connections are secure for reliable operation.
Code Examples & Walkthrough
#define VIN A0 // define the Arduino pin A0 as voltage input (V in)
const float VCC = 5.0; // supply voltage 5V or 3.3V
const int model = 2; // enter the model (see below)
In the code, the variable VIN is assigned to analog pin A0, which will read the voltage from the ACS758 sensor. The VCC variable sets the supply voltage, and the model variable defines which ACS758 model is being used, which affects sensitivity and output voltage calculations.
void loop() {
float voltage_raw = (5.0 / 1023.0) * analogRead(VIN); // Read the voltage from sensor
float current = voltage / FACTOR; // Calculate the current based on voltage
}
Within the loop() function, the code reads the raw voltage from the sensor using analogRead(VIN) and converts it to a current value based on the defined sensitivity. This allows real-time monitoring of the current flowing through the circuit.
if(abs(voltage) > cutOff) {
display.clearDisplay();
robojaxText("Current:", 0, 22, 2, false);
}
This conditional statement checks if the absolute value of the voltage is greater than the cutOff limit. If true, it clears the display and updates the OLED with the current reading. This ensures that only significant current values are shown, preventing clutter on the display.
Demonstration / What to Expect
When you run the program, the OLED display will show the current being measured in real-time. If there is no current flowing, the display will indicate "No Current." Ensure that the connections are correct to avoid issues such as reversed polarity, which could lead to inaccurate readings (in video at 05:30).
Things you might need
-
Amazon
-
AmazonPurchase OLED 128x32 from Amazonamzn.to
-
AliExpressPurchase SSD1306 OLED 128x32 from AliExpresss.click.aliexpress.com
Resources & references
No resources yet.
Files📁
Arduino Libraries (zip)
-
SSD1306-OLED-Adafruit_SSD1306-master
application/zip0.02 MB
Fritzing File
-
OLED Mono 0.56 inch 128x32
application/zip0.01 MB -
SSD1306 0.96in 128x64 I2C Monochrome OLED Display
application/zip0.01 MB
User’s Manual
-
SSD1306 OLED manual
application/pdf1.79 MB