Signal generator full rail Mega 8

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Folks!

I need a cheap signal generator, and, if I am not mistaken, the ATMEGA8 based projects(here) always use only positive rail, with that resistor thing (many resistors)...

My doubts are:
1 - If I buy stand-alone resistors, can I build them to do the same effect of that component(that is not available in my region)?

2 - Is there a way to build that kind of project with full rail-to-rail signal(-5; 0 ;+5)? Any OPAMP, maybe?

Thank You guys!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The resistor thing you are probably talking about is an R2R ladder, and yes you can build one from discreet resistors. Use the most accurate resistors you can get.

Yes an op-amp is the way to remove the DC offset of your 0-5 signal, and amplify it to +/-5V. Note that if you truly want/need full rail to rail, the rails of the op-amp will need to be slightly beyond +/-5V.

You likely want an op-amp on the output anyway, even if you didn't want to make it rail-to-rail. This is so that you can isolate the load from the R2R. The R2R will have fairly weak drive strength, and can be greatly affected by a heavy load.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"That resistor thing" that you refer is probably an "R-2R DAC". It will go rail to rail.

For an 8 bit DAC, you will want 1% tolerance resistors. And half of the resistors reall DO need to be 2.000 * (the other half). I use 10.0K and 20.0K when the load will tolerate it. If you try to use much smaller resistors (say 1.00K and 2.00K, you will need to take the port pin source resistance into account because it is around 80 ohms, more or less, depending on the power supply voltage.

You will need some kind of output buffer or driver if the load resistance is not pretty high (at least 10R, even higher is better). Problem is that no op-amp can go absolutely TO the rails. The so-called "rail-to-rail" amps only get to within, say, 50mV to 100mV, depending on the amplifier and the load. If you need a signal that goes absolutely to 0V and absolutely to 5V, then you need to power the op-amp from a power source that is, say, +/-7V or better.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, it is that, a ladder!

What kind of information I must look for on Google?
"how to remove dc offset"?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim, I agree that the R2R is rail to rail. But the OP is referring as rail to rail being -5 to +5.

Jaguar: Rail to rail simply means that the output runs from one supply rail to the other. For the AVR that will be between GND and VCC.

There are many ways to remove DC offset. The most common, and simplest is to place a DC blocking capacitor on the output.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just because no one else has mentioned it yet - Jesper's MiniDDS:

http://www.myplace.nu/avr/minidd...

(Not that it solves the "offset" thing - just a useful demonstration of an R-2R)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Jaguar: Rail to rail simply means that the output runs from one supply rail to the other. For the AVR that will be between GND and VCC.

Wow....that's new to me...I tought that rail to rail did always means -v to +v....I see I was mistaken about that, hehe..
But, I don't know.....just a capacitor would solve my problem? I want to get an ATMEGA8 signal generator, and make it go to , let's say, -5V to +5V.(square, sin, etc....)

Jim: Well, I don't need absolute rails, but I DO need -V and +V... You once helped me a lot with my PC Oscilloscope(which is on the run too), by using an OPAMP to INCREASE DC offset....

Now what I need, is kinda the opposite of that! I would have an 0 to vcc, and I want a -vcc to +vcc.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, you have a bit of a challenge, or several of them.

FIrst is peak-peak amplitude. Out of an R-2R DAC driven by 0V & 5V logic, your largest possible peak-peak amplitude is 5V. So, if you shift that to +V/-V and do nothing else, your biggest peak-peak is 2.5V. If you need more, you will have to amplify. This is a pretty common situation since DAC outputs are rarely the same as what YOU need.

The second is DC level. If your signal is always symmetrical (sine, triangle, square with 50% duty cycle, etc), the DC "level" is half way between the + peak and the - peak. BUT, if your signal is not symmetrical (square wave other than 50% duty cycle, for example), then the apparent DC level will shift with duty cycle. IF you shift with a capacitor, then your DC level would shift every time the duty cycle is changed. IF this is what you want to do, or possibly MIGHT want to do in the future, then you should DC couple with the same kind of offset used in your oscilloscope front end.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1 - To amplify this signal, I would need an OPAMP powered with +vcc ,GND and -vcc, right(let's say, 12V)? Seems that this solution fits to me....

2 - Well, I think the signal would be always symmetrical(50%)...Honestly, I did not have think about changing duty....I expect to change only the frequency, and the wave form (square, sin and saw are good to my needs).

Having all this in mind, I think the only thing I need then, is the original Signal generator HW (ATMEGA8) and an OPAMP offseting and amplifying the signal?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just a thought,

AD9833

A great sine wave generator form Analog Devices.

A

PS. No, I am not a rep.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Too good to be thruth....
AD9833 is not available in my region, and his package is too small to handle with my tools....

But it would be quite usefull!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
AD9833 is not available in my region, and his package is too small to handle with my tools....

The AD9833 was my first surface mounted project. I hand soldered it, and managed. I sure waited a lot time to finally lay out the board and give it a try... Stalling.

Even with that chip, however, you still need to remove the DC offset, and scale the amplitude, if needed.

JC