{"id":2535,"date":"2015-12-21T14:52:26","date_gmt":"2015-12-21T14:52:26","guid":{"rendered":"http:\/\/www.richardmudhar.com\/blog\/?p=2535"},"modified":"2018-10-03T21:18:46","modified_gmt":"2018-10-03T21:18:46","slug":"12v-led-sound-to-light-or-color-organ","status":"publish","type":"post","link":"https:\/\/www.richardmudhar.com\/blog\/2015\/12\/12v-led-sound-to-light-or-color-organ\/","title":{"rendered":"12V LED Sound to Light or Color Organ"},"content":{"rendered":"<p>I made a couple of sound to light units at school and university many years ago.<\/p>\n<figure id=\"attachment_2536\" aria-describedby=\"caption-attachment-2536\" style=\"width: 550px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/RadioShack_ColorOrgan_1977.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2536\" src=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/RadioShack_ColorOrgan_1977-550x373.jpg?resize=550%2C373\" alt=\"1977 - around the time when I started making my first sound to light\" width=\"550\" height=\"373\" srcset=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/RadioShack_ColorOrgan_1977.jpg?resize=550%2C373&amp;ssl=1 550w, https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/RadioShack_ColorOrgan_1977.jpg?resize=624%2C423&amp;ssl=1 624w, https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/RadioShack_ColorOrgan_1977.jpg?w=711&amp;ssl=1 711w\" sizes=\"auto, (max-width: 550px) 85vw, 550px\" \/><\/a><figcaption id=\"caption-attachment-2536\" class=\"wp-caption-text\">1977 &#8211; around the time when I started making my first sound to light<\/figcaption><\/figure>\n<p>Not much has changed about the technology, but on the display side LEDs are made for these &#8211; not only do we now have the chance of running the system at 12 or 24 V but we can avoid all the fun and games with mains triacs and pulse transformers &#8211; I got several mains shocks in those days, because while I optoisolated the main circuit from the triacs using MOC3020 opto-triacs the metal tabs on the triacs were live via the lamps, and on the same circuit board&#8230;<\/p>\n<p>Now the Chinese make these things to drive LEDs by the millions on ebay and Amazon, and the sound to light is usually an add-on to a box designed to set moodlighting by colour with a remote control. And the sound to light function is crap on the two I&#8217;ve tested &#8211; I sent one back to Amazon because it was so dreadful it wasn&#8217;t worth the \u00a312, although the cheaper Chinese device I have the light chase mode is acceptable.<\/p>\n<figure id=\"attachment_2538\" aria-describedby=\"caption-attachment-2538\" style=\"width: 546px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_lancaster.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2538\" src=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_lancaster.jpg?resize=546%2C203\" alt=\"Lancaster's original article\" width=\"546\" height=\"203\" \/><\/a><figcaption id=\"caption-attachment-2538\" class=\"wp-caption-text\">Lancaster&#8217;s original article showing the filter design<\/figcaption><\/figure>\n<p>There&#8217;s not much that has changed about the filtering from <a href=\"http:\/\/www.tinaja.com\/glib\/psycclrg.pdf\">Don Lancaster&#8217;s 1970s<\/a> article &#8211; sure we can use opamps or DSP but the essentials are still the same half a century later. I want to use proportional PWM control with the LEDs. <!--more-->There are many designs of sound to light on the internet &#8211; the <a href=\"http:\/\/makezine.com\/projects\/easy-led-color-organ\/\" target=\"_blank\" rel=\"noopener\">simplicity of this one<\/a> is appealing but won&#8217;t scale to higher power, and a plus in the 1970s was the slow response of filament lamps &#8211; without some sort of smoothing LEDs can easily get a flickery irritating mess. Some flicker is part of the territory with a sound to light unit, but it is worse with LED displays.<\/p>\n<h4>Analogue or digital?<\/h4>\n<p>It&#8217;s possible to do PWM in the analogue domain using a ramp sliced by comparators, but an Arduino or a PIC would do this well, and allow me to do some AGC. Modern music is much more compressed than it used to be due to the<a href=\"https:\/\/en.wikipedia.org\/wiki\/Loudness_war\" target=\"_blank\" rel=\"noopener\"> loudness wars<\/a> so AGC isn&#8217;t as necessary now than it was in the 1970s and 80s. However, using a microcontroller lets me consider per-channel AGC which would be clumsy in the analogue domain.<\/p>\n<p>Conversely, the active filtering is easiest and best done analogue &#8211; it would still thrash a microcontroller to do the audio filtering, and it&#8217;s just not that demanding. Going all digital requires heroics of coding <a href=\"http:\/\/www.technology.niagarac.on.ca\/people\/mcsele\/Colorgan.html\" target=\"_blank\" rel=\"noopener\">or DSP<\/a> &#8211; it&#8217;s hard to beat a quad opamp IC and handful of cheap parts. This then goes into a half-wave rectifier\/peak detector.<\/p>\n<figure id=\"attachment_2537\" aria-describedby=\"caption-attachment-2537\" style=\"width: 540px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_msg7.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2537\" src=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_msg7.png?resize=540%2C273\" alt=\"the MSG7 frequency response isn't exactly what I want\" width=\"540\" height=\"273\" \/><\/a><figcaption id=\"caption-attachment-2537\" class=\"wp-caption-text\">the MSG7 frequency response isn&#8217;t exactly what I want<\/figcaption><\/figure>\n<p>I did consider using an MSGEQ7 seven band spectrum analyser chip which uses switched capacitor filters, and has the peak detectors already, but the response isn&#8217;t really right although I&#8217;d probably get away with it. For instance using just the 160Hz, the 400 and the 2200Hz bands would be close.<\/p>\n<figure id=\"attachment_2543\" aria-describedby=\"caption-attachment-2543\" style=\"width: 550px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_cookbookIMG_3926.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2543\" src=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_cookbookIMG_3926-550x364.jpg?resize=550%2C364\" alt=\"a well-used copy of Don Lancaster's Active Filter Cookbook\" width=\"550\" height=\"364\" srcset=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_cookbookIMG_3926.jpg?resize=550%2C364&amp;ssl=1 550w, https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_cookbookIMG_3926.jpg?resize=624%2C412&amp;ssl=1 624w, https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_cookbookIMG_3926.jpg?w=640&amp;ssl=1 640w\" sizes=\"auto, (max-width: 550px) 85vw, 550px\" \/><\/a><figcaption id=\"caption-attachment-2543\" class=\"wp-caption-text\">a well-used copy of Don Lancaster&#8217;s Active Filter Cookbook<\/figcaption><\/figure>\n<p>I have Don Lancaster&#8217;s Active Filter Cookbook from 1979 and he cites the filter he used if fig 7.15. It contains some bizarre values like 56nF, I&#8217;ve never seen a 56nF capacitor in Europe, we go either 47n or 68n.<\/p>\n<figure id=\"attachment_2544\" aria-describedby=\"caption-attachment-2544\" style=\"width: 550px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_7-15_IMG_3927.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2544\" src=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_7-15_IMG_3927-550x433.jpg?resize=550%2C433\" alt=\"Lancaster's mid-frequency example, with some rum oddball values for the resistors and capacitors\" width=\"550\" height=\"433\" srcset=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_7-15_IMG_3927.jpg?resize=550%2C433&amp;ssl=1 550w, https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_7-15_IMG_3927.jpg?resize=624%2C491&amp;ssl=1 624w, https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_7-15_IMG_3927.jpg?w=640&amp;ssl=1 640w\" sizes=\"auto, (max-width: 550px) 85vw, 550px\" \/><\/a><figcaption id=\"caption-attachment-2544\" class=\"wp-caption-text\">Lancaster&#8217;s mid-frequency example, with some rum oddball values for the resistors and capacitors<\/figcaption><\/figure>\n<p>However this isn&#8217;t a challenging application, so I scaled his filters to use more common values &#8211; the simulated frequency response is<\/p>\n<figure id=\"attachment_2545\" aria-describedby=\"caption-attachment-2545\" style=\"width: 510px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_actfilt.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2545\" src=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_actfilt.jpg?resize=510%2C363\" alt=\"LTSpice simulation\" width=\"510\" height=\"363\" \/><\/a><figcaption id=\"caption-attachment-2545\" class=\"wp-caption-text\">LTSpice simulation<\/figcaption><\/figure>\n<p>The schematic is simple enough. In past sound to light units I had used simple low-pass and high-pass filters for the red and green channels, however I had spotted that the HF channel in particular tended to go off excessively. At the low end we don&#8217;t have turntable rumble to contend with any more, but due to the way the ear&#8217;s sensitivity falls with low frequencies and the fact I have no subwoofer on the PA losing ultra low frequency sensitivity is no bad thing. I used a quad opamp to buffer the input signal via a master gain control and then three linear pots into the remaining three opamps to buffer the pots and give a low impedance source into the filters as opposed ot having the pot position (and hence resistance) vary the filter shape.<\/p>\n<figure id=\"attachment_2547\" aria-describedby=\"caption-attachment-2547\" style=\"width: 529px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_filtschem.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2547\" src=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_filtschem-529x550.png?resize=529%2C550\" alt=\"filter bank schematic\" width=\"529\" height=\"550\" srcset=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_filtschem.png?resize=529%2C550&amp;ssl=1 529w, https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_filtschem.png?w=608&amp;ssl=1 608w\" sizes=\"auto, (max-width: 529px) 85vw, 529px\" \/><\/a><figcaption id=\"caption-attachment-2547\" class=\"wp-caption-text\">filter bank schematic<\/figcaption><\/figure>\n<h4>500Hz is a nice breakpoint to shift from analogue to digital<\/h4>\n<p>After the envelope detectors\u00a0 variations in the peak detected signal are slow enough to hand off to the microcontroller using three A\/D channels. The LF channel is also about right to feed a bass beat detector, which is an attractive thing to do digitally because of the lower frequencies &#8211; analogue active filters get unwieldy below about 50Hz, and I can use<a href=\"http:\/\/dpeckett.com\/beat-detection-on-the-arduino\"> ideas like this easily<\/a>, sampling at a much lower rate to my Arduino has time to do other stuff.<\/p>\n<h4>Analogue design is a lot faster than coding for me<\/h4>\n<p>I am reasonably experienced with both, but analogue design speed beats coding hands down in this simple application. I had the active filter designed and constructed on Veroboard in half a day, but I also need this project in service in a few days. So although I could break out the Arduino or a PIC I was so close to getting an output without any coding. I used a sawtooth ramp, sliced with the rectified output of the filters. In practice the display looks better if low signals don&#8217;t cause any light output, so I put 0.6V of lift on the sawtooth to give a 1.2V dead band since the signal also has to overcome the 0.6V forward drop of the rectifier diodes. So I now have a proportional control sound to light suited to 12V running.<\/p>\n<figure id=\"attachment_2550\" aria-describedby=\"caption-attachment-2550\" style=\"width: 550px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2018\/10\/e1077_sound2light.pdf\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"wp-image-2550 size-medium\" src=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_rectifier-slicer-550x275.png?resize=550%2C275\" alt=\"the rectifier-slicer. One oscillator and ramp generator serves three rectifier-slicers - the bottom part ofthe circuit is replicated for each channel\" width=\"550\" height=\"275\" srcset=\"https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_rectifier-slicer.png?resize=550%2C275&amp;ssl=1 550w, https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_rectifier-slicer.png?resize=624%2C312&amp;ssl=1 624w, https:\/\/i0.wp.com\/www.richardmudhar.com\/blog\/wp-content\/uploads\/2015\/11\/1511_rectifier-slicer.png?w=746&amp;ssl=1 746w\" sizes=\"auto, (max-width: 550px) 85vw, 550px\" \/><\/a><figcaption id=\"caption-attachment-2550\" class=\"wp-caption-text\">the rectifier-slicer. One oscillator and ramp generator serves three rectifier-slicers &#8211; the bottom part of the circuit is replicated for each channel. A common anode lighting rig is used<\/figcaption><\/figure>\n<p>It worked well &#8211; one thing I discovered is much of the effect of a sound to light is from the physical displacement of the lamps, as the different colours, so it works better with clusters of coloured 3W LEDs on a bar rather than one of those Chinese RGB light strips. Conversely the light strips work well for a colour chaser, better than discrete LED lamps IMO.<\/p>\n<p>Pretty much all RGB LED lamps and strips I have come across are common anode switched against ground so I could use NMOSFETs to ground. I used 1W star LEDs in series with 12\u03a9 ballast resistors for the main display &#8211; three each for green and blue and four red due to their lower Vf. I would say 3W of LEDs is not enough &#8211; these things are dirt cheap from China via Ebay so I may get about 30 of each colour to pump it up a bit.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I made a couple of sound to light units at school and university many years ago. Not much has changed about the technology, but on the display side LEDs are made for these &#8211; not only do we now have the chance of running the system at 12 or 24 V but we can avoid &hellip; <a href=\"https:\/\/www.richardmudhar.com\/blog\/2015\/12\/12v-led-sound-to-light-or-color-organ\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;12V LED Sound to Light or Color Organ&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[57],"tags":[],"class_list":["post-2535","post","type-post","status-publish","format-standard","hentry","category-electronics"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5aOO7-ET","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.richardmudhar.com\/blog\/wp-json\/wp\/v2\/posts\/2535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.richardmudhar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.richardmudhar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.richardmudhar.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.richardmudhar.com\/blog\/wp-json\/wp\/v2\/comments?post=2535"}],"version-history":[{"count":15,"href":"https:\/\/www.richardmudhar.com\/blog\/wp-json\/wp\/v2\/posts\/2535\/revisions"}],"predecessor-version":[{"id":3586,"href":"https:\/\/www.richardmudhar.com\/blog\/wp-json\/wp\/v2\/posts\/2535\/revisions\/3586"}],"wp:attachment":[{"href":"https:\/\/www.richardmudhar.com\/blog\/wp-json\/wp\/v2\/media?parent=2535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.richardmudhar.com\/blog\/wp-json\/wp\/v2\/categories?post=2535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.richardmudhar.com\/blog\/wp-json\/wp\/v2\/tags?post=2535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}