8 bit binary parallel input to logarithmic output

Thread Starter

arivel

Joined Mar 4, 2018
47
Hello to all . I would like some advice.
I need a D / A conversion starting from 8 bits in binary in parallel mode and the output must be logarithmic.
if it is not possible with 8 bits then alternatively 6 bits.
what are the ways you know of to accomplish this?
 

AnalogKid

Joined Aug 1, 2013
10,986
A log amp (logarithmic amplifier) will take a linear voltage in and output a voltage proportional to its logarithm. This can be done with one precision opamp or instrumentation amplifier, or something combined with an analog multiplier, although a multiple-opamp approach will have better accuracy over a wider range. Plus, I think you can just buy one. However, your question is missing a lot of detail about both the input and out ranges, the logarithm base, etc.

Here is a very basic approach; http://www.circuitstoday.com/log-amplifier

Here is a more precise approach: https://www.circuitlab.com/circuit/69z2mj/logarithmic-amplifier/

I got these from a search for ' log amp schematic '. You should try it. You'll get many examples and should be able to see a pattern in the designs.

ak
 

MrAl

Joined Jun 17, 2014
11,389
Hello to all . I would like some advice.
I need a D / A conversion starting from 8 bits in binary in parallel mode and the output must be logarithmic.
if it is not possible with 8 bits then alternatively 6 bits.
what are the ways you know of to accomplish this?
Are you allowed to use a digital solution or do you have to do it in analog only?
The digital form would be a lookup table, the analog form would be an op amp and some other parts.
 

Ian0

Joined Aug 7, 2020
9,667
Use a current-output DAC, and connect the output to a diode.

Or, for a better version, have two matched diodes and connect the current-output DAC to one of them. Pass a constant current through the other, and measure the difference in voltages.
 

Thread Starter

arivel

Joined Mar 4, 2018
47
is it possible to do this by playing with the configuration and values of the input resistors of an adder opamp?
 

crutschow

Joined Mar 14, 2008
34,280
I prefer in analog
Why?
Is that a requirement of the task or just something you prefer?
Analog requires a log amp.
Digital is easier and more stable.
is it possible to do this by playing with the configuration and values of the input resistors of an adder opamp?
Don't think so since each bit has a different value in a log scale, depending upon the other bit values.

If you better understand the mathematics of converting linear to log you wouldn't need to ask so many questions. :rolleyes:
 

MrAl

Joined Jun 17, 2014
11,389
is it possible to do this by playing with the configuration and values of the input resistors of an adder opamp?
Ok so the analog it is then. I have to say also that analog is the most challenging and therefore the most instructive. Digital is kid's play :)

But sorry no you can not change values of resistors to get a log effect because resistors are linear devices. You might use a diode to convert to log, but it's a little bit more complicated than that as i will show.
I did an article on log and anti log circuits not sure where it is now. I'll check around.

In the mean time, here is your starting point unless you want to use an off the shelf log circuit which is certainly not as instructive as doing it yourself even if just in theory.
We start with a simplified form of the diode equation for voltage taking current as an argument:
V=Vt*ln(i/IS+1)*N+i*Rs

where 'i' is the current, V the voltage, and the others are constants, for now, assuming you put this in a temperature controlled oven or just assume the ambient temperature is constant which is still informative.

By looking at that equation we notice a few things right off.
First, the right side is NOT the natural log of the current 'i', it is the natural log of the current 'i' divided by the saturation current with the constant '1' added to that, then that is multiplied by N and Vt and then the current times the bulk resistance Rs is added to the result. So the voltage is far from the natural log. If you are going for another log like base 10 log then we also have to do some other stuff, but obtaining the natural log is good enough for now as converting to another log system is easy after that.

So see what you can do with that equation first i dont want to give everything away as this is the homework section...
V=Vt*ln(i/IS+1)*N+i*Rs

Just to note:
V is the voltage across the diode,
Vt is the 'thermal voltage' which is often taken to be equal to a constant 0.026 (volts) at room temperature,
'i' is the current through the diode,
IS is the saturation current a characteristic of the diode,
N is the ideality factor also a characteristic of the diode,
Rs is the bulk series resistance often fairly low 0.1 Ohms or less in most rectifier diodes.
Because Rs is usually low it can sometimes be ignored for low diode currents but it is more instructional to keep it in there, although you can start without it just to get going and get a feel for how all this works.
Also, ln( ) is the math natural log function.

So you can start to see that to obtain the true natural log of the current you have to scale and do some other adjustments to the current and the output of the circuit. See what you can figure out before we go any farther.
 
Last edited:

Thread Starter

arivel

Joined Mar 4, 2018
47
Are you allowed to use a digital solution or do you have to do it in analog only?
The digital form would be a lookup table, the analog form would be an op amp and some other parts.
[/CITAZIONE]
I'm curious to see how you would do it digitally
 

MrAl

Joined Jun 17, 2014
11,389
Hi,

Did you reply that you were curious as to how to do it digitally? Your post reply might have been in the quote instead of a new reply.

To do it digitally the simplest method is to program a EPROM so that each binary input produces the right binary output. You would use a computer to calculate the values for each memory location.
For an example where you want to multiply all inputs by 2 you would do something like this:
for addr=0 to 32767
y=addr*2
end for
Then you just program each memory location (addr) with the corresponding value of y.
So now when you address the location 0x0003 for example, the output is 0x0006 which is double.
For the log function you would just program the log values and you might have to include a sign bit so you may want to use some form of floating point or fixed point number format.

The analog techniques is a LOT more interesting.
First you convert the equation for voltage into a form that takes a scaled and offset input current, then apply that to a diode at a fixed temperature, then divide and possibly use another offset to get the the resulting output voltage. If you need to input a voltage then first convert the voltage to a suitable current.
You may have to do some other scaling if any of the intermediate voltages go too high or too low for the system (if one value goes to 24 volts and you only have a 12 volt system then you have to scale that for example).

Still looking for my article on this but i could recreate it it's not that complicated although it's more than just driving a diode with a current source. When you drive a diode with a current source and no other circuitry to condition the input and/or output you get the voltage of a diode as output not the log of the current through the diode :)
 

Ian0

Joined Aug 7, 2020
9,667
The main problem with look-up table or digital solutions is that they need a much higher resolution DAC than the 8 bits of the linear DAC.
Have a look at Figure 1 in this application note.
Connect Vin to the output of a voltage output DAC, or, even better, Iin to the output of a current output DAC.
You can use a standard 1k resistor if you're not too bothered about a little bit of drift with temperature.
I've used this log-amp circuit before, and it's better than most because it eliminates the offset from the base-emitter voltage of the transistor.
 

MrChips

Joined Oct 2, 2009
30,706
Logarithm produces a contraction of the dynamic range.
If you take the position of the highest order bit that is 1 you will obtain the base-2 log.

For 8-bit values converted to base-10 log there are only three output values.
For 8-bit values converted to base-2 log there are only eight output values.
 

Ian0

Joined Aug 7, 2020
9,667
I wonder if it is still possible to obtain μ-law DACs. They were used for telecoms to compress the dynamic range. They probably still are, but done in software.
 
Top