Sociable Objects Workshop: Sensor/Actuator Project
Description
This project involved dividing the class in two: the actuator group and the sensor group. The actuator group was in charge of creating a device that would react to one or more sensors.
The sensor group, of which I was a member, was in charge of designing a sensor that would activate the actuator.
The exchange between the sensor and the actuator be carried out wirelessly, using the XBee radios, of course.
Both groups needed to decide on what would sense and what would trigger. Since time was not on our side, with a deadline of less than a week, we settled on the first idea that was achievable in a week: gauge the amount of water used daily in flushing toilets at ITP.
Someone on the actuator side, perhaps Michael, I don't remember, had the idea of using a water pump as an actuator. When a toilet was flushed on the floor, the pump would circlulate water, perhaps colored, through a container.
Barbra, Nathan, and I considered using an FSR or a mercury switch. Loren offered some mercury switches he had, so we agreed to use those.
During the last meeting between the sensor and actuator groups, Michael, who was designing the actuator, and I decided that, sensor notwithstanding, the word “BAD” sent across the network to his XBee would activate his actuator. (See code below.)
A mixup in communication with Loren led to us not having the mercury switches on the night before this project was due. My only option at this point was to use a pair of QT113 capacitive chips as sensors for the project; I knew how to work with them, which bought a lot of time.
Code
Perhaps my proudest moment as a programmer:
#define TOILET_A 10 #define TOILET_B 11 #define ONE_SECOND 1000 #define BAUD_RATE 9600 #define FLUSHED 0x00 void setup() { Serial.begin( BAUD_RATE ); pinMode( TOILET_A, INPUT ); pinMode( TOILET_B, INPUT ); } void loop() { if( ( digitalRead( TOILET_A ) == FLUSHED ) || ( digitalRead( TOILET_B ) == FLUSHED ) ) Serial.println( "BAD" ), delay( ONE_SECOND / 5 ); }
Using the string BAD as the trigger for this project was arbitrary.
How It Worked
The following explains the behavior of the project. A link to a flickr set appears at the end.
All of the handles in both bathrooms were wrapped
in electrical tape to shield the sensor from the
handles' metal. Afterwards, an exposed piece of
wire acting as the QT113's sensor node was taped
onto the electrical tape.
When someone flushed the toilet, his or her
capacitance would activate the sensor.
The QT113 capacitive sensors, to which the wires
leading to the toilet handles were connected,
were wired to an Arduino.
And that Arduino was connected to one XBee radio.
The string “BAD” would be sent over
the network to Michael's pump.
And that pump would circulate water in a fountain–like
way.
The entire flickr set