Go Down

Topic: Question about the MCP4922 library (Read 150 times) previous topic - next topic

LMagalhaes

Hi there,

I'm using a MCP4922 DAC on my project and I'm using it to control the output voltage of a DC voltage regulator. Now I wanted to do some triangular signals, but the minimum output voltage of the voltage regulator is making me have a gap between 0.9V and -0.9V.

My first idea was to use the second, unused DAC channel and have two pairs of MOSFETS (P and N) to control the output and have the triangular waveform, but that isn't working either due to the Vgsth of the P MOSFETS, which below 0.4V don't work anymore.

My new idea is to have two MCP4922 or a MCP4921 + MCP4922 combo on the board directly connected to the output to have the triangular waveform. But I'm not sure if I'm able to declare two instances of the class in my project. Has anyone tried to do this and know for sure that it's possible?

Thanks

Grumpy_Mike

Quote
but the minimum output voltage of the voltage regulator is making me have a gap between 0.9V and -0.9V.
What does that mean? It does not seem to make sense. What voltage regulators are these?

Anyway:-
Forget any complex systems of using two D/A converters, that is just silly. Just use one and have the zero voltage at the mid point, that is what everyone else in the world does. If you want it symmetrical around zero volts simply AC couple the D/A's output to what ever you want to drive.

Quote
But I'm not sure if I'm able to declare two instances of the class in my project.
The thought of having a libiary to drive such a simple chip is a symptom of the malaise of hobby electronics at the moment. But yes you can always have more than one instances of any class, that is what classes are all about.

LMagalhaes

The voltage regulator output voltage is being changed by the output of the DAC. I'm using a MCP1825 voltage regulator with the two basic resistors for gain setting and a third resister connected to the mid point of that resistor divider and connected to the DAC output. This allows the system to change the output voltage with a 1mV accuracy.

The problem is, the voltage regulator can't drop below 0.9V. So, if you want a triangular signal going from +4V to -4V it will go down to the 0.9V mark and won't go down. The negative part of the triangular output is handled by the mosfets. Effectively, you have a gap between 0.9V and 0V and again to -0.9V. You go from steady 1mV steps to 0.9V steps when the voltage regulator goes to that limit.

Even when using just the DAC to generate the triangular signal, the MCP4922 doesn't have negative values. Hence, there's a need to have the two pairs of mosfets to choose either positive or negative voltage (just by sticking the signal in either the red or black output). But, using mosfets also comes with a downside, since the Vgsth of the P mosfet is a minimum of 0.4V, which means the output can't drop below 0.4V again ...

I didn't really understand your point of having the A/C couple.

The idea of having the second class would be to drive the second DAC, I'm just not sure if the library is done correctly, in the way that it would work with multiple class definitions. That's why I need to be sure before purchasing equipment.

Grumpy_Mike

#3
May 28, 2016, 06:30 am Last Edit: May 28, 2016, 06:31 am by Grumpy_Mike
I think you are going about this incorrectly. The limitations of your voltage regulator is the problem. Ditch that and use an op amp and level shift the output of the D/A to the zero volts line. Then simply beef up the output of the op amp with a transistor. The feedback loop. What sort of current output do you need.

A schematic would make thing a lot more clear than words ever can.

LMagalhaes

#4
May 30, 2016, 12:06 pm Last Edit: May 30, 2016, 01:23 pm by LMagalhaes
What I'm trying to build is a precision power supply, able to deliver at most 500mA. This precision power supply must have jumps of 100mV (0.9, 1, 1.1 and so on). This particular schematic achieves that goal, but it has those weak points that I've mentioned earlier.

Here are the schematics :





I've ommited the connectors and outputs as to not add unimportant stuff.

There's an easy way to do this, I'm sure, and this isn't ideal but has worked so far, but now with the addition of a triangular wave output it isn't up to par anymore.

Thanks for your time,

Luís

EDIT: Images weren't working.

Grumpy_Mike

Quote
Here are the schematics :
Sorry but that is the worst kind of schematic, normally only drawn by companies who are obliged to produce one but who want to make it difficult to follow. All that is, is a collection of individual chips, there is no interconnection shown.
One thing I did spot is that you are connecting the unused output of one of the op amps directly to ground which is not a good idea. Those op amps should be drawn using the op amp symbols, showing it as a general chip does not aid understanding.

Quote
What I'm trying to build is a precision power supply, able to deliver at most 500mA.
OK got that, but why do you have an A/D in the circuit?
Is this supply supposed to generate a -ve voltage as well as a positive one?

Quote
The negative part of the triangular output is handled by the mosfets.
I can't see any mosfets in that collection of chip wiring.

LMagalhaes

Regarding the second opamp, I have both output and inputs connected to GND so it doesn't oscillate since I don't have a use for them. For the schematics, well I learned that while studying in college so I always draw them like that, but I would appreciate feedback.

Yes, the power supply is suppost to generate negative output voltages as well. The part that controls that is here:



Might as well show you the outputs:



The A/D is in the circuit to measure the output voltage of the voltage regulator and give some feedback to the microcontroller. The idea was to give to the microcontroller a float like "1.5" and have it adjust the DAC output until the regulator got there. Since the circuit with the opamp has some error, I just measured the DAC output codes that would give me the desired output voltages of the regulator and use those values. When the system is under load, the ADC is used to compensate the voltage loss on the output of the regulator.

Grumpy_Mike

Quote
For the schematics, well I learned that while studying in college so I always draw them like that,
Just because some idiot taught you to draw like that doesn't mean it is any good. Sorry but I don't do jigsaw puzzles I do electronics.

Quote
I have both output and inputs connected to GND so it doesn't oscillate since I don't have a use for them.
Yes but connecting the output to ground is only going to burn out your op-amp. Did the same idiot that taught you to draw a schematic teach you that? The way to deal with an unused op-amp is to connect the -ve input to the output and connect the +ve input to signal ground.

I don't think I am getting anywhere with you. You are failing to cooperate so I will leave this thread alone and leave it up to others to continue.

Good luck.

LMagalhaes

I'm sorry that you feel that way. I've given every information that I got and I've been trying to learn all the way through this process. I was just trying to figure out how I could "beef" up the output of the DAC in terms of current, that's all. Basically, all I want is to be able to choose a voltage level between -4.5 and 4.5, with 100mV precision and be able to source 100mA of current.

Thanks for your help.

Luís

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy