@@SineLab Enjoy! On that note though, I've had the Ziploc bags come apart after leaving the solvent in them for a few weeks - so it's not really suitable for prolonged storage between uses.
I've built discrete DAC's for fun before. More practically, I tend to build ad-hoc DAC's using a few free uC GPIO pins. I can say with certainty, give discrete R-2R DACs a try! The advantage of a discrete R-2R resistor ladder network DAC is that you can bulk buy resistors and use a good measurement method to "bin" the resisters to better than the precision/tolerance on the tin. That is, you can buy 1,000 units of 1% or better resistors, and build a 12~24 bit DAC with cherry picked / matched resistors. Furthermore, you can buy resistors with 10x higher resistance as parallel "trim resistors," or resistors with 10x lower resistance as serial trim resistors. You can also go completely nuts and stack trim resistors, thus trimming the trim resistors. Every order-of-magnitude trim resistor you provision for will give you a corresponding order of magnitude increase in precision. It's simple why; a 1% precision on a resistor that has 1/10th the affect on the output behaves like a 0.1% resistor that has full authority over the output. Finally, to be totally ludicrous, you can get resistors with matching/balanced temperature coefficient so that it has better thermal stability. You *CAN* build a work of art grade DAC using discreet components... but, to be fair, a great DAC IC is only a few bucks too... so.... :/
also there's a plenty chineese 0.1% resistors on sites like aliexpress. They go higher in price but those 20pcs that i bought really fitted into 0.1% tolerance (measured with HP34401A whose last calibration was done in 1996, so take this information with a grain of salt). They also promise 25ppm/c TCR but i did not measure it, because i have no proper thermal chamber
Instead of buying boxes with resistors, you can use some Python script and draw wire resistors just on a PCB. With having the smallest resistor as 0.2mm by 10cm 1oz (if I'm not mistaken, its resistance is 22 Ohms), you can place an entire weighted 16-bits DAC on a 30x10cm of 8 layers PCB (make sure you select a same oz for outer and inner layers). I think this is the cheapest 0.0000...1% resistor in the world (as cheap as 15 euros for one weighted string). Then you have to feed it with a current source, add 16 more same PCBs as a summing network, and 16 precise commutators (like a cmos on/off with a an OpAmp for a full compensation) PS You can use yet more 0.2x10x1oz wire on the same PCB in the current source to compensate a temperature while the wires become hotter
@@sc0or Did you know why copper is a bad resistor material? It got huge TCR. And your copper traces will get temperature gradient, so "equal TCR will create equal offsets" argument is not applicable here. For 8+ bits DAC it's better to just buy IC, or use some old R2R resistor matrix (like soviet 312NR6, 10bit R2R resistor matrix), if you're able to find one. They got difference in TCR at ppm's range.
@@sc0or Even ignoring the copper TCR problem, PCB manufacturing processes aren't perfectly uniform, somewhere there will be over-etching, in other places it will be under-eteched a bit. And 0.2 mm 100mm 1oz trace will be about 0.38 Ohm.
@@dinistor1254what if I buy special wire and wind it around a (ceramic) frame? Like a piano forte . I could even adjust the taps. Why do we care about temperature in a R2R ladder? How low is the noise of a power supply? How low is the resistance of the mosfets in front of the Rs of the ladder? 1mV relative to 5V ! So this is not even good enough for CD audio (invented 1981).
Just so you know, this video was more awesome than you think. Really insightful. It also seems like you upgraded the camera and audio a few times over. I say keep at it and before you know it there'll be more comments than you can read in a single lifetime.
Loved the video! Building discrete ADCs and DACs is something I really like, and testing linearity using a Python script and a Keithley bench DMM is very reminiscent of the sort of stuff I do. By the way, the K2010's input impedance in the 0.1V, 1V and 10V ranges is supposed to be greater than 10GΩ, so I don't think it was loading the DAC significantly.
You really should not be using "Earth" and "Gnd" interchangeably in circuits. Earth is usually mean to signify Protective Earth from a AC source. So using "Earth" as "Ground" although technically correct is not the right way to do it since. "Gnd" in a PCB refers to the V0 reference plane and NOT "protective earth" since the GND plane can be floating in a isolated AC to DC converter (which most AC to DC converters are and should be)
awesome work! only one major thing yu done wrong - dont use Isopropanol directly in the ultrasonic cleaner, some chinese cleaners may be incrorrectly grounded and having an open solvent is a huge fire hazard - especially if there is 3/4 Litres. i recommend having a plastic container with a lid where you put your isopropanol and stuff, and put this container into water in the ultrasonic cleaner. This has two advantages - mainly uou use less isopropanol and have it insulated
Tweezers are such a slow and painful way to hand-place large numbers of parts - get foot-operated vacuum pickup tool & pick from tape - not only is it way faster, the orientation is always right.
Would it be feasible to use resistor arrays in this design? @mikeselectricstuff Your lighting and display installations are the thing of legend, I have learned a *ton* from your videos, thanks for sharing your knowledge and experience!
100LSB INL error makes this no better than 8bit R2R DAC build from 0.1% resistors, unfortunatly... But you can make software correction for INL graph by calculating error function of output voltage (excel can do best fit polynomial). As mentioned in other comments, you should try R2R DACs, they give good results with resistors like 0.1% if you measure them and find best fit for nominal value. Of course, this is up to a certain point - when TCR difference of resistors, difference in switch resistance and many other effects will become noticable. There's reason, why in DAC8831 first 12 bits are done R2R, and last 4 are done with 15 separate resistors (Fig.44 at TI datasheet). I think this is for laser trimming. Also, your circuit reminded me of Kelvin-Varley Divider at first - maybe check it out. Anyway, this is good video demonstration! subbed:)
in modern silicon processes, transistors are so small they are essentially free. Resistors on the other hand, can take up lots of space so replacing a resistor stage with a diff pair stage is very worth while. matching is also easier to accomplish with inter-digitated fets
I misread the title and thought it's an discrete ADC. I would love to see that because I can't imagine how these things work. I've no problem understanding a DAC I've seen a simple resistor ladder DAC.
@antonf.9278 I'm not that deep into microelectronics but as I understand this would require a lot of switches (transistors) to put the right voltage in the comparator and has to be much faster than the sampling rate you want to achieve.
Would appreciate it if you did! High precision and speed ADCs are something currently reserved for high price ICs (for good reason) but I'd greatly appreciate watching you get down to the basics on that!
@@thephantompsychicADCs are made of OpAmps. OpAmps seem to contain two magic parts. In both cases two transistors are monolithically integrated. On part (or circuit) is the long-tailed differential amplifier, which is a little immune to supply voltage bias and noise. The other one is the current mirror. Now I do wonder if a microcontroller could manage these circuits and some MOSfet transfer gates. Throw in capacitors and inductivities. I imaginen that capacitor and inductivity form a damped oscillator. We calibrate for zero crossing and get the precise result whereas otherwise we would need to wait forever. A flash ADC has a string of these amplifiers supplied by voltage from a string of resistors. I like the analog nature of a single stage amplifier. Maybe we can mix their output to get better linearity?
While you're at it, note something does work that you will just about never see. Take a look at the DAC R-2R, and note that just a 374 latch or similar would drive it for 8 bits. So 8 bit digital pattern, directly driving and converted into an analog output value. You can do the opposite. Long ago looking at that, it hit me to do the reverse, analog in value directly to a digital output pattern. Comparator for first bit, high low set at the middle point. Next bit is set for 3/4, but if the high bit is low, that same low output pulls another resistor low that cuts the reference to the 1/4 level. So the second bit can determine either the high second bit or low second bit transition, with the first bit selecting which one. And work on down the line. Easy enough to do 4 bits and have fun testing it, gets hairy of course if you go further. Of course there are race and hysteresis type issues, but it is a fun idea. Even back then there was some small amount of prior art, but it's only barely used for 2 or 3 bits. You're better off using more comparators or going to a real ADC.
to create a digital-to-analog (DA) converter. For example, consider a 3-bit setup where each bit is connected to a resistor. The first resistor has a value of, say, 1 kiloohm. The second resistor is double the value of the first, meaning 2 kiloohms, and the third is also double the previous one, thus 4 kiloohms. All output points are then connected to a single point, which serves as the output....easy😊isnt
There are transistors pairs in the same case that are well matched and also multiple transistors arrays that are very well paired and with nearly identical parameters. I know that those are more expensive, but for your specific case, you may try them. Also, can reduce component count.
@@SineLab You can find many MPNs for cheaper prices at LCSC, I often get JFETs from them. :) There is a JFET sub category under the Transistors/Thyristors. for an example You can get J109 for around 20 cents. they also have hundreds of SMD MPNs as well. All in stock. Also, most of them available at JLC assembly library as well.
could you have a couple of micro adjustable resistors on the inner string - you'd only need 4 perhaps even 2 to tweak the values there to bring them into linearity
Interesting, I was watching to see you get a signal (I assumed audio, as when I saw DAC in the title I assumed...) from a PC to your DAC, but you didn't go there. I have this ancient HP 'DAC' that I thought would be interesting to try and feed some audio into it to see what happens (it was intended to drive chart recorders). However getting a PC to route audio out a serial port where an Arduino etc can grab that data and feed it into my DAC is a problem.
It’s better to try assembling a microwave ADC using discrete elements. Because they are actually almost unavailable for purchase. I would like to build a homemade oscilloscope.
In one device I saw the following signal conversion chain: photodiode -> amplifier -> ADC -> DAC -> ADC. Why do you think the developer chose this scheme?
😖😖12:37 - Please get your self some flux, will make your life a lot easier :) 13:20 - Also you don't have to fill your whole Ultrasonic cleaner, just fill it with water, take a smaller container (plastic bags work too) where your item barley fits in and fill that with as much solvent/cleaner as you need to cover it, then put the smaller container in the Ultrasonic cleaner with water. Saves you a lot of money and you contaminate less solvent, at some point the whole board would just get a little sticky. IDK what you pay for solvents but I bought a cheap glas still and every one or two years I distill my dirty solvents. Even with the first run I broke even.
I bought one like this on amazon. They're cheap, only around $60. However, I'm not happy with putting PCBs directly on the plate. I put mine on a thick piece of aluminum for more even heating. First I suspend this about an inch above the hot plate to pre-heat the plate and PCB for a few minutes, then I move it onto the hotplate to finish the job. Another guy I know uses a square fry pan in the same way.
In this case, an LSB refers to the amount of voltage in just the first bit. 3 LSBs here means that increasing the code by 1 caused the code to increase by 3x what was expected.
ultrasonic bath trick:
fill with water, put IPA in a Ziploc bag
PCB goes in the bag
Thanks, I'll keep that in mind for next time
@@SineLab Enjoy! On that note though, I've had the Ziploc bags come apart after leaving the solvent in them for a few weeks - so it's not really suitable for prolonged storage between uses.
@@hardwareful ideea sounds good .. to not waste IPA but i have a question, did you had plastic depositions on PCBA ?
also great work done by @SineLab
glass jar is good too.
@@hardwareful You can use a glass jar as well, it transfers the ultrasound even better than the plastic
I've built discrete DAC's for fun before. More practically, I tend to build ad-hoc DAC's using a few free uC GPIO pins. I can say with certainty, give discrete R-2R DACs a try! The advantage of a discrete R-2R resistor ladder network DAC is that you can bulk buy resistors and use a good measurement method to "bin" the resisters to better than the precision/tolerance on the tin. That is, you can buy 1,000 units of 1% or better resistors, and build a 12~24 bit DAC with cherry picked / matched resistors. Furthermore, you can buy resistors with 10x higher resistance as parallel "trim resistors," or resistors with 10x lower resistance as serial trim resistors. You can also go completely nuts and stack trim resistors, thus trimming the trim resistors. Every order-of-magnitude trim resistor you provision for will give you a corresponding order of magnitude increase in precision. It's simple why; a 1% precision on a resistor that has 1/10th the affect on the output behaves like a 0.1% resistor that has full authority over the output. Finally, to be totally ludicrous, you can get resistors with matching/balanced temperature coefficient so that it has better thermal stability.
You *CAN* build a work of art grade DAC using discreet components... but, to be fair, a great DAC IC is only a few bucks too... so.... :/
also there's a plenty chineese 0.1% resistors on sites like aliexpress. They go higher in price but those 20pcs that i bought really fitted into 0.1% tolerance (measured with HP34401A whose last calibration was done in 1996, so take this information with a grain of salt). They also promise 25ppm/c TCR but i did not measure it, because i have no proper thermal chamber
Instead of buying boxes with resistors, you can use some Python script and draw wire resistors just on a PCB. With having the smallest resistor as 0.2mm by 10cm 1oz (if I'm not mistaken, its resistance is 22 Ohms), you can place an entire weighted 16-bits DAC on a 30x10cm of 8 layers PCB (make sure you select a same oz for outer and inner layers). I think this is the cheapest 0.0000...1% resistor in the world (as cheap as 15 euros for one weighted string). Then you have to feed it with a current source, add 16 more same PCBs as a summing network, and 16 precise commutators (like a cmos on/off with a an OpAmp for a full compensation)
PS You can use yet more 0.2x10x1oz wire on the same PCB in the current source to compensate a temperature while the wires become hotter
@@sc0or Did you know why copper is a bad resistor material? It got huge TCR. And your copper traces will get temperature gradient, so "equal TCR will create equal offsets" argument is not applicable here. For 8+ bits DAC it's better to just buy IC, or use some old R2R resistor matrix (like soviet 312NR6, 10bit R2R resistor matrix), if you're able to find one. They got difference in TCR at ppm's range.
@@sc0or Even ignoring the copper TCR problem, PCB manufacturing processes aren't perfectly uniform, somewhere there will be over-etching, in other places it will be under-eteched a bit. And 0.2 mm 100mm 1oz trace will be about 0.38 Ohm.
@@dinistor1254what if I buy special wire and wind it around a (ceramic) frame? Like a piano forte . I could even adjust the taps.
Why do we care about temperature in a R2R ladder?
How low is the noise of a power supply? How low is the resistance of the mosfets in front of the Rs of the ladder?
1mV relative to 5V ! So this is not even good enough for CD audio (invented 1981).
Making discrete versions of ICs is an excellent way to learn. Great job.
Mate, with soldering skills like that, just get the PCBs assembled at JLCPCB!
Just so you know, this video was more awesome than you think.
Really insightful. It also seems like you upgraded the camera and audio a few times over.
I say keep at it and before you know it there'll be more comments than you can read in a single lifetime.
Thanks, this video took quite a while to make. I'm glad you enjoyed it!
Loved the video! Building discrete ADCs and DACs is something I really like, and testing linearity using a Python script and a Keithley bench DMM is very reminiscent of the sort of stuff I do.
By the way, the K2010's input impedance in the 0.1V, 1V and 10V ranges is supposed to be greater than 10GΩ, so I don't think it was loading the DAC significantly.
This is amazing. I can't start to imagine the amount of effort you put into this video.
It took a while to finish this project. :)
You really should not be using "Earth" and "Gnd" interchangeably in circuits. Earth is usually mean to signify Protective Earth from a AC source. So using "Earth" as "Ground" although technically correct is not the right way to do it since. "Gnd" in a PCB refers to the V0 reference plane and NOT "protective earth" since the GND plane can be floating in a isolated AC to DC converter (which most AC to DC converters are and should be)
I'll make sure to better distinguish earth from ground in future projects.
😂 earth and god... oh gnd
Everything following the first sentence is incorrect or really bad wording either.
what's the difference between virtual ground and gnd?
awesome work! only one major thing yu done wrong - dont use Isopropanol directly in the ultrasonic cleaner, some chinese cleaners may be incrorrectly grounded and having an open solvent is a huge fire hazard - especially if there is 3/4 Litres. i recommend having a plastic container with a lid where you put your isopropanol and stuff, and put this container into water in the ultrasonic cleaner. This has two advantages - mainly uou use less isopropanol and have it insulated
Thanks, it does seem much safer that way
Cool stuff, I just finished up a project at work using VISA commands.
Cool! The idea of cascaded string DACs looks similar to a Kelvin-Varley divider.
Tweezers are such a slow and painful way to hand-place large numbers of parts - get foot-operated vacuum pickup tool & pick from tape - not only is it way faster, the orientation is always right.
I'll take a look into getting one
Would it be feasible to use resistor arrays in this design?
@mikeselectricstuff Your lighting and display installations are the thing of legend, I have learned a *ton* from your videos, thanks for sharing your knowledge and experience!
100LSB INL error makes this no better than 8bit R2R DAC build from 0.1% resistors, unfortunatly... But you can make software correction for INL graph by calculating error function of output voltage (excel can do best fit polynomial).
As mentioned in other comments, you should try R2R DACs, they give good results with resistors like 0.1% if you measure them and find best fit for nominal value. Of course, this is up to a certain point - when TCR difference of resistors, difference in switch resistance and many other effects will become noticable.
There's reason, why in DAC8831 first 12 bits are done R2R, and last 4 are done with 15 separate resistors (Fig.44 at TI datasheet). I think this is for laser trimming.
Also, your circuit reminded me of Kelvin-Varley Divider at first - maybe check it out.
Anyway, this is good video demonstration! subbed:)
I've made 1pin DAC once.
It consisted of single capacitor and was driven by PWM:)
if u dont need speed ..yes ..that what i do all the time 😊
higt frequency pwm give faster abd beter result😊
i discribe a beter aproche using resistors in comment. take a look.
i made the same thing, but it was noisy even with 300khz pwm
@@destiny_02 with 300kh abd 5v pwm use 3.3kohm and 0.47 uf
in modern silicon processes, transistors are so small they are essentially free. Resistors on the other hand, can take up lots of space so replacing a resistor stage with a diff pair stage is very worth while. matching is also easier to accomplish with inter-digitated fets
I misread the title and thought it's an discrete ADC. I would love to see that because I can't imagine how these things work.
I've no problem understanding a DAC I've seen a simple resistor ladder DAC.
From tha datasheet of a MC I used a while back:
input -> buffer -v
DAC -> comparator -v
^- control circuit
@antonf.9278 I'm not that deep into microelectronics but as I understand this would require a lot of switches (transistors) to put the right voltage in the comparator and has to be much faster than the sampling rate you want to achieve.
I may make an ADC at some point.
Would appreciate it if you did! High precision and speed ADCs are something currently reserved for high price ICs (for good reason) but I'd greatly appreciate watching you get down to the basics on that!
@@thephantompsychicADCs are made of OpAmps. OpAmps seem to contain two magic parts. In both cases two transistors are monolithically integrated. On part (or circuit) is the long-tailed differential amplifier, which is a little immune to supply voltage bias and noise. The other one is the current mirror.
Now I do wonder if a microcontroller could manage these circuits and some MOSfet transfer gates. Throw in capacitors and inductivities. I imaginen that capacitor and inductivity form a damped oscillator. We calibrate for zero crossing and get the precise result whereas otherwise we would need to wait forever.
A flash ADC has a string of these amplifiers supplied by voltage from a string of resistors. I like the analog nature of a single stage amplifier. Maybe we can mix their output to get better linearity?
Ultrasonic + heat + 99% IPA = FIRE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Wow, Very cool! DACs rule!
It's funny how simple a string DAC seems vs what a nightmare it is to actually make hahaha. Great video BTW.
String DACs can be deceptively complex.
While you're at it, note something does work that you will just about never see. Take a look at the DAC R-2R, and note that just a 374 latch or similar would drive it for 8 bits.
So 8 bit digital pattern, directly driving and converted into an analog output value.
You can do the opposite. Long ago looking at that, it hit me to do the reverse, analog in value directly to a digital output pattern. Comparator for first bit, high low set at the middle point. Next bit is set for 3/4, but if the high bit is low, that same low output pulls another resistor low that cuts the reference to the 1/4 level. So the second bit can determine either the high second bit or low second bit transition, with the first bit selecting which one. And work on down the line.
Easy enough to do 4 bits and have fun testing it, gets hairy of course if you go further.
Of course there are race and hysteresis type issues, but it is a fun idea. Even back then there was some small amount of prior art, but it's only barely used for 2 or 3 bits. You're better off using more comparators or going to a real ADC.
Atari ST and Jaguar connect a R2R network to CMOS output pins of the purely digital GPU to create RGB analog video out.
Another descret components circuit,thanks bro
Nice video lol I'm working on something similar, but made a 4 bit r2r ladder dac. It's so awesome to use math to generate analog signals!
Multiplexer/demultiplexer plus opamp, can be base 2 or 10 (ten).
to create a digital-to-analog (DA) converter. For example, consider a 3-bit setup where each bit is connected to a resistor. The first resistor has a value of, say, 1 kiloohm. The second resistor is double the value of the first, meaning 2 kiloohms, and the third is also double the previous one, thus 4 kiloohms. All output points are then connected to a single point, which serves as the output....easy😊isnt
There are transistors pairs in the same case that are well matched and also multiple transistors arrays that are very well paired and with nearly identical parameters. I know that those are more expensive, but for your specific case, you may try them. Also, can reduce component count.
Well, amazing effort, but how it sound?
Shoud've done R2R honestly.
R2R is superior AND simpler than your contraption at the same time.
The string DAC has superior INL. With 8-bit R2R, the INL>1 is common
You can use JFETs instead of back to back MOSFETs.
Unfortunately they are way more expensive currently
I would have if the JFETs were as cheap as MOSFETs
@@SineLab You can find many MPNs for cheaper prices at LCSC, I often get JFETs from them. :) There is a JFET sub category under the Transistors/Thyristors.
for an example
You can get J109 for around 20 cents. they also have hundreds of SMD MPNs as well. All in stock.
Also, most of them available at JLC assembly library as well.
@@SineLab BTW, great video!
could you have a couple of micro adjustable resistors on the inner string - you'd only need 4 perhaps even 2 to tweak the values there to bring them into linearity
Interesting, I was watching to see you get a signal (I assumed audio, as when I saw DAC in the title I assumed...) from a PC to your DAC, but you didn't go there.
I have this ancient HP 'DAC' that I thought would be interesting to try and feed some audio into it to see what happens (it was intended to drive chart recorders). However getting a PC to route audio out a serial port where an Arduino etc can grab that data and feed it into my DAC is a problem.
I am fine with my 1-Bit DAC outputs :D
It’s better to try assembling a microwave ADC using discrete elements. Because they are actually almost unavailable for purchase. I would like to build a homemade oscilloscope.
What’s wrong with a ladder DAC though? If the resistors are accurate enough, it seems like the simplest and most elegant solution.
Precision resistors would fix that inaccuracy problem
At 13:10 please be careful with your combustible cloud generator.😲
Wait, I changed my mind: do NOT use any combustible liquid in an ultrasonic clear.
In one device I saw the following signal conversion chain: photodiode -> amplifier -> ADC -> DAC -> ADC. Why do you think the developer chose this scheme?
😖😖12:37 - Please get your self some flux, will make your life a lot easier :)
13:20 - Also you don't have to fill your whole Ultrasonic cleaner, just fill it with water, take a smaller container (plastic bags work too) where your item barley fits in and fill that with as much solvent/cleaner as you need to cover it, then put the smaller container in the Ultrasonic cleaner with water.
Saves you a lot of money and you contaminate less solvent, at some point the whole board would just get a little sticky.
IDK what you pay for solvents but I bought a cheap glas still and every one or two years I distill my dirty solvents. Even with the first run I broke even.
G.O.A.T
Could you use the internal RDSon of the mosfets to make a dac?
It would be very difficult to match RDSon for each MOSFET, but I guess it might be techincally possible.
No comparison of off the shelf and diy on same screen? Sad. 😢
Dude, use a R-2R resistor ladder network to create your DAC. I'm so confused
Where do you get the hot plate?
I bought one like this on amazon. They're cheap, only around $60. However, I'm not happy with putting PCBs directly on the plate. I put mine on a thick piece of aluminum for more even heating. First I suspend this about an inch above the hot plate to pre-heat the plate and PCB for a few minutes, then I move it onto the hotplate to finish the job. Another guy I know uses a square fry pan in the same way.
@@RUclipsBorkedMyOldHandle_why Hmmm... Maybe I'll go the DIY reflow oven route. Thank you! I appreciate the response.
I also got my hot plate on amazon.
Class D next part ?
If one LSB is 175uV then wouldn't 3 LSB be 2^3 * 175uV or 1.4mV?
Depends if you are counting by the bit/code, or the value
In this case, an LSB refers to the amount of voltage in just the first bit. 3 LSBs here means that increasing the code by 1 caused the code to increase by 3x what was expected.
@@SineLab That would be 2 LSBs since the B stands for bits not counts.
1:14 im sigma
I've never understood why DACs always seem to be so damned expensive. Now ... I think I know.
That was more complicated than necessary
please learn how to pronounce scpi (The Standard Commands for Programmable Instruments (SCPI; often pronounced "skippy") )