In this project, I created a design to squeeze limes. I’m imagining this as part of a game where you mix your own cocktails using limes…
I connected three sensors to control three images in my p5.js sketch. The design is online over here, although you’d need my circuit for it to work! http://alpha.editor.p5js.org/fergfluff/sketches/B1ZDYUMa-
Here’s the interaction.
How It Works
Read on below to hear my thoughts on my physical design. As for the code, I’m sending data from my sensors through my serial port, the P5.js serial app, and into my p5.js sketch online. I’ve written code to:
- Expect data coming in from my USB serial port
- Create a string called inString of incoming data but only up until the ASC-II character values for carriage return and new line
- State that if data REALLY IS coming in
- State that if data is NOT “hello” (which I used in my “call and response” code in Arduino to require that my microcontroller be very polite and wait to be asked to send data) then to
- Create a new variable called sensors that stores an output after it separates the”inString” numeric values from the commas
- Create a “counter” or for loop to list the array of my sensors
- Separate their data into an instance of each sensor, and send it the separated data from the variable sensors
- Draw three arcs that get smaller in size the more you bend the flex sensors, by subtracting the sensor values from the dimensions of the arc.
I spent a lot of time understanding the labs about serial communication with p5.js, which was time was well spent! Therefore, this small project is more about demonstrating that understanding than it is about my ideas or execution. But next time I would spend just a little more time prototyping my physical design at the beginning as well, to make sure the code and interaction support each other as successfully as possible.
From the start, I had idea of creating a sketch to squeeze limes because I thought the flexible sensors afforded a squeezing motion. As for an enclosure, I imagined I could cover the sensors with a lime costume of sorts, so that the exterior of my circuit suggested they were limes – and thus, you should squeeze them!
Ideally, though, I would have tested this physical prototype at the start. I’d have quickly realized my assumption that the flexible sensors afford a squeezing motion was incorrect! It’s really more of a pulling down gesture. That may sound like a minor difference, but it caused a big disconnect in the user interaction of trying to squeeze limes. Squeezing doesn’t work! Pulling does! Why am I pulling on limes??
Also, my idea of a “lime costume” wasn’t successful even as a prototype. I probably need a different kind of sensor. I did try the long flex sensor, but I’d need a well-though out enclosure to that has a very strong base so that your fingers or thumb can hold on while the rest of the hand does the squeezing.
It looks like a caterpillar! Not a lime.
My takeaway is that even though coding is harder for me than prototyping with construction paper, construction paper gives JUST as much design feedback as the code. Just like I would by write pseudo code to draft my code’s logic, I should create a quick physical design of my piece at the same time I’m starting my code
Here’s the code: