See our set up in action!!!!
More specifically our project focuses on the awesomeness of Capacitive Sensing to alter OF projections to create an awesome tactile experience!
What the process will involve:
Arduino -> Processing -> SpaceBrew -> OpenFrameworks
What you will need:
Anything conductive you want to detect capacitance with!
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Capsense With the Arduino
First you will want to set up your Cap Sense circuit.
You can create as many inputs as there are digital pins (If you wish to have more you will have to implement a multiplexer TUTORIAL LINK ).
The Cap Sense library allows you to turn two of the Arduino's pins into a Capacitive Sensor i.e. Sensors that can detect the electrical capacitance of the human body!
This allows us to create interesting touch sensors to send input to the Arduino.
Setting up the circuit:
- The first diagram shows the general set up of circuit with one input. You will want to connect the resistor between two pins, here we have done it between 2 & 3.
- Then connect which ever conductive material you wish to be your sensor to the resistor on the pin 3 side.
- We are keeping pin 2 as our common send pin which will be used for all our sensors.
- Then set up all other sensors in the same way except all having one connection to pin two and then the next free digital pin (See diagram 2)
*** It can be good to just test if it is working by having an exposed wire as your sensor!
Download the CapSense library here
After you have downloaded the library copy the folder into your Arduino library folder.
You can download our code here
(ALL code is commented)
Step 2: Our Capacitive Sensors!
You can detect capacitance with anything conductive!
We wanted to create something tactile, interesting and weird for the user to touch so we implemented some crafting techniques! We made Soft Circuit Pom Poms.
Soft Circuit Pom Pom Materials:
2. Conductive thread
** by distributing the conductive thread with regular threads and resistant materials it creates greater connections when you grab the ball or run your hand through it. IE. allowing more electricity to connect to the sensor, giving a greater value output.
1. Chicken wire
2. Plaster of paris
** the plaster of paris created a small barrier of resistance between the wire and the hand, meaning that values wouldn't be picked up until you ran your hand over the object.
Step 3: Arduino to Processing
In order to use the Arduino with SpaceBrew we must first connect the Arduino to Processing in order to be able to send our data via SpaceBrew.
We will do this by using the serial function!
Step 4: Connecting Processing to SpaceBrew
Next we will need to add the code to processing so we can send our Arduino data to the SpaceBrew Server via Processing!
We are creating a sketch that is a publisher only i.e. it only sends data.
Here is the code from the previous step + the spaceBrew code
Before you get started make sure you have downloaded the SpaceBrew Lib and copied it to your processing Library's folder!!!
Whilst we have provided the code for how to connect this to Spacebrew refer to the images for a brief description for what each of the functions do!
Step 5: OpenFrameworks Via SpaceBrew
We are setting up OF to purely be a SpaceBrew subscriber sketch, therefore it will only be receiving data from Spacebrew.
First make sure you have installed the libraries
After you have downloaded both add then to your oF addon folder, then go into the ofxlibwebsockets > libs > libwebsockets / include / win32port and delete this file!*****
You can download our code here. We've left the name of our video file in place, but you should replace them with your own video file. Put your .mov or .mp4 file in the data file in your oF folder so the compiler can find it. You could also put a still image behind.
Here's a copy of a more complex version of the code that uses binding, attractors, and state changes: Make sure you load your own video into the data file.
Also refer to the images for a brief break down of what each of the functions do and syntax when creating subscribers in OF.
Step 6: HAVE AN AWESOME RESPONSIVE SKETCH
Snaxxx n' Macs Out & Toodle pip!