# How to use analog computational circuits to feed a digital display?

Joined Jul 11, 2013
7
My project involves taking a liquid sample, passing light through the sample, measuring a voltage signal as an indicator of the amount of light is transmitted through the sample and to display the voltage in a meaningful way that relates to the colour of the sample. Basically I'm trying to make a tintometer/colorimiter for measuring a range of colours in a liquid.

The relationship between sample colour and voltage is as follows:

colour = -w.log10 ((Vsample-Vzero)/(Vsolvent-Vzero))

where: Vzero is the circuit voltage at zero transmission; Vsolvent is the measured voltage of the carrier solvent (in this case water) ; Vsample is the measured voltage of the coloured liquid sample; and, w is a multiplier and correction factor for the path length of the light as it passes through the sample holder. To simplify the math, Vzero could be manually adjusted to read zero voltage on zero transmission, I guess.

Basically I'd prefer to develop this as an all analog device. I've seen arduino and pic based solutions, but I don't want to follow that route.

What I'm currently wrestling with is the post voltage measurement side.

My question can be simplified to this: How do I translate the above formula into a simple, analog computational circuit and subsequently display that result in a meaningful manner?

Currently I've been looking at some logarithmic circuits and examples, here and as well as elsewhere, but I haven't seen anything quite like my specific application and I'm starting to sink a little. Any chance of some help?

Joined Jul 11, 2013
7
This is the current circuit I'm initially working with. It relies on using a standard digital multimeter with probes to take a reading and then do the math post reading. I want to build the whole lot into a standalone "pocket sized" wooden box... with brass corners and inlays, and french polished like finish using beeswax...

#### DickCappels

Joined Aug 21, 2008
6,374
All of your answers can be found on Analog Devices' website. An analog multiplier can be used in the feedback loop of an op-amp to make a divider. Analog Devices also makes log amps.
http://www.analog.com
You will also find application notes on their site. However, those analog parts are very expensive, and you can buy many microcontrollers for the price of a single analog multiplier.

I guess to be fair, I should mention that Texas Instruments has relevant application notes on their website, mainly owing to their acquisition of Burr-Brown and National Semiconductor.

#### MikeML

Joined Oct 2, 2009
5,444

#### Lestraveled

Joined May 19, 2014
1,946
The only reason I would consider going analog for this application would be dynamic range. How many decades of range do you want?

If you went digital, your A to D converter would limit your dynamic range. For instance a 12 bit ADC would yield a 36 dB range, a 14 bit ADC would yield a 42 dB range.

Analog log converters inherently have a much wider dynamic range than A to D converters.

#### ErnieM

Joined Apr 24, 2011
8,040
I love the constraints of the project: analog only in a finely finished wooden box. It will be a work of art for the ages.

I have some questions about how the measurements are made on the “initial” device:

Seems there are three measurements to be made?
1) Vzero with the light path blocked
2) Vsolvent with just water in the sample container (I’m picturing a test tube inserted into a dark hole)
3) Vsample with the liquid added to the test tube

Then there are what looks to be a fine and course adjustment knob. Where are these used?

Do you have any measured voltage data when using this initial device? That a good guide for looking at the range things need work with.

The right side of the bridge seems to just be setting some constant, perhaps to make the meter read zero for the Vsolvent test?

Aside: if this works with an 8V supply why not rescale and use 9V (a standard battery), and toss the 8V regulator?

#### joeyd999

Joined Jun 6, 2011
4,391
The only reason I would consider going analog for this application would be dynamic range. How many decades of range do you want?

If you went digital, your A to D converter would limit your dynamic range. For instance a 12 bit ADC would yield a 36 dB range, a 14 bit ADC would yield a 42 dB range.

Analog log converters inherently have a much wider dynamic range than A to D converters.
In these kinds of apps, noise is usually the limiting factor, not dynamic range -- especially since >20 bit converters are cheap these days.

#### Lestraveled

Joined May 19, 2014
1,946
joey999, I agree with you.

The OP needs to make the call on how much range and accuracy he wants.

Joined Jul 11, 2013
7
Hey guys, thanks for the responses. I've been looking at the AD and TI documents which is why I haven't responded so immediately.

First, dynamic range. Depending on the Color Scale to be used ( I'm a hobby brewer, so the coloured liquid is beer... SRM, EBC), this changes the multiplier and the expected output value range, but typically from 1 to 3 whole number digits.

The problem with existing designs, like the one I gave as an example, is that you require a separate Voltmeter to plug into it to take a reading which is then converted to a colour value usually in a spreadsheet or on the spot with some calculator. My aim is to have a direct reading in the chosen colour scale, " on the box" i.e. it would be a stand alone device requiring no additional computational input to get a result.

From Texas Instruments they have an example of a Log Amp IC for use in exactly this application, colorimetry. It costs about $20.00+ per chip. I also stumbled across a 2 page research paper that attempts a similar thing and costed out all the components at around$200.00 but all of these applications rely still on connecting to an external recording /display device.

Initially, I was thinking of a 4 op amp circuit that:
1) takes the signal from the LDR and does the ratio calculation;
2) takes the output from 1 and applies a log transformation to it;
3) takes the log output and inverts it; and
4) applies the required multiplier (including ln to Log conversion) to it
and then feed this into a Volt/Ammeter with a needle gauge that ranges from 0 to 100 (or smaller range with a custom colour scale printed on it and inserted in.)

From the TI site is seems like temperature (ambient and operational) has a significant impact on the measurement thus some additional circuitry is needed on the log amp (which theirs seems to do all four of the above steps. I haven't yet worked out how to get the reference voltage for Vzero without having a beam splitter and two chambers. I also haven't yet worked out how to take the output signal from the log amp and pump it directly into a guage. I'd prefer a gauge over a digital display purely for aesthetics.

Kind thanks for the digital suggestions, but I'd really like to work out how I can do this with simple componentry (and perhaps without using an existing pre-manufactured log amp ic).

I'll keep working on it because its embedded itself in my head like an earworm (self repeating music track) and I like

Joined Jul 11, 2013
7
I love the constraints of the project: analog only in a finely finished wooden box. It will be a work of art for the ages.

I have some questions about how the measurements are made on the “initial” device:
The sources for the circuit above can be found here... http://www.beercolor.com/built_your_own_430nm_portable_sp.htm

re: constraints... that's kinda my goal, to make something that is stand alone, does only one thing only with a reasonably acceptable accuracy & repeatability, and has the look of a handcrafted ye olde worldy, scientific instrumet that people look at and go, "Oooh, pretty! What does this do?"

Last edited:

#### ErnieM

Joined Apr 24, 2011
8,040
...has the look of a handcrafted ye olde worldy, scientific instrumet that people look at and go, "Oooh, pretty! What does this do?"
If you do it up right no one will care if it actually does anything.

Actually having a useful function is a bonus!

Joined Jul 11, 2013
7
Here's a thought. I've been playing with circuit designs, keeping in mind what's online as advice:

The lamp for this circuit is a 430 nm LED which requires, at its simplest, a DC power supply (I'd like this supply to be the same supply for the log amp. so how do I up rate existing 5V circuit suggestions to a 6VDC battery pack?) and a resistor related by R=(Vsource - Vled)/Aled. Do I need a parallel capacitor for source voltage conditioning? Do I need a 1/10th capacitor in parallel with my LED+Resistor like in the above source circuit? And if so why?

Next, based on what I've read so far, a blue light limited planar diffused photodiode would be preferable to improve photodiode sensitivity to the source light. Do I need other circuit hardware to make such a diode function normally? (I'm currently looking at schematics and demo applications to work this out.)

Next, most log amp circuits and applications require two inputs, one from the light source going through the sampl, and one going from the lightsource direct to a second photodiode (reference). Can I eliminate the reference diode and just input a set current load equivalent to the transmittance of the light through a distilled water sample? And why would I not do this?

Next, current log amplifiers seem to be able to provide an all in one solution, producing a single point voltage output from 0-3.5 volts with each decade of input being translated to an equivalence of 0.5V logoutput. If I have a 0-3V analog voltage meter, how would I add in a resistor to limit the max voltage output (3.5V from 0 transmittance) that is then fed into my voltmeter? (hopefully I got all of that right...)

Still reading, still researching, still doodling...

cheers.