# reading a DC voltage into an android phone microphone port

I have been using the microphone port of an android phone to read AC voltages (as it is capacatively coupled).

What if I want to read DC voltages?

I have considered...

1. turning DC into AC via an oscillator

2. using a PIC microcontroller to read an analogue voltage and send a high/low bitstream to the microphone input containing this information

I think (2) is the best way to go. What is the easiest/quickest/cheapest way to get a PIC to read an analogue voltage and output a bitstream in this way?

• Have you researched programming microcontrollers at all, or are you expecting us to tell you how it's done? – Phil Frost Feb 5 '14 at 12:27
• I'm just asking for comments on the approach, including whether PIC programming is the right one. If it is, then a suggestion of the best PIC or PIC programming resource would be helpful. – user2633388 Feb 5 '14 at 16:19

Another alternative is this: -

Feed the unknown DC voltage into an integrator. The integrator output voltage will ramp up at a rate determined by: -

• A fixed value resistor
• A fixed value capacitor
• The DC input voltage

Use a comparator on the output of the integrator - when the integrator output voltage reaches a certain level, the integrator is zeroed by shorting the capacitor with a FET or BJT. Then the whole cycle repeats.

What you get is a voltage to frequency converter. Feeding this into your android and calculating the frequency should be do-able.

Here's a circuit I got off the internet that looks like it should work - it uses a 555 instead of a comparator but essentially it's doing the same thing: -

You should be able to replace the 741 with a RRIO op-amp and get it working from a single supply voltage.

• I haven't worked with Android, but I imagine a quick two-point calibration using a known DC reference would be plan and simple. Nice solution. – scld Feb 5 '14 at 13:03
• Thanks, really interesting idea. The phone sees changes in voltage really nicely so if I can just read these blips I can find input voltage. – user2633388 Feb 5 '14 at 16:22