Mitchine - ESP8266 + MQTT connected wooden boxes with LED display

tl;dr;

Topics covered in this way too long post

  1. Boring Backstory
  2. What is the ESP8266
  3. Early Stages of Mitchine
  4. The "LED Array"
  5. Front Panel
  6. Capacitive Buttons
  7. Prototyping the Boxes
  8. Early Electronics Design
  9. A Bit More About the ESP8266
  10. Making A Custom PCB
  11. The Code
  12. Finally, Final Construction
  13. Debrief - What Didn't Work

Boring Backstory

tl;dr: I was curious how the Amazon Dash was so cheap and connected to the internet and found the answer to roughly be "ESP8266."

A while back Amazon released a product/tool called the Amazon Dash. if you're not familiar with the Dash, the idea is this: Amazon sells you this small device (roughly 3 inches long, 1 inch wide, and perhaps 3/4 inch deep) that has a single button on it. When you press the button, the device connects to your wireless network and sends a message to Amazon, automatically re-ordering whichever product you have the Dash setup to order.

I found this to be pretty amazing. The intended use of the device aside (which I think could be a potentially useful idea!), the fact that I could buy some tiny little device for five dollars that somehow connected to the internet and somehow sent a web request to Amazon over wifi was really really amazing I thought. I was really interested to know how it was possible that Amazon could afford to sell such a product for five bucks (and that five dollars actually comes back to you after your first purchase) without taking a huge loss. I know that technology is of course getting cheaper and cheaper these days, with the "Internet of Things" movement you see cheaper devices all the time.. But 5 dollars with two day shipping just seemed so accessible! I figured that Amazon is probably subsidizing the cost of the device, knowing that if used they'd make back their money when the device is actually used, but still. Five dollars!

I started thinking about how I might be able to use this five dollar device to make something cool and web connected. Googling turns up a BUNCH of projects, many of them which are featured on various popular tech blogs, but 99% of them were at their core the exact same and in my opinion not great. The basic premise of the 99% of these "dash button hacks" I'm talking about work as follows: a computer watches your router to see when the dash button connects to it, and when the dash button connects to it your computer does something (sends a http request to IFTTT.com, etc). This works, and is pretty cool, but honestly also pretty lame and not very robust. You need a computer with this script running 24/7, watching for the dash button to connect. Frankly this drives me crazy! The computer shuts down, the script stops running, the thing no longer works. It's fairly easy to setup and doesn't require any electronic related "stuff", but it just feels pretty "hacky."

The other 1% of the articles about the dash button were actual tear downs of the device, to figure out how it actually works. And somewhere along the lines, somebody found out that the dash button is based of off something called the ESP8266. Full disclosure: I may not be technically correct when I say it's "based off of the ESP8266" - but this was my rough takeaway. I also found what I'd consider to be the "holy grail" for me, which was this article that basically showed the feasibility and the very simple building blocks that would eventually become parts of project. Most importantly the articled showed the feasibility of making a low cost single button press device based on the ESP8266, and making it "programable" via a web interface. The later part was a near requirement for me as I find it prohibit-ably annoying to have to hardcode router SSID / passwords on a device when they might change. Without having them be end-user programable, my parents router configuration changing (for instance) would require the chip/device being physically "opened" to be reprogrammed. "Less than ideal" would be one way to describe this setup, "a bit lame" also comes to mind! Not a big deal if I was making something for myself, or even Lindsay (my partner) to use at school or something, but when my family is all around the country it's sort of a deal breaker if I wanted to give something based on these as, say, Xmas presents!

From this point forward, my attention was no longer on the Dash Button, but was now on this ESP8266 "platform". I found out that in fact the ESP8266 came in different form factors, and that it was cheap. Anybody coming from the Arduino world is used to prices like, for example, 25 bucks for an arduino, 45 for a wifi shield, etc. Numbers that are big. But, it turned out you could get various ESP8266s for 2, 3 dollars, EASILY. When I saw this I was so excited because it basically meant for a few bucks I could have a web connected device of some sort.


What is the ESP8266 (roughly)

Super high level: The ESP8266 is a tiny little computer that you can program to do things and has built in wifi so can connect directly to the internet.

So what is the ESP8266? Well, at a high level it's a little device that has inputs and outputs, similar to an Arduino, but a bit less user friendly. Along with the inputs and outputs, it has a microprocessor that you can write code for, and it has built in wifi. To put it another way, it's like a much smaller, slightly less user friendly arduino that has built in wireless.

I'd add that if anybody reading this is interested in the arduino, but would like to make something web connected and has a bit of patience, I'd actually recommend skipping directly over the arduino and going straight to the ESP8266.

The ESP8266 comes in different versions. Below you can see the Arduino Uno on the left, and then a series of five ESP8266-12E and a single ESP8266-01. The numbers at the end represent the different form factors. The 12E and 01 are very popular, and the 12E is the version I ended up using for my project.


Early Stages of Mitchine

So after I figured out what this ESP8266 was, I decided that I wanted to make something with the thing. Christmas was coming up in two or so months and I decided that I would try to make something for my family with this new found electrical component.

I didn't yet know what I would make specifically but I decided to do something simple, without a ton of moving parts (no motors, etc) or complicated displays (color displays, etc), but something that looked nice and was hopefully meaningful. I wanted to use the web-connected nature of the box to do something that would allow my family members to communicate. I had considered doing some version of the Harry Potter clock that shows where family members are, but decided to do something more reliable that allowed for intentional updates between family members.

I had also recently joined a hackerspace in Chicago called Pumping Station: One and had access to a lot of great wood-working equipment so wanted to take advantage of that as much as possible.

I decided to make a wooden box that had icons on the front representing different family members, and a simple button that when pressed would light up an icon representing that family member that pressed the button. See: the video on top of the completed project :).

I'm pleased to say that I actually took a video during the VERY early stages when I was first sketching out the idea and trying to come up with basic dimensions, solutions for handling light diffusing, etc. You can see that below.

Here is a photo of the very first sketch for the project idea, if you don't feel like watching the above video

So that was the first step. I decided I wanted to make a box, with icons, and a button. Around this stage I'll add that I was doing a LOT of early research behind the scenes into the feasibility of my idea. Basically, would I be able to make this box "work" with the ESP8266, would there be some sort of service/technology/protocol that would allow me to communicate between boxes at near real time, would there be enough outputs on the board to allow me to do all of this. Etc.

Honestly I am not an electronics expert, and there are so many very basic concepts that I didn't understand, and the ESP8266 community was amazing in helping me get started with this project. I honestly can't recommend ESP8266.com enough.

Once I knew roughly what I wanted to build, I started putting together some drawings in SketchUp. The first versions of the sketch weren't very good and I actually ended up re-doing these a few times to get better, more dimensionally accurate versions.

Here is a few from the back...

And here you can see a cutout that shows the location of the "led array" that I would end up using to mount the LEDs and diffuse the light.


The "LED Array"

In the very beginning I knew that I wanted each icon in the front of the box to be independently lit, and I knew that I wanted the icon or name that was lit up to be independent from the other lights, and to be evenly lit. In other words, if the light representing "Grandma" was lit up, I didn't want the adjacent names the even a bit lit up. So no light bleed. And because I was using single LEDs I knew that I ran a risk of having bright spots on the individual names/icons as well, so I wanted to make sure to difuse the light as much as possible.

Additionally I had to actually consider how I was going to mount 8 LEDs in each box, times 9 boxes (7 in my immediate family, plus Grandma, plus Lindsay)

This was around the time that I realized, by far, what the most difficult part of this project was: making nine boxes that all worked the same and looked the same.

This is already going to be a painfully long blog post, so I won't spend TOO much time dwelling on this, but there were so so so so many things on this project that I could have "faked" and sort of just figured out and brute forced, like figuring out how to mount 8 LEDs inside a box, perhaps I could use used cardboard and just cut some holes in them and pushed the LEDs through or something. But there was room for human error, and if I had built a box this way and found out that later on it wouldn't work for some reason, then I could have just done it over a different way. No big deal. But when I'm building 9 of these boxes, I can't afford to waste an hour on something that turns out not to have worked because that's actually 9 hours, a full days work. On something small. So everything I did, as you'll see throughout this blog post, I did several times over and over in various stages of prototyping, before I came up with a design that I felt would work. I could have "faked" a single box in a fraction of the time, but doing things x 9 meant a lot more planning, and even still a TON more time.

I ended up coming up with a design that would allow some space between the LED and the face of the box, so that the LED wasn't pressed right up directly against the front (testing this showed me that I'd end up with more of a bright spot, even the inch or so of space between the LED and the fact of the box helped with diffusion quite a bit). Here you can see a few different version of the early idea. The first image below was done with the idea of 3D printing the part in mind, but after some research and discussion I decided that it was more practical to laser cut the thing.

Here you can see a closeup of one of the "boxes" in the array. Note that the rear square cutout is dimensioned such that the LEDs I ended up sourcing would fit snugly into (in theory!)

After doing the design and thinking through how this would work, I used the very awesome and free/open source tool Inkskape to actually create the laser cutter paths for the part. I'll add that this was a brand new experience for me (first time I'd ever used a laser cutter, first time I'd ever used Inkscape, etc). So I had to learn all of the tools/materials/etc, which add to the project timeline quite a bit.

Eventually it was time to actually cut everything out. Again, it's difficult to explain just how much time I spent figuring out which sorts of material I should use for these "LED Arrays" but I ended with this fairly cheap particle board stuff I was able to buy at Home Depot. You can see one of the first parts that I cut here. A small side note: you can see my early experiments with different "icons" for the face plate. I eventually went with a much simpler icon, largely because it was difficult to get a look that I was happy with that had a lot of small parts because cutting complete circles around things means the thing is no longer attached to the part, so it's not very practical.

Here is where I did this all..

And here are things actually being cut...

You can see a video of the parts actually being cut out here:

Here are the parts, cut out and separated.

Here you can see how the LED fits into the back of the array.

And here you can see a long and not particularly interesting video where I describe in more detail the LED array, how it will be put together, etc.

I mention in the video problems with gaps that allowed light leakage and I mentioned spray painting the inside of the box with silver paint. This was another "rabbit hole" that involved me reading various forums about light reflecting spray paints, materials/strategies for stopping light leaks, etc. In the end I actually ended up using some puffy paint that I had around the house to seal up any light leaks. It wasn't as "pretty" but in the end this LED array isn't visible anyway so it doesn't matter too much, and the important thing is that the light leaks were stopped!

After I made a single LED Array and tested out the fit/etc, I started to mass produce them. This wasn't exactly a quick process. I think it took me around 20 minutes per box to PRINT, then another 15 minutes or so to glue together. Plus additional overhead for each step. I'd guess I spent a full 6-8 hours just making the 9 led arrays, and that's after the designing, testing, etc.

Spoiler alert: you can see the LED arary in an early prototype box, with an LED in it. this was the basic idea.


Front Panel

The front panel of the box was something I spent a lot of time thinking about, testing, etc. In short, I had to decide what sort of material to make the front panel out of, how best to diffuse the light, etc, colors, look, feel, etc. You can see some of the early samples here.

Originally I had planned on using a thicker material for the faceplate, and cutting the icons out of this. This would have let me have a rigid face plate which would have made it easier to actually build the boxes (wouldn't have to worry about fine little details being broken/bent on the paper) but I realized quickly that thicker face plate material meant that the details of the icons were lost at angles. Here you can see the problem I had with the thicker front face.

Here is another video where I talk about some of the different ways I considered doing the front face. It's a bit annoying and I sound a bit like an idiot, but the point is that I was considering all sorts of different ways to make the front "display."


Capacitive Buttons

I like the idea of capacitive touch buttons and so I decided to use one for this project. In past projects I've done a simple flat wire "inlay" that acts as a touch button, but for this project I decided I wanted something a bit more three-dimensional. I also knew that I wanted something copper. In my very fist mockup/design I had thought that I might try to find a solid copper cylinder and machine out a smooth dome on the top. Doing some research, this turned out to be incredibly expensive (copper isn't cheap) and on top of that would have required me learning a new skill (machining). So I decided making a flat, solid disk wasn't practical.

What I found instead was flat copper "blanks" used for jewelry making. These turned out to be an even better and more aesthetically pleasing (in my humble opinion!), although they did require a bit of experimentation and a bit of reading about/learning about basic jewelry making techniques.

The idea was pretty simple. Take a ball-peen hammer in a vice and pound the blank disk until it naturally formed a dome.

Here you can see the station I worked at.

Unfortunately, I wasn't able to get a perfectly uniform (in size/diameter) dome, so I ended up making up a simple "jig" for pounding out the shape. They actually make devices for this ("doming"), but I didn't have one so I just made my own. This worked OK, but the soft/cheap wood ended up allowing the copper disk to "stick" inside which required using a screwdriver to pry out the disk from the jig. Not a huge deal, but this left some of the disks a bit blemished. Oh well!

Here you can see the start of the jig and how it was made, basically by driving concentric holes of decreasing diameter into a piece of a 2 x 4.

Here you can see one of the disks being formed in the jig.

On the opposite side of the jig I had a 1.5" hole drilled to a millimeter or so depth, which was the size/diameter I would eventually have drilled in the top of each box. Basically I used this as a template so I knew when the disks were properly sized. Here you can see a disk properly sized, fitting into the template.

Here are the stages of the metal disk creating, from blank to ball-peen hammer shaped to get the basic texture/shape, to the final shape/size after using the jig.

And finally, some of the final domes. Note that the texture is not the same on all of them becaue I experimented with different types of hammers. This was somewhat annoying for me in the end to not have 100% uniform boxes, but the types of woods I used on the final boxes were a bit different anyway and I think some of the more hammered looks go better with some of the darker woods. Also, you'll notice some of the copper looks darker, that's (I think) because it's a bit more tarnished because I handled some of the disks more earlier on and there were a few days in between forming some of the disks.


Prototyping the Boxes

I should point out that not all of the steps here are 100% in order. A lot of the parts of this project I did at roughly the same time. In other words, I didn't make 9 LED Arrays, then 9 front faces, then 9 capacitive touch buttons, then start prototyping the boxes. I did all of this together, so that I could test the different components together as I went. Probably obvious, but I just wanted to point this out!

I ended up building perhaps 3 or 4 almost complete boxes in various steps. I had done a somewhat stupid thing in that I had decided on a lot of inner dimensions of the box somewhat randomly, which meant I ended up having to plane each board down to another somewhat random dimension. Of course I could have adjusted other inner dimensions to make the sides more reasonable, but at this point I had already started mass producing the LED Arrays and had already started to cut the front facing "display" panels, so I just went with the sizes I had originally specified.

Below you can see photos from the first prototype. The first prototype was built out of some scrap MDF that was around the shop.

Here you can see some of careful and very professional looking calculations I did for sizes.

The first box I used a table router to cut the groves for the front and rear panels.

And here is the amazing first prototype with a frosted piece of plexiglass inserted.

The first box I mainly built so that I could test out the LED Array and the front panels, and to roughly figure out the dimensions and size of the box, to make sure everything roughly went together. I didn't even bother with a fourth wall of this box.

The later prototypes were made out of slightly better materials. Actually one of the last prototypes was actually good enough that I used it for my Grandmother, mainly because it was Oak and I thought it looked like it might fit well in her house (the other boxes were maple). Here I am planing down some of the 3/4" "common" boards.

I ended up using the table saw to make the mitre cuts on the final boxes. This worked pretty well. I was originally planning on using the mitre saw, which is perhaps the obvious choice, but I found it difficult to get perfect 45 degree cuts... Looking back I think I should have spent a bit more time testing out the mitre saw vs table saw, because my cuts were not perfect on the table saw. Actually (spoiler alert) the lack of perfect 45 degree mitre cuts was one of the top regrets when I was all done (you'll notice some gaps in the final boxes around the edges).

Here is one of the prototypes with the jig I used when I was attempting to cut the pieces with the mitre saw.

Here is one of the later prototypes, including one of the formed copper buttons.

And here is a mess of wires with the LEDs I used to test the box. As you'll see during the final "building" process I used white wires for the LEDs.

And here is a prototype with an early working version of the circuit


Early Electronics

As I mentioned earlier, during this entire process above, and in fact even before, I started designing the actual "guts" of the system. In other words, the actual circuit and code for the ESP8266 that made everything "tick." At times "designing" is a bit of a nice way of putting it, as there was a lot of posting on random forums saying, "what the hell is this diagram supposed to mean?" or "what exactly does the forward voltage requirement for this LED tell me?", etc. I learned soooo much during this project.

There were a lot of considerations to make early on in terms of how I would approach the circuit. My original plan (based on recommendations from the ESP8266.com community that really were probably very smart, and very practical, and would have saved me a TON of time and money) was to use ESP8266-12 "test boards" for the project. These have basically (almost?) everything I'd need in a single package, with all (most?) of the IO pins exposed. In fact, I actually ended up buying probably 15 or so of these things - I needed 9 for "production", 3 for early tested, 3 extra just in case. 15 of these things x ~3 or 4 bucks might seem crazy, considering I only needed 9 of them, (i.e. a waste of 24 bucks), but the problem is that to get the parts this "cheap" I had to buy them directly from China via Aliexpress, which meant potentially a month of shipping time.

Here is a closeup of teh board itself

This was actually a theme of this project, order/shipping lead time. I'd actually call it a somewhat enjoyable puzzle because it added suspense and gravity to my decisions, because, again in the example of the test boards mentioned above, I might only get one, possibly two chances to order a part. If I messed up, ordered the wrong part, screwed up too many times, etc, then the whole Christmas delivery would be completely shot, potentially by weeks if not months. So, again, I found myself always ordering around one and a half times the number of items I needed, sometimes twice as many.

But I digress! The point is, I ordered these tests boards with the intention of using them for the project. I also ordered a separate board that I was intending to use as a power supply.

Here is the ESP8266-12 test board (the battery pack came with it, attached, but I didn't plan on using that), and next to it you can see the power supply I had intended to use.

Of course I didn't order just one, I actually ordered something like 15 of these power supplies, which you can see here. (Bonus photo of the box the 15 or so test boards came in!)

Here are the "wall warts" I bought for the power supply. These I did end up using, luckily, so all was not a waste!

I also bought a number of other parts (in quantities of 15 or so), including MCP23017 IO expanders to allow me to more easily drive all of the LEDs I wanted. I also bought a bunch of ESP-01 (this is the version of the ESP8266 used in the original tutorial I found) to test with early on.

You can see that early on I had a mess of wires, and struggled on and off to even get the most basic circuit to work.

In the end, thanks in large part to encouragement from my very dear friend Nick S., who asked me something along the lines of (semi-kiddingly and in a friendly and supportive way!), "would Steve Jobs have made such a terrible looking thing?", I decided to not use ANY of these parts what so ever.

A quick step back and look at that decision...


A Bit More About the ESP8266

I mentioned earlier in this post (seems like ages ago!) that the ESP8266 is sort of like the Arduino, but simpler. I mentioned it's sort of like a computer with wifi. I think I should mention a bit more of the details around the limitations and what you get "out of the box." A huge caviot here is that I have a fairly simplistic and high level understanding of the ESP8266 and I am NOT an electrical engineer by and stretch of the imagination.

All of the ESP8266 have the same "core" (processor and innate abilities), but they have different output pin configurations. The EPS8266-01 for example only has 8 pins exposed (including Vcc and ground), which means without using different electronics bits or using fancier electronics logic you can't directly control much stuff. By "pins exposed" I mean the ESP8266-01 actually has male header pins for the IO, meaning you can directly hook a jumper wire up to it (this is in large part why it's used on a lot of simple one-button projects I think). On the other hand, the ESP8266-12(E) has a LOT of IO exposed (10, maybe 12, including ADC? Maybe even more), but it's not directly accessible without soldering the ESP to a header board (not sure if this is the correct term), or buying something like the test board I mention above (which basically takes the ESP8266-12(E) and puts it on a board with all of the IO connected to male header pins for easy access, plus a few other things I'll mention below). So if you want more IO (for directly controller a bunch of LEDs for example!) the 12E variety is a better choice.

Again here is a picture of the 12E on the left in a tape package. Note the pads on the exterior with the little holes in them. This is the IO, but there is no practical way of attaching a wire to these. On the right is the ESP8266-01 from the side. Note there are 8 pins only, but that the male header pins are exposed, making it really easy to directly connect this board to power and use the available IO pins

The Arduino handles power management for you out of the box. You can take an Arduino and plug it directly into a power source (within reason) and BAM! It will work. The ESP8266 on the other hand, has nothing like this. The board requires source of 3.3V, and it's pretty picky about this it turns out. Which means you need to have some circuit "in front" of the ESP to clean power and supply it with 3.3V. This is not that complicated it turns out, but it's an additional step to think about. This is why the test boards originally were a great choice, because part of the circuit you can see on the yellow PCB is actually a power regulation circuit, that takes an input voltage of around 5V or so and "cleans" it and provides 3.3V directly to the ESP. The extra power source I had purchased was to take voltage from the wall wart and convert it to ~5V, to make sure the test board could handle the voltage from the wall. This MAY have been overkill but I wanted to be sure the test board could handle the voltage coming in, and it wasn't dealing with power directly from the wall.

The other thing it's worth noting is that although it really isn't ALL that complicated, unlike something like the Arduino, out of the box if you just plug the EPS8266 into power it won't "run", or at least not correctly. The thing is, certain pins on the ESP have to be "pulled high" or "pulled low" depending on what you want to do with it. What this means (basically) is that to "boot" the ESP into normal run mode, you need to have certain pins directly connected to either power or ground. If you want to boot the thing in programming mode, certain pins need to be "pulled low" (i.e. connected to ground). The test board in theory does this for you, which was nice. Without the test board, you have to make sure you are accounting for these requirements and that if you want to program the board you have some way of setting the pins to their required configuration for the given task. This turned out to be a bit difficult for a somebody like myself new to some of these concepts.

I'll add that because of these "pull up" and "pull down" requirements, it makes some of the 10 or so pins on the ESP8266 not actually fully usable, at least not directly. This I won't get into TOO much, but basically the trick is some of the pins need to be connected in certain ways to either voltage or ground, which long story short meant I had to use them "backwards" - rather then turning "on" a pin to turn on an LED, some of the pins I had to turn "off" to turn on. This added to the mental overhead of the project. I could have gotten around this mental overhead for the most part by using an IO expander (mentioned above and seen in the video of the non-working blinking LED!) but I ended up not going that route. Frankly I'm not sure it wouldn't have made things "easier" in the long wrong, but in large part of aesthetic reasons, and to cut down on the number of "systems" (Nick gave me a push in that direction!) I went without the IO expander.

So basically the test board gave me this: power management, exposed IO pins, and making it easy to set the "mode" of the board between programming, boot, and run.

The "cost" of these features was having a really ugly, big, and probably overly complicated circuit. Rather than a slick, "clean" circuit that did exactly what I wanted and nothing more and nothing less, I was cobbling together a bunch of random parts. Jumper wires going everywhere, etc. A general mess.

So, I eventually decided to go all in and design a custom PCB for the project.


Making A Custom PCB

So after deciding to make a custom PCB (which was FAIRLY early on in the project, around the time I had completed the second prototype) I jumped pretty much straight it to designing a schematic. Overall this was fairly simple process and basically consisted of figuring out what I need in terms of supporting the power requirements, what I need in terms of supporting programming the board (basically using a jumper to allow you to switch into "program" mode), and what I needed in terms of components for the LEDs.

One decision I had to make fairly early on is what size components to use. It turns out there are a lot of different sizes of components (resistors, capacitors, etc). I decided to use 0805 components, which are small, but manageable. I actually got OK at soldering this sized component, although it's an incredibly tedious task (especially when you are soldering, say, 15 * 9 little 0805 components, plus the screw ups!).

To give you an idea of size, this is one of the resistors I used on the board (it's on the "Command" key).

Here is a tape that contains the power regulating chip that outputs 3.3V. Each of those little windows is one of the chips, and these are actually relatively "big".

This was my first time designing a PCB, and I chose to use Eagle, in large part because I had watched This amazing video tutorial series from Jeremey Blum which went a LONG way in getting me started.

Here is what I came up for "REV A" - the first version of the board (that turned out to have a few problems!).

Here is the Eagle layout version.

After designing the circuit and asking as many people as I could for feedback (and once again, huge thanks to Nick for working though lots of problems with me, there was a lot of team effort in this!), I got the board printed at OSH Park. OSH Park is an amazing service in my opinion, especially for somebody new to designing a circuit board, because you just upload your Eagle file and you're done. It's pretty simple.

After getting the first revision of the board back I was super excited to try it out, and super disappointed when I quickly realized that I had not properly pulled certain pins as I needed to for the board to properly boot up and "run." The problem with a hardware bug is that it's not something that can be fixed quickly with a software update, it requires reprinting the boards. Which means another 10 days or so turnaround.

Here is the first board I soldered together. If you're wondering what the symbol (that didn't end up printing well so was removed) on the board is, the white circleish design, it's a hanko stamp design for "Mitchell." Here I am trying to get the first board to work. I eventually did get it to work it just required manually connecting various pins on the ESP to vcc/gnd/etc, and it wasn't reall practical.

REV B of the board worked. There was still a "bug" where I didn't connect a few of the LEDs to GND, so I had to bridge some pins with a bunch of solder, but overall everything worked with REV B.

This is the "preview" that OSH Park gives you when you print a board

Here are the boards when they came in the mail

And an individual board...

And a board with MOST of the parts soldered


The Code

Programming the ESP8266 is a fairly simple process, and there are a lot of choices in terms of how to actually program the board. A lot of the tutorials and articles you'll see on the internet use Lua, which is a good option, but there is also an Arduino "port" that allows you to write Arduino "sketches" to run on the ESP. I seemed to have better luck with this approach, so that's what I did!

I mentioned briefly in the past, but I decided to use the MQTT protocol for communicating between boxes. Essentially MQTT is a pub/sub type system where you (the boxes) subscribe to certain topics by sending a message to the server (which I host) asking it to notify you about a particular topic, and as soon as a message comes in to the server with a particular topic you execute some code. The message is passed in as a parameter to whatever callback you specify.

In other words, each box subscribes to a shared topic, let's call it "mitchinexmastopic" and each time a person presses the capacitive touch button the the top of the box, the box sends a message to this topic. The message itself is just the unique ID of the box whose button was pressed. For example, say I press my boxes button, the message "kev" might be sent to the "mitchinexmastopic." Each box will get this message, normally within a fraction of a second, and turn on the appropriate LED.

There is a library that I was able to use to support MQTT which was SUPER handy. I also used a library to provide a simple web interface to configure the box. Essentially, when the box starts up it enters "AP" mode where it broadcasts a wireless network. Connecting to this network allows you visit a simple website hosted on the ESP, and this allows you to enter various configuration information including your SSID/password, your box ID, etc.

If you're interested in the code you can view it here on github.


Finally, Final Construction

Finally, a few weeks out from the holidays, I had the boards in, one full board completed and soldered together and tested, I cut all of the wood, finished banging out all of the buttons, cutting the front displays, etc.

Cutting the wood and drilling holes for the button

I decided I wanted the rear panel of the boxes to be removable and clear so you could see inside the box, and I put a male power jack in the rear panel as well. This is testing hole sizes to find the correct size for the jack, and then the first final rear panel, plus photos of the laser cutting the front panels.

A stack of the completed front and rear panels, plus some extras!

I also decided to engrave the inside panel of each box, so I hand drew a little note for each family member, scanned them and engraved them inside.

I soldered each capacitive button to a wire to connect to the board. This wasn't too bad, though "not too bad" x 9 is still a bit of a task!

What was TERRIBLE though was making all of the LEDs for the box. I hand soldered 2 x 8 x 9 wires, then crimped (and I didn't have a crimping tool!) by hand, using my finger nails, the other ends, and then finally shrink wrapped the solder points. And then I used some cheap pain to color code the LEDs so I could be sure to put them in the correct relative positions in the LED Array + the board.

Here is a small pile of the LEDs

Here is a single completed LED that's wired and colored.

Here are some of the bundles of LEDs getting ready to put into the LED arrays

The bottom of each box was drilled to allow the PCB to be attached to the bottom

Here are 8 of the final boards soldered up. I ended up running around 2 of the REV B boards due to terrible soldering missteps.

The LED array with the LEDs glued in (and on the front the "display"" glued in place)

And a bunch more of them...

Everything but the capacitive touch button hooked up, and basically ready to be glued

And the first box glued up! Notice the gaps on the mitre joints I mentioned earlier :(

And this is what our kitchen table looked like for a solid month (sorry Lindsay!) during this project.

Our "office" wasn't much better...

Here you can see the back of the box. You may not be able to clearly see but the rear clear acrylic slides in and is removable for service/reprogramming

And tada! All of the boxes finished and packed in boxes to wrap and put under the tree!

Easy! Done!

And some more complete renders


Debrief - What Didn't Work

Overall, I'm pleased that I completed the project, and I'm proud of it, but realistically I'd only give the final product a 8.5 out of 10. The main reasons for this are as follows:

In "production" for the past month, I've recently had a lot of issues where my box will "freeze" every few days. I'm not sure why this is, and it's likely fixable, but it's certainly annoying and generally leaves me feeling like a lot more care would need to go into the code and circuit to make things more robust. It's POSSIBLE I have a short somewhere that's causing the issue, but I haven't had the motivation yet to track down the issue, I just have to unplug the box every once in a while. This is OK for me, not a huge problem, but for the "product" I was hoping to give my family it falls a bit short.

The experience using the web interface to configure the box and setup the SSID/password for home networks leaves a LOT to be desired. This was one of the biggest pains to get to work at all, and it's FAIRLY reliable, but I've noticed that certain devices don't seem to connect very well to the AP created by the ESP. Again, it's something that can be worked around, but in terms of being a finished product the experience falls a bit short.

The LEDs themselves, and the way that I soldered each LED to wires, and crimped them, and then shrink wrapped them, and then color coded them, took up SOO much time. I did this largely so that I could replace a bad LED if needed without having to throw away the whole board, but it was just such a huge pain and took literally DAYS of soldering to complete. I think there must be a better way (maybe?!).

The actual construction of the box was fairly well thought out, but there is a lot of room for improvement, specifically around the front face and how it was inserted into the box. I cut a slot in the front of the box that the front clear acrylic and the laser cut "display" + light diffusing velum had to slot into. This worked out, but it was a huge pain in the ass because I only had one shot when I was glueing the wood sides together to get the glass/paper layers into this slot. So I ended up with dust and glue on the inside of the acrylic panel, which sucks because there really isn't any way to fix this once the sides are glued together. Luckily it's not super visible, but it was certainly a poor design choice, or at least a choice that could have used a lot of improvement.

Again, overall I'm very pleased with the final version of the box. I learned SOO much and have a bunch of new project ideas that I think will now be much more attainable with all of the skills and experiences I gained from this project.

Thanks for reading!