Asking sensors data to Alexa

Hey! If you are much into IoT, you must have tried controlling your appliances through your Alexa smart speaker. Well, how cool will it be if Alexa itself could tell you the real time sensor data. That is possible by creating our own voice flow applications through Alexa. Want to know how? Here you go.

Components Required

  1. ESP8266 12e development board(NodeMCU) (http://amzn.to/2BKS7cv)
  2. 4 x 5V Relays (http://amzn.to/2ChddQC)
  3. 4 x 1n4007 Diode (http://amzn.to/2EM4IuD)
  4. 4 x BC547 transistors (http://amzn.to/2oiTbfV)
  5. 4 x 330ohm resistors (http://amzn.to/2ojg8zN)
  6. 16 channel analog multiplexer module (http://amzn.to/2mLwlfl)
  7. PIR motion sensor (http://amzn.to/2EK1OX2)
  8. MQ135  sensor (https://amzn.to/2SKFBR4)
  9. Sound Sensor (http://amzn.to/2HCYO0z)
  10. Light Sensor (http://amzn.to/2CcBAPr)
  11. DHT11 Temperature and Humidity sensor(http://amzn.to/2sPh3fO)
  12. 7805 Regulator IC (http://amzn.to/2CdUvcq)
  13. 9V Power Adapter (http://amzn.to/2CfffAL)
  14. 4 x 2 pin PCB mount screw terminal (http://amzn.to/2EM5Luz)

Connection Diagram

PCB Design and Gerber File

As there were a lot of connections in this project, I just designed my own custom PCB for it on EasyEDA.com . Now if you want the Gerber file or the design of PCB for this project, then you can get it by going to my EasyEDA account.

You can just click here and this will re-direct you to the page where you can find the design of this PCB.

Working of the project :-

We have already explained the whole working of Voiceflow and how to use it for controlling appliances in this article. Must check it out for better understanding.

In here we will mainly be focusing on getting the sensors data through Alexa.

Above is the flow of blocks that we have used for this particular application. as you may notice most of the blocks used in here are same as the previous application. We have just added few more choices in the choice block for getting the condition and readings of our appliances and sensors respectively. The only major change here is the API link that we have used for getting the data from our IoT board.

The API link for fetching the data looks something like this.

Further there’s one more block that’s not previously discussed and that is if block. As the name suggests you are using the if block just to change the value variable from 0 or 1 to off or on respectively.

Code for the project:-

The code I have used for this project is uploaded in my github account. You are free to use the code. Don’t forget to give credits, it makes a creator overwhelmed.

Click HERE! for the code.

Video tutorial:-

If you have any confusion or you want to understand the project in much more detail. You can have a look to my YouTube video.