- The buck converter is supplying up to 0.5 Amperes, based on update in the question. * See note at end regarding invalid output current assumption.
- The Arduino in use is one of the "classic" ones, powered at 5 Volts DC, not one of the recent 3.3 Volt models.
There are at least two potential issues with the specified approach.
- Voltage output of sensor if measured directly:
- The ACS758-050B has a sensitivity of 40 mV/A, and a quiescent VIOUT of 2.5 Volts if Vcc is supplied from the Arduino (i.e. 5 Volts). Thus, at a full 0.5 Amperes of current through the device, the voltage output would be either
2.5 + (0.04 * 0.5) = 2.52 Volts or
2.5 - (0.04 * 0.5) = 2.48 Volts.
- The Arduino's ADC (10-bit) when used without AREF, reads
5.0 / 1024 = 0.00488 V = 4.88 mV per distinct value. Thus, the ADC would read either ~ 516 or ~ 508 for 0.5 Ampere current, and span this range of just 8 ADC values (not 0 to 1023) for a full spread of currents from -0.5 Amperes to +0.5 amperes - The sign indicates current flow polarity.
- Clearly, the OP understands this and thus the need for amplification of the output voltage.
- Unsuitability of TI's uA741 for this application:
- The parametric limits for the uA741 state a minimum supply voltage (between Vcc+ and Vcc-) of 7 Volts, so a 5 Volt supply simply isn't characterized.
- None of the various flavors of IC 741 (LM741, uA741, etc) is specified to work with inputs or outputs going all the way to the supply rails. For achieving ADC full-scale deflection, at the least, a rail-to-rail output op-amp will be needed, and a rail-to-rail-input-output (RRIO) op-amp is needed if you use the unidirectional version of the current sensor IC.
- Use a lower current specification sensor, such as the Allegro ACS712 sensor rated for 5 Amperes full-scale deflection. This has an output sensitivity of up to 185 mV/A, better than the 40 mV/A of the current part, but still very low for direct ADC measurement.
- Replace the uA741 with an RRO op-amp designed for single supply operation of 5 Volts, such as Analog Devices OP777, Texas Instruments OPA344 or Analog Devices AD822.
- Use a more sensitive current sense part such as the Texas Instruments INA213 for bidirectional (50 V/V), or INA214 for unidirectional (100 V/V) current sensing, which with a 0.1 Ohm external shunt resistor, will provide output from (V+)–0.2 to (VGND)+0.05 Volts, for a current range of 0 to 0.5 Amperes. This allows full-scale ADC input to the Arduino without additional amplification.
- The INA21x parts are designed for a load impedance of 10 kOhms, thus ideal for direct use with the 10 kOhm input impedance of Arduino ADC pins.
By not using the Allegro parts, however, you do lose the built-in line voltage isolation that Hall Sensors provide. Your circuit will have to take this into account. Also, please keep in mind the maximum common mode voltage permitted by the part selected - the shunt resistor + sensor method may be unsuitable for high voltage circuits.
Update: This application note provides several methods and associated parts for current sensing, as well as valuable insight into the subject.
Invalid assumption of output current:
While the question states "expecting the same current for the output", this would only be true if the input and output voltages are nearly identical. For a 2x voltage increase, for instance, roughly twice the current is needed at input, as is consumed at output. Similarly, for a step-down to half voltage, the input current would be half the output current drawn.
In other words, power
V x I at input and at output will be roughly similar, ignoring losses and the converter's own consumption.
The calculations and circuit design need to take this into account, based on the step-up or step-down the switching regulator is designed for.