Sensors: MQTT Door / Window Sensor Hardware
MQTT Door / Window Sensor
So, in this video we are going to go over all the parts required for the door sensor and then we are going to make it. To start off with the parts we are going to need 2 2 pin pcb terminals, 1 4 pin female header, male header strips that we can cut to length, 2 pin jumper, 10k resistor, 5v to 3.3v regulator, ESP8266, Custom Printed circuit board more on that later, plastic enclosure, magnetic switch sensor, 2 conductor 22 Gauge Cable, Male usb connector and a 5v USB Wall adapter. The wall adapter can be any usb 5v adapter like a phone charger. For tools we are going to need a soldering iron with ST7 tip, flux, steel wire, solder, wall tac, PCB holder, helping hands, wire strippers, small wire cutters, small flat screwdriver and a hot glue gun. That is everything that we will need. The links to all the parts and tools will be in the description. In the beginning I did say custom circuit board because to make this easier I designed a custom circuit board so that way not only will it be very stable and have strong connections with no guess work in assembling it but, also so I can make many of them really easily for my house. I have provided the gerber file in the description as well as where to get it made. Also, I have made a video on my website showing how to order the custom circuit board from iTead so that way there is nothing to be scared of and you know exactly how to order it.
Since all the connections are already made on the circuit board all we have to do is solder the components on to the board.
1. First let's take the circuit board and put it into the circuit board holder. If you look closely at the circuit board you will see that there are labels next to the component slots, when I say where to put the component that is what I will be referring to.
2. I like to solder from the less sensitive components to to most sensitive so, let's start off with the 2 pin terminals, take the terminals and put them in J1 and J4.
3. Then take the wall tac and temporarily secure the component.
4. After flip the pcb so we can start soldering. When soldering I recommend taking the flux and putting some on the on the soldering area, so it makes a better solder connection.
5. Then take your soldering Iron and put it on the component and put the solder behind the component. Clean the soldering iron with the steel wire often.
6. Once the solder is cooled remove the wall tac from the component. Great we soldered our first components!
To make this guide simple I won't repeat myself with the wall tac, flux and how to solder instead I will just refer to the whole process as soldering.
7. Next take the 4 pin female header and put it into J2 and solder it in.
If the leads get long and stick out gut them with wire cutters.
8. Then take a strip of the male header and using the wire cutters make a header that is 3 pins long.
9. Take that 3 pin male header and solder it into J3.
10. Now take the 10K resistor and bend one side so the two leads are parallel to each other and solder it into slot R1.
11. Next take the 5v to 3.3v regulator and match up its leads to the board and solder it in.
Great now we have one component left to solder and that is the esp8266.
12. I recommend putting flux on every single pad of the esp8266 and of the circuit board and then solder it in.
13. Now that everything is soldered take the 2 pin jumper and put it on the pins above PGM.
14. Next take the Magnetic Switch Sensor and strip its leads and fold them over so they are touching the wire insulation.
15. Then loosen the terminal screws where it says Sensor Input using the small flat screw driver.
16. Now take the leads of the Switch Sensor and put it in the holes of the terminal, it does not matter which lead goes into which hole.
17. Then take the screwdriver and tighten the screws.
18. Now we are going to make the power cable for the device so go over to where you are going to have the device and cut how much 22 gauge wire you think you are going to need for the device to the nearest outlet.
19. Then take one end of the wire and strip it to expose the 2 conductors.
14. Strip a little of the each conductor and then take wire boot and plastic boot of the usb connector and slide it over the 2 conductors.
15. Next take the helping hands and put the 22 gauge wire in one of them and the usb connector in the other.
16. Then solder the black wire to the far left pin and the red wire to the far right pin.
17. Now put some hot glue on the connector and slide over the plastic boot and the wire boot.
18. If you want you can connect the USB to the 5v wall adapter but do not plug it into the wall.
19. Almost done, strip the other end of the 22 gauge cable and then loosen the two screws on the 2 pin terminal above the 5v.
20. Then take the red wire and put it into the hole parallel to where it says + and the black into the hole above the - symbol and tighten the screws.
21. Finally take the PCB and put it into the plastic enclosure, but don’t put on the lid yet because we still need to install its software which is what we will cover in the next video.