An electronics project : Presence Box

I built an electronics project for my partner’s birthday. Heres what I made.

My partner’s birthday was at the end of Febuary. Due to a lack of money to buy things, and a desire to make something with electronics and Arduinos, I made the ‘Presence Box’.
I realise the name is quite creepy. But hear me out.

The finished presence box

The original idea for the project was to build something which would be a thing that was there when I wasnt (we live in separate cities).
I wanted to make something that would visibly react to the presence of my partner without them actually having to touch the object.

I shared my thoughts at Derby Makers (Local Hackspace/meetup).
One of the other members suggested utilising “Capacitive Sensing” to provide the interactivity element without physically touching the box. The easiest way to show that the box was doing something was to make the box light up.

Knowing very little about electronics at this point I asked him to explain:

“Capacitive sensors work by measuring the capacitance of a material. You can measure how close your hand is to a piece of tin-foil with an Arduino and a library.”

Sounds perfect.

Armed with this new found knowledge, I went and bought a few Chinese replicas of the Arduino Nano, an Arduino that I thought would be small enough for the size box I wanted, while also having enough pins for what I wanted to do (Turns out I could have bought one with even less pins!).

I also wanted something using 3.3 volt logic and had a USB port on, although that was most of them. Cost was also important, since they’d be effectively consumable for this project.

As my mind worked out the intricacies of what I wanted from the project, I decided that I also wanted the box to be passively interactive with the environment. I.E required no human interaction to be ‘doing something’.

I decided to also add a thermistor to control the colour of the RGB NeoPixels that would be forming the lighting part of the project.

Leading ahead with the project, I went a bought the parts I needed, including some wire, thermistors, resistors, capacitors and ‘borrowed’ some NeoPixel clones from my partner.

I started with getting the Thermistor to work.

Connecting a thermistor to an Arduino Nano

Making good use of the available resources, getting the thermistor printing temperature values over the serial line was easy.

I started with these articles from Arduino, and Adafruit.

The concept was easy, wire up the thermistor like so:

Do an analogRead() on the pin you’ve connected to the thermistor and get back the resistance the of the thermistor.
There are some calculations provided on the Adafruit tutorial to convert resistance to degrees Centigrade (roughly).

Thats the easy part!

Enthused by how simple this appeared to be, I continued a few days later.

Next step was to implement the capacitive sensing. Slightly tougher, but again, as simple as importing an Arduino library and following the library’s tutorial.

Wiring the capacitive sensor was simple, compromising a sheet of tin-foil, one or many resistors and maybe a capacitor.

The capacitor on the receiving pin is optional, apparently a small capacitor (in the range of picofarads) is meant to reduce the noise of the signal, but I didn’t have any luck with that. I don’t think I had any capacitors that were really small enough.

I found that a set of resistors summing 4MOhms worked well with a good distance of sensing my presence.

Upon making this set up, one could read the time it takes for a signal to get from one pin (send) to the other (receive). The closer you move something that has a capacitive capabilities (i.e metal things, or a human body) the larger the number you get back from the library.

Using this, I could make the NeoPixels get steadily brighter the closer I got to the tin-foil, and dimmer as I got further away. Yay! Progress!!

Next step was integrating both the thermistor and the capacitive sensor.
I wanted the lights to change colour with the temperature read; redder if the temperature is colder (to warm up), bluer if the temperature is warmer (to cool down).

This was surprisingly easy to integrate. I think in most part because programming is my strong point. So writing the code to do this was something I found easy.

I’d got to the point where the lights would be redder, or bluer depending on the temperature and brighter or dimmer depending on how closer I was to the tin-foil.

Moving forward, I wanted to start building the box this was going to go into.
Making use of the workshop at The Derby Silk Mill and their laser cutter, I build a small box (60mm x 60mm x 60mm) out of 3mm plywood.

Several iterations of the box and the eventual product

It too many iterations to get the measurements correct. Mostly I blame this on InkScape not being designed for precision measurements. But its also my fault too due to being rushed and not paying enough attention to detail.

After completing the box, I found out that Inkscape has plugins to make meshes for boxes exactly like the kind I’d just made completely manually.

The more you know hey!

With only a couple of evening Makers sessions left, I got to soldering.

I needed to move the electronics off of breadboards and onto a more permanent strip-board solution.

After several evenings getting very frustrated with the soldering, breaking the joins and re-soldering things after they didnt work, I finally had something that fitted in the box.

Unfortunately, I hadn't actually planned as well as I could and the electronics only just fitted.Trying to shove them in resulted in breaking some of the rather fragile connections on the NeoPixels, a frustrating evening.

I managed to complete the project the night before I had to give it to my partner.
I’m actually very proud of the fact that I managed to make it and make it work and didn't have to compromise on what I’d planned to do.
And of course, most important thing, my partner appreciated what I’d made and doesnt think I’m silly for making a box with lights in as a present.

Below is a video of the working end result!

The source code for the project is available here: https://gist.github.com/Samathy/c00436887e83cfa55103c21d1b6ea3ff