i try , explain best can, have project need alter current using pwm (battery tester), have preset value of 3amps adjust sensor value , when battery voltage fall need decrease sensor value maintain 3amps having little issue
if try code, current readings start increase until 3amps reached readings become unstable jumping 2.75amps 3.2amps , sensor value fluctuates between 232-235
to combat seems work current increase's 3amps reading stable , sensor value not fluctuate holds @ 232,if current passes 3amps sensor
value not increase above, think because of delta =abs(last_current - vresults1);
how write code obtain smooth readings , if current increases or decreases pwm(sensor_value) if increase/decrease input voltage(battery voltage),
i need adjust current if falls above or below preset value if input voltage increased or decreased happens on period of time, i've @ p.i.d don't suited using pwm
if try code, current readings start increase until 3amps reached readings become unstable jumping 2.75amps 3.2amps , sensor value fluctuates between 232-235
code: [select]
if ((!cutoff_voltage_reached) && (vresults1<= current_draw)){
// decrease duty cycle compensate smaller load
sensorvalue--;
if (sensorvalue < 195){ //set minimum current value 2.50amps
sensorvalue = 195; //set minimum current value
}
}
else if ((!cutoff_voltage_reached) && (vresults1>=current_draw))
// increase duty cycle compensate larger load
sensorvalue++;
if (sensorvalue >255){ //set maximum current value 3.0amps
sensorvalue = 255; //set maximum current value
}
pwmwrite(9,sensorvalue);
to combat seems work current increase's 3amps reading stable , sensor value not fluctuate holds @ 232,if current passes 3amps sensor
value not increase above, think because of delta =abs(last_current - vresults1);
code: [select]
delta =abs(last_current - vresults1); // calculate absolute value of difference between previous , current light value
if (delta<vresults1){ // adjust duty if current falls
if ((!cutoff_voltage_reached) && (vresults1<= current_draw))//{
// decrease duty cycle compensate smaller load
sensorvalue--;
if (sensorvalue < 195){ //set minimum current value
sensorvalue = 195; //set minimum current value
}
}
else if ((!cutoff_voltage_reached) && (vresults1>=current_draw))
// increase duty cycle compensate larger load
sensorvalue++;
if (sensorvalue >255){ //set maximum current value
sensorvalue = 255; //set maximum current value
}
pwmwrite(9,sensorvalue);
last_current = vresults1;
how write code obtain smooth readings , if current increases or decreases pwm(sensor_value) if increase/decrease input voltage(battery voltage),
i need adjust current if falls above or below preset value if input voltage increased or decreased happens on period of time, i've @ p.i.d don't suited using pwm
why not use basic lm317 current shunt....simple , accurate.
Arduino Forum > Using Arduino > Project Guidance > unstable current readings 0n electronic load
arduino
Comments
Post a Comment