use the DAC output signal

zebedeus

New Member
Hello fellow "desigers"

I am strugling to use the output of the DAC port on a PICAXE18M2. I am trying to use that signal in the standard 32 steps en feed as in input signal to LM3914 LEDbar driver. It steps nicely from about 0.15V to 4.7 V which is perfect for me.
The DAC-signal itself is to low powered to drive the LM3914 straight away so i tried to use an OpAmp with single powersupply like LM324 or LM339. I can't use dual power because there is no negative power available.
I am using the LM324 as a gain follower but as soon i connect the DAC output to the non inverting input of the LM324 the output of the OpAmp jumps to half level of the power powersupply. For example powersupply is 5V then output from the Opamp will b 2.5V
Has anyone of you a good working solution for this problem ??? Maybe an electric schematic ??

Excuses for my horrable english :rolleyes:
 

Technoman

Senior Member
Hi,
... to low powered to drive the LM3914 straight away...
It is very surprising as the input current of the LM3914 is very low.
A circuit diagram and eventually pictures are necessary to help you.
 

AllyCat

Senior Member
Hi,

Generally, a low-pass filtered PWM output makes a much better DAC than the PICaxe's "DAC" output. Lower output impedance and many more voltage levels. ;) IMHO much easier than adding an Op-Amp.

Indeed the input current (pin 5) of the LM3914 appears to be very low, but are you sure you're using the correct reference divider circuit, etc.? The LM339 is a comparator rather than an Op-Amp, so not ideal. The LM324 should be satisfactory (up to a maximum output of Vdd - 1.5 volts), but have you remembered to connect its "inverting" input to the output to make it a unity gain follower? Also you may need to add some decoupling or filter capacitors.

Cheers, Alan.
 
Last edited:

Goeytex

Senior Member
The LM3914 has a unity gain buffer (OPAMP) in its 0-5V signal front end. I am slightly surprised that the DAC Output is insufficient to drive this as it only requires about 100 nanoamps .

If this is indeed the case then a rail to rail OPAMP can be used between the PICAXE and the LM3914.

Attached is a diagram for reference. I show an Analog Devices AD8565 but there are others just as well-suited. If you are using an LM324 then make sure it is connected like the AD8565 in the diagram.

24443
 

zebedeus

New Member
thanks Goeytex,
your drawing is exact what i tried but unfortunaly no results. Leaving your 22k resistor away gives the same result. I even tried a 22k resistor for coupling between de output and the non-inverting input. In theory i should get an amplifyng factor of 2 (1+(22k : 22k)) which would be OK but that was not the solution. The problem is that the output of the LM324 which is used as a gainfollower alwysays gives an output of 3,7 Volt regardles the input voltage. I have tried the other ports in the chip with the same result, other chips i tried, i used separate power supplies for the LM32 and the PICAXE, i tried a 9 Volts power for the LM324 and 5V for the PICAXE but still disapointing results.
In between with experimenting i discovered that when i made on a n experientboard that the LM324 doesn't function correct as ain follower when i use it separatly. Instead of the DAC signal i use a potentiometer which i connect to the same power as the LM324 and connect the midcontact from the potentiometer to the non-inverting port of the LM324. Surprise, surprise, same resuts as with the PICAXE so probably my theory about connecting the DAC to an gainfollower is somewhere wrong. I starts to become an obsession ;-))

In detail, i am using it as an RPM counter for a diesel engine. In telegram style; count the pulses from the generator 'W'-signal; make a calcuation and put the result on the DAC-output. So an PWM output is not usable in this situation. Drawings with a SAK ?12 chip i build is OK for an analog gage but i designed a LEDscale from 32 LEDs to indicate the RPM value.
 

Goeytex

Senior Member
thanks Goeytex,
The problem is that the output of the LM324 which is used as a gainfollower alwysays gives an output of 3,7 Volt regardles the input voltage. I have tried the other ports in the chip with the same result, other chips i tried, i used separate power supplies for the LM32 and the PICAXE, i tried a 9 Volts power for the LM324 and 5V for the PICAXE but still disapointing results.
That would likely indicate one of the following:

1. Incorrect connections to LM324
2. Missing / poor grounding All grounds must be connected together
3. A failed LM324

Attached is a cartoon diagram that shows correct connections to the LM324 including the the pin numbers.

Suggest you try this exact circuit to verify correct LM324 operation.
 

Attachments

AllyCat

Senior Member
Hi,
using it as an RPM counter for a diesel engine .... count the pulses from the generator .... and put the result on the DAC-output. So an PWM output is not usable in this situation.
Why not? A PWM output followed by a simple Low-Pass R-C filter IS a DAC (and with a much higher performance capability than the PICaxe "ADC" output). The only limitation is the speed of response, which cannot be an issue with the counting of pulses from a diesel engine, etc., scenario that you have described.

Cheers, Alan.
 

AllyCat

Senior Member
Hi,

Indeed, it should be "easy" , but it still can be more difficult to get an Op-Amp working correctly, compared with a simple R-C filter. ;)

And just to show that I'm not the first to use a single PWM output pin as a DAC to drive a LED analogue display:

https://picaxeforum.co.uk/threads/1-digital-voltmeter-becomes-one-pin-led-display.27594/.

https://picaxeforum.co.uk/threads/reading-byte-with-digital-voltmeter.27872/

https://picaxeforum.co.uk/threads/using-pwm-as-a-stabilised-dac-even-with-an-unregulated-power-supply.28079/

Cheers, Alan.
 

Goeytex

Senior Member
These observations should be meaningful

1. The LM324 when configured as a voltage follower constantly outputs 3.7V regardless of the value of the input voltage
2. The PIC DAC output will not drive the High Impedance input of the LM3914.

I suspect a grounding problem as far as the DAC and LM324 are concerned.
Are the 5V ground, ... PICAXE ground ... LM324 ground and LM3914 ground all tied together?

The LM324 should be simple to get working as long as the connections are correct.
 

neiltechspec

Senior Member
Re: The above Statement

"2. The PIC DAC output will not drive the High Impedance input of the LM3914."

Oh yes it will.

Searching through my LED & optical drivers, I found a re-claimed LM3914 and reclaimed Bar LED with 10 leds.
Quick assemble & driving of an 08M2 using the LM3914 ref voltage (nominal 1.25V) as the +Ve ref for 08m2 DAC.

Works fine ramping up & down in a slow loop. Checked with scope & LM3914 has no noticable affect on DAC O/P.

Neil.
 

Goeytex

Senior Member
@Neil

I think you may have misunderstood observation 2. Maybe not.

But to clarify: This was an observation by the OP, not a statement of fact.

The OP reports that the PIC DAC will not drive the High Impedance Output of the LM3914 when we know that it should.

The OP also reported that the LM324 always outputs 3.7 volts regardless of the input voltage when we know that the output voltage should change relative to the input voltage.

These two observations/claims by the OP lead me to believe that there is a grounding or connection issue.

On another note: If these basic issues cannot be sorted out then I think there is little chance of getting a low pass filtered PWM to work (assuming the OP can be convinced that it might be a better method).
 
Last edited:

neiltechspec

Senior Member
It's amazing how some of us forget how useful some of these analogue chips can be.
What a nice & flexible chip the LM3914 is.

I'm sure I will find uses for it having played with it a bit & read through the datasheet.

Neil.
 

tmfkam

Senior Member
The LM3914 makes an excellent and highly sensitive (though non-PicAxe) bat detector. An ultrasonic transducer amplified a few hundred times or so fed into the 3914 gives a good indication of when bats are flying nearby. In fact, I ought to get a PCB drawn for mine...
 

zebedeus

New Member
View attachment 24445
Above, the circuit diagram recommanded by Microchip for the PIC16(L)F1826 on which the 18M2+ is based on. Microchip datasheet
Seems this guy succeed in connecting a PIC (16F88 - although slightly different) directly to a LM3914 : https://pic-in-pascal.blogspot.com/2017/06/led-bar-graph-one-line.html

I looked at the URL above mentioned and that worked indeed at least with one 3914. I have to see what happens when i use three 3914's in cascade.
Otherwise i found that a LK331 is a replacement for the SAK?12 i mentioned before. This chip has easy adjustments with components and its output is adjustable as well. So that could be a good "plan B" as well.

for all of you who replied thanks for all the ideas. It give my a lot of possibilitys hopefully until the end of the Corona-crisis. Stay well and healthy !!
 
Top