Home Automation Hangout 2020-10-25: Light switches

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] grace [Music] good morning hang on i think i haven't oh no i have gone live have i i don't know i started obs and then i didn't actually click the go live button in youtube i think it's doing it automatically yes it seems to be so before we get into anything else i acknowledge the traditional owners of this land i pay my respects to their elders past and present and to aboriginal elders and peoples from other communities who may be taking part in this live stream today so hopefully you can hear me hopefully you can see me well actually no hopefully you can't see me hearing me is enough oh good thanks pancake it looks like we're alive that is something it looks like that behavior may have changed recently because what i used to have to do was start streaming out of obs and then in youtube studio click go live as well but it seems to be doing that automatically now so today is going to be about light switches at least until i see some squirrel running off into the distance and start chasing that but there's a lot we can talk about with light switches um oh chris just said i'm seeing and hearing nothing oh that's a worry but it looks like other people are so chris i don't know why that is uh hopefully it's something just that's just at your end okay everybody else is everybody else is seeing it hopefully you can get that figured out chris all right so uh i'm i was so rushed getting prepared for this that i was actually soldering headers onto a shield right before i had to rush over here and hit the buttons to go live which is why i'm all flustered right now and i haven't finished soldering it which means we get to do it you know while you're all watching just for a bit of added entertainment now okay i've got to take a breath and figure out where we're going to start with this right so one of the reasons that i decided to talk about light switches today is that there has been a lot of interest in this subject on the discord and there are a couple of very active discord members who have been working on a on an extension to my new light switch controller because that project has been kind of stalled for a while and people get tired of waiting so they go off and start fixing it themselves and i can't remember who it is i think it might be james kennewell um i think guru of nothing is involved anyway you can speak up so the other thing is that guru of nothing is building a house at the moment and is on the discord has been talking about wiring schemes and those sorts of things so the whole subject of light switches has been a bit of a hot topic recently and i i figured that i would try to resurrect a project that i started on a couple of years ago well there are multiple related projects ah dodgy yes so thanks frank it's um dodgy brothers who is building the house or is going to be soon and is working on the wiring scheme now interestingly i have just seen my views on youtube for this stream dropped to zero and hopefully there aren't any weird things going on i don't know whether the problems that chris was having with seeing the stream are indicative of something bigger that's going on maybe it's just weird glitches all right i am just going to assume that streaming is working and you can maybe hear me maybe okay thanks iot hof all right so let's back up a little bit and i'm going to explain a little bit of the context for uh for home automation light switches now for many of you who have seen some of my previous videos you will already understand this but there are people that probably haven't seen me talk about this before it's a couple of years really since i've done anything much related to light switches so the fundamental thing to understand to start with is that in a home automation system there are really two very distinct ways that you can set up your light switches and it partly depends on whether you're doing a retrofit or a build from scratch because doing a build from scratch gives you a lot more flexibility you can do things in a different way too if you're doing a retrofit at least unless you want to do a whole lot of rewiring and work taking an existing system and rejigging it so what happened with my house is because we were doing a big renovation and we tripped out all the plaster we were re-plastering rooms moving walls it was effectively a rewire so it was like wiring from scratch so there are two different ways you can do it with a traditional wiring scheme what happens is that power comes from the switchboard goes to so i'm talking about mains power here goes from the switchboard to the light switch the switch either makes or breaks the connection and then the cable goes from there to the load like the light or whatever it is and it's this switch that you're physically manipulating which is turning the load on or off the alternative way of doing it is having switches that do not control the load directly all they do is provide a logical input to the home automation system so the home automation system has direct control of the loads excuse me this is starting early today i hope this is not an indication of things to come so in that scenario what you do is have a home automation system that can control the loads using relays or it could be son-offs or whatever you know you've got some kind of device where your automation system has logical control over the output and that means that your switches that are on the wall don't need to actually switch any mains they just control surfaces it's just a user interface to talk to your home automation system and that gives you a whole lot more flexibility so what i'm talking about what i'm going to talk about here today is mostly that second method so using light switches as control surfaces and sending logical signals to your home automation system not necessarily directly controlling the mains although i'm going to cover that as well because there is a project i did a few years ago that i totally forgot about it's one that has never been shown on this channel before and it is this monstrosity of a thing this was my attempt at a smart switch a few years ago which directly controlled the mains so the idea is this is a direct drop-in replacement for a light switch with mains wiring in the wall we'll get to that later i hope all right so oh we've got people from all over i've just been seeing some hello so james o'gorman hello from milly warkay we've got gary from ireland mark from atlantic georgia we've got lots of people here so thanks for all coming along and uh all right so i hope my explanation of that was clear enough two light switch methods one physically controls the current or the power to the load the other one is just a control input to the automation system and my approach has been the second which is logical control and it's also the way i suppose partly because when i started putting together my home automation system the the commercial equivalent that i was most familiar with was clips or c bus and that does the same basic thing so one of the as i was thinking about how to wire my house up one of the things i had in my mind was i'm not necessarily going to live in this house forever i'm going at some point i'm probably going to sell it we'll move out and then i need to think about what am i going to leave behind for the next homeowner and potentially how am i going to remove all of my home automation equipment and replace it with commercial gear that can be supported with warranties and if something goes wrong they don't have to phone me personally because i'm the only one that knows about it so the architecture of my home automation system is very similar to the way a typical eclipse or c-bus system is set up it has essentially switched loads so star wiring going out to the loads and the inputs are just control surfaces on twisted pair cable the difference is that i started off with ethernet on twisted pair and now i'm just using switch signals on twisted pair whereas with clipsal it's a like a multi-drop bus system but very similar in terms of the way the wiring is done so in my house if i was going to sell this house what i would probably do is just remove all of my own modules drop in clips or c bus modules or some equivalent that has a similar wiring scheme and i could walk away and know that it's got proper commercial gear in there that is not going to come back to me at any point and electrician who is familiar with that can support it so let's have a look at some light switches where to begin with this where to begin all right now there there is something i'm working on at the moment that uh we'll get to but i'm just going to start with showing you something that many of you will have seen before already and that is these little things let's see if we can get some overhead action happening here on the camera and oh you'll i've got stuff piled up on the bench all over the place here you'll see all of that we'll get to it oh this is what i've just been working on and we'll get to that as well that's the thing that's most interesting right now so typical domestic light switch and it's got the terminals on there for directly connecting to mains and it switches the load this is what i currently have in my house and it is buttons instead of rocker switches but we could use rocker switches and one thing that i've been wanting to do is hook up a regular light switch and also the other thing is this partly comes out of a conversation that was happening in the assistive tech section on the discord server because we were talking about the issue of feedback and tactile switches so for someone who is sight impaired for example it may be useful to be able to feel the switch and to know whether it's in an on position or an off position so what i'm going to do is try connecting one of these up to one of my light switch controllers and show how to use rocker switches instead of buttons to achieve the same thing once again we'll get to that there are so many different aspects to this we can talk about today it sounds like i'm jumping around all over the place right now but hopefully there will be a little bit more little bit more to it as we get through it a bit more structure all right so this particular switch is the same sort of thing as i've got in my house these are momentary buttons they're illuminated it's just a single color led and it's got an rj45 socket on it or an 8p8c socket if you want to be pedantic about it so that i can use ethernet type cabling and just plug it in and that provides 12 volts which illuminates the leds and then i use extra pairs on the twisted pair cabling to send the button events basically just shorts to ground and then that's detected on the switch controller so it's a star wiring topology this goes back over twisted pair cable to a central location where the uh the light switch controller is so oh where to go next all right so and partly what i'm doing here is rushing through a bit of a catch-up thing because many of you will have seen parts of this before many people won't have seen different parts so it's just showing all the different elements this is a project that i've had in progress for a little while which is an updated version of my light switch controller i did a video about building my existing light switch controller the one in fact i've got two of them currently controlling the two halves of the house and this is the replacement for it the original version had modules that were directly connected to digital i o pins so what i was doing with what i am currently doing is using a freetronix ether mega and then the connections that come back from the light switches go down the cable they go into another socket and then they go directly to a digital pin what this does is replace all of the direct digital pins with addressable i o expanders each one of these is an mcp23017 which is a 16 uh yeah 16 channel gpio driver and it can take on it can be either switchable outputs or it can be inputs and the i squared c so i've got different addresses on each of these and that means that i can connect the whole thing to a microcontroller with a little cable that's just power and i squared c very neat so all we need is any microcontroller that can support this particular gpio expander with i squared c so instead of having a big massive cabling we can have a module that breaks out a whole lot of light switch connections over a little connection and in this case it's connected to an ether10 and there is another i squared c module here which has got an oled on it and some menu buttons so that you can do navigation and that's it like those things that are on the screen right now all you would need to support a whole bunch of light switches around the house right now this is not available because i have been working on it and wanting to release this as as both individual modules so people can customize and build their own but also as a complete unit and this thing here is a rack mount this was a prototype so i had these are steel it's all laser cut steel i designed this in fusion 360 and took the designs down to a local laser cutting place and had them make it up so they laser cut it and then folded it and it need it still needs some stuff cutting it so the idea is that there would be a slot well three slots cut along the front here and then this will mount in here somewhere that's the general plan this slot this one was done with a raspberry pi mounted in here with the pi ports exposed on here so it's a different configuration this was an early iteration before i had designed this pcb so it's a work in progress but you can see that there are parts of it there that are coming together and the end result will be a 1u rack mount light switch controller that you can put into a rack in your home automation system and it will have all of these sockets on it and then each one of those can be connected to a light switch that can be somewhere around your house and it could be one button two button three button there's a four button light switch so at the moment i've got uh anything from yeah one two three or four in terms of the size and so where okay so far i've just been totally ignoring the chat and uh let's see okay so what questions have come up already uh so thiago ss said has your automation server ever crashed and everything stopped responding now when you're talking about an automation server there are several different parts of my system that you could consider an automation server the probably the most central part of it is currently a raspberry pi running mqtt and node red and a couple of other things that has never crashed um i'm trying to think of a situation where that's failed i mean obviously there are issues where i've had blackouts and things like that but i've i've never actually had that crash and just stop responding and the light switch controller as well so my existing light switch controller which is it's not an integrated pcb like this it's separate breakouts that i'm trying to think about whether that's ever crashed i don't think it has it's never uh it's never got into a state where it's just stopped responding i do have a watchdog timer in it so that it can reboot itself automatically and if that happens there is an event that's logged in mqtt it publishes to a an events topic so i can see what happens but i don't recall ever seeing that happen um the only time that it has been a problem is if there has been something like a blackout and then doing a cold startup of the entire system and and there can be issues with things like dhcp server being too slow to start up and then you've got a then the watchdog timer has to kick the light switch controller and make it restart until like keep restarting until it gets an ip address there are issues like that but the short answer is no it's apart from bad situations like blackouts it's super reliable it just always works that wasn't always the case though when i was running my original light switches which had ethernet directly in them just wondering if i've got an example uh in this big box of bits i probably do so what i used to do is have oh yeah so all right here's a super crude example because it's crude it's actually a good example this was one of my very early ones so illuminated buttons connected to an ether10 so arduino with ethernet on it there's a power over ethernet regulator and this would connect to the central uh this would connect to an ethernet switch and when you press one of the buttons it would publish to mqtt now i did have these fail from time to time like they would just stop responding and i didn't have a watchdog or anything on that and what would happen is i would have to go into the garage where the switchboard is unplug the cable for that particular light switch to power cycle it and plug it back in but the last few years that i've been running on this centralized light switch controller system it has been rock solid which is cool and adam said a maximum of six buttons on those i guess so it actually only four and the reason for that is that i decided to follow the same wiring convention as diy power over ethernet so typically with 10 and 100 base t so not gigabit ethernet but up to 100 base t it only uses two pairs of the cable in the ethernet cable two of the pairs of spare so for the cheap and nasty way of doing diy power over ethernet is you use those two spare pairs and you put power on it typically something like 12 volts or 24 volts and so what i did with this was maintain the same pin out so i've got two conductors for plus 12 volts two conductors for ground even though that's unnecessary i mean i could have done it with just one for 12 volts and one for ground but i wanted to be consistent with the power over ethernet wiring convention so i'm using two for positive two for ground and that leaves me with four conductors so two pairs so what i'm doing with these is each of these buttons that you see here switches one of those four spare conductors which are normally data lines in an ethernet system but i'm not using it as ethernet and it switches them to ground so it's kind of a self-imposed limit that it's only four instead of six but that is because of wanting to stick to that wiring convention to be consistent with power over ethernet and uh i suppose i figured that if you want more than four then i could run two cables and so far i haven't had a situation where i need more than four or if you need more than four say you wanted a panel here with five or six on it it starts to become a very dense button like a very dense control surface so if i needed more than that i would probably put two panels on there so it would be like two light switches side by side and run a separate cable to each one but yes you are absolutely right that is a limitation of this system but that limitation may be about to be removed based on what i'm going to show you about what i'm working on at the moment because you could use wi-fi to send the signal instead um all right feels like i'm jumping around so randomly so far this morning because i've got so many different parts of this that i want to talk about let's see magic blue smoke said i thought there was limit of four of those gpio expanders addresses so no there are uh eight i believe yes eight it's uh there are three address lines on mcp23017 it may be that on some breakouts they don't expose all of the the address lines but if you're designing your own pcb you can you can do it however you want and i can show you the schematic for that in a minute we're going to have eagle open a little bit later in this episode because i'm going to be showing you the stuff that i'm working on and a lot of it is still just an eagle it doesn't physically exist yet all right i'm going to try to uh quickly get through the comp the backlog of questions and things here so i can get back to showing you things ah awesome so james o'gorman said i made a calculator for the standard super house light switch controllers the wall plates i o breakouts etc and that is really cool so um if we can drop the url for that in the chat that would be great someone who has the privileges to do that i know andy does i suspect that james does not have the privileges for it but what i can do is make james a moderator i think can i do that let's see if i can do it from inside here add moderator yes uh okay so james you are now a moderator in youtube so if you want to stick in a url you can go for it so yeah james has been very active in terms of the development of the light switches so a great question from frank mcallender who said any hardware debouncing or pure software so yes this is a um it's a software based system so i don't have any hardware debouncing in this and i haven't found that i've needed it it's been yeah it's been fine so we will have a look at some code in a little while as well i've got the arduino ide open here so i can show you some code i've got to finish soldering the headers onto the shield we can plug stuff in we can look at the code and we can run it and hopefully a lot of this will start to make more sense so dan neymar said so the push button sends a signal to the module and then you have to have a relay module to wire the 110 volt to power the light right yes and mike icon has already responded to that yes a relay or a contactor needs to be driven to turn on a light yeah and james explained it as well so what we're talking about here is the control input to the home automation system and then the automation system is the thing that sends the commands out to turn the loads on and off so it's acting as an intermediary you are sending it instructions of what to do using the switches but it is the one that is executing what you want it to do and having that there as an intermediary is what really gives you the flexibility in the home automation system to do automations and to respond to sensors like motion detectors and make decisions about when and how to take action but you can directly switch as well we will get to that so much to talk about today uh yeah so oh yes okay this is a this gets into something that is probably a squirrel to chase another time but um mike o'connor pointed out that he has a design document for long distance i squared c described in tida double now i'll just address that very briefly because it's kind of fundamental to the overall architecture of what i'm doing here at the moment what i have is a simple star topology it's not multi-drop so what i have is a light switch with a cable and it goes to the centralized location where the controller is and if you want another light switch you put it in a different location and you run another cable all the way to where the light switch is and it is just switch it just switches on the ends of a long piece of wire it's as simple as that partly what mike is alluding to here is the is an alternative approach where instead of just having a switch on a bit of wire use some kind of communications method you know like the way clips or c-bus works because with c-bus what you can do is run the cable to the first light switch and then you can loop it out and go to the next light switch and then loop it out and go to the next light switch it's not a star topology it's a bus topology but in order for that to work what you need is some kind of a communication system that will work like a multi-drop bus which could be can-bus it could be rs-485 which is a multi-drop serial bus there are quite a few different ways you can do it so what you do is have a bit of intelligence inside the switch and then the switch has an address so when you press the button on here it sends a message over the communications bus and it says i am light switch 23 and button one has just been pressed and then another switch that is looped around on the same piece of cable might say i am button 24. i am switch 24 and button one has just been pressed so it gives you a way of being able to distinguish the events on the different switches even though they're all on the same piece of cable but that requires some smarts at the light switches rather than in the central controller well you need it in the central controller as well but you need smart light switches and one of the options for that is to use something like i squared c because what we could do is make each of these lights which is nice squared c device but the limitation is that i squared c in fact the name i squared c it actually stands for inter-integrated circuit that's why it's the iic name it was originally invented as a communications method to link integrated circuits on the same physical pcb it was not originally intended to be a communications method for linking remote devices so it wasn't designed with high noise immunity in mind or you know all of those sorts of attributes that you care about if you are putting a device at the end of a 20 meter piece of wire which is effectively a big antenna and it can have noise electrical noise induced on it so i squared c does work at multi-meter sort of wire lengths but it was originally designed to work at multi-centimeter wire lengths and just on the same physical pcb not even leaving the pcb and since then i mean i squared c has been around for a very long time i think it might have come from when was it the 70s or something the 80s i can't remember and since then it's been improved and expanded and it now does a whole lot more than that and there are methods that you can use to extend i squared c signals and make them work reliably over long wires so that is what mike is referring to in in that data sheet about what was it not a data sheet has a like an application note for long distance i squared c so that is one possible solution to this okay lots of other stuff there um all right so how about what i'll do is finish soldering the headers onto the this little shield that i'm wanting to use because then we can hook some stuff up and make it actually do things and it might be a little bit easier to understand when stuff is really working and we can see it all connected together what i would like to do is have a little i'm just going to switch on a fan here which will make an annoying buzzing noise but it'll help drag the smoke away out of my face come on so once we've got everything connected together you'll be able to see the different components lot of the time when i'm trying to explain this i'm trying to use examples of things that are that are distributed around my house and you can't really see it because there are different parts of it in different parts of the house having a test system some kind of a demo system where come on oops where you can see all of the components in close proximity and you can see the wiring and how they relate to each other could be very helpful so get rid of that noisy fan and get rid of this header jig and hopefully i won't need the soldering iron so i'll get rid of that all right so this little shield which i've just stuck the headers on to is a super mini version of this light switch controller except that it's got direct digital connections it's not it's not i squared c so i did this because i wanted a really easy way to be able to just connect one or two light switches to an individual arduino type board for you know the simplest possible installation so what we can do is just plug this into here and we can then connect light switches into here just as if this was wired in a house so if i take this one so this is a three-way light switch i'm gonna need a few more things here to make this work maybe some ethernet and i don't actually even know what code is running on this board at the moment but let's just plug things together and then we'll see how it goes so we'll plug that into there we need to get some power because we want 12 volts to run to this i'm going to change that over to there oh you can see the led is glowing there so it may not even need power let's see how we go without it actually i'll plug this in just so you can see the leds a bit more clearly so i'll set my lab supply to 12 volts turn it on okay so now you can see that the leds are glowing so this is the the led the single color illuminated buttons and normally what would happen is that this gray cable here which is just a little patch cable that's the cable that would go through the wall of the house and then through the ceiling or under the floor or wherever it goes and it ends up going back to the switchboard where the central control point is and then this is representative of what would be in that control location and in our case we've only got two sockets so we've got connections for two light switches but if you used something like this you could plug in many more let's ignore that for now and just go with this simple solution so let's see if we can make this work over here i've got some code and let's um have a quick look at this and then we'll flash it onto here oh look i haven't updated this for so long so you can see i've been i was working on this 2015 to 2017. it's been a little while i don't even remember quite how this works all right so we've got some configuration this particular thing is assuming that we've got wired ethernet it's using mqtt so it uses the pub sub client library and it's got a fallback ip address if it can't get an address from dhcp there's an onboard mac address rom so it tries to get the address from that one and this is the address of my internal mqtt broker which let's have a look at that it's probably going to have a whole lot of noisy events happening on it but hang on i'll move this into a spot you can see it in a moment oh look my thing is out of date i'll move it over here and invigorate it so that we can see what's going on so nice g um let's just subscribe to hash for now actually no what we'll do is we'll subscribe to events this is a topic that is used by different devices so when i have when i create firmware for for devices that use mqtt my convention for the last quite a few years has been to have them start up and publish to the events topic and what that means is that by subscribing to the events topic i can see things that go on like devices rebooting or reporting their status so there's no watchdog timer this is me looking at my own code and trying to remember what the hell i did panel id so let's just change that panel id to 99 i don't want it messing up with anything that is how the switchboard controller identifies itself i'm not the switchboard controller it's the light switch controller in the switchboard i'm not going to go into through all this code in great detail that's not really what we're here to talk about today there's the mqtt callback that happens when it receives a message sets up ethernet attempts to reconnect okay so here we've got a button array and these are the i o pins on the board so the board that we were looking at just before this one here it's got two rj45 sockets on it and there are four inputs for each socket so you can see the pins defined here and it's got the state of each one so that it can detect transitions whether it's gone from unpressed to pressed oh look d-bounce delay this comes back to that question earlier about d-bounce so 50 milliseconds de-bounce delay button pressed one button not press zero these are just definitions so that later we can do logical comparisons and we can do things like say if button pressed or if whatever equals button pressed button state equals button pressed you know that sort of thing watchdog timer ignore that get the address from the mac address rom ignore that set up ethernet we don't really care about all of this stuff button array loop okay so the loop itself is very small which i like that's my generally preferred way of doing things is to uh is to abstract things out into little routines that do stuff and then the loop itself can become fairly self-explanatory so client.loop is the mqtt client and all it's doing is processing the input button why is it i is less than 48 surely that should be eight i think that must be a bug in the code because i think that this originally would have been the code that ran the large the light switch controller that i currently have which is very similar except that it's got way more inputs than this and so let's go out on a limb and just change that to eight and hopefully i haven't killed it so heartbeat that's just for the watchdog process button digital uh this looks painfully complicated more complicated than it needs to be but it's just reading the digital input oh look here we go if um last button state the button id is button not pressed and then it checks so that means if the button was previously unpressed but it is pressed now so that's how it detects the transition and it's got the debounce delay in there reports to the serial and reports to mqtt and the rest of it we don't care about okay so let's shove that code onto just waiting for the menu to open onto that board so if we go flash hopefully we will now be flashing onto that ether 10 sitting on the bench with the light switch shield on it so compiling hopefully this all works and my arduino environment is not broken which is quite highly likely just about every time i use it seems there's something broken on it come on you can do it compile compile uploading all right so this should now be running the code that we have just uploaded which means that it should oh look at this hang on let's go back to the desktop in mqtt we've now got events reconnecting arduino blah so this is the device that we have just flashed and it's just woken up and said hello this is me so let's open the serial monitor and see if we can get anything here yeah in the serial monitor it reports a whole lot more information and you can see it's getting its mac address and it's reporting the ip address uh setting the input pull ups connecting ready transition onto input four i wonder why that is i wonder if there's something wrong with that button that i've just plugged into it like this switch plate but um let's see what happens i'm just gonna pick up the switch panel you can see that in the little view and if i press one oh look at that we've got transition on zero input two i just press the top button and then i'll press the middle one input one bottom one input three inputs what zero one three that's weird maybe there's some strange mapping going on with the pins now i'm going to switch back to overhead and plug this into the other port so this would be as if we've got a second switch plugged in and then i'll go back to the desktop and then i'm going to press the top one look we've got input 4 input 5 input six yeah i think i've got some weird things going on with the mapping there's probably a mistake in that little array that defines what the pins are but in any case that doesn't matter not for these purposes anyway this is just demonstrating that you can detect the button presses and then publish to mqtt and see the events so where is it publishing hmm i have no idea i don't know what um what topics this is going to be doing let's drink from the fire hose and see what we see so this is now just subscribed to the wildcard topic and you can see a whole bunch of stuff that is going past now i'm going to press these buttons a few times oh look we've got some events happening there i'm going to control see it so that we can stop and see what actually happened now if we look at these events here what happened was that i did the subscribe sorry to subscribe to mqtt and i use the minus v flag which is verbose and that means that it reports not just the messages on the topic we subscribe to but it also reports the topic that the message appeared on and that's important because we subscribe to the wild card so we're just looking at everything and so what we're seeing here is buttons is the topic and 99-15 in this case was the message that was sent so uh all right let's i was just thinking we could have what i could do now is i could actually link this up to my home automation system for real and have it send events that turn the lights on and off um it's kind of tempting we can pull up some node-red let's see i'm just going to pull it up on another screen and um see if it would make sense to do that right now live while you're watching it might end up just being a a distraction from the point of what i'm actually talking about [Music] okay i know we can do this we can actually do this pretty easily all right so what we have now if we look at what's going on on my mqtt broker is that when i press one of these buttons it publishes to the buttons topic and it publishes the panel id and the id of the button which is why it's 99-14 so if we go back to the source code here and look at what it's publishing and you might remember way back at the start i edited a value where is it there it is panel id 99 i changed this because just the way the code works is it publishes the panel id and then the id of the input so let's pick one that is a known input i'm going to run that subscribe again and i'm going to press the first button so it's 99-14 is the button we want and now let's have a look at some node red slightly off topic for what i'm wanting to cover but it gives you some idea oh and what you can see here is code left over from last week where um where i had daniel and michael on the live stream and we had daniel controlling the lights and the water cannon using the voice control system that michael had written and if you look just down here you can see a little bit hooked into it this is where messages came in from the voice control system that daniel was using and then it set a value just using a function node here and passed it into the office lights and that's how daniel was turning my lights on and off so what we can do is let's have a look toggle toggle all right i'm going to copy that node i'm just going to copy and paste a few things here and then we'll look at what they're actually doing so i'll copy that i'm going to copy that and stick it in here so this buttons subscription is simply as an mqtt subscription to the buttons topic so just a moment ago we were looking at um where was it we were looking at these messages being published and when i press the light switch it publishes something like 99-14 on the buttons topic so what this is doing is subscribing to the buttons topic so we can see when those messages come in and then that goes into a function and let's have a look at what's in that function it's doing a little bit of logic so we want 99-14 uh i know i can get rid of oh okay let's change i'm gonna do this a different way sorry i'm gonna remove those because i just realized that the way i've got the logic set up i can do this in a simpler way i don't have to add those i can just add it in here because we already have this subscription to the buttons topic the message from the button to topic comes into this function node and it's looking for a message payload and you can see that it's saying if the message payload is 1454 and then across here or if it's 1463 so there are two switches that are capable of changing the lights in my office so i'm just going to add a third switch in there and i'm going to make that 99-14 and i'm kind of rushing through this without much explanation and it may not be making a lot of sense right now this doesn't matter i'm just rushing through this to show you that i can very quickly link this device sitting on my bench that we've only just set up to my home automation system just by changing a little bit of code but the details of that don't really matter we're going to get back to the light switches in just a second so all i'm going to do is apply that edit and i'll deploy yes confirm deploy and once this is finished so that should be finished now actually let's go back to what shall we look at let's have a look at what's going on no no not an event we'll have a look at what's going on in buttons and now you can see behind me the office lights are on this is a real unplanned demo so much scope for failure here a demo that was created right live in front of you so press the top button and nothing happens button is only 9 14. press it again nothing happens failure so what is going on why are my office lights not changing state when i press that well like there's some error what is the error on that did i do it some kind of a syntax error i probably did oh yes i did look at that i messed up so i've got a missing bracket right there awesome and that's why i should have paid attention when i was doing that deploy and it came up with an error message all right so back to here and now i'll try pressing this and now my lights have turned off press it again and my lights turn on so we've now just added an extra light switch to my home automation system and done the software setup everything is still everything else is still working fine which is nice so that well i suppose the interesting thing about that is that it shows the uh the flexibility that you get when you are directly controlling the load through the light switch if for example i had wanted to add a two-way light switch to my house what i would have to do is get an electrician to come in and at the second location they would have to install the switch they'd have to loop around the mains wiring and do the you know the two-way lighting setup it would cost me many many hundreds of dollars and i'd have to book the electrician and wait for them to come but because the control of all of the loads in the house is totally separated from the the control system it means that i can arbitrarily add different control methods and then with just you know tiny software changes i can change how it behaves so as you saw i only soldered the headers onto this shield a few minutes ago live on the stream we uploaded the code onto this arduino and now we've got a light switch that can control the lights in my lab and by just making tiny changes in node-red i could have that same switch do all sorts of things i can have it controlling anything anywhere around the house all right now back to the light switches the switches themselves and okay let's do a minor detour into direct mains control switches because it's not something that i like very much but it can be really useful from a retrofit point of view now i wonder if i've got one handy there are the um there are things like the sonoff touch which is a direct drop in light switch replacement no i don't have i've got them around but i don't need to go and pull one out just to wave it in front of the camera right now but before the sonoff touch came out this was a few years ago now this was a project that i worked on as a way of making a direct drop in retrofit replacement for a hard wired light switch this particular one is the is a four outlet version and on the back now one of the reasons for showing this to you is that it illustrates a concept that is going to be very important for the project i'm working on right now which we'll get to soon and that is the separation of these two boards now you can see there are two pcbs here there are the switches mounted through the face plate and they go to this front pcb and then there is another pcb on the back of it and that back pcb is where the mains is the front pcb is all digital logic and there is total physical separation between them there are electrical connections here which allow control signals to be sent from the logic pcb up to the mains pcb but they're really two different things so let's get it over there so you can see it a bit better um maybe even get some zoom happening we can keep focusing close enough so there you get a better view of it there are the two pcbs stacked together in a sandwich with this connector between them so the way this is intended to be used it's got mains connections along the bottom here and what we've got on the right you can see well you probably can't read it but it's active neutral and earth so these three right hand screw terminals are where you supply mains power directly into this device now i'm going to keep these other terminals covered for now because we're going to do a signal path sort of approach to this so mains power comes in on these three connections and it goes to this higher link switch mode converter so this is a mains to what is this one five volts output five volts yes so this is a five volt switch mode regulator so it takes power from the mains and it gives us a nice regulated five volts out and there's a a mob or something on there for some protection and then there are these mains relays so the mains power goes to both this power supply and to the input side like the common of each of these four relays and then the outputs from those relays so i'll cover these three now and then we've got another four screw terminals each one of those screw terminals is a switched output from one of these relays so by firing the relays we can switch four loads from this device like from this light switch now those relays are controlled through five volt outputs which run up through this header and all of the logic for the control happens on this board that's under here now on here you can see a couple of things i might even take this apart just to make it a bit easier to see i'm not going to power this up now i could if there is enough if enough people want to see me potentially shock myself live on camera what i could do is get a mains cable and wire this up and uh and then you can see it doing its switching but for now i'm just going to maybe being totally mercenary maybe what i can do is take donations how much you're willing are people willing to pay to see me potentially electrocute myself so this is the mains board and i picked red for this pcb just to to show that it's dangerous so this is the the high voltage board it's got the relays and then there are driver transistors under here so that's what turned the relays on and off and then the logical inputs on here and then this is the logic board and you can see this one's got a particle photon or is it a spark core i can't tell i think it's a particle photon pretty much the same thing anyway well one is the successor to the other and that is the brains of the device so if i was building it these days of course i would use an esp32 or some processor like that but this was done years and years ago is there a copyright date on this i don't know i can't see one what about on here where's the date 2015 okay yeah that would have been just prior to esp days so yeah it would have been right around when i was starting to use esps i think and so what this was doing is relying on this module as the controller so this has got wi-fi on it and there is also a radio receiver on here this is a 433 megahertz receiver module and what we could do is decode the the control signals coming in on the radio and that way you could either use the buttons as controls or we could send radio signals to it and control the switch that way and there's a piezo on there so we could do audio feedback if we needed to and that's about it it's actually quite simple but the general concept here the important thing is that what we've got is a logical controller board which has the control surface and then we have a high voltage board that does the switching of the output and those two things are isolated from each other just with this connector between them and so i followed that same sort of process with another project that i've been working on which i'll show you in just a moment but one of the things to think about from this point of view is that it gives flexibility in these uh in what am i saying like in a combination all right so this particular board this logic board has mounting points for four buttons on it this controller output has four relays on it but neither of those have to be the case what you could do is have a control board here with a single button and you could have an output board with four outputs because the thing is that this can also receive its commands by other methods it could be by mqtt or by radio link or whatever but if you un if you remove a regular light switch like a regular wall switch and you put this in its place you now have control over that load both using these buttons and by whatever other communication method you can bring into this device so over wi-fi over radio or whatever so you could conceivably have a switch on the wall that has four buttons on it and it only has a relay board on the back with one relay because you might have taken out for example a standard light switch which was just a single switch and you still only have one load that you want to switch so you could pick a backing board that is a single channel backing board like a single channel mains board because it is just going to be switching that that single load but have a four button panel on the front and then the one of the buttons could control the load directly and the other buttons could be sending other commands to different devices on the network anyway i'm not sure how useful that would be but the concept was that it's separating the control surface from the high voltage control and then you can mix and match them as you need to so i could do different versions of this this was just my first prototype and i never actually took it any further than this and my concept was that i would do different versions of this control board with different numbers of buttons and i would do different versions of this high voltage board with different numbers of relays and then i could just pick the combination i wanted connect them together and away i go so in my house this is actually useless because all of my all of my loads are controlled through the switchboard and all of my light switches are just control surfaces and i don't even have mains available at my light switch locations so i can't you know plug this in i was doing this kind of as a bit of a a bit of an experiment and to see how practical it would be to make some kind of a drop in home automation light switch so that you could take an existing house which doesn't have any kind of automation take a light switch off the wall and just screw this into its place and whoa now you have wi-fi control over the load that you have just you've just replaced the switch for and potentially you have extra buttons that you can use for other things so that was a project that didn't really go anywhere and you can see the name on this pcb it says switch four and then i was going to do switch one switch to switch three and all of that in fact i think all of this might be on github because i um i would have i tend to publish things even when i'm just messing around with them as concepts when i haven't even finished them i have so many people who contact me saying i've seen this project of yours on github and uh where can i get it it's like sorry you can't get it yet it's it's just something i was playing with and i pushed it to github because i'd rather keep everything public than keep things secret and if people find that the design files for that are useful for themselves go for it it's all open source you can use it if there is a lot of interest in this sort of thing then i'd certainly be open to continuing to develop this and this is functional if i was doing this again of course i wouldn't use a particle photon on here i would probably put an esp32 on the control board and that's starting to get into the the next project that i'm going to show you in just a moment because the interesting thing is that the next project is kind of a successor to this and it could be the basis of a new version of this but esp based instead so uh we're kind of heading towards the actual point of this whole live stream now what do we want to look at let's see let me see if there are any questions or comments that i've missed while i've been just ranting uh okay so uh a homie convention um okay so christopher mcaveeney said have you ever explored the homie convention before the esp library deals with the boiler activities you show there in your code and there is a yeah so it's homey iot.github.io for people that want to follow that along short answer is no i haven't looked at the homie convention and it sounds like it's worth investigating and uh chris holmes does the control software have an easy switch cable identification feature or you're relying on well-labeled cables um the the way i've done it in the past it's actually kind of cheating i do have well-labeled cables and in fact my cables all come back to patch panels and my patch panels are very well documented and i did actually did a video a few years ago about the way i document my wiring setup as well because there was a friend who died a few years ago from cancer and he had some home his house had some home automation stuff in it and when he passed away his wife had some problems because she couldn't figure out passwords to different devices that were in the house and there were issues like that so i did a video a few years ago showing the documentation that i keep about all of the my home automation system so that if i have a heart attack right now on the live stream my wife would be able to call an electrician and hand him a hard copy clipboard which is actually kept inside the switchboard so that it'll be the first thing you see if if a strange electrician comes in and opens my switchboard the first thing they're going to see is a clipboard with hard copy documentation on it listing every cable in the house and every circuit breaker and everything it's all really well documented and um okay but what i do is what we were seeing just earlier if i switch back to my desktop the funny thing is that my general approach to this has been really quite lazy in that what i'll do is if i put in a new switch like what we just did with this i'm just going to press a different button now because i won't turn the lights on and off what i'll do is connect in the switch and then i will just subscribe to mqtt and i'll just start pressing buttons and i'll say oh that one is 99-15 cool and then i'll just map 99-15 onto whatever function i want so i don't even really need to know in advance i can just plug the switches in watch mqtt and then use the id of the button presses to link to whatever activity i want to link to uh so oh okay magic blue smoke said i think the question on everyone's lips is what is the device happy bubbles that's a very good question i'm gonna just do this um this sub again and yeah you'll see right there in fact i'll do a um i'll do a i'll look at happy bubbles presence as the topic and what you'll see is not anything useful because this is not functional right now this is part of a localization system localization i mean it uses ble so bluetooth low energy tags to identify the location of people or objects within the house and at the moment the system is not running which is why it just keeps saying what tab is most likely in blank with average distance zero and this is a system that what you do is you put fixed location bluetooth low energy devices around your house and they all report back the the signal strength so i think it's based on rssi i don't think it's using time of flight it might be of bluetooth devices in the house and because you know the location of the fixed reference points it can then tell you this particular device is probably in the lounge room and with a distance and average distance of whatever so that's what that is about unfortunately happy bubbles tech have gone out of business i've got a bunch of their hardware i've got a whole box of happy bubble stuff sitting over there and right now i'm not actively using it but the agent that runs and talks to the fixed positioning nodes is still running which is why we're getting these messages coming up in mqtt i've just not actually turned off the agent that does that but what i was working on with this was figuring out who is in each room of the house based on the location of their phone and various other things so that was just a fun thing to play with i might get back to that sometime all right so um apostolis um katrina uh sorry catronetsus said uh interesting combines node red with openhab in the past yes i was running node-red and openhab together but i actually turned off openhab a while ago and i'm running purely with node-red at the moment yeah our magic blue smoke said i know node red is meant to make it easy to understand flows but the amount of buttons you have to click and move seems so easy to accidentally break stuff still easier than test motor rules though yeah node red i don't want to get into this too much because this really is a big squirrel to chase and i would never actually catch it but node red has some strengths and some weaknesses strengths are very quickly linking things together weaknesses are when you have lots of repetitive structures and there are ways around that if you do things in a better way so this is one of you can see that i've got many tabs across the top here for different parts of the house and i've got well air quality yeah you can see a whole lot of stuff being extracted out of air quality sensors there and being reported to different things and charted but if we go back to the lab and garage tab you can see a lot of repetitive structures so that particular thing there that structure that's highlighted is just repeated down and down and down and the difference is that they are looking for different like there are different little state recorders here and now i could have structured this in a in a more scalable way so that i didn't have to keep repeating that structure like programmatically this could have been done differently so that didn't happen this ends up looking like a really long complicated page just because there is so much that is repeating yeah yeah i'm not going to get into that there are ways i could improve that within node-red and make it much simpler to follow and probably more robust but let's stick with light switches for now because i haven't even got to the project that i was going to be talking about as the main thing today and it's already 11 20. what is going on all right i'm going to quickly rush through some more comments and questions sorry magic blue smoke said wi-fi interference from the wi-fi chip being beneath the mains and that's in relation to this here and the short answer is probably to some extent but it does still work and if you look at things like sonoffs they are directly switching mains and they have wi-fi built into the the chip into the esp8266 right there on the pcb right next to where they're switching the mains and they still work pretty well so it's certainly something that's worth thinking about but i don't think it's generally a big problem and james ogleman said i think the hv board could use isolation slots that is 100 correct and let's um i'll show you what uh what james means with that so this is the high voltage board we've got the screw terminals along the bottom here and these are the relay connections that are switching the mains and in fact mains comes all the way up to the top of the board here to this power supply but we also have low voltage so 5 volt or elv i suppose technically five volt logic here which is switching the relays those transistors are directly on the back of the pcb and we've got the connections through here to the logic board so there is the potential danger for flashover or arcing particularly if for example you get a lot of dust built up on the pcb that can then cause uh high voltage arcing so typically what you would do as a good design practice is you would keep the five volt part of the circuit physically separated from the 240 volt part of the circuit by putting milled slots into the pcb so that there is no physical connection whatsoever across the pcb between the mains part of the circuit and the low voltage part of the circuit so james thanks for pointing that out that is a good thing to consider now oh mako said do the app would share the mains ground as i saw four pins only yeah so what i did with this is that you've got active neutral and earth coming in on those three terminals and then there are four switched actives coming out so the idea is that if you if the electrician was installing this what they would do is either well there are regulations limiting how many wires you can put into a single screw terminal i can't remember i think it might be three might even be lower it might be two i don't know but i think it's possibly three so if you were running four loads out of this you would need to bridge all of the neutrals together either by putting them into that neutral screw terminal or by using like an external uh connector but yes there is a common neutral and then there are just four switched actives as the output and um christopher mcaveeney said what powers logic board with this model this black box here this high link thing that is a switch mode power supply so you give it 240 volts in well actually you give it anything from what is its input range anything from 100 volts to 240 volts and it's either 50 or 60 hertz so it's a pretty much universal power supply in most countries you can just plug this power supply in on the input and then you get 5 volts out so this provides 5 volts that is then passed down to the logic board all right so james ogleman asked a very good question which is one of the reasons i didn't end up going ahead with that which is any idea what the bill of materials cost or this price would be for that setup a lot when i put this together it it actually ends up costing a lot of money this high link power supply is not cheap by the time you add a few relays like making this board costs a few bucks and then you've got to make this board which costs a few bucks and then if you look at the uh these illuminated buttons these chrome buttons these are like seven dollars each i mean you can get them cheaper than that but if you look at just general onesies and twosies price say even say five dollars for one of these illuminated buttons you're looking at 20 bucks just for the switches then you've got the controller and other stuff on the pcb so the thing is that by the time you put all of this together your bill of materials cost is you know it's as you can see it's years since i've looked at this but i would guess probably 40 bucks 40 to 50 dollars as bill of materials just for that which means that you've then got to assemble it and you've got all the usual markup issues so it'd end up being a hundred dollar device which is a lot for a light switch i mean not really compared to some of the light switches out there but still it's um it's painfully expensive and um john bert gallagher said can you show the mains relays for your house not right now on this live stream i'm not really set up to do that there is a video of mine from a few years ago which was uh what was it called it was cold arduino powered switchboard i think i'm just going to find the episode and drop this in in fact what i'll do is drop in a link to this episodes page into the chat this is an index of previous videos that i've done and where is the specific thing uh how do we know home automation light switch controller no i think it was way before that it was one of my very early ones it was super house number two arduino controlled home automation switchboard amazing so long ago which means it's probably ridiculously out of date and painful to watch but oh well you asked for it so that's what you get and um adam said future live stream topic your node red setup yeah that's a good idea i am very very far from an expert on node-red but it's definitely a really interesting thing and in fact the video that i am filming right now is showing how to install node-red along with other stuff for data logging so there'll be a little bit of node red in that and [Music] oh kfash said for your current wall switch i think you can also add a tiny oled and using i squared c it will look really cool yes that's true so there are little i squared c oleds that could be built in directly that is a big topic that i'm very tempted to get into but i won't because what i was wanting to get to today was showing you some stuff in eagle and fusion 360. so you can see the project that i'm working on right now but yes kfash that that would be very cool right so let's pull up now before i get into that is there anything else that we should talk about ah yes there is one thing that i was really hoping to do on this live stream and that means i've got to turn my soldering iron back on because there is a topic that came up on the discord just recently um let's what is going on here where is it oh there here is eagle i'm just going to open up something in eagle but we'll get back to it because first i want to do something i've been intending to do for ages and i just haven't got to it and we can do it right now on the live stream and i think it'll be interesting so smart switch i'm just looking for the project hardware smart for smart control open all right now uh i'm going to just leave this open oh come on manage libraries it's because i was editing this on my laptop and i edited the library so now i've got it to manage libraries update all right so i'm just going to leave that for now and i'm going to try doing something back on the desktop all right now right at the start of this live stream i waved this at you probably see it better here why aren't i using this camera so this is just a regular mains light switch and i'll wave this at you which is the logical switch which has got my breakouts on it and it's using buttons for momentary input so we are currently using this now the the important thing here is that these are using push buttons that are momentary so you push it and it makes the connection you let go of it and it breaks the connection so in the software what we are doing is detecting the transition from open to closed and we are treating that as a press event and then it it's ignoring when you release it so it doesn't actually matter if you press and hold this i'm not doing any long press detection or anything like that it's just detecting the transition from open to closed on the circuit and in fact if we switch over here to let's switch back to the arduino ide and back to the desktop we should be able to find here in the code somewhere where it does it so we've got pressed yeah we've got pressed and button not pressed and then down a little bit further i've got to find the thing process button here we go so if sensor reading is zero so if this button has been pulled low to ground it means that we've detected that it's pressed and it is only doing a an event if it is pressed so it's checking that it is currently closed and the previous state was not pressed in which case it is going to detect a a transition from not pressed to pressed so it is now pressed and in fact to make this cl this clearer what this really should be is button pressed and that would logically explain a little bit more about what's going on here we're detecting the transition from not pressed to pressed and then it's doing the d bounce etc and then we're taking action on that transition so what we can do is switch back to here and what i'm going to do is patch in a board into this switch and where do i have one here it is so this is one of the little breakouts that in fact i wonder if i have a breakout um is it worth looking yes i think it is i'm going to make you wait for a second while i look for other light switches what have i got because i should have another light switch pcb here that is the older style no not with connectors on them all right scratch that let's go with what we've got and i'm going to take grab a couple of bits of wire here now my original intention had been to do this with some kind of like a single core cable but what i'm going to do is take this breakout which normally goes to momentary buttons and i'm going to wire it to this switch and then we're going to look at the logic in in that sketch and change it so that it will work on transitions both from high to low and from low to high and then we can have a rocker switch that is linked to the home automation system and this sort of thing is good if you're wanting to do retro fits or you're wanting to make a system that looks like it behaves in the same way as usual now before i do this i need to figure out what have i got here it's those pins so it's that one and that one okay so if you've got a home automation system and you want to make it work in the same way as as the normal switches do and make it look like you don't have a home automation system then you can do it using this little trick this one crazy trick that yeah you know those headlines go find it again that one that one yes it must be that one so solder this wire on here solder this one on here yep sorry i'm slightly off camera there but it's just because of the way this is all positioned come on gotta get this holder into it all right so ah what's going on there the wire fell out the bottom okay that's better so instead of having this pcb mounted onto the back of the switch we've now got some flying leads on it and they should be across the uh the pins that are where the button would normally go now hopefully i haven't wired that across the pins that would be illuminating the led that would not be good but i think i got the right ones i should have stripped off more of that cable oh well should still be all right and i just need a little straight blade driver so which are the connections i don't use these switches very often so i've got to look at it so that's common that's the live and then that'll be the other switched output so common comes in and then it switches between these two one of them is blocked off normally you'd have to snap that out if you wanted to do like two-way wiring and that's the connection for looping around the live so if we are not live l um neutral oh hang on maybe i'm looking at the wrong one l common ah let's just figure this out i so passionately avoid touching anything that's mains related that yeah that's it did i barely even look at these sorts of switches so it's uh i can't just look at it and know which connection is which so i'll screw that in screw this in okay so without any modifications to the software what will happen all right let's take this unplug it from this and i'm going to plug it into this oh look my lights just turned off so now without any modifications what will happen is that if i flick it this way nothing happens because that's opening the circuit and then i flick it this way it closes the circuit and you can see the lights turned on now i take it back nothing happens flick it again closes the circuit and the lights turn off so what we see at the moment is that this switch is now controlling my home automation system it's just a regular main switch but because it is a rocker switch it's not a momentary button you have to flick it twice to change the state you have to flick it back and then flick it again and then flick it back and flick it again so what we need to be doing is detecting not just the transition from open to closed which is what we want with a momentary button we want to detect any transition so from either open to closed or from close to open but electrically this is working so we've now got this regular main switch which could be mounted on the wall linked to my home automation system and if this was mounted on the wall of course no one would even know that there is a home automation system it's just a regular switch so let's have a look at some code to change this around and i'm going to do a crazy hacky thing here um and this is not at all the way this would normally be done oh actually else transition off uh digital right all right so in this logic we've already got if it's pressed so we've got the the logic works if it's pressed it does this let's do what i could do is change some stuff in this part of the logic but i'm going to do the hackiest thing ever so if it's pressed then we want to do that transition i am just going to copy that entire thing oh hang on where does that bracket end oh okay cool so what we can do is copy all of that and don't do this at home because it is seriously ugly code and it's probably going to break this could not possibly work so we're going to say de-bounce delay blah then do this publish um and last buttons date you know where does that end it ends there so what we really wanted to do was take that and let's stick that in there and we'll say last date button not pressed and we're going to take and move it out and stick it up here and if this actually compiles i will be amazed because i probably got brackets in the wrong place come on give me an error re-register was not declared in this scope yeah there's some that is not actually the problem the real problem is that i have screwed up the brackets down here so you can even see it because the the indentation here is wrong now i know there are a whole lot of people looking at this right now screaming at their screens saying no this is not how you do it all right so if let me get the logic of this correct if sensor reading is button pressed and that ends where there there needs to be another curly brace here so uh so if the button was not pressed and it transitions otherwise do that and that let's just see if this compiles i think you can see where i'm going with this anyway even if this doesn't work i'm not going to take a whole ah else okay last button state oh okay that's because we're already taking care of that we could have we could have put this into that other else section instead come on work this time the point of this live stream was not to what done compiling what all right let's just try flashing it and see what happens so we've got i'm going to switch back over to the uh overhead and we'll see if the logic on this is now working properly uploading done uploading okay so if i flick this switch my lights turn on flick it back nothing happens oh yes it did happen it was just delayed okay so i can't believe that this is actually working now that the structure of that code is ugly and it needs to be refactored but you get the point what we're looking for now is a transition from low to high and we send an event or a transition from high to low and then we send an event it's actually the exact same event in both cases it's uh effectively it's saying someone press the button but when you flick the switch so now if i flick this switch you will see in the background eventually see my lights turned off there was a bit of lag in that i wonder where that is oh and then they turn back on again and then turn back off ah i know why it's because the logic it's because of that debounce thing so i'm just going to leave the switch there anyway it's because i haven't set the flag properly to say what the current state is and the comparison is screwed up so when the switch is in one state it's actually bouncing between two uh two outputs anyway that can all be fixed so um my the point of this it i mean another five minutes of messing around with this code and it could be looking a whole lot better and it could be functioning properly but my point is that by making this little software change you can detect transitions in both directions not just button presses and in tasmota for example when you have an input you can have an input that's either connected to a button or a switch and that is exactly the difference of what we're demonstrating here it's either detecting something that changes state or it's uh push on and push off all right so now finally i'm going to get to the project that i've been wanting to show this whole time and i'm sure if i looked in the chat right now there would be a whole lot of people yelling at me for what i've just been showing you with that horrible code now library manager okay i'll just update that library that's right that's where i left this so now if we finally get into the project that i want to show you now conceptually this is a little bit similar to that mains powered switch that i was just showing you except that it's not using mains this is a drop in replacement for my existing light switches which are just a switch on the end of a long piece of wire it's the way i keep describing them and the idea with this is that in fact let's fire up fusion it'll take a while so i can talk while that's happening so this particular pcb i just saw a whole bunch of glitches on the live stream i think i'm dropping frames all over the place because my computer is busy opening fusion and it's working hard so [Music] what we saw let's switch back to here can i do a scene change or is the computer too busy grinding on opening fusion no i can't change cameras at the moment it doesn't seem to be responding obs is not responding okay so at the moment i have a switch on the end of a long piece of wire so my light switch controller is expecting to see connections between my computer's finally caught up what the controller is expecting to see is that connection being pulled to ground and that's exactly what we were seeing a moment ago with that mains powered light switch oh look it's opening fusion 360 now so what i've been working on is a replacement light switch which is a drop in replacement for these simple switches and it provides the same interface as far as connecting to the light switch controller so the little ap8c connector on here you can plug it into the same cable it's powered in the same way like it takes 12 volts over the wire and it can communicate back to the light switch controller in the same way by shorting to ground one of those four data lines and using those as signaling lines so uh but i wanted to add some more features now where is this somewhere i've got so much stuff here that i've lost track of where everything is it's not that no uh where on earth did i put it oh it's right here okay so let's just jump to the to the finish line and i'll show you this in like it as a complete thing and then i'll show you the different parts of it and how it works together now you can see that just like the other switch this is two pcbs sandwiched together they've got a connector between them in the first one that i showed you the one this one here what i was doing was putting the logic and the buttons on the front pcb and then mains control on the back pcb this one is kind of similar except that the front pcb is just a breakout for the buttons and then the back pcb is the logic there is no mains layer in this conceptually there could be it could be another pcb sandwiched in the middle here somewhere and we could do main switching as well but that's not what i'm focusing on what i've got here is the logic on this backboard and then the front is mostly a breakout for the buttons but the buttons have rgb leds in them and we've also got ws2811 driver chips on there and you'll be able to see those once we look into the individual parts of this where shall we go let's go back to here so what we're looking at here come on change the greens is the i'm not gonna have to do it this way so what we're looking at here is the pcb that is on here it's the logic pcb now my concept with this once again was to be able to do mix and match you've got two pcbs that are sandwiched together and you can use different combinations of them so the logic pcb which is the back one with the socket on it is going to be consistent for all the different light switches and the front pcb which has the switches will vary depending on how many buttons you want to have so this one that we can see here sits on the back you can see there's an rj45 socket what we're looking at here is an updated version so this one that i've just been waving in front of the camera and that you'll see in more detail in just a moment this design is from several years ago when was it did i put a date on this one i think it might have been 2017 2018. so it's a couple of years old i think it's about two and a half years old and i've just resurrected this project and this is a slightly updated version and just because i can and some people will understand the joke i'm just changing the boot pin to snoot um so that if you want to put the esp8266 into boot loader mode you can just boot the snoot and where are we all right so explaining this board this board in fact let's have a look at the schematic it might make a little bit more sense come back over here all right so the schematic has an esp-12 module on it so esp8266 and it's just got the usual supporting stuff on it nothing exciting there reset pin flash pin which i need to rename to snoot and some i o so we've got four button inputs and then we've got an leds connection now i'll leave those till later because they're kind of intriguing this is the connection for the ap8c connector and that's the exact same pin out as my current static light switches and it takes the 12 volts it comes down off the cable and it regulates it there's a switch mode regulator that gives 5 volts out and we need 5 volts because we're going to be running rgb leds off that that then goes into a 3.3 volt linear regulator and that's what runs the logic including the esp8266 there's an esp flash header button panel connector which we'll get to in a moment that's where the two boards sandwich together and how it connects to the buttons and then up here we've got some interesting little arrangements that might take a little bit of explanation but um they're not really all that important right now so i won't go into them in great detail but so this connection here for example comes in from the button and it's got a pull up on it and then it's going into a mosfet so what happens is that in a normal situation the button will be open it's not pressed and then this pull-up resistor will be turning on this mosfet which will pull this input to low so normally when you're not pressing a button the input in this case gpio16 will be at zero volts or close to it through this mosfet when you do press the button what it does is pull this to ground which turns off the transistor and then this pull-up makes this input go high it goes up to 3.3 volts so what we are doing there in fact that pull-up could be going to 3.3 volts not that it matters at this point because all it's doing is controlling the transistor and you might be wondering why am i doing this like why is there this big complicated circuit right here when i could be doing it by having the button come in to the input and then just use an input pull up could be a much simpler circuit not need this transistor and all of these things the reason is that i am maintaining backwards compatibility with the existing light switch controller so this button input here this connection that comes in from the button is normally floating but it's pulled high by this input res this pull up resistor and when you press it it goes to ground now if you come across to [Music] here you'll see that that exact same wire that same signal comes out on the 8p8c connector and when you press the button it pulls it to ground and that means that totally independently of any of these active electronics if this system didn't even have power to it those buttons would still work exactly the same way as a passive button on the end of a long piece of wire so there is zero reliance on any of this on the esp8266 on anything else from being able to plug this in and have it work as a direct drop-in replacement for my light switches for my existing light switches with my existing light switch controller if i plug this in right now it would just act like a button on the end of a long piece of wire but there is a twist because we have this on-board esp8266 it gives us the possibility of doing extra things that my simple passive light switches can't do for example in addition to having the switched output and sending that signal to a central light switch controller we could also process those button events locally on the esp8266 and publish them to mqtt over wifi so we could do control within the light switch we can also do things like change the color on the rgb leds now there is a signal here gpio12 which is going to the leds and that means we can do things like change the color of the switches depending on the state of whatever output it is that it's controlling and that could be done using something like mqtt messages so with this particular system we get the reliability of the button on the end of a long piece of wire but we get the extra bling i suppose of having of other features that we can do through the esp8266 to change the colors on the leds and show a state of a load which could be changed not just from this switch it could be changed from some other thing like you could change it using a different light switch or change it using your phone or a rule or whatever by having events going to mqtt we could now have the light switches reflecting the status of whatever it is that we want to show but even if all of this fails the buttons still work and that was my primary objective here so really what this is doing is taking the the super reliable system that i have now maintaining full backward compatibility and adding the flexibility of being able to do non-essential things like show load status through the esp8266 so uh what do we look at all right let's have a look at the at the other part of the board so smart for rgb here we go so the other pcb that this is all attached to is a breakout that looks like this and you can see it's got the four buttons on here and the idea once again is that there would be a few different versions of this there would be versions for one two three and four switches and mechanically they would all be the same mounts they've all got the same electrical connections they're all direct drop in compatible replacement so what you would do is have where did i put it so what you would do is have the same logic board and then just use different switch breakouts on the front and plug the logic board in and what you can see here is these particular rgb switches have connections for the switch so you can see one side of the switch is going to the the data connection which is the input to the esp8266 and the other side is ground so when you press the button it's just shorting that line to ground exactly like the regular switch but we also have the five volts coming in which is from that little switch mode regulator and then we've got red green and blue inputs to the leds on the switch so let's go back to here and plug this in i haven't actually checked whether this is going to do anything uh let's plug that in alright so this would now be powered up it'll be on my wi-fi network and connected to mqtt and you can see that the leds have come on in fact i wonder if this is going to work this is let's just press this button and see what happens nope i wonder if it's if the code that we just added has messed it up what should be happening is that this will be detected by this and then acting like a normal uh switch input i it did see i pressed it and my light switch has turned my lights they've changed a couple of times if i just press it once let's see what happens no my light switches haven't changed anyway this is a kind of broken demo because i've just cobbled together things that weren't really set up to work this way but if i press that maybe it'll detect it i don't know press it and hold it and now it's changed let go and it come off it's come off because at the moment the logic and this is all messed up i could revert the logic in here to detect buttons instead of the nasty hack i did to make it work with a switch but you get the idea so at the moment there is no logical connection whatsoever between what's on here like that esp8266 is not having anything to do with controlling the lights in my room right now it is simply the fact that that switch connection is being wired down through here and coming to what would effectively be the light switch controller it's detecting the button press events and then publishing and that's what's controlling it but the thing is that we now have an esp8266 on here and we have rgb leds so we can do a whole lot more things we can do things like send messages to the light switch to tell it the status of a load and have it change its color i'm going to turn that fan off i wonder if you've been able to hear that the whole time that would have been annoying so we could do things like change the the color on here now these rgb leds are being driven by ws2811 driver chips and that is this little chip just here so if you have used a um oops not that that so if you have used you know what people call a neopixel so a ws2812 you know an addressable rgb led strip those leds have a little driver chip inside them and this ic that you can see here on the pcb that is essentially the driver chip that is included inside an addressable rgb led except that it's a separate chip which means we can use it to switch whatever we want to and what i've done is taken the the outputs from it and used it to control the rgb led that is inside the buttons so effectively what i've done is taken oh you can't even see it there effectively what i've done is taken these rgb buttons and stuck and turn them into neopixels so you can address the color on each of these buttons individually because they're effectively in a string like one two three four it's essentially a string of four neopixels and it's connected through to the esp8266 now right now this is running test motor so i've installed has motor onto the esp8266 on this and that means you've got all the flexibility of that you can change the topics that it's publishing to you could make these buttons do different things and the other flexible now the other thing that comes out of this the other bonus is that we actually don't rely on this cable anymore either so there are a couple of different usage scenarios one scenario is the one i'm talking about where in my house i already have these switches on the wall what i could do is just unscrew this switch from the wall get this new one plug it in and screw it back on and it would look the same it would function the same the home automation system thinks it's just buttons on the ends of wires but now i can do things like dial up different colors on all my light switches so i can customize the light switch colors and i can change their state but this is the big difference you can also forego that whole control system with the control the central light switch controller and do it all over wifi if you really really want to it's not personally what i would do but for people that want to see this little screw terminal on here all you have to do is supply power to this anything up to you know 24 or 26 volts is fine and this will run just fine so if i unplug this now it's going to power down if i grab my lab supply and connected power into the screw terminals this would power up and now we have a tasmota device with rgb leds and switches connected to wi-fi and so if you were wanting to wire up a light switch in a new location and you didn't want to have to run cable all the way back to your light switch controller what you could do is just put this on the wall provide power to it using a you could use a an ac to dc converter or you know whatever method you want to use you just apply you put 12 volts into this and now you've got a smart light switch on the wall that can publish to mqtt and reflect state changes on its leds and do all of those sorts of fun things anyway that is what i've been messing around with during the week this week and just got it working so this prototype is from a couple of years ago and i put it aside and never really followed through on it but um i know i just a few days ago got tasmota running on it and i've been working on this updated version so what you're looking at here is the design from 2018 for the button portion of the light switch this is the the bit that is the actual interface that you make contact with and the other part is the controller oh and there's a okay so this is the rgb version and it's got these ws2811s controlling it there is also a version which is non-rgb and i've just switched to it and you probably barely even could tell the difference between the two boards in fact i'm going to switch back again so that is the rgb version that is the non-rgb version and it's still got the ws2811s here but we're only taking one of the outputs we're not using red green and blue so it's just like a cathode output to the illuminated button and what this allows us to do is show we can't change the color because we don't have rgb leds in the buttons but we can do things like turn the leds on or off or vary their intensity and then the logical board that goes in the front is this one so what we're looking at here is actually an updated version what you see on the screen is not exactly the same as what's on here and if you looked closely on this when i had it on the big camera you would have seen there are some bodge wires on there so you can see for example there is a little yellow wire just here because i had to cut a track and put a jumper around i ended up having to reassign a couple of the i o pins for various reasons and also there were some mechanical problems you can see that the bolt heads here are really close to the buttons there just isn't enough clearance and in fact i only put bolts in those two corners because i couldn't get couldn't get them to fit through there so the version that is on the screen here is an updated version what i've done is moved i've made it four millimeters longer so i've got two millimeters extra vertical clearance on both the top and the bottom and i've also moved things around a fair bit so the end result of what that looks like if we switch over to fusion 360 is where is it uh light switches where is it super i can't even remember what this project is called light switches and i should have a model of that pcb so this is the updated version and [Music] i'm probably going to send this off a fabrication this week along with an updated version of the pcb that goes in the front where the buttons connect all right so this is what that pcb looks like in eagle at the moment not the physical one that i've been showing you this is the updated version so there are a couple of changes as i said before i've made the whole pcb a bit longer i've also moved this socket up further because in the version that we've got at the moment the socket is a little bit further down the pcb and the voltage regulator is behind it now if you compare that and a couple of other things i'll point out while i'm here so you can see that the power screw terminals come out the side here the um the socket is a little bit down the pcb there is a four pin header here which is actually the same as the programming header on a sonoff that's now been changed you can see that there is no cutout in the bottom of the pcb the esp12 module is sticking out and these are two millimeter pitch headers that link the two pcbs together so keep all of those changes in mind and looking at this one you can see that i've moved the voltage regulator so i previously the voltage regulator was up the top here and the connector was further down i've moved it around to the side and moved the regulator up and the reason for that is to give as much room as possible for the cable that plugs in here because the cable is going to come out horizontally if we're looking at this board from the side like this there'll be a cable plugged in and it will come out horizontally this way but then you want it to curve up and away so that it can clear inside the wall when this is in place and so by moving the connector further up the board it means that there's just better mechanical clearance you can see i've also moved the esp12 module further up the pcb and put a cutout in here so that the antenna is well clear the programming header here is no longer just the four pin sonoff programming header it's now the six pin esp flash header which is the same as the sonoff header for the first four pins and then it just adds reset and gpio zero and i've also changed the the interconnect between the two pcbs this is now standard 0.1 inch pitch header instead of the two millimeter pitch header and that just gives it a bit more mechanical support it makes it a bit easier to work with and importantly it adds a little bit more space in between the two boards the screw terminal for power has been rotated and it's up there and that's it so and you can see that i've very deliberately kept this part of the pcb clear there are no parts on this central part of the board because when you're plugging the cable in any parts that are on the board here would get in the way and i didn't want them to be damaged so the center part of the central part of the pcb is clear and you can just put the cable in here and clip it in without knocking anything now ideally all of these parts should be on the other side of the pcb so that this side is totally blank other than the connectors and i've thought about doing that but uh i haven't really got to it don't know if i'm going to i suspect that what i'll do is just leave it like this for this iteration at least because i'm kind of lazy and if that turns out to be a problem i might change it but what i've been thinking about doing is designing a 3d printable cover that goes over this so it would be like a plastic shell that sits over the top and it would have clearance over the parts and then come down to be just a very thin layer in this central section so it would be like a it would come up on the sides and then have a channel in the middle where the cable plugs in and wrap up and over these larger parts obviously and then maybe uh have uh holes to access the reset buttons and that sort of thing but the idea would be to make it so that when the light switch is off the wall like when you're just using it and going to fit it with the plastic cover over the back of the pcb you don't have all of these exposed connections which are not really all that good in uh a kind of a semi-consumer product which is what this ultimately could become it would just be a like a plastic cover with the exposed socket where you plug your cable in anyway that's what i've been playing with recently and i still need to revise the button portion so i've changed the dimensions on this and i have changed the header here but what i have not done is changed the button pcbs to match so if i go back to well yeah this one this is still a two millimeter pitch header and in fact you can see here the overlap the the bolt holes here are too close to the edge of the body of the switch which goes on the other side of the pcb um okay let's see what other comments there are oh uh thanks james for the um the super chat i really appreciate that uh any sample units for supporters yeah i think i can arrange some samples so yeah i actually do have pcbs of these original versions right now like that one that i've just been using for demonstration purposes but i had those limitations that that i was just mentioning so that's why it definitely needs another revision but i've got when i had these boards fabricated there were i got whatever the minimum quantity was it was probably like 10 or something so i do have spare pcbs of that i don't think i would want to be distributing those because it would just have problems it might be better to wait until i get the new ones fabricated all right so before i wrap up i'm going to have a quick look through comments so magicbluesmoke said so your system will switch even if the esp is dead uh i mean you can also add yes yes exactly that is what i was getting at so the um the idea with this version is that the switches that are on the panel are acting as inputs to the esp but they are also directly switching the lines on the connector which means that i could plug this into my home automation system right now like on the wall you can't quite see it slightly out of view but just over there is a four-way light switch which is one of the in fact it is exactly like that so this is my passive four-way light switch i could unplug that and plug that into its place and the home automation like the light switch controller would not know the difference it thinks it's the same thing because it's just switching the connections regardless of whether the esp8266 is working so the esp8266 adds bling but it is not a is not on the critical path in terms of controlling things uh so christopher mcaveeney said uh would an extension to this to be poe compliant for a power supply with esp for networking be too much overhead um yeah not quite sure what to yeah i don't know i'm what i'm trying to avoid is full poe on this i've moved away from a poe based light switch system for reliability reasons and james a gorman said might need to have a failover setup going if the esp chip stops peeing the server then respond to physical inputs in the switchboard otherwise ignore them and use mqtt yeah that would be a really cool way to do it so i could either use the esp8266 and mqtt directly from it as the primary method and fall back to using switch inputs or i could use a split system so what i had in my mind was that i would probably use a split system where it does actually just use the button inputs all the time but it uses the esp8266 to do things like reflect the state of whatever it is that you're controlling by changing the leds uh yeah oh and um magic blue smoke also made a very good point which is you can also add in devices to the esp2 through i squared c sensors yeah exactly so with i squared c available on the esp on here now one of the things is that because the esp-12 module is very limited there's not a lot of i o on it i'm actually using i think i think i'm i can't remember if i've got spare i o pins or not but if i can expose i squared c on this it means you could add environmental sensors or other things you could add a motion detector or something on that um yeah so john burke gallagher said if you switch to an esp32 then you could use bluetooth as part of your bubble detection in each light switch uh yeah so i started doing this back before esp 32 days and uh i actually still have a bag of like a 100 or a couple of hundred esp12 modules lying around somewhere so i'm probably going to stick with esp8266 for now and i might go esp32 at some point one of the big limitations of course of the a266 is you can't do um you can't do any sort of crypto stuff it's just not really up to it and there are other limitations as well but esp32 would be nicer it would give us more options of doing things like that and yeah using the ble built into the esp32 could potentially allow you to use every light switch in your house as a fixed location ble like position detection system so you could track objects through your house that would be very cool and james o'goman um said have i ever considered adding other sensors on the wall plates like uh luminosity motion temperature etc yeah that is the sort of thing that i was thinking of as a way of extending this so this step one is to make this a drop in replacement for my existing simple light switches step two is to start using the functionality of the processor to then add these extra things that that allows but without making that part of the critical path uh so oh fernando said is this new version poe not properly so it's not in terms of being in fact this isn't even ethernet but what i've done is i've used the same pin connections as common diy power over ethernet but instead of using the two pairs for data the two pairs are being used just for switches so it's not really poe but it's kind of poe like i suppose oh yeah adam s made a very good point i was actually thinking about that in fact let me switch back to so adam's point was you might want to move the reset and flash button so the cable doesn't hit them yes in fact i think it was last night i can't remember it was recent no it wasn't last night it was the night before when i was working on this and i was putting on the silk screen to show the uh to show the position of where the cable comes in in fact is that synced onto fusion yes it is okay cool you get a better view here anyway yeah i was doing the silk screen to add this little thing that shows where the the cable plugs in oh you can't see what i'm doing i need to switch the desktop there we go so yeah i was doing the silk screen on the pcb showing where this plug would come in and i thought oh i'll make it look kind of like a little curvy cable and have the cable come out the end and when i did that i was looking at that thinking hmm i wonder if this cable could be squished around and end up pushing against either of these buttons so that is a very good point i mean those buttons probably should be somewhere quite different like ideally you'd stick them up at the far end of the pcb or somewhere off to the side here or more so that it's nowhere near where this cable could come near them yeah that's a good point um and that's also partly what i was thinking of fixing with a plastic cover so if there's a cover that goes over all of this it would also cover these buttons probably just with a little hole over it so you could use a pen or something to poke through it to activate them and uh um rudolph said kunai have you ever thought of using asp to connect to wi-fi use a network cable to be really a network that is actually what i used to have and i've went away from that and people that have been following my channel for a while will have seen videos of my old light switch system where every light switch was a an ethernet device with power over ethernet and they were each light switch was directly publishing to mqtt over ethernet and so i moved towards more of the simple switch on a piece of wire approach to make it easier to manage so i didn't have to keep doing software updates on every light switch i could just do it on the light switch controller and more reliable i didn't have issues with light switches needing to be rebooted and those sorts of things so my experience with that i mean i keep talking about not making the logic on the light switch part of the critical path and making the switches work independently of it that is because of my experience with previously having smart light switches where there was a lot of the smarts in the switch and it relied on that to be working for the switch to be functional and if you had a problem like the light switch dropped off the network and it couldn't get an ip address then your light switch stopped working you know annoying things like that so that's what i've been trying to avoid and oh trevor peacock made a very good point it said worth has surface mount threaded standoffs little pricey but will keep your your button board clear and is provided a part list now the other way to do that is with um now i'm going to show you just wondering if i will will i when i yes i will i'll go for a bit of a wander roof nuts and clinch nuts these things i love these this is something i've been starting to use on some projects recently including on the new light switch controller and these may not be quite the devices that trevor is talking about but probably similar concept [Applause] now [Music] [Applause] let's find an example all right so [Applause] these are the names kind of end up being used in different ways and it's a bit obscure but the way i think about it is this is a rive nut no that's a rivnut this is a clinch nut and in fact it might it might be easier to see what it is if i stick it under the microscope let's get some microscope action happening but first i need to be able to see the microscope on my screen so that i can tell if it's looking at the right thing and get some focus all right zoom out and focus and reduce the brightness so you can see it and let's see i'll hold it with a pair of tweezers so this is a nut you can see that it's threaded through the middle but the body has these little knurls on it and what you can do is put a hole in your pcb that is just a little bit smaller than this diameter so what you do is you make it so that it's approximately that diameter whoops that diameter there i'm looking sideways because i'm not looking through the microscope i'm looking at the screen to see what you're seeing and there so you make your hole that diameter and then this gets pushed into the pcb and those little knurls sort of cut into the fiberglass and it becomes a threaded hole and i've got a field of view there so you end up with a threaded nut that is physically attached to the pcb and then you can in this case so this is an m3 size so you can then put an m3 bolt through it and screw things onto your pcb and the other thing you can use for that is one of these this is a rivnut so if you've seen a rivet before this will look just like a regular rivet until you look inside and you can see that there is thread in there so what you do is use a special tool that say you have a hole through whatever material is you want to fix you poke this through and then you use a special tool and switch back to the other overhead view there are a few different ways to do it there are manual tools and automatic tools this is one that goes into an electric drill and there is a little thread on there it's a bit hard to see but that is an m3 size thread and then as i turn this you'll see that the thread goes in and out so the way you use this is you have the thread fully out you put the rivnut on the end you have a hole in your pcb or whatever material could be a sheet of steel you push this through the hole you run the drill which then turns and it pulls the end in and it crimps down and bites onto the the material in exactly the same way as normal rivet would but then once you've taken it out you've now got a rivet with a thread in the middle and then you can fix bolts to it and things and it's a really strong secure way of attaching things mechanically and in fact if i a good example of that is if i bring this over here so this is the the prototype rack mount enclosure for you know the new light switch controller right here you can see these riv nuts so what i did was drill hole through the steel poke the river nut through from the bottom and then crimp it down and you can see that it's spread on the top and that locks it in place so these are really strong now they're not going anywhere so it's a little rivet with a thread in it so now you can get an m3 bolt and just screw it into that and this effectively becomes a standoff so this is a mounting point for a raspberry pi those four holes are to match a raspberry pi mount so you can put the raspberry pi in there and then just screw it down onto these riv nuts and you've got really strong secure mounting locations so with this particular type with riv nuts it uses space top and bottom of the material that you're fixing to so in this case it's a piece of steel but it could also just be a pcb with with the clinch nuts it's uh it's much lower profile it just has a bit sticking out on one side of the pcb and the other side is pretty much flush not as strong but they're good in different situations as well and from uh what sorry from what trevor was saying it sounds like there is a surface mount equivalent to this which may be different to anything i've seen before so that's definitely worth investigating but yeah i really like looking at things like this it's it's not really electronics but it's really really useful when you're building projects and you want to mechanically make them strong and you know fit together neatly and have threads that can be reused and all of those good things so okay i've now run way over time what i think i've just lost 40 minutes somehow no idea how so i am going to wrap it up because i need to go and get some lunch and i need to get a drink and you have been sitting here for way too long listening to talk listening to me talk in a random unstructured way but thank you very very much for coming along today to the live stream and riveting topic yes chris um so i'm gonna bail for for sunday go and grab some lunch you should too if you're in the same time zone as me otherwise you might need to go to bed it's probably about three in the morning for some of you and ah i will see you all next week or in the discord so if you want to keep talking about this light switches are quite a topic of discussion right now and there are some ongoing activity in the discord about it both in the general channel and also in there's a special channel for it and in the assistivetech channel so come along talk about light switches and i will keep working on this particular one and i will see you all later so thank you very much bye you
Info
Channel: SuperHouseTV
Views: 13,609
Rating: 4.8135595 out of 5
Keywords:
Id: vAcA7NBy2b8
Channel Id: undefined
Length: 152min 56sec (9176 seconds)
Published: Sat Oct 24 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.