Difference between revisions of "2m3"
Line 1: | Line 1: | ||
− | ====''About''==== | + | ====''About 2m3''==== |
2m3 is an open space of 2 metres in 3 dimensions. It represents a platform for artists who like to suprise themselves and a small audience. A performance starts with 2 minutes of action in 3 minutes of silence.With each artist goes a special beer to keep us all company for the night. This experimental snapshot takes place at home, every last friday of the month. http://2m3.be | 2m3 is an open space of 2 metres in 3 dimensions. It represents a platform for artists who like to suprise themselves and a small audience. A performance starts with 2 minutes of action in 3 minutes of silence.With each artist goes a special beer to keep us all company for the night. This experimental snapshot takes place at home, every last friday of the month. http://2m3.be | ||
+ | |||
+ | |||
+ | ====''Technical''==== | ||
+ | [[File:Schietlood.jpg|plummet exploded view|600px]] | ||
+ | |||
+ | ====''Code''==== | ||
+ | |||
+ | /* | ||
+ | Code for driving a pendulum and detecting a small wooden block to fall | ||
+ | This example code is in the public domain. | ||
+ | Digital pin 12 has a solid state relay attached to it. Whenever the pin | ||
+ | goes high it allow current to flow to the coil to give the passing pendulum a push | ||
+ | Attached to interrupt pin 0(digital pin 2) is a hall effect sensor, which latches | ||
+ | whenever a magnet passes over. | ||
+ | */ | ||
+ | int SolidState = 12; //switching solid state | ||
+ | int Piezo = A0; //listen to piezo on Analog port 0 | ||
+ | int PiezoValue = 0; | ||
+ | const int thPiezo = 100; // threshold for piezo, if bigger then treshold switch of light | ||
+ | int HallState = 0; //Status of hall effect sensor | ||
+ | unsigned long timeON ; //moment of time that hall effect is triggered | ||
+ | unsigned long timeOF ; //moment of time that coil is activated | ||
+ | unsigned long currentTime; | ||
+ | long timeDON = 0; //time that has passed since hall effect was triggered | ||
+ | long timeDOF = 0; //time that has passed since coil was activated | ||
+ | int timeOFa = 0; //some trick I had to come of | ||
+ | long threshOn = 100; // milliseconds to pass before activating solid state relay to sending a push with coil | ||
+ | long threshOf = 100; // milliseconds to pass before deactivating solid state relay | ||
+ | |||
+ | void setup() { | ||
+ | // initialize serial communication at 9600 bits per second: | ||
+ | Serial.begin(9600); | ||
+ | |||
+ | pinMode(SolidState, OUTPUT); // make the SolidState's pin an output: | ||
+ | digitalWrite(SolidState, LOW); // set SolidState pin LOW | ||
+ | |||
+ | // adding attachInterrupt on digital pin 2, | ||
+ | // when this pin's state changes, the push function will be executed | ||
+ | attachInterrupt(0, push, RISING); | ||
+ | |||
+ | } | ||
+ | |||
+ | // the loop routine runs over and over again forever: | ||
+ | void loop() { | ||
+ | unsigned long currentTime = millis(); | ||
+ | PiezoValue = analogRead(Piezo); | ||
+ | //Serial.println(PiezoValue); | ||
+ | if (PiezoValue > thPiezo){ | ||
+ | Serial.println(1000); | ||
+ | } | ||
+ | |||
+ | if (HallState == 0) | ||
+ | { | ||
+ | timeDOF = currentTime - timeOF; | ||
+ | if (timeDOF > threshOf && timeOFa == 1) | ||
+ | { | ||
+ | digitalWrite(SolidState, LOW); | ||
+ | Serial.println(2000);//2000 = solenoid off | ||
+ | timeOFa = 0; | ||
+ | } | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | timeDON = currentTime - timeON; | ||
+ | if (timeDON > threshOn) | ||
+ | { | ||
+ | HallState = 0; | ||
+ | digitalWrite(SolidState, HIGH); | ||
+ | Serial.println(3000);//3000 = solenoid on | ||
+ | timeOF = currentTime; | ||
+ | timeOFa = 1; | ||
+ | } | ||
+ | } | ||
+ | delay(100); | ||
+ | |||
+ | } | ||
+ | |||
+ | void push() { | ||
+ | HallState = 1; | ||
+ | timeON = currentTime; | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
[[category:Daylighting]] | [[category:Daylighting]] |
Revision as of 11:28, 4 December 2012
About 2m3
2m3 is an open space of 2 metres in 3 dimensions. It represents a platform for artists who like to suprise themselves and a small audience. A performance starts with 2 minutes of action in 3 minutes of silence.With each artist goes a special beer to keep us all company for the night. This experimental snapshot takes place at home, every last friday of the month. http://2m3.be
Technical
Code
/* Code for driving a pendulum and detecting a small wooden block to fall This example code is in the public domain. Digital pin 12 has a solid state relay attached to it. Whenever the pin goes high it allow current to flow to the coil to give the passing pendulum a push Attached to interrupt pin 0(digital pin 2) is a hall effect sensor, which latches whenever a magnet passes over.
- /
int SolidState = 12; //switching solid state int Piezo = A0; //listen to piezo on Analog port 0 int PiezoValue = 0; const int thPiezo = 100; // threshold for piezo, if bigger then treshold switch of light int HallState = 0; //Status of hall effect sensor unsigned long timeON ; //moment of time that hall effect is triggered unsigned long timeOF ; //moment of time that coil is activated unsigned long currentTime; long timeDON = 0; //time that has passed since hall effect was triggered long timeDOF = 0; //time that has passed since coil was activated int timeOFa = 0; //some trick I had to come of long threshOn = 100; // milliseconds to pass before activating solid state relay to sending a push with coil long threshOf = 100; // milliseconds to pass before deactivating solid state relay
void setup() {
// initialize serial communication at 9600 bits per second: Serial.begin(9600);
pinMode(SolidState, OUTPUT); // make the SolidState's pin an output: digitalWrite(SolidState, LOW); // set SolidState pin LOW
// adding attachInterrupt on digital pin 2, // when this pin's state changes, the push function will be executed attachInterrupt(0, push, RISING);
}
// the loop routine runs over and over again forever: void loop() {
unsigned long currentTime = millis(); PiezoValue = analogRead(Piezo); //Serial.println(PiezoValue); if (PiezoValue > thPiezo){ Serial.println(1000); } if (HallState == 0) { timeDOF = currentTime - timeOF; if (timeDOF > threshOf && timeOFa == 1) { digitalWrite(SolidState, LOW); Serial.println(2000);//2000 = solenoid off timeOFa = 0; } } else { timeDON = currentTime - timeON; if (timeDON > threshOn) { HallState = 0; digitalWrite(SolidState, HIGH); Serial.println(3000);//3000 = solenoid on timeOF = currentTime; timeOFa = 1; } } delay(100);
}
void push() {
HallState = 1; timeON = currentTime;
}