Resin-in-resin is a Raspberry Pi with a display completely encased in a block of clear epoxy, but still able to be updated and used.
Some people have brought up very valid concerns about battery expansion in this project. I'm working with some ideas on how to easily add an external battery rather than keeping it inside the block of epoxy, so I'd suggest doing something similar if you want to build a project like this yourself.
The epoxy is about an order of magnitude more thermally conductive than air (meaning heat dissipation is not really a problem -- the unit will stay cooler than it would outside of the epoxy due to the greater surface area of the block) but there could still be some potential outgassing issues. So if you build this, do your own research and thinking about the battery.
My colleague Sonya agreed to pitch in and help make a few more of these! We headed over to the Cambridge Hackspace and got to work.
She was thrilled to mix epoxy.
After getting the base layer of epoxy down, we got to work on wiring, which actually is more fun.
Cutting up a perfectly good USB cable never stops feeling weird though.
We experimented with using a heat lamp to cure the epoxy as it was quite cool in the hackspace where we were working.
Now that I knew that I could cast a Raspberry Pi and display in epoxy and have it still work afterward, my colleagues and I started brainstorming about how to improve it. We knew we wanted to get rid of the one remaining cable, but we weren't sure what the best way would be.
We talked about a few ideas: inductive charging, leaving flat metal pads flush with the epoxy, or maybe a pair of pins or small sockets. We decided to try inductive charging first as it was the only truly wireless/contactless solution.
I had a few Qi charging pads lying around from phones with this capability, so I got a Qi receiver coil (and a handy power regulator and battery charging circuit from Adafruit). I threw a battery in as well because if you're going wireless, you might as well make something you can pick up and hold while it's working.
I fumbled around a lot while testing out that circuit -- trying to keep a multimeter lined up with it while keeping the coil lined up with the charging pad was a huge pain! It finally occurred to me that I could just tape the coil to the charging pad while I was working on it and things went much more smoothly from then on.
My intended design was to have a micro USB cable in the power input of the Pi, strip the ends of that and solder them directly to the power regulator, and plug the battery in to give it portability. So I started by verifying that that setup worked.
I had to strip the inner wires of the USB cable with a small knife as my wire strippers wouldn't go that small. (Somehow cutting up a USB cable felt... wrong. It wasn't that tough to do physically but it was emotionally difficult!)
Everything worked just as I had expected. But there was one more thing I needed to try: starting up from a completely dead battery. Without any external way to disable the Pi, it would have to run until the battery died every time it was charged.
This turned out to be bad news. The Pi would power up when put on the Qi charger, but the 500mA that it provided wasn't quite enough to boot up with the display attached. It would start booting, get partway there, and then die (right about the time it tried to initialize the WiFi, I think.) After watching it struggle for 10 minutes and not make it all the way on, I realized I would have to include a power switch so that the battery could charge for a few minutes before turning on the Pi. (Handily, the functionality to turn off the device pulling power but still allow the battery to charge is already provided by the charging circuit I had.)
This was disappointing because I wanted to have this thing completely sealed, but a single switch flush with the outside wouldn't be the end of the world.
I got everything laid out and hot glued in place so it would stay that way while I put it in epoxy, but it was getting to be too late in the day to start casting it so I decided to wait for the morning. This turned out to be the best idea I'd had so far!
I headed out to see a movie with a friend of mine and chewed on the problem on the walk there. I had a feeling that there must be something that would keep me from having to put a power switch on the outside. I thought about various circuits involving solar cells and flashlights, or photoresistors... but then I realized I had a magnetic reed switch sitting in a pile of parts at home! As long as the magnetic field was strong enough to work through a centimeter or so of epoxy I'd be all set!
The next morning I ripped out the switch and replaced it with a reed switch and started casting.
This was way more elegant than the physical switch and would be easier to keep lined up in the epoxy to boot. I was thrilled when it worked!
The only hiccup I ran into this time was that the epoxy loosened the hot glue enough that it didn't all stay in place while setting up. So I had slightly skewed components at the end. But that was okay with me, as I had a working, totally sealed Pi! It's hard to overstate how cool this was. :)
The magnetic switch worked perfectly too, letting...Read more »
Now that I knew that my epoxy wouldn't dissolve an LED or catch on fire when I stuck wires in it, I felt confident enough to try it out with a Raspberry Pi. I found a cheap silicone mold on Amazon to use. You can find a lot of molds for jewelry, candles, and chocolates, but they tend to be too small for something like a Pi. I managed to find one for making bars of soap that was just about the right dimensions. I'd rather have had it another cm or so larger on each dimension, but it was big enough that the Pi would fit even if it were a bit tight.
Casting worked a lot like the LED I did originally, though with me mixing the epoxy much slower this time. I started with a thin layer in the bottom of the mold which I let set for about 3.5-4 hours. Then I poured a tiny bit of epoxy in, gently set the Pi on top of it, and drizzled a ton all over the back. I made sure that I got epoxy into the USB and Ethernet ports so that there wouldn't be a huge air bubble there at the end.
At this point I hadn't yet come up with the idea of making it totally wireless, so I just snaked a USB cable out of the back to provide power. It just extends out of the mold to stay out of the way here.
After letting that set for another 4 hours, I got a last layer of epoxy ready to pour. On a whim I decided to throw a resin.io sticker in to make the back a bit more interesting.
Then I let it set overnight. I made a small aluminum foil shield and set a radiant heater next to it as it was a bit cooler in my house than the epoxy instructions recommended. This seemed to work very well and caused the epoxy to set up a bit faster than I expected.
The next morning I peeled back the mold and tested it out. Luckily it fired right up!
There were a few small bubbles in the front (which weren't really able to escape from under the flat display) but the back was crystal clear. The bubbles at the front are something I'm still working on resolving; I might eventually try doing one of these face up, though the corners don't turn out quite as nicely on that face. But they look way worse in a photo than they do in reality, so I'm reasonably satisfied with it for now.
After doing some research and ordering a bunch of epoxy, I wasn't 100% sure that what I had would work. It might have some interaction with the electronics, not bond properly, be conductive, shrink too much or put out too much heat... there were a lot of open questions.
So rather than start with a full Raspberry Pi, I went with something a bit smaller and cheaper. I decided to embed a single WS2812 LED in a block of epoxy.
I made a "mold" out of some clear packing tape in a rough square. I poured this in two parts: first a base layer, which I let mostly harden over the course of 4 hours or so, then put the LED and wires in and poured a layer on top. (You can see some of the tape "mold" in these pictures of it drying.)
Doing this was useful beyond just for testing whether the epoxy would work for electronics. You can see that the blob of epoxy I ended up with is very frosty, not terribly clear at all. This is especially true of the first layer at the bottom. There's a clear line between the first and second layer because the first one is so bubbly and frosty. It's especially visible once I took the tape "mold" off later.
I learned here that even though the epoxy instructions say to mix thoroughly for a long time, what they really mean is to mix for a long time but very slowly. I wasn't stirring particularly fast (maybe half the speed you'd stir something while cooking) but it still introduced a lot of bubbles. The key in the future would be to mix as slowly as I could to minimize those bubbles.
Anyway, once it was hardened came the moment of truth: would the LED light up when I put power to it?
It worked! Now I knew I was ready to try the real thing.
Lessons learned from this stage:
I've wanted to build something that makes a Raspberry Pi "inaccessible" for a long time. I work at resin.io where we make it possible to safely deploy and update code on embedded devices "in the field" where you might not have direct physical access to them. If you can't easily get to it if you mess up a deployment or update, then it becomes really important not to "brick" a device!
It finally occurred to me that what could be more inaccessible and "embedded" than being actually embedded in clear epoxy? A rock hard brick of resin with a computer in the middle of it is about as inaccessible as you can get!
I did a lot of research up front on different materials, trying to find what was clear and safe to use on electronics. Finding something truly clear was the first challenge until I found the magic phrase "water clear epoxy". Apparently it's "water clear" that means "really actually clear and not just kinda translucent" if you're in the materials business.
Once there I started looking for materials that were safe to encase (or "pot") electronics. They existed but they were all very expensive and would cost me in the neighborhood of $150 or more to encase a single Raspberry Pi. On the other hand, there were plenty of materials intended for covering counter and table tops that would cost me $15-20. So I decided to start there and see what happened.
The interesting bits I learned at this phase are:
Grab the equipment needed. For simplicity I made a wishlist on Adafruit that contains all of the electronics. (I'm not associated with them in any way other than as a happy customer; feel free to get similar parts elsewhere if you have a preferred provider.)
The only thing you'll need aside from the electronics is a mold and some resin. I got a square silicone soap mold from Amazon. The mold I linked to is just barely big enough for all the components to fit in snugly and leave a tiny amount of epoxy around the edges. If you use something else make sure you measure carefully to be sure it will fit!
I also got the resin I used from Amazon, though you can likely get any similar epoxy from a craft store or home improvement store. Look for something intended to coat tables or counters. The 16 ounces (just shy of 500 mL) is enough to make one of these, but it's pretty close. If you haven't done this before, I recommend getting a bit more epoxy to experiment with first. (Or to make other cool projects after!) It's not expensive and you'll be much more likely to get a great result if you play around with some small, simple casting first.
Get a nice work area ready. You'll want plenty of space to assemble everything as well as paper towels and gloves -- epoxy is sticky!
It's a step everyone wants to skip, but making sure you have everything laid out and ready to go will help you to not panic when you have epoxy curing and you're not sure if you're really doing this right or not.
Mix and pour the first layer of epoxy. Follow the directions for your particular epoxy to mix it properly (mine is a simple 1:1 ratio).
Do this slowly so you do not introduce bubbles. It's a good idea to do it in a clear container so you can tell when the epoxy turns from cloudy into clear. (Hint: wait until you can see something with fine text clearly through the epoxy, then stir for like another 3 minutes. You want this stuff to be really mixed.)
When pouring, use just enough to make a thin layer in the bottom of the mold.
(Creepy lighting is optional.)