Handheld AC Impedance Bridge


On 25 April, 2016 I gave a talk at the monthly meeting of the San Diego iOS Developer's Group SDiOS. This page contains links to my slides from the talk, XCode projects encompassing the source code, and additional online resources which may be helpful to those who found my topic interesting.

On This Page:

Slides From My Talk

SDiOS SIG #61 Poster

iOS devices typically have very good sound hardware, which led me to think about using an Apple handheld to create a precision measuring instrument. After working through a lot of derivations, I realized that a generalized AC impedance bridge could be implemented with little more than the stereo headphone output and microphone input present on most iOS devices. My slides, linked here, illustrate some of the path I followed to obtain a bridge capable of comparing arbitrary impedances with a precision of 0.1%, at frequencies ranging from 100 Hz to 10 kHz.

iOS UDP Socket Server XCode Project

iOS AC Bridge App Screen Shot

XCode 7.3 project directory as a zip file, 140 kB, targeting iOS 6.1 or newer. Implements an AC impedance bridge using your handheld device's sound hardware. Exposes a UDP socket server on port 54321. Clients can request a measurement with specific setup parameters. The server fulfills the request, and sends a reply to the client with the results. Note that the server is only listening while the device is awake and the app is in the foreground. Can interact with multiple clients, but when requests overlap, the current version gets confused about where the reply should be sent.

MacOS UDP Socket Client XCode Project

MacOS Dialog App Screen Shot

XCode 4.2 project directory as a zip file, 45 kB, targeting MacOS 10.6.8 or newer. Implements a simple dialog app which gathers user input from text fields, packages it in a JSON tree, and sends it to a server like the iOS app shown above. Accepts server's reply (asynchronously) and computes impedance ratio from known and measured values. When the "Continuous" box is checked, inbound replies from the server will trigger a new measurement request. When the "Leveling" box is checked, inbound replies from the server will cause the measured signal level to be evaluated, and the left and right amplitudes to be adjusted for the next measurement. Measurement data is recorded in a disk log file, saved in the user's Documents directory.

Python UDP Socket Client Scripts

Python script targeting Python 2.7. Simple client program packages a measurement request as JSON text and sends it off to the server. Accepts replies (blocking with a timeout), shows them on the console, and logs them to a CSV format disk file. Log file can be opened in Excel. Note that contents are expressed as complex numbers, which require special cell functions in Excel. Tested on MacOS, Windows, and Linux.

Python script targeting Python 2.7. Very simple client program sends a short snippet of text to the server, waits for a reply (blocking), and shows it on the console. Tested on MacOS, Windows, and Linux.

NetCat Command Line

You don't need a purpose-built client app to interact with the iOS server. If you can ping the handheld, you can use NetCat to talk to the server. A typical command line might look something like this:

MyComputer:~ MyId$ nc -u 192.168.1.65 54321

The command 'nc' is followed by the '-u' flag, which says to use a UDP socket. This is followed by the host name or IP address, and finally the port number to use. After you hit 'RETURN', you can type lines of text which are sent to the given IP address and port. Replies from the server will appear on the following line, type 'ctrl-C' to exit. NetCat can do much more than this, but is beyond the scope of this page.

Impedance Converter Schematic

Impedance Converter Schematic Diagram

Schematic diagram, created in Eagle CAD, showing the impedance converter used to form an AC bridge with an iOS handheld device's sound hardware. Q1, a 2SK596S JFET (junction field effect transistor), is a special low-cutoff type, allowing operation with the gate biased at ground potential. A simple barefoot FET would have sufficed, but the compound pair shown gives improved gain, headroom, and linearity.

Orthogonal Results

Sensor Data Plotted Against Time

Excel spreadsheet, 410 KB, with iOS AC Bridge data from two sensors. Thermistor (temperature-varying resistor) and humistor (humidity-varying capacitor) are connected in series, to form one leg of an AC bridge. The technique given here is phase sensitive, allowing the resistance and capacitance to be plotted separately. This typically requires rotating the axes in the imaginary plane, as shown in the spreadsheet. Some versions of Excel give a file error on opening this file, which appears to be harmless.

Vendors

General Radio Standard Capacitor

References

Fine Print

I am placing the ideas and source code presented on this page in the public domain, for the benefit of software developers and engineers. Please remember that only you can determine if these ideas are suitable for your application. The burden is on you to verify, through functional test, code inspection, and any other means you determine is appropriate, whether the source code presented here actually works or not. Feel free to post a link to this page on your site, this page should be available at this URL for the foreseeable future. I claim a trademark interest in the names "Williamsonic" and "www.williamsonic.com".

ArrowMap


Home Page Next Page Last updated 5/2/2016 by No Spam Please!