Electronic – Reading 5v analog to 3V PIC

analogpic

I'm trying to figure out how to connect a linear pushbutton sensor to a Microchip PIC.

The problem is: the sensor has an 5V output and only 3 pins (VDD, Sensor and GND). I need to power the sensor with a VDD different than the one my PIC is running on. But this means I should either connect the 5V ground to my 3V ground or do an analog reading without connecting the sensor's ground to the side of my microprocessor.

Is there any way to do this? I already have a PCB so besides the resistor divider to convert the 5V, I don't have any room for another component.

Note
The 5V and 3V power supplies have to be isolated from each other.

Edit
I have sacrificed the separate ground planes in order to connect the sensor. This works.

Best Answer

Just connect the 2 grounds of the different circuit (and use the voltage divider of course) and you'll be ok. It ensures that the divided 5V from the sensor is a meaningful voltage for the PIC. The PIC won't notice anything about the 5V in the other circuit.

edit
OP seems to need isolated circuits (was not in the question). There are analog optocouplers which allow you to get your sensor voltage across an isolation barrier. The IL300 is mentioned a few times here on electronics.stackexchange, for instance here. You won't need the voltage divider.