Arduino Enclosure with Sensors

Building a case to house an Arduino and multiple sensors

Posted by revmecha on November 15, 2015

I've made a few enclosures but wanted to try making a portable setup that was easy to use and sturdy. Even as a prototype, it was getting hard to carry around breadboarded sensors, Arduinos, and Raspberry Pis. It would be ideal to have a case 3D printed and have it match the size of the RPI, but I at least wanted to take a go at it and see what the process was like.

Setting Up The Case

I had a bunch of cases lying around that were a mix of sizes. I looked into ordering a better size but the wait was too long. I decided on this case as it would give me room for the sensors, a regular size Arduino, and the port for the USB cable. I also wanted some flexiblity so that I wouldn't have to hardwire everything. I figured I could start big and make the second version smaller.

Using the bigger enclosure gave me layout options.

Testing the Arduino and RPI

The smaller Arduino would have been better but I already had a bunch of the normal size units. I wanted to be able to repeat the setup if need be and also have a backup of the whole setup on a breadboard for debugging. I built two identical setups and tested them with two different RPIs. I also used this setup so I could have a baseline and track differences over time(in and out of the case).

Testing with two unique sets of sensors connected to individual Arduinos and RPIs.

Status Display

Figuring out a way to display status messages seemed easy at first. I was just going to use an OLED display to show that the devices were on and the handshake had occured, the sensors were sending a range of data, and data was being transmitted to the Crossbar service. I breadboarded the display and got most of the messages working, but I realized I might be getting low on space. It does look cooler with the OLED screen but I finally decided to use three regular LEDs for the same purpose.

Although it looks cool, I ended up not using the OLED screen for status messages.

Making It All Fit

I didn't want everything to be set in stone for the first version so I didn't solder any of the connections and made it so that it was easy to change elements. It is just a prototype so I wanted to see how rugged it would be and if I even needed that level of flexiblity. I also wanted to be able to have access in case there were any issues after it had been moved around. I also added access holes for adjustment screws on the sensors.

Basic layout with the wires cut and sensor clips made with plastic and hot glue.

Mapping Out Sensor Data

Plotly is a pretty awesome way to map out data. They have a good API and their latest update includes a lot of cool ways to display data. I'll go into this more in a separate post, but Plotly gave me a quick way to track how different sensors functioned over long periods of time. Having the triggers at a lower threshold means that it can get boring if there's not much activity. Using the Plotly graphs helped me to see what my margins were.

A basic Plotly graph showing sensor data over time.

Testing Serial Data

This wasn't a necessary step, but I had noticed some errors in the data that was comming into the RPI. I thought about using BlueTooth but opted for USB since it would be easier to debug at first. I hooked up the scope and tested out different baud rates for the serial connection. The sensors all got measured at different times in the Arduino and some of the buffered output was getting clobbered. This at least helped me figure out it wasn't the connection.

Checking the transmitted output from the Arduino on the Oscilloscope.

Finishing the Enclosure

The completed case is pretty big and isn't that pretty, but it works and has held up fairly well. It gave me a better appreciation for product design and packing interconnectd devices into a small space. I would like to have better indicators in the next version so you can quickly tell if everything is working or get a light if there is an error. I could still use an OLED screen for that but want to make it smaller. I also didn't notice a big difference between the sensors in and out of the case.

Testing the completed case and indicator lights before closing it up.

Calibrate the Visualizations

I pretty much used the same visuals as from the other project using ThreeJS. I left out the motion sensor so it's just showing light level, audio threshold, and distance from the unit. The threshold is set pretty low so I have the screen display random visuals until someone walks up or other triggers are registered.

A variation on the original ThreeJS visuals to show more sensor activity.