2
\$\begingroup\$

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.

\$\endgroup\$
5
  • \$\begingroup\$ A schematic would help, but connecting the grounds together and using a resistor divider would be the usual way. Why do you think connecting the sensor's ground to the microcontroller will be a problem? \$\endgroup\$
    – PeterJ
    Commented Aug 12, 2013 at 8:48
  • \$\begingroup\$ Hi PeterJ, I think it's a problem because I have designed the PCB using 2 separate ground (isolated DC/DC). So I can never connect the 2 grounds. \$\endgroup\$
    – JoGe
    Commented Aug 12, 2013 at 8:53
  • \$\begingroup\$ What sensor is it? A datasheet link would help, as would a schematic for your circuit: Please tell us the actual problem, rather than present your hypothesized solution which may well not be the ideal solution in this case. The "Here's my approach, how can I fix it" approach merely wastes people's time, and does not optimally utilize their knowledge. \$\endgroup\$ Commented Aug 12, 2013 at 9:34
  • \$\begingroup\$ This is the datasheet of the sensor: apem.com/files/apem/brochures/switch-pushbutton-IH-ENG.pdf I don't have a clean schematic, everything is in my Eagle file. I have a isolated DC/DC 12V-3.3V and 2 isolated ground planes on my PCB. \$\endgroup\$
    – JoGe
    Commented Aug 12, 2013 at 9:45
  • \$\begingroup\$ Even w/ isolated DC/DC, you must have an isolated point that brings in your analog 5V signal, or you'd never be able to sample it. \$\endgroup\$ Commented Aug 12, 2013 at 14:15

3 Answers 3

2
\$\begingroup\$

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.

\$\endgroup\$
4
  • \$\begingroup\$ Hi Frederico, I'm using 2 separate ground (isolated DC/DC) so I can't connect both grounds together. \$\endgroup\$
    – JoGe
    Commented Aug 12, 2013 at 8:54
  • \$\begingroup\$ @Delusion you may be using two separate grounds but is there a technical reason why they can't be connected together. DC-DC converters don't usually have a problem in this respect. \$\endgroup\$
    – Andy aka
    Commented Aug 12, 2013 at 9:45
  • \$\begingroup\$ It's just there in case something goes wrong on either side of the DC/DC. The PCB is intended for the automobile sector so it has to be fail-safe. \$\endgroup\$
    – JoGe
    Commented Aug 12, 2013 at 9:51
  • \$\begingroup\$ @Delusion I'm not sure that isolating something makes it necessarily fail-safe? \$\endgroup\$
    – Andy aka
    Commented Aug 12, 2013 at 16:44
2
\$\begingroup\$

The datasheet of the hall effect pushbutton sensor in question indicates an operating voltage range of 3.5 to 24 Volts. The output voltage is approximately the same as the supply voltage applied to it.

While the PIC microcontroller being used has not been specified, many PIC microcontrollers support an operating supply range of 2.0 to 5.5 Volts.

Assuming the specific PIC device available to the OP has this same range, an optimal solution would be to operate both the microcontroller and the sensor at 3.5 Volts - this eliminates any need for voltage level translation, since the sensor will not exceed the 3.5 Volt supply, and thus its output can be directly used with the PIC.

The datasheet provides the following graph of output voltage to distance of travel for the sensor:

Graph

With a 3.5 Volt supply, the right-hand end of the graph would shift linearly down to around 3.0 Volts output at 4 mm travel, with the lower limit remaining approximately at 0.5 Volts. That would work fine with a 3.5 Volt supplied PIC.

\$\endgroup\$
2
  • \$\begingroup\$ Some pics, like the dspic33j line, specify that only SOME I/O's are 5V tolerant. Be sure to read the datasheets carefully \$\endgroup\$ Commented Aug 12, 2013 at 14:16
  • 1
    \$\begingroup\$ @ScottSeidman The very point of my answer is that the 5 Volts is not needed - both the sensor and the MCU will happily work at 3.5 Volts, so 5 Volt tolerance does not enter the picture. \$\endgroup\$ Commented Aug 12, 2013 at 14:17
0
\$\begingroup\$

If you need to isolate the two power domains, you can use an isolation amplifier like the AMC1200. It works like an OpAmp, but provides high voltage isolation between input and output.

Since the AMC1200 comes with a fixed gain of 8, you will still need a resistor divider on its input.

There are also other variants available, e.g. from Analog Devices.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.