Proof of concept (potentially final) files for ConeDown sensors
We're using force-sensitive resistors (FSRs) as sensors to detect presence on our dancefloor tiles. This is an integration between those sensors, an Arduino, and our computer
We have a simple Arduino test for multiple sensors. This can be loaded directly into Arduino via the gist-conedown-sensor.ino
file
Our circuit is a voltage divider circuit in the following form:
- 5V to FSR
- 5V is used as this is analog reference for Arduino Uno, https://www.arduino.cc/reference/en/language/functions/analog-io/analogreference/
- FSR to
- Digital input (e.g. A0, A1)
- We used analog pins to optionally perform analog reads for testing
- 3.3k ohm resistor (currently using 10k ohm resistor due to availability, more sensitive to lighter weights as a result)
- 10k ohm resistor to ground
- Digital input (e.g. A0, A1)
Once the circuit is built and the Arduino sketch is live, look at the Serial Monitor for output
Resulting voltage when FSR to is open (i.e. infinite resistance):
V_out = 0
Resulting voltage when FSR has slight weight (0.22lbs) (i.e. very high resistance):
V_out = V_in * R_2/(R_1 + R_2)
V_out = 5 * 3.3e3/(7e3 + 3.3e3)
V_out = 1.60 (considered LOW/0)
Resulting voltage when FSR has full weight (22lbs) (i.e. very high resistance):
V_out = V_in * R_2/(R_1 + R_2)
V_out = 5 * 3.3e3/(250 + 3.3e3)
V_out = 4.64 (considered HIGH/1)
We use the Firmata protocol to use the Arduino directly from our computer
To get an example integration working with Python, perform the following:
- Inside of Arduino IDE, upload "File -> Examples -> Firmata -> StandardFirmata" to the Arduino UNO
- Set up a virtual environment for Python to keep dependencies self-contained
- We recommend virtualenvwrapper which would be used like:
- Initial creation of virtuale environment:
mkvirtualenv gist-conedown-sensor
- Switching to virtual environment in other shells:
workon gist-conedown-sensor
- Initial creation of virtuale environment:
- We recommend virtualenvwrapper which would be used like:
- Install our dependencies (currently skipping
requirements.txt
due to simplicity)pip install pyfirmata
- Run our program (currently using Python 2.7, should work with Python 3.3 or later)
python main.py