====== LamaPLC: Allegro ACS758 Hall-effect linear current sensors ====== {{ :sensor:cjmcu_758_1.png?180|Allegro ACS758 Hall-effect linear current sensor}} The provided part numbers refer to specific models within the **Allegro ACS758 series** of Hall-effect linear current sensor integrated circuits (ICs), which primarily differ in their current-sensing range, sensitivity, and operating temperature range. ^Part Number^Current Range^Sensitivity (Typ.)^Operating Temp. Range| ^ACS758LCB-050B (CJMCU-758)|±50 Amps|40 mV/A|–40 to 150 °C| ^ACS758LCB-100B|±100 Amps|20 mV/A|–40 to 150 °C| ^ACS758KCB-150B|±150 Amps|13.3 mV/A|–40 to 125 °C| ^ACS758ECB-200B|±200 Amps|10 mV/A|–40 to 85 °C| * **Supply Voltage:** 3.0 to 5.5 V. * **Internal Conductor Resistance:** Ultra-low 100 µΩ, providing minimal power loss. * **Bandwidth:** Typically 120 kHz. * **Zero Current Output:** For these bidirectional ("B") models with a 5V VCC, the output voltage is typically VCC/2 (2.5V) when no current is flowing. ==== CJMCU-758 Pinout ==== {{ :sensor:cjmcu_758_2.png?180|Allegro ACS758 Hall-effect linear current sensor}} **Low power** * **VCC:** Power supply input (3.0V to 5.5V). * **GND:** Ground connection. * **OU1:** Direct analog signal from the sensor. * **OU2:** Buffered signal through an onboard op-amp (often a Texas Instruments LM358 or similar) to reduce noise and drive longer cables. **Power path** * **IP+:** Current input. * **IP-:** Current output. **Directionality:** For bidirectional ("B") models, current can flow in either direction. For unidirectional ("U") models, current must flow from IP+ to IP- for a positive voltage increase. {{page>:tarhal}} ==== Arduino code ==== This code reads a bidirectional sensor (such as the models you listed) and computes the DC current. It assumes a 5V Arduino and that the sensor is powered by 5V. Select the //mVperAmp// value based on your specific ACS758 model: * 050B: 40 mV/A * 100B: 20 mV/A * 150B: 13.3 mV/A * 200B: 10 mV/A const int sensorPin = A0; // Pin connected to CJMCU-758 OUT int mVperAmp = 40; // Change to 20, 13.3, or 10 based on model int ACSoffset = 2500; // 2.5V (VCC/2) is the 0A midpoint for bidirectional sensors void setup() { Serial.begin(9600); } void loop() { // 1. Read raw ADC value (0-1023) int rawValue = analogRead(sensorPin); // 2. Convert raw value to voltage in mV // 5000mV / 1024 ADC steps = 4.88mV per step double voltage = (rawValue / 1023.0) * 5000; // 3. Subtract offset and divide by sensitivity to get Amps double current = (voltage - ACSoffset) / mVperAmp; Serial.print("Raw: "); Serial.print(rawValue); Serial.print(" | Voltage(mV): "); Serial.print(voltage); Serial.print(" | Current(A): "); Serial.println(current, 2); delay(500); } **Key Considerations** * **Calibration:** The quiescent offset (voltage at 0 Amps) is theoretically 2500 mV but often varies slightly due to power supply noise or stray magnetic fields. Measure the voltage at 0 A, and update the ACSoffset in your code for improved accuracy. * **3.3V Microcontrollers:** If using an ESP32 or Arduino Due, you must use a voltage divider on the output to drop it below 3.3V, or use a 3.3V reference in your calculations (the sensitivity will also be lower). * **Averaging:** To reduce jitter, take 10–100 samples in your loop and compute the mean. ===== CJMCU topics on lamaPLC ===== {{topic>cjmcu}} \\ {{tag>CJMCU CJMCU-758 ACS758 ACS758LCB-050B ACS758LCB-100B ACS758KCB-150B ACS758ECB-200B Hall-effect current sensor analog arduino code}} This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}