I'm a little stuck (yet again), I'm building a bench PSU with voltage and current displayed to an LCD, the voltage measurement is working fine however I'm very stuck on getting the ACS712-05B maths.
The sensor reads -/+ 5A giving 0V output at -5A, 2.5V at 0A and 5V at 5A. and is connected to AN1
So I was thinking that rather than messing around with negative figures in maths could I use a Vref of 2.5V on the analog input, or would that also apply to AN0 and mess up the voltage reading. Or is there a simple way to get the current to 2 decimal places that doesnt involve going into negative numbers?
I am sorry if this is a fairly basic question but maths was never my strong point
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using a 2.5V Vref isn't going to help, any a-d readings over 2.5V will read 255? Dim the a-d reading variable as an Integer. Then use a conditional to check for values <127 and set the MSb to 1 (i.e. adVar.15 = 1) for the negative readings.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Guys,
I'm a little stuck (yet again), I'm building a bench PSU with voltage and current displayed to an LCD, the voltage measurement is working fine however I'm very stuck on getting the ACS712-05B maths.
The sensor reads -/+ 5A giving 0V output at -5A, 2.5V at 0A and 5V at 5A. and is connected to AN1
So I was thinking that rather than messing around with negative figures in maths could I use a Vref of 2.5V on the analog input, or would that also apply to AN0 and mess up the voltage reading. Or is there a simple way to get the current to 2 decimal places that doesnt involve going into negative numbers?
I am sorry if this is a fairly basic question but maths was never my strong point
Using a 2.5V Vref isn't going to help, any a-d readings over 2.5V will read 255? Dim the a-d reading variable as an Integer. Then use a conditional to check for values <127 and set the MSb to 1 (i.e. adVar.15 = 1) for the negative readings.
Make the conditional check for <511 when using ReadAD10.
Oops, that never even crossed my mind, I see what you mean, if it's less that 511 then ignore value as its negative.
Cheers