22 May 2017 / Last updated: 23 May 2017

Resin-in-resin: how to make a literal "embedded" device

Execution time:
This project is also on Hackaday!
Resin.io does a lot of cool stuff. But if you had to say what we do in one sentence, it's this: "resin.io enables you to safely deploy and manage fleets of embedded devices that you might not have physical access to."
I'm a Solution Architect here, which means that part of my job is to show people exactly how resin.io works. Usually I do this in a very "real world" way by pointing webcams at devices located in our offices all around the world and then deploying code to them with a single git push. But I've always wanted a way to make this feel even more tangible than deploying to a fleet of Raspberry Pis that are thousands of kilometers apart. Something that people could really see and know for sure that resin.io just plain works.
A few weeks ago I realized how I could do it: I'd attach a display to a Raspberry Pi and encase the entire thing in a block of clear epoxy resin. The USB and Ethernet ports are filled in and the SD card slot is inside the solid block. Even when I carry it with me, it's still accessible only remotely. It’s literally an “embedded” device.
I call it "resin-in-resin."


In order to make a completely sealed-off single-board computer that could still visibly work, there were a few things I needed to figure out and some tests I needed to run.
The first challenge was finding something to encase the device in. It needed to be clear, not electrically conductive, not corrosive or otherwise damaging to electronics, and a decent conductor of heat (otherwise my Raspberry Pi would melt if I left it on too long). Luckily, there are epoxies that meet all of these criteria. After some research, I found several epoxies specifically made for "potting" (encasing) electronics. But they were all very expensive and would have cost me hundreds of dollars to get enough to encase a single Pi.
Instead, I decided to test some cheap epoxy on some electronics I didn't mind losing if it failed. My first mold was a rough rectangle of cellophane tape and my "electronics" were a single WS2812 color-controlled LED. It was a success!
I strongly recommend running some small scale tests like this before casting anything in epoxy. My first attempts were clumsy and I ended up with a huge number of air bubbles in the resin. It's a cool effect with an LED but I'm glad I learned how not to do that before casting a nice display. (For those playing along at home, the trick is to stir very slowly and not pull the stirring stick out of the resin.)
After the LED test was successful I did one more test, this time with a Raspberry Pi. To keep things simple for this one I used a USB cable that I kept out of the epoxy entirely, allowing me to plug it in for power.
This test was successful as well and we were able to use this prototype to great effect at Dockercon 2017.


Warning! Please don't attempt to recreate this version of the project without giving the battery space to expand. We're currently revising the project to account for this design flaw.
After a these tests, I was ready to build the standalone model. After discussing with my colleagues at resin.io, I worked out what would be needed:
  • a Raspberry Pi
  • a display
  • an inductive charging coil (for wireless power)
  • a battery (and associated charging/power management hardware)
  • a magnetic reed switch to turn off the Pi
The battery (and associated switch) are needed because the Qi charging coil can only provide 500 mA of power. This is enough to run the Pi when it's idle, but unfortunately not enough to allow it to boot reliably. So the boot process is to use the magnetic switch to turn off the Pi, put it on the charger for a few minutes to allow the battery to charge up, then remove the magnet so the Pi boots.
Here we see the battery charging with the magnetic switch keeping the Pi turned off.
Of course, I enlisted some help from my colleagues to make this, including resin.io's head of support and chief solderer, Sonya Green.

Final result

The final result is pretty cool if I do say so myself!
Everything works! The inductive charger gives the battery enough juice to keep the Pi running for hours on a full charge and we can push updates to the Pi using resin.io. It's truly an "embedded" system!
If you're at @makerfaire, you must check out what @resin_io is showing. A @Raspberry_Pi completely enclosed in resin. Completely wireless. pic.twitter.com/djVjoLz3hI
— Matt Richardson (@MattRichardson) May 20, 2017

Building your own

If you'd like to build your own, I have put together a shopping list on Adafruit.com with all the necessary electronic components.
You can buy a silicone mold or make one yourself out of wax, clay, or even tape. Just make sure that the mold has at least a centimeter or so of space on each side to allow the epoxy to completely coat the Pi. And if you build your own mold, make sure it is sturdy enough to hold everything and not dump epoxy all over your floor!
The epoxy is also easy to find online - the key phrase to look for is "water clear epoxy". It's usually sold as a tabletop or countertop coating, so the instructions will talk about pouring out a large amount in a very thin layer, but it will still work very well for casting. Just take it slow when stirring and pour several layers when embedding your Pi instead of trying to do it all at once.
I've put together detailed instructions and logs of each step at hackaday.io. If you build your own we'd love to hear about it!

Share this post