Thứ Sáu, 3 tháng 7, 2020

How to do Simple Home Automation with Amazon Alexa || ESP8266

If you own an Amazon fire tablet like me or one of the other Amazon definitely not surveillance gadgets Then you might be familiar wolf Alexa.

It is an intelligent personal assistant Developed by Amazon which you can interact with verbally to, for example, set a timer or hear a funny joke Of course, there are more useful functions that Alexa can handle for example home automation So in this video, I will present you a simple way on how to control a micro-controller output with Alexa Which allows us, for example, to verbally turn on/off the lights and a corridor Let's get started! This video is sponsored by JLC PCB upload, your Gerber files to other high quality PCBs for insanely low prices and turn your designs into real boards to make your projects look more professional The first thing we need for the small project is obviously a microcontroller.

I went with the popular ESP8266 Since it offers Wi-Fi and is supported by the Arduino IDE once we install its library through the boards manager Additionally, we need an electrically controllable switch which should be some kind of relay because I want to let us switch mains voltage with it and while we are at it, we should probably add a voltage regulator circuit for the microcontroller and a transistor will flyback diode for the relay But before I overcomplicate this project too much.

Let's rather order one of those ESP8266 Relay Board it got everything we need for those projects.

A voltage regulation circuit, A Relay with transistor and diodes as well as slots between its high voltage traces PCB terminals and even an Optocoupler Input as a bonus.

If you want more details about the board Then definitely check out microcontroller experiments article about it which offers tons of useful information For our application though.

We only need to know the GPIO pin four of the esp8266 Is connected to the base of the relay transistor Which means by pulling it high it activates the relay and by pulling it low it deactivates the relay Which is also indicated by an onboard led This way the change over contact of the relay which are connected to the upper three PCB terminals Can be used to connect our appliance to mains voltage To reprogram the microcontroller though.

I sold at male headers to all the five solder pads in the down left corner of the PCB then I grabbed a USB to serial converter set to 3.

3 volts and Connected its TX pin to RX, RX to TX and ground to ground Afterwards, I shorted the lower two pins with a jumper and connected the boards to a power supply set to at least 7 volts With that been done it was time to program But since I'm terrible at that, I rather try to utilize the FouxmoESP codes Which basically emulates a Belkin WeMo device and thus lets you control the ESP8266 through Alexa so after editing the provided example codes Choosing the right upload options and uploading the codes.

I then remove the jumper Restart the boards and realize that no matter how often I search for the device with the alexa software it never found it There seems to be lots of problems with incompatible libraries in alexa updates So I ditched that idea and instead went with a bulletproof method provided by Kakopappao papa Firstly I had to create an account on Sinric, which is an IOT site that can connect all kinds of boards with Alexa Then I added a smart home device Which I will call lights and continued by downloading the example Sinric ESP8266 code from Github After unpacking, I opened the switch example and downloaded/included the two libraries which were mentioned in the codes afterwards, I added my Wi-Fi information along with the API key for my Sinric account as well as the API key for my light switch to the codes Here I can now tell the microcontroller what to do when the device is been turned on or turned off which is in my case a simple digitalWrite function and With that being done I uploaded this new code to the boards, added the Sinric skill to Alexa and search for new devices Which this time was successful At this point the voice control of the microcontroller should work without any problems Alexa turn on the lights (Clicks) Okay Alexa turn off the lights (Clicks) Okay That means we could now hook up a lamp or something similar to the relay and call it a day But I wanted to present you a more practical example of home automation with Alexa As you might know when it comes to switching on your lights then we got a pretty straightforward electrical installation We usually start in the distribution box where we got our fuse with the protection in place the wire then goes to a switch and Afterwards to the lights before it returns to the distribution box in order to complete the circuit So the place where we would need to add our Alexa relay is in parallel to the light switch Which is certainly not an easy and appropriate real life solution The good news though is that I got one light circuit that is different because it utilizes push button and a surge relay Which like the name implies is a relay that either closes/opens its contacts when other there's a current surge This way we can add the microcontroller with relay right next to it in the distribution box and utilize the given hat rail assembly So I reprogrammed my microcontroller in a way that it only activates the relay for half seconds to simulate the current surge Mounted the board inside a hat rail compatible enclosure and added at 24 volts hat rail power supply to the mix Afterwards, I added the parts to my distribution box and wired them up But I will not go into detail here Because if you plan to add something like this to your own house wiring then you should always consult an expert otherwise, you could kill yourself through mains voltage or burn your house down And once my wiring was complete it was time for another test Alexa turn the lights on (Clicks) Okay Alexa turn the lights off (Clicks) Okay As you might have noticed this system works flawlessly But since I'm not such a big home automation enthusiast, I rather remove the system from my distribution box But I still hope that this example gave you lots of ideas on how to utilize Alexa and an esp8266 in order to control all kinds of things, but please handle mains voltage with care.

As always thanks for watching.

If you enjoyed the video, then don't forget to Like share and subscribe Stay creative and I will see you next time.

Không có nhận xét nào:

Đăng nhận xét

Soviet tank doesn't get penetrated often, but when it does…▶️ IS-1

When someone mentions soviet heavy tank youprobably think of well armored tank with sloped armor and a massive Aphe shell with very longrelo...