{"id":850,"date":"2020-11-11T16:51:03","date_gmt":"2020-11-11T16:51:03","guid":{"rendered":"http:\/\/bassett.me\/mike\/blog\/wordpress\/?p=850"},"modified":"2020-11-19T15:54:57","modified_gmt":"2020-11-19T15:54:57","slug":"a-tale-of-two-noises","status":"publish","type":"post","link":"https:\/\/bassett.me\/mike\/blog\/wordpress\/electronics\/a-tale-of-two-noises\/","title":{"rendered":"A Tale of Two Noises"},"content":{"rendered":"\n<p>There are sometimes when noise is useful.  I find that when designing filter for instance that rather than using a swept frequency and an oscilloscope a noise generator and spectrum analyser can give you a better picture.<\/p>\n\n\n\n<p>There are two flavours of noise generator:  digital and analogue.  I have decided to rig up one of each and compare them.<\/p>\n\n\n\n<h2>Digital<\/h2>\n\n\n\n<p>My first circuit was the digital one as this was the easiest to implement as I didn&#8217;t have the parts for the analogue version.  I used an Arduino Due which has two 12 bit DACs and runs at 84MHz.  I combined the two outputs; DAC0 and DAC1 in a simple resistor network. and wrote a simple sketch.  You don&#8217;t need to set up the random number seed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" src=\"http:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Diagram-Image-1024x752.png\" alt=\"\" class=\"wp-image-854\" width=\"580\" height=\"425\" srcset=\"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Diagram-Image-1024x752.png 1024w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Diagram-Image-300x220.png 300w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Diagram-Image-768x564.png 768w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Diagram-Image-680x499.png 680w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Diagram-Image-740x543.png 740w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Diagram-Image.png 1474w\" sizes=\"(max-width: 580px) 100vw, 580px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"481\" src=\"http:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-noise-1-1024x481.png\" alt=\"\" class=\"wp-image-858\" srcset=\"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-noise-1-1024x481.png 1024w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-noise-1-300x141.png 300w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-noise-1-768x361.png 768w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-noise-1-1536x721.png 1536w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-noise-1-680x319.png 680w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-noise-1-740x347.png 740w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-noise-1.png 1898w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>The spectrom up to 400kHz and the waveform at 2mS \/ division<\/figcaption><\/figure>\n\n\n\n<p>Above is the result.  The spectrum at the top and the waveform below.  A white noise spectrum should be flat but this dips at 80kHz intervals.  If you inspect the waveform at a faster sweep you can see why.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"485\" src=\"http:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-faster-1024x485.png\" alt=\"\" class=\"wp-image-860\" srcset=\"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-faster-1024x485.png 1024w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-faster-300x142.png 300w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-faster-768x364.png 768w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-faster-1536x728.png 1536w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-faster-680x322.png 680w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-faster-740x351.png 740w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Digital-faster.png 1857w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>The waveform 50uS \/ division<\/figcaption><\/figure>\n\n\n\n<p>It consists of a sequence of square topped periods.  This is to be expected and according to Harry Nyquist this limits use to half the sampling pulse rate; in this case about 40kHz.  If you&#8217;re only dealing with audio this is more than adequate.<br>If you want to create a digital noise generator the clock rate has to be double the intended bandwidth. To get large bandwidths requires high speed logic.<br>Another drawback is that the amplitude dynamic range is not very good.<\/p>\n\n\n\n<h2>Analog<\/h2>\n\n\n\n<p>For the analogue version I found a good circuit online.<\/p>\n\n\n\n<p>It looks a bit unusual because T2 has only two terminals connected and those are reverse biased.  The circuit uses the emitter &#8211; base junction as a very noisy Zener diode.  I&#8217;ve tried this with other transistors without much success.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1018\" height=\"1024\" src=\"http:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-Noise-1-1018x1024.png\" alt=\"\" class=\"wp-image-872\" srcset=\"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-Noise-1-1018x1024.png 1018w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-Noise-1-298x300.png 298w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-Noise-1-150x150.png 150w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-Noise-1-768x772.png 768w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-Noise-1-680x684.png 680w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-Noise-1-740x744.png 740w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-Noise-1.png 1088w\" sizes=\"(max-width: 1018px) 100vw, 1018px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"480\" src=\"http:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analog-noise-1024x480.png\" alt=\"\" class=\"wp-image-866\" srcset=\"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analog-noise-1024x480.png 1024w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analog-noise-300x141.png 300w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analog-noise-768x360.png 768w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analog-noise-1536x719.png 1536w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analog-noise-680x319.png 680w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analog-noise-740x347.png 740w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analog-noise.png 1898w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"477\" src=\"http:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-faster-1024x477.png\" alt=\"\" class=\"wp-image-868\" srcset=\"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-faster-1024x477.png 1024w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-faster-300x140.png 300w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-faster-768x358.png 768w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-faster-1536x716.png 1536w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-faster-680x317.png 680w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-faster-740x345.png 740w, https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-content\/uploads\/2020\/11\/Analogue-faster.png 1892w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This is what a good noise generator should look like.  Notice that the spectrum goes all the way up to 25MHz without any humps.  It probably goes quite a bit further but my &#8216;scope doesn&#8217;t.  The lower waveform as at 10uS \/ division just to prove that it doesn&#8217;t have flat tops.  My scope can&#8217;t display much higher frequencies.  <br>The analogue generator is only really limited by the gain-bandwidth of the transistor.<\/p>\n\n\n\n<h2>Conclusion<\/h2>\n\n\n\n<p>If you want a good, simple, white noise generator it has to analogue.  If, like me, you are a little impatient and have the parts around the digital version can serve well at lower frequencies.  Digital noise generators are far more expensive, but a professional model has functions I can&#8217;t imagine using.  I also want my Arduino Due back.<\/p>\n\n\n\n<p><strong>Postscript<\/strong><br>Simon Monk made a suggestion that improves the bandwidth of the digital version using the following sketch:<br><br>void setup() {<br>  analogWriteResolution(12);<br>  while(true) {<br>    analogWrite( DAC0, random(4096)); <br>    analogWrite( DAC1, random(4096)); <br> }<br>}<br>void loop() {}<br><br>This improves the bandwidth by about 30%.<br>you can find out about Simon Monk at simonmonk.org<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are sometimes when noise is useful. I find that when designing filter for instance that rather than using a swept frequency and an oscilloscope a noise generator and spectrum&nbsp;[&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-json\/wp\/v2\/posts\/850"}],"collection":[{"href":"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-json\/wp\/v2\/comments?post=850"}],"version-history":[{"count":5,"href":"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-json\/wp\/v2\/posts\/850\/revisions"}],"predecessor-version":[{"id":880,"href":"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-json\/wp\/v2\/posts\/850\/revisions\/880"}],"wp:attachment":[{"href":"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-json\/wp\/v2\/media?parent=850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-json\/wp\/v2\/categories?post=850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bassett.me\/mike\/blog\/wordpress\/wp-json\/wp\/v2\/tags?post=850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}