User:Yoana Buzova/mrSTOCK2

From XPUB & Lens-Based wiki

Idea to transform light into sound ---> therefore be able to make self-generated sound of different brightness patterns (initially we wanted to transform an old slide projector (thank you for the donation Roel) into a film loop machine, with a self-generated sound this is the slide projector..or what is left of it now.....we did not have time to think of the mechanical mechanism during the workshop, due to to very big struggle with electronics, due to lack of knowledge! next to it is the schematics of the modification

Slide proj.jpg Slide projector proj schematics.jpg




DC motor speed control with IR sensor

code:

 int transistorPin = 9;      // motor connected to digital pin 9
 
 int sensor = 3;   // sensor connected to analog pin 3
 
 int sensorValue = 0;         // variable to store the read value
 
 
 
 void setup()
 
 {
  Serial.begin (115200);  
   pinMode(transistorPin, OUTPUT);   // sets the pin as output
 
 }
 
 
 
 void loop()
 
 {
 
   sensorValue = analogRead(sensor);   // read the input pin
   sensorValue = map(sensorValue, 0, 1023, 100, 255);   //map values
   analogWrite(transistorPin, sensorValue); 
   Serial.println(sensorValue);
  
 }


Ir controlled DCmotor.jpg DCmotor+ard.jpg


8 LDRs making some noise 1st code


 nt myInts[8]; const int myPins[] = {A0,A1,A2,A3,A4,A5,A6,A7}; int mySensVals[8]; int myMaxValues[8]; int myMinValues[8];
 const int speakerPin = 9;
 void setup() {
 Serial.begin(115200);
 // using those pins as output
 pinMode(speakerPin, OUTPUT);
 for (int n = 0; n < 8; n++)
 {
   pinMode(myPins[n], INPUT);
   digitalWrite(myPins[n], HIGH);
   myMinValues[n] = 1023;
   myMaxValues[n] = 0;
 }
 }
 void readSensor(int n) {
 int val = analogRead(myPins[n]);
 if (val > myMaxValues[n])
 {
   myMaxValues[n] = val;
 }
 if (val < myMinValues[n])
 {
   myMinValues[n] = val;
 }
 mySensVals[n] = map(val, myMinValues[n], myMaxValues[n], 0, 255);
 }
 void readSensors(void) {
 for (int n = 0; n < 8; n++)
 {
   readSensor(n);
 }  
 }
 void printSensors(void) {
 for (int n = 0; n < 8; n++)
 {
   Serial.print(n, DEC);
   Serial.print(": ");
   Serial.print(mySensVals[n], DEC);
   Serial.print(", ");
 }
 Serial.println();
 }
 void loop() {
  readSensors();
  printSensors();
 }
 void makeTone(int freq){
   digitalWrite(speakerPin, HIGH);
   delayMicroseconds(freq);
   digitalWrite(speakerPin, LOW);
   delayMicroseconds(freq);  
 }