Isn't it frustrating to live on an unstable connection, which is unpredictably slowing down and dropping out every few minutes? I bet you answer yes. But even if your connection is rock solid, it may still fail from time to time, for example when your ISP is doing some maintenance work.

I present to you the ESP8266 Internet Alarm. It will not save you from the misery of a non-working line, but it can at least give you a warning, when your internet is not working properly. A nice big red strobe light supporting your decision to declare your own Defcon 1! It has only a few components and it's easy to program. Oh and did I mention you can build it for only $10-15?

As with my other instructables, this one is also mainly picture-driven.

Let's get started!

Step 1: Parts & Tools

Essentially all parts for this build came from eBay. It's cheap but you have to wait for the shipping. Of course, there's always the possibility to buy from local retailers (Adafruit, Sparkfun...) for several times the price, but with fast shipping. Anyway, here's the list of parts which we will need:

Not included in the shopping list:

  • 12V / 1A wall adapter + a suitable DC jack
  • Wires of different colors, I used mainly some fine red and black silicon-coated 24AWG wire, and 30AWG white wire.
  • Electrical tape and/or kapton tape
  • A breadboard for testing + a breadboard power supply module. I strongly recommend the type with an on/off switch.
  • USB <-> serial converter, such as FTDI or CP2102 - must be 3.3V compatible

This is a fairly non-intensive projets in terms of the required tools. I was able to accomplish it with only a soldering iron, solder, flux, hot glue gun, needle nose and side-cutting pliers, a metal file or a hacksaw blade, and a sharp knife.

Step 2: Schematics and Prototype

I began by building a prototype on a breadboard. For connecting the ESP, you can use female-to-male hookup wire, but I opted for an adapter similar to the last picture. I made it myself from a piece of prototype PCB and some pin headers, but you can also buy it if you want to.

The circuit is extremely simple. The transistor is connected to GPIO2 through a 560R resistor (anything between 470R - 4K7 should work fine). This transistor turns on and off the strobe. The ESP module is powered by a 3.3V regulator, which is connected to the 12V input. It's not shown in the schematics, because Fritzing didn't have a component for it. For programming, GPIO0 will be connected to a 2-pin header to which you can connect a jumper connector. RxD, TxD pins and GND are connected to a 3-pin header, to which you will connect the USB - Serial adapter for programming.

Please note: There's a 10K resistor in the schematic. As I learned the hard way, DO NOT USE IT, as it will disable the ESP from program execution. Just ignore that resistor.

Step 3: Programming

I am using the Arduino IDE for writing the software. It is extremely simple, but you first have to download and install the ESP8266 addon. There are lots of great tutorials, such as:


Once you've done that, you can now write Arduino sketches for the ESP8266, as if it was just another Arduino board.

My code, as well as all the schematics are available on Github: https://github.com/3zuli/esp_internet_alarm/

Clone it into a directory and open the esp_internet_alarm.ino sketch. First of all, you will have to make a few small modifications:

// Select mode of operation by uncommenting one of the following lines

Select the mode of operation by uncommenting one of these lines. When DETECT_NO_INTERNET is uncommented, the light will flash if there is NO connection to the internet. Similarly, when DETECT_INTERNET is uncommented, the light will flash when there IS a connection to the internet. Make sure that only one of these lines is uncommented and that the other is commented out.

// Your WiFi network credentials
const char* ssid     = "Your SSID";
const char* password = "Your Password";

Pretty self-explanatory. Enter the name and password for the WiFi network you want to monitor, make sure they're both correct!

// Set to true to enable debug printouts
const bool debug = false;

Finally, set this to true if you want to see debug printouts during the execution, namely the value of the hasInternet variable, and if the LED is being turned on or off. It's disabled by default.

Then connect GPIO0 to ground, reset the ESP module and hit upload. It should work. Open the serial monitor to see messages. Ideally, you should see something like:

Connecting to "Your SSID"
WiFi disconnected
... WiFi disconnected WiFi connected IP address: WiFi OK Connecting to httpbin.org Requesting URL: httpbin.org/get HTTP/1.1 200 OK Server: nginx Date: Sat, 16 Jan 2016 21:58:41 GMT Content-Type: application/json Content-Length: 128 Connection: close Access-Control-Allow-Origin: * Access-Control-Allow-Credentials: true{ "args": {}, "headers": { "Host": "httpbin.org" }, "origin": "", "url": "http://httpbin.org/get" } closing connection

The code works as follows: At the beginning, we assume that we are not connected, so the strobe is turned on. The ESP will attempt to connect to the WiFi network you specified. It starts connecting and checks the connection status every 500ms, until it was able to connect, then the strobe is turned off. In the main loop, it first checks if it is still connected to the network. If not, it will start to connect again, and the strobe is turned on. Otherwise it then attempts to open a connection to http://httpbin.org/. It's a simple site meant for testing of HTTP applications, if they are communicating properly. If the connection fails, it turns on the strobe and exits the loop(), waiting for another round. Otherwise it proceeds to sending a HTTP GET request to http://httpbin.org/get and then reads the response. The /get simply sends back some json-encoded information about the connected client. (Try it yourself!) After that, the loop waits 5 seconds and repeats itself.

The reason we are using httpbin.org (and not trying to load Google as you do on the computer) is that it returns a very small amount of data (typically under 200 bytes). This way it will work even on the slowest connections, like EDGE (2G) phone network, and also very likely on dial up (if anyone even uses it today). I roughly guess, that this connection should consume at most only about 1.6MB per 24h of continuous operation.

The code is not yet completely finished. First of all, it doesn't check if it actually received any data. It would be nice to also add some other features, such as measuring ping to the server, or turning the strobe on only after a certain number of failed attempts. Or record the uptime/downtime statistics. It's open for anyone to contribute :)

Step 4: Let's Start Building!

There's quite a bit of space in these security strobes. Under the PCB is about 1cm deep space, just enough to fit all our electronics. We need access to the two pin headers for programming. I also decided to partially expose the ESP module, so that we can see the status LEDs. This means we have to make some slots in the edges of the PCB. Luckily, the board is very sparsely populated, so it's easy. I made three cutouts for the ESP, for the programming serial connection and for the programming jumper, see the pictures.

Also, desolder the original wires from the strobe PCB. Mark where the connection points were and their polarity.

Step 5: Start the Wiring!

Start wiring up the electronics. I created a 4x2 female pin header by taping together two 4x1's. This makes it easy to disconnect the module if needed. Just remember the correct polarity!

First hook up a red wire to the VCC (3.3V) and CH_PD pins on the ESP. Then a single black wire to GND. In my case, these wires were about 6cm (~2 1/4in) long. Then prepare the 3-pin serial connector with 3 pieces of wire (white, yellow, black in my case). I wanted to route them around the circumference of the light, so they are a bit longer, about 8cm (~3in). Solder the white wire to RxD pin on the ESP, yellow to TxD and black wire to GND. Remember this association, write it down somewhere.

The wire lengths are approximate, you will have to adjust them to fit your light. As you will discover, you will need to test-fit everything frequently, check if some cables aren't too long (or too sort) and adjust the overall layout to make everything fit inside nicely. It's always better to start with slightly longer wires and shorten them later, than to have a short wire which you then have to extend. And of course, triple-check everything before you start gluing components in place.

Step 6: More Wiring

Take the mosfet, bend the Gate and Source leads to the sides. Bend the Drain upwards. Shorten the Gate, solder a 560R resistor to it along with ~4cm (~1 1/2in) piece of wire. Connect this (white) wire to GPIO2 on the ESP module. Take the black wire from GND of the ESP module and connect it to Source of the mosfet.

Connect the red wire from VCC of the module to the output (VOUT) of the voltage regulator. As you can see, I had to trim the corners a bit to make it fit, but now it fits snugly in place between the plastic posts. Be careful here, so that you don't cut any trace on the regulator, and that you don't short anything out!

Lastly, resolder two new wires (~6cm, ~2 1/4in) to the original PCB and secure them with a bit of hot glue.

Step 7: Final Assembly

Begin by gluing the mosfet to the bottom of the strobe. No big continuous current is flowing here, so it doesn't need a heatsink. Connect the negative input of the voltage regulator (GND) to the Source of the mosfet. What isn't shown in the picture, take the negative power input wire (black) and connect it also to Source. I used the Source lead as a kind of breakout board, this is where all ground is connected to.

Solder the red input wire (positive) with the red (positive) wire from the PCB together to the input (VIN) of the voltage regulator. Solder the black (negative) wire from the PCb to the Drain of the mosfet, and bend it backwards if necessary.

Put the PCB on top, hold the two pin headers in their places and mark their positions. Then lift the PCB away and glue the pin headers in place using hot glue. You want to offset them from the walls by 0.5mm or so. I used a servo lead connector to help me hold the pins in place.

Last, it's a good idea to wrap the connector of the ESP in some electrical tape to prevent shorts. Additionally, I glued a piece of soft foam on top of the connector. This gets pressed together by the main PCB and holds the ESP module nicely in place.

Now just figure out, how to stuff all the wires inside the small space left and screw everything back together. Done!

Step 8: Let's Build a Frame for It!

So our funny little light is done. Now let's build a nice stand for it, so that it can be proudly displayed in front of everyone's eyes.

Begin by printing out the two included PDF files (also available in the Github repository). Set the scaling to 100%. The design is based off the front plate which has to hold the strobe itself and display a meaningful logo. I chose A5 paper size as the starting point and even though it turned out a bit bigger, it's still fine.

Glue together the three pieces of the stand. Steal from your work Get a piece of cardboard (ideally the heavy duty two-layer), that fits both the stand and an A5 sheet. Mine came from some shipping crate. Trace out the stand template along with the bend lines and cut it out. Now comes the fun and tedious part. We need to score and clean each fold on the inside, so that it can nicely fold into the 90° angle. For the two main folds (between the base and the two triangles), I used the following technique: First, make two parallel cuts, each about 2mm from the main fold line. Hold the knife upright and make sure to only go through the first layer of cardboard. Then repeat the cut, but now hold the knife at a 45° angle and again make sure to only go through the first layer. Now the strip of cardboard should just fall out. This is easier, because we are cutting parallel to the cardboard lines.

But cutting the side tabs is more challenging, because we are cutting perpendicular to the lines and it doesn't fold together so nicely. So, we use the same technique again, but this time we are cutting through both layers, leaving only the bottom paper in place. I first make a ~4mm wide cut around the main fold line all the way to the bottom layer, but I take great care not to go through it. Then I additionally cut away about 4mm of the top layer (on the stand body side).

Pro tip: A flat head screwdriver was extremely effective at removing the cardboard from the cuts.

Now, a few fixes will have to be made. First I found out, that the side tabs overlap with the bottom tab. Easy, just mark the line where they overlap and cut away a small piece of the top pad. The slightly worse problem is, that I didn't take the thickness of the cardboard into account, so now the stand is about 5mm wider than the A5 paper. Not a big deal, we just cut out a slightly wider piece for the front part!

Step 9: Glue on the Front

Getting the alignment right is a bit tricky. I don't have many pictures of this. The front PDF includes crop marks, the very faint crosses in the corners. Lay the printed out paper with the printed side facing up. What I did is I positioned the cut out cardboard piece, so that it's aligned with the horizontal lines and then I centered it vertically, so that there is equal "overhang" on both sides. Then I folded the edges of the paper up and over the cardboard and I run my fingers along the edges to create folds. Then I removed the cardboard, took the paper and bent each of the folds in the opposite direction to create a "frame" into which the cardboard can fit. Finally I glued the paper and cardboard together. There has got to be a better way of doing this!

After the glue dries, cut out a hole for the cable of the strobe. Use the mounting plate (which probably came with your strobe) to mark the two needed holes for screws and poke them through with a screwdriver. Now you can screw it together for a test fit, but we will be disassembling it for the next step.

Also, the included screws are probably too short and this way of mounting isn't very durable. I'd recommend to use longer screws (~20mm), then to put the mounting plate on the back side drive the screws through it.

Step 10: Assemble the Frame

Get ready for some quick hot glue action! (Or perhaps not so quick if you use some other glue.)

I started by marking out the horizontal center line of the front piece.

Now glue on the bottom tab. I held the tab bent in its position, applied hot glue onto it and then quickly pressed the front piece on, making sure it lays flat on the table. Continue by applying hot glue into the side tab folds and quickly bending them into their final position.

Now you could just glue the side panels perpendicularly, but I decided last minute to glue them at an angle to add some interest. This is where that center line comes in handy. I bent both side panels so that their tips end 5cm from the center line. I marked lines where the edges of the panels would end up. I put glue into their folds and bent them into position, according to those lines. I then secured the panels with some tape to hold them in the correct angle.

Now for the final gluing operation. First, apply a lot of glue into the bottom tab fold. Then apply glue to the tabs and close it together! You have to be quick, but at the same time pay attention to the tabs, if they are aligned correctly with the lines.

Step 11: Wiring

Install the strobe to the front panel. Now we have to do something with the wire and the DC jack. I could just solder the wires to the jack and hot glue it in place, but since I think I will want to remove the strobe from time to time, I added a simple connector between the jack and the wire.

This DC jack came from some old device, I simply cut it out along with its PCB. There's a trace coming from the positive pin of the jack, and it's surrounded by a ground plane (connected to negative pin). I scratched away the green solder mask and soldered here a female pin header. A male pin header is then inserted into it, and finally the (shortened) wire is soldered onto the male header. Before you finish, check if there isn't an electrical short between positive and negative, as that would be very bad. Of course, check the polarity of the connector and mark it (I marked the positive pole with white).

Finally, hot glue the jack in place and simply tuck the wire into the corned. It's pretty stiff and stays nicely in place.

Step 12: Finished!

So it's finished! Enjoy your brand new (maybe not so) useless toy! Now watch it not blink, signalizing that your connection is stable and hope that it will NEVER blink ;)

Also, another video coming soon as well, so stay tuned.

Thanks for reading my Instructable. If you enjoyed it, you can vote for it in the contests.

About This Instructable




More by 3zuli:Mini Arduino Lux Meter ESP8266 Internet Alarm Universal Portable USB Charger 
Add instructable to: