LEDs, Microcontrollers, and Microphones - The World’s Most Complicated Backsplash?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
do you like projects that involve a  strange premise hundreds of hours of   electronics development and way way too much money  invested maybe mix in a little embedded software   development and some Home Improvement just for fun  and of course RGB LEDs if so I think you're going   to want to stick around for this one I'm Zach  and you're watching Zack of all Trades [Music] [Music] a few months ago we started a remodel  of our entire kitchen cabinets counters floors   backsplash the whole thing really the kitchen  has a main counter section with a large sink   there's also this detached bar area this has  a small sink an instant hot water dispenser   it's a place ideal for making tea coffee perhaps  your favorite cocktail now naturally this needs   a backsplash and since it's smaller and on the  other side of the kitchen from the main counter   section we decided to go for something a little  more bold we settled on dark blue glass hexagonal   mirror tiles from a big box Home Improvement  store we brought one home to check it out in the space so I think this backsplash would look pretty  great here as is but I got to thinking each of   these tiles is a piece of glass that is painted  reflective on all the edges if I were to add an   individually controlled led to each of these tiles  it would make something of a display on this wall   I pondered this for a while had another Revelation  if I were to add some sort of feedback where I   could tell which tile had been touched I could  program interesting effects things like ripples   from where you touch the wall I could even program  the game of snake and play it on my backsplash   I'm going to guess I'm the only person who's ever  said that before let's talk about how I plan to do   this the LEDs are the simpler part I'll be using  addressable LEDs they're known by several names   the most famous of which is probably neopixels  these are the LEDs that usually make up things   like RGB LED strip lighting panel lights Etc the  actual part numbers are ws2812 sk6812 SK 6805   stuff like that I'm sure there are others these  things come in a wide variety of packages but they   all contain red red green and blue LEDs sometimes  white LEDs as well as a digitally controlled   constant current driver I actually bought around  10 different shapes of surface mount LEDs to see   which would work the best but I settled on a tiny  SMD package just 1.4 mm Square I'll get into how   these are controlled later but how do I tell if  a tile has been touched or not I considered a few   options such as perhaps a photo down light sensor  or an accelerometer these both came with issues   though a photo diod would respond to changes in  light however I was unsure that touching a tile   would block enough light to be distinguishable or  that sunlight streaming through a window wouldn't   throw off the results an accelerometer may have  worked but they're generally more expensive and   require physical displacement to generate a signal  while I likely could have found one sensitive   enough I believe there's a better solution I  settled on a small microphone these mean all the   requirements they're small as evidenced by the one  I'm currently holding in my fingers they're cheap   and they should be very sensitive to perturbations  the idea is to couple each microphone to a tile   when the tile is tapped a sound wave will be  generated in the material which will excite the   microphone I'll then find the difference between  the maximum signal and the minimum signal Engage   The amplitude of the tab now this should fall off  as a function of radius so the tile touched should   be the loudest and those around it less loud I'm  hoping that the similar materials like the grout   between the tiles will attenuate the sound so that  it is obvious which tile has been touched so we've   got an LED and a microphone on each tile how do we  implement it all together let's draw it out okay   so we have our tile here to each tile we'll Bond  the LED with red green and blue components as well   as the digital control chip we'll then attach one  of these small microphones and now we'll duplicate   this over and over again for each tile but how  many tiles are there this area is trapezoidal   with a base width of 46 and 1/4 in and Heights of  35 and 3/4 and 69 and 1/4 in doing a quick area   calculation shows a total of 2,428 square in now  each sheet of tile contains 16 tiles and is about   12 in by 10 1 12 in or 126 Square in this means  I'll need 2,428 divided 126 tiles or about 20   sheets of 16 tiles that's 320 tiles and I'm not  accounting for Edge Cuts so this is going to be   a lot of soldering on to how the electronics will  work first these addressable LEDs have just four   connections on them there's the obvious power and  ground as well as a data input and a data output   the LEDs are strung together such that the first  led in the string has its data input connected to   the output of whatever is controlling the entire  string of LEDs all LEDs after the first one have   their data input connected to the data output of  the LED that came before it as such you actually   only need three wires to connect up an entire  string of LEDs these SK 6805 LEDs and this is   generally the same for the neopixels such as the  sk6812 and the ws2812 they require a clock signal   sent to them at around 800 khz now typically you'd  imagine a clock signal with 50% duty cycle that is   the amount of time the clock is high and low is  symmetric however here we're actually going to   use use an asymmetric clock signal to encode the  data right into the clock to Signal a logical zero   we'll send a clock that is low for 88 microc and  high for 32 microc to Signal a logical one will   give it a signal that is high for 74 microc and  low for .46 micros these values come straight from   the data sheet for the SK 6805 ec14 the exact LED  I'm using and even though the data sheet is not in   English I can at least still read these numbers  note that both of these add up to 1.2 micros the   period that represents one clock cycle at 800 khz  now these values are given in the data sheet as   ranges and some of the data sheets for the SK  685s even l a tolerance on the frequency I'll   be exploring this later to get a lower clock rate  so we've got this string of clock signals with the   data encoded in them what we need to do is send  24 bits of data representing the 8bit values for   the brightness of the green red and blue LEDs in  the string in that order each LED will block the   signal from reaching the subsequent LEDs until it  has had its fill of 24 bits basically if we have   10 LEDs and each LED requires 24 bits we'll need  to send a total of 240 bits the first led will   receive the signal and will record the first 24  bits it sees all while not forward anything out of   its data output so of the second LED and all the  ones after that we'll hear absolutely nothing of   those first 24 bits once the first led has had its  fill of 24 bits it will afford anything else it   gets straight through and it won't pay attention  to those bits the second LED will then see these   next 24 bits the second 24 bits as the first thing  it sees so it's going to do the exact same thing   the first led did it will record the first 24  bits won't forward anything along during that   and then once it's had its fill of 24 it will  forward anything else it sees straight through   each LED will do this in succession recording the  first 24 four bits then passing the rest on so   that a theoretically infinite number of LEDs  can be controlled off of just one wire there   are of course practical limitations such as the  power required to run infinitely many LEDs but   you know the number you're limit to is well on the  thousands when you're done assigning the values to   the LEDs you simply hold the clock line for 200  microc hold it steady and that tells the LEDs   to reset and start the process all over again note  that the values I've given or for the SK 6805 ec14   if you're using a different LED be sure to consult  the data sheet so now that I've handled commanding   the LEDs how do you de with the microphones each  microphone sends an analog signal that has a small   varying voltage perhaps just m Volts for a given  audio excitation in general analog signals are   sensitive to external noise parasitic capacitance  and inductance Etc so it's difficult to send them   over long wires uncontrolled environments besides  if I were to send each and every signal back I   would need 320 wires and not only am I too cheap  for that uh but microcontrollers wouldn't have   enough pins and frankly I don't want to run  all those signal wires so here's my thought   as discussed each LED will get its first clock  signal only after each of the LEDs before it has   already gotten its signal so if I send a response  back from each tile only when it gets its first   clock Edge then the responses should be returned  in the same order that the LEDs were commanded as   long as each response is short enough that it  occurs within that 2400 CL cycle span and the   signal Integrity is sufficient the main controller  can then just receive the signals and know which   microphone value corresponds to which tile  since they're all in order signal Integrity   is one of my main concerns here I'm worried that  the return signal will be garbled and unreadable   after passing through so many circuit boards  without decent impedance matching now this is   really a topic for another video uh and since I  don't know how big of a problem this is going to   be until I connect subboard and succession I'm  going to leave it at that for now implementing   this technique will look like this two LEDs will  be implemented onto each board with each board   straddling between two tiles this will save me  from having to build twice as many boards the   LEDs are easy there'll just be a wire to the data  input of the first LED and a trace on the circuit   board to forward that signal from the first led  onto the second each board will also contain   two microphones one to couples each of the two  tiles but now I need something to monitor these   microphones and report back the maximum voltage  swing from them as alluded to a microcontroller is   the obvious solution here but even the cheapest  part for a reputable company such as St micro   Electronics the stm32 c0 is 74 cents for quantity  250 parts now luckily well maybe luckily this   depends on your definition of luckily I follow  some Electronics forums there was recently some   Buzz about the cheapest microcontroller which  which turned out to be a onetime programmable   part for something like three CS now this one  works very well for my application because you   can only write it once and if I'm developing the  code you can bet I'm going to flash two or 300   attempts of software to it slightly after that  article however there was talk of another part   this time a flash based part called the puya p32  now these are cortex m0 plus parts much like the   stm32 c0 and they're available for around 10 cents  each in modest Quant of these even if I got the   highest end part a 64 pin part with substantially  more RAM and program memory it would only be 57   cents per P still cheaper than the cheapest stm32  c0 this is the perfect solution for around 10   cents per board I can read the microphones with  the internal analog to digital converters then I   can perform the math detect the amplitude and  use the interrupt pins connected to the LED's   data line to trigger a response back to the main  controller these even have a u peripheral so I can   use that to send the response back let's briefly  talk about Hardware selection every engineering   project has its constraints for electronics  development these are often things like cost   reliability size weight power development time  part availability etc etc etc depending on what   you're developing or who you're working for these  constraints can be radically different in my day   job for instance things like reliability and  schedule tend to dominate over things like   cost and size for this project the main drivers  are cost and development time although size is   also very important because circuit board cost is  proportional to the size of the circuit board so   the smaller the board the cheaper I can buy them  the lower the cost as mentioned I chose the SK   6805 ec14 LED which is tiny thin and should have  no issue going between the tiles for microphones I   chose the ZTS 6156 these are analog output surface  mount devices that are slightly smaller than 2x3   millim they have their audio port on the bottom  side and have an internal preamplifier but they   do require external amplification to be read  directly by the microcontrollers analog the   digital converter for that amplification I'm using  a coign cosos 722 dual opamp by using a dual opamp   I can put only one extra part on the PCB finally  the microcontroller I selected is the p32 F0 02   in a qfn 16 package that is only 3 mm Square  I ordered 500 of all these and that quantity   basically every part came out to 10 cents each I  also bought a bunch of passive components these   all came from reputable companies and they  actually end up costing more than all of the   active Parts PCB selection was something that I  noodled on for a while I wanted to mount the LEDs   to the size of the tiles you know where the grout  would ordinarily be the back of the tile is opaque   and besides if the LED was shining through the  back of the tile it would just look like a spot   of light in the middle of the tile rather than  really making the whole tile glow originally I   thought I'd have a thin long board that would  go sideways in between the tiles with all the   components on either side of it I quickly realized  this was overly optimistic though because the gap   between the tiles which is supposed to be an  eight of an inch is actually a little under   that and it's just not sufficient room for all  that a standard PCB thickness is about 1 16 of   an inch so that only leaves about 1/16 of an inch  left for components I also had some scope creep   which meant that I needed to put more components  on the circuit boards meaning I needed more board   space so even if it would have fit in the crack I  don't think I could have put enough in that much   area I settled on flexible pcbs my favorite low  volume vendor Ash Park offers these for $10 per   square inch for three copies of a board meaning  they could be affordable as long as I keep them   small I may explore even cheaper options for PCB  fabrication for the full build with a flex PCB I   can have a large area parallel to the tiles where  the bulk of the components will go then I'll have   the LEDs out on these little arms I'll simply Flex  the arms to 90° slide them in the space between   tiles and glue them in place some other little  details to join the pcbs I'll be using ribbon   cable I already a full spool of 26 gauge four  conductor from 3M that is only about 2/10 of an   inch wide I'll strip the insulation and solder it  directly to the pcbs there was a slight issue with   voltage levels the microphones want 1.5 to 3.6  volts whereas the LEDs specify 3.7 to 5.5 volts   notice that there's no overlap here because the  current draw of the microphones is so low however   I'm going to try to get away with just using a  resistor divider to drop the 5 volts into the   microphone's range the microcontrollers actually  specify 1.7 to 5.5 volts this is actually larger   than the stm32 parts which don't tolerate 5 volts  input voltage meaning that these 10 cents parts   were actually the better choice for this project  there's another question regarding microphone   orientation the microphones I've chosen have their  sound Port coming out the bottom basically through   the circuit board I'm hoping to block that Port  off and then just couple the metal case of the   microphone right to the tile it remains to be  seen if this is going to perform well enough   okay let's jump into key Cad and let's take a look  at the actual schematic first the LEDs not much to   see here just data in the intermediate signal  data out the ins and outs are over here where   the ribbon caes mate these are custom Footprints  I made to match the ribbon cable pitch I added   decoupling capacitors anywhere the power rails  intersected apart including the ribbon cables   next is the microphones they're simple they're  just a voltage in ground and log out you can see   the divider here also note that when I calculated  the resistance values for these resistors I had to   take into account the current the microphone was  consuming I couldn't just use the normal resistor   divider equation as that would have given me  erroneous values the microphone outputs feed   into the Dual operational amplifier both sides of  this are identically configured both in inverting   mode I'm using another resistor divider to set  the common mode voltage to half of the 5vt rail   there's a simple debug LED over here and finally  the microprocessor most of the micro or signals or   simply run to and from their corresponding pins I  just had to make sure that the microphone signals   went to two of the ADC channels the LED signals  went to non-conflicting interrupt pins and the   uart was in the right place also don't forget to  pull the boot zero line down or nothing is going   to work I broke the remaining pins out to small  circular test pads just in case I needed them   for unforeseen reasons I've put the serial debug  connections on test points as well so I can solder   away to them and plug it right into my debugger  hopping over to the layout we can see the unusual   board design with the two arms each arm has LEDs  on opposite sides that way when I bend the arms   to 90° the LEDs will Point opposite directions  one into each tile these boards are only 1 in by   3/4 of an inch making them 3/4 of a square inch  meaning they're going to cost many $2.50 each   the front s has the microphones the debug LED and  the test points now this proved to be a bad idea   putting the connections on this side because once  I glued the circuit board onto a tile I could no   longer access any of these the back side contains  everything else the pads for the ribbon cable the   processor the opamp and nearly all of the passive  components I'm not going to go into depth into   circuit board layout it's certainly not my area  of expertise but I do find it quite enjoyable   it's an intriguing mix of engineering art and  puzzle solving for this board I prioritize the   important data out signal line I kept a wide  5volt Trace since all of the current for all   the LEDs in the string are going to be flowing  through this trace and I attempted to keep the   analog signal lines short and clean I also made  sure that the traces and copper fill were only on   one side of the arms where they're going to flex  this will help them bend easier since I don't need   to stretch or compress the copper on both sides of  the board to bend the arms so I put the ordinator   for the circuit boards now there's nothing to do  but wait while we're waiting for these boards to   come back we might as well talk briefly about the  software I plan to use an stm32 development board   such as the new Cleo boards that STM themselves  make and this is going to run the entire wall now   these are reasonably cheap and I only need one  because it will be substantially more powerful   than the py 32 I enjoy working with STM through2  Parts St microelectronics has great free tools   including an eclipse based IDE and a configuration  tool that can handle all of the work configuring   a uart or input output pins Etc there's also a  tremendous amount of online support for these in   forms stack Overflow even stuff like University  lectures this makes it very easy to get started   and learn the py 32 though uh let's just say it's  not exactly the same I found out about them from   Jay Carlson's blog but that's about the only  place on the internet that talks about them I   think uh Jay has a wee bit more experience than I  do with these types of things as well so I wanted   to implement them in the simplest possible way now  that meant I did things a little bit differently   for the ID I chose ke microvision which I believe  is arm's own IDE and you can download a copyright   from them free of charge to get started with a  board you're going to need a pack which I was   able to get from pu's website note that when you  go to their website all of the p32 documentation   is the same it's just in the same zip file so  download it and you'll get everything you need   for any of the p32 ports the pack is located in  there if you want to install it that way way and   when I originally started this I had to manually  add the pack but the latest time I installed micro   Vision I found that it was already there in this  ZIP file you can also find the text documentation   and it's 90% in Chinese although there are a  couple of data sheets and reference manuals in   English although there isn't one for the p32 f2a  there is a reference manual in English for the p32   f030 which is actually really well written and  applicable since they're both cortex arm zero   cores there's also libraries for the how drivers  and these look very familiar to stuff you might   have seen if you've worked with STM parts and  by very similar I mean very very simil so once   I had the pack and I linked all the libraries I  wrote some C code and everything worked perfectly   if only that were the case uh because that's not  true at all all of these tools I mentioned that St   has to make everything easy well none of those  exist for the p32 parts so I had to learn how   to manually initialize every peripheral now this  isn't particularly hard there's plenty of examples   even in the downloaded zip file you get from  their website there are good examples for each   the peripherals and these were extremely useful  but there were some other issues I ran into for   one I have both a knockoff stlink V2 programmer  as well as an official St link V3 I found out the   hard way that the official St links are locked to  STM products so I had to use the cheaper one here   I also learned and believe me this wasn't easy  to figure out that even though the Parts say   that they're good to 5.5 volts and indeed they  seem to work fine there they will not program   at 5 volts I had to drop the voltage to 3.3 volts  in order to get the code to flash I purchased a   couple of p32 f003 development boards very similar  to the f002 just with a few more peripherals and   by the way all the py 32 Parts the microphones  the LEDs and the opamps were all purchased from   LCSC now these development boards were really  nothing more than a breakout board board with   a regulator and a crystal and I happen not to  even use the crystal so before really diving into   this project I wanted to make sure that I could  get these to do anything at all and I use these   boards to do that I implemented stuff like serial  communication got the adc's reading values I was   able to configure the clocks appropriately and I  verified that the interrupt pins would work and   for the most part I was able to get everything  working to my satisfaction and moved forward   with the project although I was never able  to get the print F redirect to the uart if   I wanted to send serial message to a computer for  debugging purposes I end up doing it the hard way   by concatenating strings and C converting types  and then manually sending it all over the uart   I still haven't figured this out seems to be  something fairly deep in C and I don't know I   lost interest of course there are better ways to  debug than printing to the console so it wasn't   a huge loss now I'll probably do a whole video on  the puya series of Parts since there's so little   information out there and 10-c microcontrollers  could put out some crazy applications let me know   if you want me to push this up in the queue so  the boards have arrived and they're thin they're   flexible they look exactly like what I sent out in  other words they're perfect to populate these with   components I need a solder based stencil luckily I  have the perfect tool for this a 50 W fiber laser   engraver now this is meant for marking Metals but  it has no problem cutting through thin ones I have   absolutely no reason to own this laser it's very  expensive I just think they're cool and making   solder paste stencils is actually one of the main  reasons I used to justify it you can buy sld pay   stencils even cut out of metal for literally tens  of dollars this machine will never pay for itself   so I exported the appropriate key CAD layout  data as a scalable Vector graphic an SPG file   deleted the things I didn't want in inkscape and  I added a few little tabs back in I did this for   both sides of the circuit board and then I brought  it over to the laser I used lightburn here so I   just opened that up I applied the power and speed  settings for the material I'm using an 8,000 7 in   thick aluminum B business card now this is too  thick and it resulted in way too much solder but   it worked fine for the Prototype I didn't grab  the audio from the laser but this is actually a   laser cutting in real time so now I just align  the board to the stencil tape it on spread the   S paste in all of it is easier said than done I'm  using bismuth based solder paste here which melted   a very low temperature around 138 C I usually use  sn100c for conventional soldering but I find that   this temperature stuff works really well for LEDs  as those can melt pretty easily I'll then peel the   stencil off fix any solder paste areas that need  it and pop the components on throw this into the   oven real quick I'm using a controlo 3 that I  built from a kit out of a toaster oven now the   Kit's about $300 which does seem like a lot but  I believe these ovens work substantially better   than some of the other lowcost options and you do  get quite a complete kit for the money I already   have the profile set up so so all I have to do is  hit start now rinse and repeat for the other side   of the board and we're done well almost done I had  a couple of minor issues to fix for one there was   too much solder on some of the components  particularly on the thermal pad under the   microcontroller and this caused some of the pins  on the microcontroller to lift up and not connect   I removed this part with a hot air pen removed  some of the solder with the cering iron and pop   it back down I also had some solder bridges on  the op bound that needed correcting and one of the   parts was in backwards which was probably due to  my laziness with the silk screen I reworked this   by hand off camera I like to put out a video at  some point on some of the more advanced soldering   techniques something that you can do cheaply and  effectively in the home shop and we'll cover all   of this in more detail with the boards built  there was nothing left to do but apply power   and do a smoke check I started with the LEDs since  these didn't require me to code anything on the   p32 microcontroller and they worked great I then  brought up the p32 micr controller I checked out   the adcs the interrupt Etc but I think this video  is going on a little too long to start talking   about the software join me in the next one we'll  talk about it in detail now this project has been   tons of fun already I've learned a crazy amount  and that's one of the best parts of doing these   projects but there's still so much to do I need  to get the p32 code polished I'm still having some   issues with the microphones that I need to run  down and I need to take what I've learned with   the Prototype and design the actual final circuit  board uh not to mention I need to solder at least   160 of these things glue everything on the tile  and wire them up then there's the coding of the   controller to command LEDs and programming the  functions to do cool things like make ripples oh I   forgot about actually tiling the wall so if you're  enjoying this project and like the video please   consider subscribing we're going to be finishing  this project up and then there are many more   projects in a queue covering a wide variety of  topics thanks for watching and go make something
Info
Channel: Zach of All Trades
Views: 807
Rating: undefined out of 5
Keywords: diy, electronics design, rgb leds, backsplash, neopixels, PCB, Puya, Puya PY32, PY32, cheap microcontroller, electronics
Id: 3QHFTsDGk6E
Channel Id: undefined
Length: 27min 59sec (1679 seconds)
Published: Fri Feb 09 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.