Тёмный

Making a 12 bit DAC Using an Arduino - The Learning Circuit 

element14 presents
Подписаться 771 тыс.
Просмотров 44 тыс.
50% 1

Наука

Опубликовано:

 

28 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 76   
@skesinis
@skesinis 3 года назад
This R/2R DAC was my first sound card (just 8 bits) on my first PC back in the early ‘90s! I managed to fit 18 resistors and a 100nF capacitor for integration of the output signal in a DB25 plug back then, playing WAV files from the printer port of that old PC! 😊 Great video! It literally took me back to those years!
@phant0masterr
@phant0masterr 3 года назад
Covox speech thing! 😊
@mikeelmquist6620
@mikeelmquist6620 3 года назад
Pp
@skesinis
@skesinis 3 года назад
@@phant0masterr Also known as “Disney Sound Source”. I found the schematics of it back then, on the text “readme” file of the “MODplay” player of Amiga music tracks. Something like a MIDI file with 8bit sampled instruments. It was supported by 1 or 2 games but I remember that I had to write the software to play the WAV files in assembly, because even Pascal wasn’t fast enough to play them at the actual speed. My 386sx/16MHz back then was even slower than an Arduino in some tasks!
@peter.s.3207
@peter.s.3207 3 года назад
This is an excellent video explaining how early DACs were built and the principles behind them, nice work! One thing got me at the end however, you mentioned that the original input signal captured by the ADC could never be reconstructed exactly by the DAC. This is (mostly) incorrect though, as it ignores Nyquist-Shannon. If you band limit the input of the ADC at 1/2 your sampling frequency (idealized case) or lower (practically, 1/5 to 1/10 is sufficient for slow, non-specialty filters), then include an exact copy of this input filter on your output, you will reconstruct a mathematically identical signal to the one received! The limitation bit depth poses in this scenario is an increase in base noise floor, rather than a distortion of the signal itself. Because of this, these filters are nearly always included on off-the-shelf components designed for distortion sensitive applications.
@jacobrzeszewski6527
@jacobrzeszewski6527 2 года назад
Ahhh, good old Nyquist Shannon sampling theorem.
@kennymd2488
@kennymd2488 3 года назад
Hi... I did a similar thing almost twenty years ago, through the "User-port" of my Vic 20 with 16 KBytes RAM expansion, to make a long research about PCM synthesis of percussive sounds (bass drums, snare drums, toms, claps, hi-hats etc... ). My "DAC" wasn't a R/2R type, but just eight resistors (10K-20K-40K-80K... ) from MSB to LSB, linked to a common line and "grounded" through a 10K resistor to convert the out from current to voltage levels. I created the sounds with BASIC programs that simulates sine oscillators, white and pink noise generators, "click" and "crack" A-R envelope generators, mixers and LP/HP filters (the elaboration's time was a little terrible, as you can guess!!!) and played with a simple Assembler programs, with a sample rate around 25 kHz. The result wasn't bad, it was a fun experience, but i soon discovered that 8 bit is too low as resolution for percussive sound voices (anyway some commercial drum-machines, as Korg's DDM 110/220 or DDD5 actually makes use of 8 bit samples... ). Now I'm thinking to assemble a vintage-style drum-machine with Eight sampled voice-cards triggered via MIDI by a DAW (as "Caustic 3" and the like), with a Pic and a simple cheap 16 bit DAC in any voice-card. Today a 16 bit DAC is cheaper than a bunch of 1% resistors... :-D Anyway I would like to listen to a 44/16 wav file through your home-made DAC expanded to 16 bit... Bye... :-)
@scottlarson1548
@scottlarson1548 3 года назад
I also did something like that with, believe it or not, the parallel printer port on my Ohio Scientific computer (very similar to an old PET computer). I built an 8 bit DAC resistor network into a printer cable which I connected to my amplifier and I "printed" various wave forms which sounded... interesting. Random numbers made something of a rumbling white noise which could have sounded like explosions if I had known how to code envelopes. BASIC was too slow to make anything but the lowest frequency sine waves so I wrote a BASIC program to make a lookup table which then jumped into a machine language routine which "printed" values through the table, skipping values to increase the frequency. It didn't really sound like a pure sine wave but it had a flute-like sound. I could have done much more if I had known what I was doing.
@ditronix
@ditronix Год назад
Although a year old now, just a quick thanks for the video. It has inspired me further, to explore the MCP4728 device on my latest IPEC ESP32 ATM90E32 IoT Power Energy Controller and Monitor board (variation on the original IPEM). So many different DACs and ADCs available v massive variations in cost and availability, it is sometimes not straight forward to choose one device for a particular design. Keep up the good work.
@catthecommentbothunter6890
@catthecommentbothunter6890 3 года назад
I will use this to power my stepper motor because i wanted to make a mechanical clock
@skesinis
@skesinis 3 года назад
You can also use as an alternative, one of the cheap stepper motors with a 64x gearbox divider which, combined with the 64 steps of the stepper gives 4096 steps for 360º, resolving better than 1/10º. I used a stepper motor like that to drive my telescope’s focuser, because I wanted the accuracy, especially for a 5x teleconverter when I’m imaging planets, and also because I wanted to focus without touching the telescope at such high magnifications.
@dzee9481
@dzee9481 3 года назад
These DACS are still still used in single chips since waffering Resistors is easy and produces very high tolerances. There are different kinds of DACs, and each of them have there specific requirements on their implementation.
@TheRealSneakyPlayz
@TheRealSneakyPlayz 3 года назад
Hi Karen, really enjoy your approach. Make it easy to understand. I want my kids to get into circuits and your approach will really help, Thanks!
@mavericklast2555
@mavericklast2555 3 года назад
This is who I need to teach me arduino
@sanjaybhatikar
@sanjaybhatikar 3 года назад
Love your clear explanations 💕
@dashamm98
@dashamm98 3 года назад
Useful for raspberry Pi GPIO also if you don't want to use any dedicated chips. If you use a standard shift register that almost any hobbyist has, you don't need many pins
@RetroShare2
@RetroShare2 3 года назад
Why not using a low pass filter for the 8 bit one to see the difference to the 12 bit one?
@jairoalexandermaldonadogon2966
@jairoalexandermaldonadogon2966 3 года назад
Muchas gracias por tu tiempo.
@ajinkyamahajan5736
@ajinkyamahajan5736 3 года назад
Please next video on Delta Sigma ADC with Arduino
@mikelee1906
@mikelee1906 2 года назад
Karen is the best!!!!!
@petercheung63
@petercheung63 10 месяцев назад
great video, thanks
@magiclay
@magiclay 5 месяцев назад
4 bits should show 16 different values?
@zvotaisvfi8678
@zvotaisvfi8678 Год назад
brilliant idea actually !!!! !!!! !!!!
@MrCardeso
@MrCardeso 3 года назад
Cool! Thanks, Karen!
@AKONBATISTA
@AKONBATISTA 2 года назад
The tx and rx ports are always on due to the Serial.begin() command. This way, the first two bits are always on. To get over this problem you have two solutions, you can shift the pins by two, starting in pin 2, or just delete the Serial commands.
@johnj596
@johnj596 10 месяцев назад
I love your videos! Can you make one explaining class D amplifiers and PWM?
@Willow1w
@Willow1w 3 месяца назад
Oh snap I should watch this
@freedomisfood6966
@freedomisfood6966 2 месяца назад
You are a scientist
@XanCraft21
@XanCraft21 8 месяцев назад
Thank you, this video really helped me. I have a question for you, if i were to use a controller that does not have any easy to use ports, could i use a shift register and a serial input to control the resistor ladder?
@dt1133
@dt1133 9 месяцев назад
Awesome content. Thank you
@tlwbob
@tlwbob 3 года назад
A question, the ADC on the Arduino is only 10bit, so surely the 12 bit is a bit fruitless?
@skesinis
@skesinis 3 года назад
Indeed the ADC of the Arduino is only 10bit, so reading back the 12bit output of the DAC will not be accurate, but it doesn’t mean that the DAC can’t be used to drive something else. After all, the redirection of the DAC’s output back to the 10bit ADC input of the Arduino was mostly to demonstrate the different bit depths ladder output on the video. On the other hand, a 12bit DAC on the 5V digital output of the Arduino, would theoretically resolve in 1.2mV per step. So using 1% resistors may give you noise higher than that in the end, assuming that your power source is also stable enough.
@richgolfs
@richgolfs 3 года назад
Well done! Good review
@davidstonier-gibson5852
@davidstonier-gibson5852 2 года назад
It's good to be teaching hobbyists this. But a 12 bit DAC with 1% resistors? It is likely to have some serious non-linearity issues. You would need 0.025% resistors for an honest 12 bit converter. I did one of these for a my first serious professional project back in 1968/69. AFAICR is was 6 or 7 bits. I only had 5% resistors available. But I did have a kickass DVM available. So I soldered a bunch of resistors in a long chain, applied a stable voltage and measured and noted the voltage drop across each resistor. Then I sorted them in order of relative resistance and picked an optimum combination.
@bbqgiraffe3766
@bbqgiraffe3766 Год назад
3:40 oh wow, this is exactly how a 6522 VIA is programmed, I didn't realize my Arduino was so similar to my homebrew 6502 computer, cool
@thebirdwatchingbloke3991
@thebirdwatchingbloke3991 Месяц назад
Will this be functional with music or just test tones?
@U8uxa8SP
@U8uxa8SP 3 года назад
Thanks for the video, I enjoyed it.
@iamNaddy_
@iamNaddy_ 16 дней назад
Where can I get the source code and full review of the schematic diagram..??
@hardware4200
@hardware4200 3 года назад
Nice demo!
@element14presents
@element14presents 3 года назад
Glad you think so!
@jorgeaalmeida29
@jorgeaalmeida29 2 года назад
Congratulations ! Very good video. One question, please. Can I use this to audio? What is the high frequency possible? Thanks
@iggynub
@iggynub Год назад
0:56 Isn't more bits purely the scale of assignable amplitude? Isn't 5:15 the digital version? I'd like to see the 8 bit sine on an oscilloscope after it is converted to analog.
@snytty
@snytty 11 месяцев назад
Does this cross 0v so it doesn't bias the audio signal by +2.5v?
@Rob_III
@Rob_III 3 года назад
@0:58: 6 bits is 64, 8 bits is 256.
@adambeedle
@adambeedle 3 года назад
Great video 👍
@ytubeleo
@ytubeleo 2 года назад
At 05:15, this appears to be 2-Bit (4 values) rather than 4-Bit (16 values).
@dirkgiglot912
@dirkgiglot912 2 года назад
I noticed this too. Serial ports Rx & Tx are the problem here. By using 2 Arduino's, one to generate and another to analogRead the signal it works correct.
@005Ash
@005Ash 3 года назад
The delay() function pauses the program, is it still improves stability that way? 4:45
@soggybottomboys2792
@soggybottomboys2792 2 года назад
Time to see why 256 actually looks like 😂! I wouldn’t mind seeing a video on how this effects audio quality either
@jandupreez3759
@jandupreez3759 2 года назад
Oh my goodness 😍😍
@johnmarquez7413
@johnmarquez7413 3 года назад
thx
@topgearIQ
@topgearIQ 2 года назад
Good
@urmasjoeleht5293
@urmasjoeleht5293 3 года назад
This "zooming in" to 12 bits waveform shows pixels of screen, not 12bits DAC steps. Unless you have screen resolution with 4096 vertical lines. Nice video anyway :)!
@rezer1024
@rezer1024 3 года назад
The jaggedness of the pixels isn't what she's referring to, but rather the slight waviness of the line that's similar to the previous stair-stepping of the output but on a scale of 4-5 pixels per step.
@pracheerdeka6737
@pracheerdeka6737 2 года назад
Why dont we use 1 resistor set at maximum loudest point
@riccardo1796
@riccardo1796 3 года назад
Will it work with my SoundRocks™ and solid gold speaker bus bar?
@odissey2
@odissey2 2 года назад
It is not possible to achieve 12-bit resolution using R2R ladder and simple microcontroller. The problem lies in the resistors mismatch. Theoretically, even to achieve 8-bit resolution, 0.1% resistors are needed. But that is only part of the problem - the uC pins all have output resistances variation in the range of 100-200 oHms which adds to the mismatch error. Then take into consideration the pin voltage,Vdd, which is not very stable (typ 1-5% noise). There's more errors coming from the high-speed glitches due to pins risetime / falltme mismatch. In practice, 4-7 bits of resolution is achievable, depending on the update rate. What was shown here was at best 7-bit resolution in nearly static conditions. After falling into a pitfall and making few R2R DACs myself, I advise not to utilize such approach - a simple PWM DAC is more than adequate for the Arduino users, and saves a ton of digital pins on uC!
@vajskidsconsoles2005
@vajskidsconsoles2005 2 года назад
Look at E-Tims 2007 R2R DAC for N64 to get digital RGB to Analogue, for a laugh. It's being commercialised. He compressed the shift register and D flip flops into a single CPLD but it's still using R2R.
@deang5622
@deang5622 2 года назад
It's why no one ever practically makes a discrete R/2R ladder network DAC. Covered it in a lecture at degree level in about 10 minutes. Never thought anyone would be stupid enough to make one and then try and teach people how to do it. It's pointless, it has no value, not even from a teaching perspective.
@markderlo212
@markderlo212 Год назад
nice; two notes: - when you change resolution you movevtge jumper wire, but you do nit show on schematic which one... - would be good to actually see the dac output on oscilloscope as well ; plot from serial is still ‘software’, we need real hardware signal, dont we?
@TheHelp22
@TheHelp22 3 года назад
Question about the code. You step through i from 0 to 360 by 1 to calculate your sign wave. That is 360 steps. Shouldn't you have used MAX_12_BIT_NUM as the number of steps between 0 and 360? It still looks okay because you showed graphs of 8bit (255) and 12bit (4095)... I wonder if 10bit (1023) would look the same as 12bit because they both would have been truncated to 360 steps by your loop.
@maker_karen1785
@maker_karen1785 3 года назад
I’m honestly not sure. Jeff wrote that part of the code and I didn’t fully understand how it worked. But since I was trying to create an arc 360 sounded right at the time.
@stnwrd
@stnwrd 2 года назад
Could you please demonstrate a 12 bit DAC without the use of an Arduino please?
@Sidman723
@Sidman723 3 года назад
Hey Karen, I met you at the Milwaukee Maker Faire a few years ago. Will you be at the one for this year? I plan to be there. Maybe I will bring my rPi mini Arcade.
@maker_karen1785
@maker_karen1785 3 года назад
Yes. I’ll be working on the Powerwheels track helping run the races.
@awaazmatroko5972
@awaazmatroko5972 3 года назад
Nice! Using any board, low budget , audio DSP 24bit 96khz, ADC- DAC, with room correction, pls if any do respond. Thanks
@petrbucha5762
@petrbucha5762 3 года назад
super video😍👍🚂😉🍻
@arnelcondino2634
@arnelcondino2634 3 года назад
Hi Karen
@maxpolaris99
@maxpolaris99 3 года назад
Ok Teach!
@momomunsta8887
@momomunsta8887 2 года назад
"Smooth and Siny" is t shirt material
@RussCottier
@RussCottier 3 года назад
ADCs are not stairstep! 🤯 yes stairstep exists in sample hold. But it’s a bad way to explain ADC.
@MoebiuZ
@MoebiuZ Год назад
Pi pico pwm
@freedomisfood6966
@freedomisfood6966 2 месяца назад
And why 2r between r s .i dont have time think .just question for save my time😂😂😂😂
@softdorothy
@softdorothy 3 года назад
The programmer/nerd in me wants to declare the constants: MAX_4_BIT_NUM (1 >> 4) - 1 MAX_6_BIT_NUM (1 >> 6) - 1 MAX_8_BIT_NUM (1 >> 8) - 1 // etc.
@djm9937
@djm9937 3 года назад
So lovely, but all this is beyond my understanding
Далее
DAC using R-2R resistor ladder
22:38
Просмотров 110 тыс.
What is a 1-Bit DAC and How Does it Work?
19:31
Просмотров 13 тыс.
Using the ESP32 DAC - Voltages, Waveforms & Sounds
34:46
5 Ways To Generate A Sine Wave (Analog)
13:16
Просмотров 89 тыс.
How Do DACs Work? - The Learning Circuit
8:55
Просмотров 56 тыс.
RTR ladder DACs
8:15
Просмотров 32 тыс.
Arduino - Analogue Outputs
12:25
Просмотров 10 тыс.
How 555 timers Work - The Learning Circuit
7:48
Просмотров 516 тыс.
Dyson is Back… Why Do These Exist?
10:40
Просмотров 2,5 млн