24 June 2019 (updated: 23 September 2020)
Chapters
Can you pour concrete into a cardboard mould?
If not, maybe it’s high time. But if you did, then welcome to the club! We recently had an internal hackathon at EL Passion, and I came up with a challenging idea. Making a lamp!
A smart lamp. A smart lamp out of concrete! A smart wooden/concrete lamp with an RGB LED strip… And BLUETOOTH!
Within two short days of the hackathon (with a small overhead) we accomplished all of it!
About two months ago, I began to play around with electronics. I wanted to broaden my horizons, learn what cables to cut in the case of intelligent machines uprising and expand outside of my Frontend Engineering knowledge. I guess most of you can relate.
I started with the basics, got some components, watched tutorials and then could not decide what to do next.
After about two months, I remembered that there was a hackathon coming up!
I also recently saw Stephanie Nemeth’s talk at a front-end conference, where she had shown the fantastic things you can do with Arduino and RGB lights. So I decided I want to make something as neat as that.
But I wanted to make something that would be usable, functional and would require DIY, coding & electronics skills.
I settled on the most obvious thing one can make with lights — a lamp. And I found a perfect DIY build I wanted to imitate.
DIY lamp from a DIY Creators youtube tutorial
I already had an idea. Now I needed a team.
Pitching — Gathering the Team
Three days before the hackathon, we usually have pitching, where we present our ideas to the rest of the company and gather people that will work on our project. I’m not a great salesman, so mine sounded a bit like:
Ummm, so yeah, I want to make a Concrete Smart Lamp. Thank you very much.
Despite the lack of information, there were five people interested in joining my team! We had an impressive set of skills:
Let’s take a look at the shopping list. I listed only the things that we used and embedded permanently in the lamp. All the additional equipment, Arduino (prototyping, loading code to AVR), and components that we broke are not counted in.
Overall cost: 159 PLN (approx. $43)
It’s possible to get all the items for a lower price, but in our case, it was quite urgent.
Planks, concrete, sanding paper and other useful things.
The construction phase of the project was an exciting challenge. We spent the first 2 hours discussing how to make a cast for concrete that would meet the following requirements:
We came up with something like this:
It looks simple but making it wasn’t that easy. To make the cast we used a cardboard box, a lot of grey tape, a “magic mouse 2” box, two plastic straws and some hot glue.
Later we mixed and added concrete.
We didn’t want the cast to deform, so we used more tape and four litres of milk. We also put the wooden base into the concrete so that we would have space for it later (we nearly forgot about it though). All this is the equivalent of a “quick fix” on production systems, but as they say:
If it looks stupid but works, it ain’t stupid.
Smart People
This quote became our motto for the rest of the build.
I don’t have an image of the base right after taking it out from the cast, but here it is after a bit of sanding and already with the wooden arm installed. We also added some silicone legs, so that the concrete wouldn’t scratch the tabletop.
The arm is made out of two separate parts: the top of the lamp and the base with a cable inside. We connected them with a large screw, for which we drilled holes in both top & bottom parts.
Miraculously we didn’t burn down the office.
Turns out correctly measuring things is tough.
The top part was quite a challenge, as it required some delicate work with a soldering iron, but let’s start with the basics. We made it out of three pieces of wood, two thin ones (sides) and a square one. First, we glued everything together, drilled a hole for the large screw that holds the top and bottom parts together. After doing some sanding to make up for the fact that the planks were a bit crooked, Ula painted the arm, and once it dried, I went on and started mounting LED strips onto it.
First thing I did was measure out how to cut-up the LED strips. We didn’t want to put one long part inside, as it would not give that much light, so after measuring how much we’d fit, I cut up three strips, each one measuring 35cm. Then I soldered the main cable to the first part of the LED tape and used a heat-shrink tube to secure the connection.
A heat shrink tube and solder joints connecting two LED strips.
After taping the first strip onto the wood, I realised that I forgot what cables I connected to Red, Green, Blue and 12V+ outputs. It was a small setback, but we thankfully had a multimeter that allowed us to check the connections.
Next thing I had to do was to solder the two LED strips in series with the first part. It took me some time, but I managed to do it, despite having an 8$ soldering iron, with a tip that shrunk with each use. We tested it by connecting the cable to the breadboard and using one of the rotary encoders to change colour.
The lower part of the arm was complicated because we had to embed the cable inside of it. We thought about cutting it in half, carving out some space and then piecing it back together, but that would be error-prone, and time-consuming. In the end, we decided to glue on three additional pieces of wood to create some space for the cable, as shown on the graph. That’s also the reason why the part inside the base is slightly narrower.
We were missing a few parts, some pieces of wood, and the screw that would hold the arm together. We took a short break from all the work and went to the store to buy all those things.
The natural pine colour wasn’t that nice, so Ula painted both top and bottom parts of the lamp to make them a bit darker. We left it to dry overnight, and the next day, we connected it, and it looked great!
Painting process.
Cable arrangement inside the lamp.
I was not that involved in the iOS App creation process so I cannot give a more in-depth insight into the code. Jakub took the lead and delivered a working app before the end of the first day. On the second day he expanded it to have more incredible features, such as “Ambilight” like support, where, when you play a video, the lamp syncs colours with it (demo at the end of the article).
There were some issues with Bluetooth connectivity, more precisely, one Bluetooth module connected to iOS but not to Android, and another went the other way around. Right now the lamp only works with iOS, but for an MVP, that’s enough. And the Bluetooth module can be easily switched if needed since it is not soldered in place.
Speaking from my expertise, I can say that the App looks impressive, and the speed with which Jakub delivered it is also incredible!
The whole code is open source on GitHub. You can go through it. I’m not going to dive into the deep technicalities of how it works. Wojtek, who wrote most of the code, would be better suited to do it, so I created a high-level overview of how everything works. The simplified algorithm goes as follows:
Wojtek wrote the first version of the code for Arduino, and later I updated it to work on plain ATmega chip. The differences are minimal, as I introduced only two main changes:
You can see the pull request that contains a diff of all the changes if you’re curious.
Our plan was quite ambitious, for such a short time, but thankfully, Wojtek is quite smart and played around with electronics before, so he was the “lead” for this part.
We started with baby steps, testing different solutions by trial and error. Wojtek worked on both the code and the circuit simultaneously and tested how everything works. The electronics part of the lamp consisted of:
At first, we used Arduino instead of a standalone microcontroller, and we put everything on a breadboard to simplify the development process. At the end of the second day, we had everything connected on the prototype board. Bluetooth, rotary encoders and Arduino. This is what it looked like at the demo session:
After the hackathon, I wanted to spend some time and shrink the electronics to fit inside the lamp, so that the build is complete. To shrink down the electronics I had to:
I started with replacing Arduino. To do so, I had to install the bootloader onto the ATmega AVR (it’s the same one Arduino uses). I watched some tutorials (linked below the blog post) on how to install the bootloader and how to use Arduino as an ISP programmer (it lets us upload software to the microcontroller without any additional hardware). After doing so, I updated the code to use slightly different pins and Voila!
Next, I had to solder it all onto a tiny stripboard.
It was my first time working with stripboards, and I couldn’t find any simple software to help with the physical circuit design, so I went old school and planned it out by hand. I printed a sheet of dotted grid paper where dots represented holes of the stripboard. Then I drew all the connections and the way they should fit based on the current breadboard circuit.
To make it more understandable and visible, I created a graphic that represents the circuit on the stripboard.
Representation of created circuit. In the real build, I had to adjust it slightly, to fit all the components, but it looks 90% like the one above.
After about ten hours of soldering (still a newbie), and two burnt fingers (don’t touch the components if something smells funky) I managed to get it working! It went better than expected.
In-progress photo, to build up for the big reveal!
All the pieces put together. White cables are knobs, small wires with black insulation are the LED connections
View from the bottom. I used a thin copper wire to connect the joints.
If you look close enough you can see all the glue we used.
Check out a full demo where I go through all the features that this lamp has. Despite a couple of issues, e.g. crooked rotary knobs, and colours not being represented correctly sometimes, it works!
For me, and hopefully, the rest of the team, this has been one of the most satisfying hackathon projects yet. Both the process and the outcome were incredible, we had a lot of fun, and we learned a lot about working with wood, concrete and electronics.
If anybody wants to build a similar lamp or needs more details, feel free to comment and ask me anything!