electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software
R/2R - Me Heartys - Yo Ho Ho
Post new topic   Reply to topic Moderators: jksuperstar, Scott Stites, Uncle Krunkus
Page 1 of 3 [75 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: 1, 2, 3 Next
Author Message
Uncle Krunkus
Moderator


Joined: Jul 11, 2005
Posts: 4761
Location: Sydney, Australia
Audio files: 52
G2 patch files: 1

PostPosted: Mon Jun 18, 2007 3:43 am    Post subject: R/2R - Me Heartys - Yo Ho Ho Reply with quote  Mark this post and the followings unread

Unlike 2 days ago, I now understand what an R/2R network is, how to build one, and how to implement it, but I'm wondering does anyone know of a place I could find a description of how it works? I'd like to understand it properly.
_________________
What makes a space ours, is what we put there, and what we do there.
Back to top
View user's profile Send private message Visit poster's website
crazeydazey



Joined: Feb 15, 2007
Posts: 303
Location: England
Audio files: 4

PostPosted: Mon Jun 18, 2007 4:14 am    Post subject: Reply with quote  Mark this post and the followings unread

bit of a description.. not a great one though..

http://www.allaboutcircuits.com/vol_4/chpt_13/3.html
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Mon Jun 18, 2007 4:40 am    Post subject: Reply with quote  Mark this post and the followings unread

http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/dac.html has a good explanation, it even links to http://hyperphysics.phy-astr.gsu.edu/hbase/electric/thevenin.html and it's dual http://hyperphysics.phy-astr.gsu.edu/hbase/electric/norton.html which together with http://hyperphysics.phy-astr.gsu.edu/hbase/electric/ohmlaw.html form the basic tools for DC circuit analysis.

Edit : had some links messed up, fixed it.
Edit : and again Very Happy

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Mon Jun 18, 2007 4:47 am    Post subject: Reply with quote  Mark this post and the followings unread

http://hyperphysics.phy-astr.gsu.edu/hbase/emcon.html#emcon has all electro/magnetism stuff. Great site !
_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
crazeydazey



Joined: Feb 15, 2007
Posts: 303
Location: England
Audio files: 4

PostPosted: Mon Jun 18, 2007 5:11 am    Post subject: Reply with quote  Mark this post and the followings unread

Blue Hell wrote:
Edit : had some links messed up, fixed it.


yeah it did that to me too..
Back to top
View user's profile Send private message
Uncle Krunkus
Moderator


Joined: Jul 11, 2005
Posts: 4761
Location: Sydney, Australia
Audio files: 52
G2 patch files: 1

PostPosted: Mon Jun 18, 2007 5:32 am    Post subject: Reply with quote  Mark this post and the followings unread

Okay,... Shocked

I get the feeling I'm going to implement this long before I fully understand it.

Thevanin Shmevanin! I reckon he was a trickster who specialised in making complicated voltage, ohm & current calculations (which is what I wanted) disappear in a flash of smoke and mirrors simplification! Razz

_________________
What makes a space ours, is what we put there, and what we do there.
Back to top
View user's profile Send private message Visit poster's website
Uncle Krunkus
Moderator


Joined: Jul 11, 2005
Posts: 4761
Location: Sydney, Australia
Audio files: 52
G2 patch files: 1

PostPosted: Mon Jun 18, 2007 5:41 am    Post subject: Reply with quote  Mark this post and the followings unread

My next most pressing question is,
How do I implement this "virtual earth" in my connections to the data source, if I'm doing a "roll your own" style DAC?
I could switch a reference voltage with the data by using a CD4066, but does an open switch in a 4066 act as an earth?
Could I simply connect the diode based OR gates which are the outputs from my data? Can we "see" the virtual earth of an AND gate through a reverse biased diode?
Or do I take these diode gates into a simple buffer? Surely a logic 0 on the output of a buffer acts as a "virtual earth".
Does Thevanin theory negate all these fears?
Does it make them real?
Damn you Thevanin!! Laughing

_________________
What makes a space ours, is what we put there, and what we do there.
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Mon Jun 18, 2007 5:47 am    Post subject: Reply with quote  Mark this post and the followings unread

Virtual ground .. no wonder you feel a bit dizzy Laughing

What DAC construction did you have in mind exactly?

It's Thevenin BTW

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Uncle Krunkus
Moderator


Joined: Jul 11, 2005
Posts: 4761
Location: Sydney, Australia
Audio files: 52
G2 patch files: 1

PostPosted: Mon Jun 18, 2007 6:00 am    Post subject: Reply with quote  Mark this post and the followings unread

It's a simple/complex experiment I was working on a while ago, which didn't do what I thought it would. I've since refined what I would like it to do and decided to resurect it.
I was basically trying to come up with a hand rolled DAC off the top of my head. I now see the error of my ways, (though this circuit does output an exponential style of DAC)
So this part is basically just a hand rolled 4bit DAC. Or it will be when it's fixed.
The interesting thing is what drives the data lines. I've got 8 4bit up and up/down counters being sequentially strobed to these data lines, and being incremented at various speeds. It will hopefully result in a constantly morphing wavetable style sub-oscillator/harmonic generator.


HMDAC.gif
 Description:
 Filesize:  15.04 KB
 Viewed:  19475 Time(s)

HMDAC.gif



_________________
What makes a space ours, is what we put there, and what we do there.
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Mon Jun 18, 2007 6:10 am    Post subject: Reply with quote  Mark this post and the followings unread

In that case an open switch acts as "nothing", ideally, and it would be reasonably ideal with those resistor values.

But I guess you want to modify this for an R2R ladder? In that case the signals going into the ladder should be hard switched between ground and Vcc. So it would be impossible to directly use a diode OR or AND function - there should be buffers in between.

Edit: and the CMOS switches are not needed then.

Did I get the question right?

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Uncle Krunkus
Moderator


Joined: Jul 11, 2005
Posts: 4761
Location: Sydney, Australia
Audio files: 52
G2 patch files: 1

PostPosted: Mon Jun 18, 2007 6:14 am    Post subject: Reply with quote  Mark this post and the followings unread

You can't get a linear output by shorting resistors in series like this. I've been trying heaps of ways, it' just mathematically impossible.
Yes, I'm gonna take the diode gates through a buffer and into an R/2R network. It'll be nice new ground to plow!

_________________
What makes a space ours, is what we put there, and what we do there.
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Mon Jun 18, 2007 6:17 am    Post subject: Reply with quote  Mark this post and the followings unread

Uncle Krunkus wrote:
t'll be nice new ground to plow!


Hear hear, and nothing virtual about it, your hands really will get dirty Very Happy

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
bearblock



Joined: Sep 27, 2006
Posts: 90
Location: uk
Audio files: 1

PostPosted: Mon Jun 18, 2007 12:56 pm    Post subject: Reply with quote  Mark this post and the followings unread

i wonder if you could cobble together a 4-bit ADC in a similar way? then add a rotary encoder to scramble the data lines, so you'd have a bunch of 'wild' wavetables to drive with a saw VCO (or whatever)...
Back to top
View user's profile Send private message Visit poster's website
Uncle Krunkus
Moderator


Joined: Jul 11, 2005
Posts: 4761
Location: Sydney, Australia
Audio files: 52
G2 patch files: 1

PostPosted: Mon Jun 18, 2007 4:08 pm    Post subject: Reply with quote  Mark this post and the followings unread

The "problem" is that at these kind of frequencies (160-160000Hz) with only a 4bit word, scrambling the data lines tends to create a lot of extra clicking and noise. It's kind of difficult to explain the effect I'm after until the circuit is fixed and I can post some pics/samples, but the main reason I want to fix up the DAC part is so I can get smooth ramps controlling the individual time slices.
I do see what you're getting at, and have been thinking about some interesting bit-wise operators which could be dialled up for each time slice. If these operators create sudden jumps in the timbre, I've then thought about the ability to use an external trigger to clock the counters, thereby making the shifts in timbre synced to the tempo/drums/sequencer steps etc.
But the original idea, and the thing I want to master first, is a sub oscillator who's harmonics are slowly, smoothly and yet unpredictably shifting in amplitude, number and phase relationship.

_________________
What makes a space ours, is what we put there, and what we do there.
Back to top
View user's profile Send private message Visit poster's website
toppobrillo



Joined: Dec 10, 2005
Posts: 766
Location: oakland, ca
G2 patch files: 1

PostPosted: Mon Jun 18, 2007 5:33 pm    Post subject: Reply with quote  Mark this post and the followings unread

it's not linear because your resistor values are exponentially related. Very Happy

you should take a look at something like this-

http://www.cyndustries.com/synapse/synapse.cfm?pc=43&folder=march1977&pic=33

you've got the resistor values already- 5-40k right? thats all you need for 4 bits.

why not go 8 bit and get an integrated DAC? they are pretty cheap these days.

or how about addressing a MUX/DEMUX like the 4051, 4067 etc. with a current source tied to a series string of the *same* value resistor... this works pretty well, so long as you filter it a bit. i did a coupla things this way.

josh
Back to top
View user's profile Send private message Visit poster's website
Uncle Krunkus
Moderator


Joined: Jul 11, 2005
Posts: 4761
Location: Sydney, Australia
Audio files: 52
G2 patch files: 1

PostPosted: Tue Jun 19, 2007 3:32 am    Post subject: Reply with quote  Mark this post and the followings unread

topp wrote:
it's not linear because your resistor values are exponentially related. Very Happy

The idea of shorting out series resistors was bound to create a non linear result, which I was trying to counter by using exponential resistor values. The problem has more to do with the method, than the values.
Quote:

you should take a look at something like this-

http://www.cyndustries.com/synapse/synapse.cfm?pc=43&folder=march1977&pic=33

you've got the resistor values already- 5-40k right? thats all you need for 4 bits.

Well, yes, I now realise that I could just switch the four resistors to a summing amp using the 4066. But I think buffering into a tiny R/2R will be more fun.
Quote:

why not go 8 bit and get an integrated DAC? they are pretty cheap these days.

Cos then I'd have to re-build all my counters, and I'd need twice as many AND gates and ORing diodes.
Quote:

or how about addressing a MUX/DEMUX like the 4051, 4067 etc. with a current source tied to a series string of the *same* value resistor... this works pretty well, so long as you filter it a bit. i did a coupla things this way.

josh


And I'm not sure what you mean by that last 'bit'. (said the parity checker to the shift register) Laughing

_________________
What makes a space ours, is what we put there, and what we do there.
Back to top
View user's profile Send private message Visit poster's website
Uncle Krunkus
Moderator


Joined: Jul 11, 2005
Posts: 4761
Location: Sydney, Australia
Audio files: 52
G2 patch files: 1

PostPosted: Wed Jun 20, 2007 8:06 am    Post subject: Reply with quote  Mark this post and the followings unread

Okay,
this is what I've got now.
I probably still don't get the op-amp bit, cos as it is, it ramps down from -V/2 until MSB goes high (1000), then it sits on -V for the rest of the count. At 0000 it comes back to -V/2. If I pull the TL071 out of it's socket and just monitor the other side of R13 I get a full (if slightly glitchy) 16 steps from 0V up to +V. Does anyone know why?
Do I need the pull down resistors? I think these are okay, cos there's good data getting across the buffers. It's being fed by diodes on AND gate outputs. Do I need different values on the pull down resistors?
Have I wired the op-amp right? Just an inverting buffer yeah? If pulling it gets 16 steps, the problem must be here yeah?
Contaminated supply?


HMDAC.gif
 Description:
 Filesize:  11.86 KB
 Viewed:  19452 Time(s)

HMDAC.gif



_________________
What makes a space ours, is what we put there, and what we do there.
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Wed Jun 20, 2007 9:05 am    Post subject: Reply with quote  Mark this post and the followings unread

Hmm .. you ran into a classical example of the law of conservation of misery I'm afraid.

The R2R output goes from zero to Vcc, the opamp circuit has to at least amplify a factor of one, it can't attenuate. And so it has to be able to drive it's output up to the positive or down to the negative supply voltage (depending on wether you use an inverting or a non inverting buffer), and it can't do that, it needs some headroom.

Well I think, that's the problem ...

So how you're going to solve it ... Rolling Eyes Laughing

BTW, the pull downs are OK and really needed, assuming you want a logic OR function there. Anyway, after diodes there should always be a pullup or pulldown, depending on the diode direction.

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Uncle Krunkus
Moderator


Joined: Jul 11, 2005
Posts: 4761
Location: Sydney, Australia
Audio files: 52
G2 patch files: 1

PostPosted: Wed Jun 20, 2007 4:21 pm    Post subject: Reply with quote  Mark this post and the followings unread

So why has it converted 0 -> +Vcc into -Vcc/2 -> -Vcc? And why is it on -Vcc for half the steps? Why did it start at -Vcc/2?
I'm not expecting you to come with the answers Jan, I'm just miserying out loud. Laughing (and laughing out loud)
I'm using a proper dual PSU by the way. Do I have to do anything with the offset pins on the TL071?
I just realised that what I'm getting is as if I had shifted the output down by V/2. That would explain why (0000) gives -V/2, and of course it would stop at -V for the other half of the count, 'cos it can't go any further. I know you can shift the voltage level using an op-amp, maybe I've done it by accident.
I'll check the exact bit values vs. output, and get back later.

_________________
What makes a space ours, is what we put there, and what we do there.
Back to top
View user's profile Send private message Visit poster's website
Uncle Krunkus
Moderator


Joined: Jul 11, 2005
Posts: 4761
Location: Sydney, Australia
Audio files: 52
G2 patch files: 1

PostPosted: Thu Jun 21, 2007 8:56 am    Post subject: Reply with quote  Mark this post and the followings unread

I have the answer!!
First, it didn't start at -V/2 at all. It was just -1.6V (Don't exaggerate readings!)
I made a little de-bouncer and checked all the output voltages for every input. Starting at -1.6V it goes roughly 1.5V into the negative with each step. Now 12V divided by 16 steps is .75V (hmm,.... factor of 2) Of course it stops at -10.6V cos it's got nowhere else to go.
I read on a web page that "Thevenin analysis shows that looking back towards the LSB from each data line always equals a resistance of R" The circuit I copied had 2R as the feedback resistor! That gives the op-amp a gain of -2!!!
So replacing it with R should bring the results back into what the op-amp can deliver.

My next question is: -
Can I change the Gnd on the +ve input so the output gets shifted up by V/2?
Or should I do that with a separate buffer so I don't mess up the R/2R decoding?
An output of 10Vp-p swinging around Gnd would be the best outcome yeah?

BTW, it's already sounding heaps more "musical" than before. Very tasty drone sound.

_________________
What makes a space ours, is what we put there, and what we do there.
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Thu Jun 21, 2007 9:39 am    Post subject: Reply with quote  Mark this post and the followings unread

Uncle Krunkus wrote:
I have the answer!!


Right, so I was wrong Very Happy

Why not just use a non-inverting buffer ?

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Uncle Krunkus
Moderator


Joined: Jul 11, 2005
Posts: 4761
Location: Sydney, Australia
Audio files: 52
G2 patch files: 1

PostPosted: Thu Jun 21, 2007 4:13 pm    Post subject: Reply with quote  Mark this post and the followings unread

Apparently, when buffering an R/2R network, you can't. According to an article I found on the net. I'll sit down and have a few more beers with my good friend Leon Thevenin and find out why. You know he's lost a lot of weight since he died. It's turned him into a bit of a two pot screamer. Laughing
_________________
What makes a space ours, is what we put there, and what we do there.
Back to top
View user's profile Send private message Visit poster's website
Uncle Krunkus
Moderator


Joined: Jul 11, 2005
Posts: 4761
Location: Sydney, Australia
Audio files: 52
G2 patch files: 1

PostPosted: Thu Jun 21, 2007 6:56 pm    Post subject: Reply with quote  Mark this post and the followings unread

Here's a sample of what's going on.
The 8 counters ramp the words which are presented sequentially to the DAC. This sample is all at the one fundamental frequency. There are 4 up only counters, and 4 up/down counters.

It's roughly divided into 6 parts.
1. All counters slow
2. 1 up counter full speed
3. 2 up counters full speed
4. 1 up/down counter high speed
5. All up/down counters high speed
6. All counters high speed

The next step is to add a schmitt trigger and/or comparator to the front so it can be clocked by a square VCO. Maybe a phase locked loop would allow more options about harmonic control.


HMDAC Sample.mp3
 Description:

Download
 Filename:  HMDAC Sample.mp3
 Filesize:  247.82 KB
 Downloaded:  1358 Time(s)


_________________
What makes a space ours, is what we put there, and what we do there.
Back to top
View user's profile Send private message Visit poster's website
DrJustice



Joined: Sep 13, 2004
Posts: 2114
Location: Morokulien
Audio files: 4

PostPosted: Fri Jun 22, 2007 2:43 am    Post subject: Reply with quote  Mark this post and the followings unread

Hey Uncle, check out this thread where bigtex is getting into some R2R stuff.

Have you considered using laser trimmed R2R networks? At least if you want CV with musical tuning it's a good idea. Nonetheless, respect for scratch building one!

DJ
--
Back to top
View user's profile Send private message Visit poster's website
Uncle Krunkus
Moderator


Joined: Jul 11, 2005
Posts: 4761
Location: Sydney, Australia
Audio files: 52
G2 patch files: 1

PostPosted: Sun Jul 01, 2007 8:48 am    Post subject: Reply with quote  Mark this post and the followings unread

I've had some ideas about how to improve this circuit and I'm just going to throw some of them out there and see what you dudes think okay?

Obviously, one of the first things I'd like to sort out is getting it to track another wave. For that I'm going to experiment with Scott Gravenhorsts Frequency Multiplier for the Fat Man. It's based on a 4046 PLL.

http://home1.gte.net/res0658s/fatman/4046pll.html

This also should give the option of driving the timeslices with a frequency which is 1, 2, or even 3 octaves up. (with other possibilities as well)

But the main idea I had the other day is this: -

When I was playing with the counters, I found I could make an automatic up/down 4 bit counter by XORing the 5th bit with the first 4. So XORing bits gives the inverted version of the original.
I realised I could double the resolution of the wave by adding a 5th bit, which not only acted as the new MSB, but could be XORed with the first four to create a mirror of the Less Significant Bits.
While we're doubling the voltage resolution, why not double the sample frequency too? 16 steps. For the first 8 we have something similar to what's happening now, except it's being purposely held in the "positive" going side of the wave by the MSB being set to 0. As the second set of 8 outputs starts, the MSB is set to 1. This not only shifts the same bit pattern into the negative side of the wave, XORed with those bits flips them upside down. And by having these timeslices addressed in reverse, we complete the process of presenting to the DAC the same shape, mirrored, reversed and shifted. Note that the MSB is not part of the 4bit words coming from the counters. It's generated by the timeslicer and fed straight to the DAC. So I don't need to rebuild my 8*4bit counters.
We end up with a wave that has twice the resolution in both directions.
This rotational symmetry about the 0 crossing is something common to many naturally occurring waves, and I think it will help to reduce the "buzzy" digital sound which the original suffers from.
Of course PWModulated waves do not share this rotational symmetry, and to address that possibility, the other feature is to include a method of controlling which step (1-16) activates the MSB. I'm actually thinking I'll stick with choosing step 1 to 8. I don't think the other half will matter, as it would just be an inverted, phase shifted version of the first 8.
Symmetry around 16 steps means that the dominant frequency will be 4 octaves below the timeslice clock. This is why I like the idea of a frequency multiplier which puts out 3 octaves up. This also improves the possibility of then removing the "carrier".

Does that make sense to anybody else? Or have I just completely lost the plot?

_________________
What makes a space ours, is what we put there, and what we do there.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: jksuperstar, Scott Stites, Uncle Krunkus
Page 1 of 3 [75 Posts]
View unread posts
View new posts in the last week
Goto page: 1, 2, 3 Next
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use