开发者

Reading milliVolts in Android for pH Tester

I'm looking in to making a pH tester for my Android phone. I've found a pH electrode that will send a milliVolt signal which I can then use to convert into a pH reading (59.2 mV per pH unit @ 25° C). The question I'm having is would it be possible to connect the electrode to the headphone jack and directly read the milliVolt reading or would I need to convert the analog signal to digital first and then plug it in via USB? I'm not a big electronics guy but I'm开发者_如何学Python doing this project on the side and hoping to learn from it.

I was thinking perhaps getting the mV reading from the headphone jack would be possible with the GetMaxAmplitude function like from this thread here: Range of values for GetMaxAmplitude. Although, from what I understand the lowest reading possible with this function is 0 and there are negative mV values that can be read when testing for pH.

Any help is greatly appreciated, thanks!


This should be asked in the electrical engineering site. But the best way is to use a Bluetooth-to-serial converter, ($5 off ebay) and a PIC microcontroller with USART and A/D converter, ($1), you could program the PIC quite easily in C with the 'MPLAB' IDE and 'HI-TECH' C compiler. The tools you'll need are a PIC programmer ($20) and something with a serial port if you want to configure the Bluetooth-serial converter, like a desktop PC or a USB-serial converter. You might need an op-amp circuit to amplify the signal so it's readable by the PIC. You'd then use code from Google's BluetoothChat example to get your phone connecting to your bluetooth system, and receiving data from it.

Using a microphone for input would be tricky, for one reason, because it will be filtered to accept only AC. One way to get round that would be to modulate an oscillator's output so its amplitude is proportional to the DC signal you're measuring, then you could measure the magnitude by analysing the data from the microphone.

Interfacing with USB is more difficult than it sounds, it would be harder to build something which would interface with that and measure millivolts, than with bluetooth, because the PIC processor you use for analog to digital sampling and USB client would in fact have to either act as USB host or USB OTG on a phone, which is far more complicated than being a USB peripheral.


I think you would have the most consistent operation across a range of android devices if you built a circuit which uses the voltage from the sensor to control the frequency of an audio oscillator, and measures the frequency with software on the phone.

It's not impossible that a direct connection and reading the amplitude would work, but the two problems are that the signal path may not be good all the way down to DC - there may be a minimum frequency that it can pass making it unsuitable for measuring constant voltages. And second, that the gain of the input channel may not be consistent from device to device or even over time, temperature, etc. There are possible workarounds such as circuits which alternately send the voltage upright and inverted, effectively modulating it to overcome minimum frequency limitations, or even alternate the actual reading with a reference voltage to help model the input gain.

But I'd probably recommend either the frequency modulation approach, or using a $20 embedded bluetooth module and going wireless. Either way, the sensor system is going to need its own small battery pack.


You can extract some power from the headphone jack by telling android to make some sound (and, I suppose, rectifying the output and storing it in a capacitor) - I've seen a bunch of jack-powered things do this. I wonder if the 2 ideas could go together? What if you modulated some audio out through the headphone jacks, through the sensor, then back into the mic? The pH reading should mess with the received sound in some kind of measurable way I'd expect?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜