Case Study: Capybara

Capybara is a project of mine that uses a wireless network of Arduinos to collect anonymous movement data from patrons visiting a small retail store. The data was collected and visualized in Processing and used to inform decisions such as store layout and product placement as well as to measure which days of the week and times experienced the highest number of visits.

Capybara started out with a simple goal: I had wanted to learn about microcontrollers and sensor technology. I had been interested in both of these for a while and had done some very basic projects with Arduino and Processing, but I needed an interesting, real-world project to really get me moving into more advanced areas. I could have begun tracking activity in my home, but that seemed boring. I wanted to physically sense the activity of people in a public space, but this presented some difficult challenges: if I located the sensor outside in actual public space, it could be stolen or destroyed by weather. I also didn’t know how to power a sensor without access to power outlets. Another concern was the legality of collecting data in a public space. And finally, there was the issue of how to communicate and store all that data without WiFi.

I began to look around my neighborhood for a place that I could install my sensor, and I ended up walking into a small boutique clothing store named Tigertree (Figure 9-3), just a few blocks away from home, which happens to be owned by two close friends. I asked their permission to put a sensor in their store, and they agreed. I probably would have put the entire project off for another year, but the next day one of the store owners called me and asked, “Why don’t you put a whole bunch of sensors in the store and give me some data that’s actually useful?” That’s when the project became very real and very exciting.

I began by searching online electronics hobby shops for sensors that could detect physical activity. I found the passive infrared (PIR) sensor at a local RadioShack store and began plugging away. Most of these sensors have plenty of example Arduino code to get you started and after about an hour of figuring out how to wire up everything, I was looking at a terminal output that printed a “1” every time I waved my hand in front of the sensor. I cannot explain in words how this felt. Even though I was using example code, an example wiring schematic, and the most basic of all sensors, I had created something dynamic that responds to real-world physical movement! I spent the next hour speaking in rapid incomprehensible bursts while waving my arms around frantically, trying to convince my girlfriend that this was the most amazing technological breakthrough since the microprocessor, because that’s what it felt like. (She demurred, but patiently let me go on.)

The test bed for my sensor project

Figure 9-3. The test bed for my sensor project: Tigertree

The next step was to get this sensor to communicate with Processing. I had a bit of previous experience with Processing, and I knew it was possible to hook up an Arduino to a Processing sketch. I found Firmata, a Processing library that reads serial data from an Arduino, and after a couple of hours of installing libraries and looking up error messages in Google, I had those ones and zeros flashing in bright orange in a 300 x 300 pixel Processing sketch.

This was the second major technological breakthrough of my life, and once again I spent another hour waving my arms around and marveling in my futuristic achievements. (My girlfriend sighed and moved on to another room.) After the excitement ebbed a bit, I set out to learn how to increment the number on the screen. I needed to keep track of this data, so after searching for more example code, I found something that I thought might work. I was able to piece enough of it together with the example code I already had that I was able to get it counting, even though I didn’t really understand how it was doing it.

This is my first real exposure to code. When I attempted Processing tutorials in the past, I would always lose interest because the tutorials lacked a tangible goal. Now, I had a practical need to understand and absorb how these things were working. I spent the next week asking developers with whom I work to explain every line of code to me while I simultaneously annotated comments within the example code. When I had a tangible and meaningful example of what the code was doing, suddenly the more abstract concepts such as variables and for-loops became much more accessible. I used my body movements for an input and tracked this movement through the lines of code to see exactly what was going on to that caused the pixels to move on the screen; the excitement of this new knowledge combined with creating something dynamic and physical was addictive.

< Prev   CONTENTS   Source   Next >