Voltage and Current Sensors with PIC18F4550

Discussion in 'Embedded Systems and Microcontrollers' started by corsair, Oct 18, 2010.

Mar 6, 2010
51
1
For a school project, I was put onto a project where I am supposed to use a PIC18F4550 to create a voltage and current sensor with a 0-24V range and 0-7A range, respectively.

For the voltage sensor, my idea was to just use a simple voltage divider with a Vin = 3.3v.

Therefore, Vout/Vin = 3.3/24 = R2 / (R1 + R2) which leaves R2 = 3.3k Ohms and R1 = 20.7K Ohms.

I am not very good at circuit design and I was wondering if someone with a lot of experience can tell me if this sounds decent? I had some suggestions about considering filtering and a capacitor to smooth voltage spikes, but I have no idea how to create the circuit to do that and I want to keep it simple and working.

As for the current sensor, I was thinking about using a current sense amplifier circuit. Would someone help me design one of these?

I appreciate all help and suggestions I can do to develop these tools. Thanks!

Corsair

2. nhenri New Member

Oct 18, 2010
3
0
hey it is
v=ri -> 24*3.3/20.7 = 3.34v

-Nik-

3. Markd77 Senior Member

Sep 7, 2009
2,803
594
Interestingly a low pass filter could remove the need for an op amp. If from the divider you have a 150K resistor going to the pin and a 1uF capacitor from the pin to ground, you have a low pass filter and the capacitor means the impedence presented to the pin is very low. It would probably mean the pin has to be set as a digital input most of the time and only switched to analog when needed.
I've seen this suggested before, and analog circuitry isn't my forte so if anyone can confirm this or give better values...

Mar 6, 2010
51
1
ill run this by my professor tomorrow, ill post up some thoughts he may have and run them by you guys for more help. i appreciate your inputs so far tho!

5. Markd77 Senior Member

Sep 7, 2009
2,803
594
Sure, but during samping you can ignore the 150K resistor because the voltage across it is small. The PIC only sees the 1uF capacitor charged to a certain voltage. It's impedance is tiny and the leakage current of the ADC is only +-500nA for a few microseconds.

Mar 6, 2010
51
1
so my professor just made this 10x more complicated for me. he wants me to use a norton amp to make the voltage sensor, and a hall effect sensor for the current sensor... does anyone have any sample projects with PICs that they could share their code/circuit design in doing so?

Mar 6, 2010
51
1
i made a circuit, but i was wondering if someone could help me figure out resistor values? how would i be able to solve for it so that the voltage across RLoad sweeps from 0-3.3 volts? currently as it is set up, it is staying constant at 2.6volts. V2 sweeps from 10v to 14v

File size:
17.7 KB
Views:
40
8. Markd77 Senior Member

Sep 7, 2009
2,803
594
That circuit isn't going to do what you want. For a start the op amp has a minimum requirement of 4V and the output can't reach higher than 1V below the power supply voltage.
R4 is going to prevent the voltage across Rload going anywhere near 0