hi,
The maximum count from the adc is 1023.
I have found the easiest way is to use a simple resistive divider on the adc inpit pin, say a 100R/4k3 or 82R/3k6 [ or if you prefer a 5kpot]
Set the pot/divider so that for a 5V input to the divider, the adc pin is 4.88v, this will give 1000 adc counts for a 5V signal input, using a 5Vref
This makes the maths in the PIC simple.
Note that the LM35 is only accurate to approx 0.5Cdeg.
Ok, so I understand how you do that, taking the 5V input and dividing it to give you 4.88, which works out at 1000 counts of the 1023 (with Vref of 5V)
But are my calculations right? other than I multiplied by 1024, where it should have been 1023?
The reason I ask is I'm needing to try understand how to do this in the future, pointless me asking someone to every time I make something.
Ok, so I understand how you do that, taking the 5V input and dividing it to give you 4.88, which works out at 1000 counts of the 1023 (with Vref of 5V)
But are my calculations right? other than I multiplied by 1024, where it should have been 1023?
The reason I ask is I'm needing to try understand how to do this in the future, pointless me asking someone to every time I make something.
hi,
For your 20 to 30C, you will only see a 0.1V change and for the 20 to 80C a 0.6Vchange.
I would suggest a OPA for both ranges, that could give you 5V[4.88v] =1000 counts, which could be dumbed down to 0.1C resolution [NOT accuracy]
and the 0.6V to, 4.88V * [600/1000] = 2.928V
I have a PSU I'm wanting to put a LCD Voltmeter and Ammerter.
The out put is 30V and 3A. It has a load sensing resistor as part of its design as it has current limiting circuitry. The Resistor is a 0.47Ohm. Therefore the voltage across it is 1.41V (give or take) at 3Amps.
I'm wanting a resolution of 0.1V and 0.005A.
Amperage:
3A / 0.005A = 600 counts.
1.41 / 600 = 0.00235V per Step, therefore 0.00235 * 1023 = 2.404V for Vref.
The voltage:
30V / 0.1V = 300 counts
So I can use a resistor divider to drop the 30V to 0.705V to get the 300 count, but due to the way it is connected to the PSU, it will also add the Voltage from the load resistor. (but maths in the software will sort this out - I hope)
But now I'm sure I've read you can't use a Vref of less than 2.5V. Is there anyway of getting around this without having to use opamps?
hi,
I would not recommend using a Vref of less than 2.5Vref, with a +5Vs to the PIC.
The OPA you require are only about 20p , ~20c, you can get a dual rail to rail OPA for this price,, which would be ideal for your project.
I would say a 0.47R current sense resistor is too high for a Imax of 3A. If you use a 0.1R, that will have a 0.3V drop across at 3A.
Use an OPA to increase that to say 1.46V for the adc. Thats 5V * [300/1023] = 1.46V.
Connect the Rsense 0.1R resistor in the Low end of the external load, thats the outgoing 0V line.
To work out the Voltage side, I will have to read AN0 and subtract AN1 to get the "true" voltage excluding the voltage over the sensing resistor.
I'm worried a bit about the resolution, as its will only give me a 0.1V, and due to having to work it out as stated above, I'm thinking I should maybe use something with a 12bit to get a better resolution?
To work out the Voltage side, I will have to read AN0 and subtract AN1 to get the "true" voltage excluding the voltage over the sensing resistor.
I'm worried a bit about the resolution, as its will only give me a 0.1V, and due to having to work it out as stated above, I'm thinking I should maybe use something with a 12bit to get a better resolution?
hi,
Question, is the PSU output going to be fixed at 30V or variable, if variable over what range of voltages.???
I know the PSU output current is going to variable from say 0A thru 3A.
IMO a 12bit ADC is an overkill for a bench PSU.
Do you have a full circuit to post, perhaps I can help with the design.?
Sorry, its a variable voltage, 0V - 25/30V (Just need to confirm ripple voltage and full load, but more than likely 25V or 26V), and variable current 0.002 to 3 amp.
Should have pointed that out.
I have attached the schem of the circuit. Thanks for all the help!
Can you check the following, set the Vout to 15V and load it for 3A , measure the no load and 3A voltage.
Do it again also for 30v, let me know.
EDIT:
This is one option.
Note the 0.01R and the MC34071 OPA type.
If you could fit a low power +12V regulator inside the original PSU, you could use that to power the OPA. In that case you could use a LM358 or a CA3140.
Not quite with you, should I measure the voltage across R7 (sensing resistor) while doing this? or the outputs? as the voltage will be 0V when the current limiter kicks in from being shorted?
Would it not be better to use higher quality 1% 0R1 resistor in series from the 0V/gnd?
The reason I ask is because I have 4 seperate boards, forming 2 isloaded +25V - 0V - -25V, they may have slight voltage differances over R7?
hi,
The voltages across R7 look usable as a take off point for Isense OPA.
Use a simple divider across the Vout, by using high value resistors in the divider and the second have of a dual OPA we could avoid loading the R7 with divider resistor.
Do you need another drawing.?
EDIT:
The 0.47R is R7
The plot shows the Vout from 0v to +30V with a 10R load