Karthik rajagopal
- May 9, 2016
- 248
- Joined
- May 9, 2016
- Messages
- 248
Hi all,
I recently completed making my lab bench power supply. I have used Arduino to detect and display the voltage and current on an LCD display. I have used a current sense IC from Texas Instruments (part no. INA250A4PW) which has an integrated current shunt resistor with an output of 2 V/A. Since my supply can deliver a maximum of 4A (sensor output of 8V ), I thought of reducing the output of sensor to half its voltage so as to bring the voltage within the limits of Arduino. The problem that I am facing is that the current reading displayed is not stable and fluctuates a lot from the actual value. A direct reading from the sensor is accurate and has no issues. So,I tried reducing the sampling rate to one sample per second but in vain. Please help me resolve this issue . I have attached both the circuit diagram and the arduino code.
I have included only the part of code that senses current in order to make it more clear.(remaining part of the code does not contain any 'delay' functions.)
Code:
[Mod edit: changed from raw text into codebox]
I recently completed making my lab bench power supply. I have used Arduino to detect and display the voltage and current on an LCD display. I have used a current sense IC from Texas Instruments (part no. INA250A4PW) which has an integrated current shunt resistor with an output of 2 V/A. Since my supply can deliver a maximum of 4A (sensor output of 8V ), I thought of reducing the output of sensor to half its voltage so as to bring the voltage within the limits of Arduino. The problem that I am facing is that the current reading displayed is not stable and fluctuates a lot from the actual value. A direct reading from the sensor is accurate and has no issues. So,I tried reducing the sampling rate to one sample per second but in vain. Please help me resolve this issue . I have attached both the circuit diagram and the arduino code.
I have included only the part of code that senses current in order to make it more clear.(remaining part of the code does not contain any 'delay' functions.)
Code:
[Mod edit: changed from raw text into codebox]
Code:
#include <elapsedMillis.h>
elapsedMillis samplingRate;
float current=0;
void setup()
{}
void loop() {
if(samplingRate>=1000)
{
current=((analogRead(A5)*0.0049*2.2)/2.0);//2.2 is multiplied to compensate the accuracy error in resistor divider
samplingRate=0;
}
//lcd commands to print the value.
}
Attachments
Last edited by a moderator: