Go Down

### Topic: Electrical impedance of Dout port (Read 6608 times)previous topic - next topic

#### dhenry

#15
##### Nov 29, 2012, 01:26 pm
Quote
Could you be more specific?

It is actually very simple:

When the gate is 0, the opamp is in negative feedback and outputs a 3v so its inverting input sits at 3v.

When the gate goes to 6v, there are two cases:

1) if the mosfet's Vgs(th) is sufficiently low (let's say 1v) for the mosfet to conduct, the inverting inputs will be at 6v (mcu's otuput) - Vgs = 5v. With the opamp's non-inverting input at 3v, the amp goes to 0v to try to bring down the voltage differential - it can never do that. or

2) if the mosfet's Vgs(th) is sufficiently high (let's say 4v) so the mosfet cannot be opened, the inverting input continues to sit at 3v, and the opamp outputs a 3v.

The analysis has nothing to do with the resistors in the drain, as you have noticed.

You could have easily reconfigured the circuit into a r2r and you wouldn't need to use those mosfets.

If you do want to use the existing topology, put a pnp mosfet there, between the resistors and 6v to switch the resistors into / out of the network.

Another alternative is to use a switched divider network.

Also, when you pick the mosfet, pick one with small capacitance (TO90 or IRF510) to avoid ringing on the rising edge.

#### dhenry

#16
##### Nov 29, 2012, 02:16 pm
Another alternative you can try is a summing amplifier (both inverting or non-inverting).

What you should realize is that the mcu pins can be viewed as switches: they switch in (Vcc or GND) or they switch out (high impedance).

That will make it easier for you to think through the various issues.

#### Papa G

#17
##### Nov 29, 2012, 04:01 pm
Maybe you can be a little more specific about what you are trying to accomplish. You mentioned a function generator. From one of the 'scope traces it appears you are trying to synthesize a low resolution sine wave. Is that true? I don't see how your circuit, as you have drawn it, will produce that output.

If you are trying to build a DAC with some sort of custom weighting I imagine you will have an easier task if you use an off the shelf DAC with more bits resolution. DACs are pretty cheap and I would be surprised if you can make your own for less, not to mention the space a discrete one will take up.

No matter how complicated and boring you think your application may be, you will get better help if you are not so mysterious.

#### dr.benway

#18
##### Nov 29, 2012, 04:02 pm
Hi, Grumpy Mike, may I contact you in PM ?

Quote
You haven't said where you are measuring this signal.

The measure is between the digital port of arduino and the ground.

I need a square wave, almost 50% , about 10 kHz of frequency.

I read a square wave with spikes, as show in the pictures.

Quote
I would not use a 9V battery like that as it will very soon drain, you will get no more than a few hours from it.

But  a 9V battery is the safest way to prevent ground loops.
I power up Arduino, just a moment, to take the measure.
Anyway, the battery in  brand new.

#### dr.benway

#19
##### Nov 29, 2012, 04:11 pm
Quote
If you are trying to build a DAC with some sort of custom weighting

Yes, that's correct.

This a project about an alternative design of a "DAC ".
The circuit is incomplete and the weighted resistors value is WRONG (I need to calculate the right value yet ).

I posted the schematic, only to explain the kind of topology of the net.

Anyway, the problem is the signal for arduino, or maybe the probe of the scope.

Thanks.

Giorgio.

#### Papa G

#20
##### Nov 29, 2012, 04:18 pm

Quote
If you are trying to build a DAC with some sort of custom weighting

Yes, that's correct.

This a project about an alternative design of a "DAC ".
The circuit is incomplete and the weighted resistors value is WRONG (I need to calculate the right value yet ).

I posted the schematic, only to explain the kind of topology of the net.

Anyway, the problem is the signal for arduino, or maybe the probe of the scope.

Thanks.

Giorgio.

When you mention the "problem", are you saying that you already have an end result that shows the effects of the overshoot of the square wave or that you are just predicting that the overshoot will affect your end result?

#### dr.benway

#21
##### Nov 29, 2012, 04:49 pm
[
Quote
When you mention the "problem", are you saying that you already have an end result that shows the effects of the overshoot of the square wave or that you are just predicting that the overshoot will affect your end result?

Yes.
I want to generate a squared "sinusoidal" wave summing 4 weighted digital signals.
But,
every signal have  overshoots so the results is a "dirty" sinusoid.
This is my problem, not a prediction.
My priority is to eliminate the overshoots from Arduino.
Maybe there is something wrong in my probe.

Thanks.

#### Papa G

#22
##### Nov 29, 2012, 05:04 pm
Code: [Select]
`Maybe there is something wrong in my probe.`

May I make a suggestion? Instead of toiling with the circuit you have, use an off the shelf DAC with enough bits of resolution to get the result you expect from your discrete circuit. You are less likely to get the sort of overshoot you are seeing that way. If it is really important that your final product use the weighted resistor approach you are trying now, you can attack that problem again.

#### dhenry

#23
##### Nov 29, 2012, 05:18 pm
Your solution doesn't have to be this complicated.

Take 5 resistors: tie your four output pins together through 4 reistors, R0..3, and from there tie them to ground through Rg. Buffer the output from where the resistors meet, with a jfet or an opamp.

The output voltage is = (V0/R0 + V1 / R1 + V2 / R2 + V3 / R3) / (1 / R0 + 1/R1 + 1 / R2 + 1 / R3 + 1 / Rg). V0..3 is either 0 or 5v, representing the output from your mcu.

All you need is to find the values of R0..R3 (in terms of Rg) to best approximate 16 points on a sine curve over 360 degrees (actually just over 90 degrees but that requires fancier software / hardware).

#### dr.benway

#24
##### Nov 29, 2012, 11:00 pm
Quote
Take 5 resistors: tie your four output pins together through 4 reistors, R0..3, and from there tie them to ground through Rg. Buffer the output from where the resistors meet, with a jfet or an opamp.

The output voltage is = (V0/R0 + V1 / R1 + V2 / R2 + V3 / R3) / (1 / R0 + 1/R1 + 1 / R2 + 1 / R3 + 1 / Rg). V0..3 is either 0 or 5v, representing the output from your mcu.

Yes, I am sure of this, but this kind of design is useless for my application.

I need a design as this:

My problem is about the implementation of the switch.
The c-mos are working in this case, but maybe there are better design available... i need to study this part yet.

But my topic now are the spikes from arduino.
I only need to put the right capacitor at the right place ...

#### dhenry

#25
##### Nov 29, 2012, 11:06 pm
Quote
I only need to put the right capacitor at the right place

Only if it were that simple. Two causes for those spikes:

1) gate capacitance: as long as you have mosfets, you have gate capacitance, especially when they are undampened;
2) non-atomic operation on the output pins.

Essentially, you took the more difficult route when easier ones are available.

#### dr.benway

#26
##### Nov 29, 2012, 11:21 pm
Quote
1) gate capacitance: as long as you have mosfets, you have gate capacitance, especially when they are undampened

Yes, I will put a dump resistor between the gate and the ground, to protect the mos.

If i connect directly the probe to arduino i have this behaviuor:

A probe grounded with a spring have  a better result:

So the problem IS the probe.

I the weekned i will post some results ...

#### retrolefty

#27
##### Nov 29, 2012, 11:37 pm
Quote
Yes, I will put a dump resistor between the gate and the ground, to protect the mos.

A 'damping' resistor if required, needs to be in series with the gate from the driving source, not wired to ground. 220-330 ohms seems to be a popular size to use.

Lefty

#### LROBBINS

#28
##### Nov 30, 2012, 03:30 pm
My approach to this comes from a naive amateur's perspective.  Whenever I want to do a "select i of n" operation, or a multiplexing operation, I fall back on the old tried-and-true 4066 D/A switch.  In a 14-pin DIP, or even smaller SMD package, one gets 4 gates with low power drain, very high input impedance, good isolation and bi-directional output (with some limitations on the last - see data sheet).  No matter how noisy my input, I've always gotten clean output.  In an electrically noisy, DC-motor and long cables, environment, even with 100k, or even more, pull-ups noise has never been a problem, and simple RC timing of inputs yields nice on or off delays.  Combining 4066 gates with diode-diode logic and or with each other one can get a lot of flexibiity for implementing just about any logical switching function.
Ciao,
Lenny

#### Grumpy_Mike

#29
##### Nov 30, 2012, 11:45 pm
Quote
I fall back on the old tried-and-true 4066 D/A switch.

You used one of these at 2MHz as the OP wants, or even at 200KHz? They are as leaky as a sieve. I tried several to multiplex a 125KHz RFID signal recently and they were total rubbish. The signals from some unselected channels were just as big as the signal from the selected one.

Go Up

Please enter a valid email to subscribe