Electrical impedance of Dout port

Hi,
I have a question about the digital out port of Arduino duemilanove board.
What is the electrical impedance of the port?
Thanks in advance.

Giorgio

The Atmel mega328p datasheet doesn't list or state an output pin impedance value in it's specification tables. They do however show graphs of pin output voltage Vs pin current draw for both current sinking (output low) and current sourcing (output high) both for 3vdc and 5vdc Vcc conditions and at several device operating tempertures, and the results appear linear. Not sure if those curves gives one the information to calculate a single 'output impedance value' or not.

One classic way I was shown to measure output impedance for a voltage source was to measure it's unloaded voltage and then load the output with an adjustable resistance and lower the resistance until the output voltage reaches 50% of the unloaded voltage, where then the load resistance equals the output impedance of the voltage source. However performing that test measurement would cause a greater current flow then the absolute maximum output pin current specification of 40ma. So in effect that might be a destructive test procedure to try and perform.

Maybe someone else can answer your question in a more straight forward manner?

Lefty

Hi,
Lefty is right that this is not a typical "Spec item" for a digital output.

What are you trying to accomplish? What type of load / cable are you considering?

You can find the datasheet here: http://yourduino.com/docs/ATMEGA328DataSheet.pdf maybe easier than other places. It's BIG and 555 pages...

It is not a constant value it changes with load.

This link is not for the arduino but the Raspberry Pi which has configurable drive impedances, you can use the same sort of measurements I used on this page two work out the impedance at any voltage level. That is your curve might not be linear.
http://www.thebox.myzen.co.uk/Raspberry/Understanding_Outputs.html

However from this experiment I did with the arduino you can see that it is less than 20R.
http://www.thebox.myzen.co.uk/Tutorial/LEDs.html

Hi,
thanks for the reply.
I try to use my arduino duemilanove board as signal generator.
I designed a very simple DAC R2R network.

image

But if I connect the digital output of the port to my scope, I read a big oversoot.
Maybe there is a problem of Impedance matching and a square wave with overshoots is useless. :roll_eyes: :~

Any idea or suggestion?

Thanks in advance.

Giorgio.

If I know the impedence of the port, maybe I can design a matching network.

Maybe there is a problem of Impedance matching and a square wave

No.
You only get over shoot with inductances. It is probbly not real, just an artefact of the scope.

Do you mean overshoot or lack of monoticity? That is not a circuit of a R 2R ladder that I recognise, are you sure it is right?

Thinking more about it that is NOT a R 2R ladder circuit.

Hi, Grumpy_Mike

You only get over shoot with inductances. It is probbly not real, just an artefact of the scope.

Yes, I am thinking the same...
this is the (tragic) situation:

So, is real or "ghost"? :roll_eyes:
Maybe I need to change the sampling frequency ... :cold_sweat:

Thinking more about it that is NOT a R 2R ladder circuit.

Isn't a R2R, but the concept is pretty close.
Actually the circuit is designed as function generator, but it's complicate (and boring) to explain all the details.
But, I'm sure that the digital signal IS the problem.

Thanks.

If the overshoot is causing a problem you are going to have another problem (even without the overshoot)... If the overshoot is short (compared to the clock/sampling rate), you might be able to filter-out the "glitches" at the DAC output.

When your data lines change states, there is a short period of time during the transition where everything is undefined. So, __there is usually a clock line along with the data lines. The data get's written-out, and after the data is stable, a rising or falling clock edge latches the stable data (or the clock edge triggers a read, etc.). With this scheme, overshoot or ringing don't cause problems as long as the lines are stable when the clock-edge comes along. __
There is still a point (actually a period of time) inside the DAC when things are switching, and I don't know how a DAC handles that internally. But somehow, it has to hold the current output state 'till the new data is stable and the next state is known.

you might be able to filter-out the "glitches" at the DAC output.

No because, at the output i need a signal like this.

Thanks.

What is the electrical impedance of the port?

50ohm is a good number to use.

Before you proceed, think about your design:

  1. your circuit will not work, as is. It is not a r2r network and the switches are wrong. A typical r2r network can be implemented much easily, without using the switches.
  2. If you really want to use your existing topology, think about a high-side switch.
  3. you will run into issues with atomicity if those pins are not on the same port and you don't use port operations.

Unless you have a specific reason to use your design, there are far better ways to implement a dac.

the switches are wrong.

Could you be more specific?

Thanks.

Don't worry about dhenry he has some what of a reputation on this forum.
You have already said that this is not a R 2R ladder but I guess he did not read that. The switches are wrong if you had a ladder.

What you do have looks to me like a weighted resistor D/A going into a mixer with the values of the resistor all screwed up. So there will be no monoticity.

However I do think that those spikes are not real and are caused by the probe / scope. You haven't said where you are measuring this signal. However, this is not your problem.

Your problem is that you are expecting something out of this circuit that you are not getting. However as you have not explained this it is hard to offer any real help. Impedance matching is barking up the wrong tree.

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.

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.

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.

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.

Hi, Grumpy Mike, may I contact you in PM ?

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.

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.

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.
I am sure about this.

Thanks.

Giorgio.