Light to Frequency toy/noise generator

| No Comments | No TrackBacks

...getting it in the box was easy.  the hard part was getting it into the box!


I've been obsessed with TSL230R-LF programmable light to frequency converters; many have been burnt up by these hands.  They're commonly available, cheap and if you like making music/noise, then wiring them up is a snap (even compared to making a 555 generator).    

There are two TSL230R-LF in the blue box (recessed below the black holes), and and an Arduino micro-controller for simple syncopation.  The box pictured above is wire-wrapped with a 24 pin header connecting the board to the controls.  When plugged in, the box produces super clean digital square-waves based on the intensity of light.  You can simulate 8-bit acceleration in spy hunter, create noisy beats, or control it like an optical theremin with a very full audio range.  The switches control the sensitivity and the pots control the syncopation.  The led's are a direct indicator of when the LTFC is generating a pulse.   The output is to a stereo mini 3.5mm jack with one generator to a channel i.e left and right.   On the oscilloscope, the two outputs have been plotted in XY mode to create the spiral.  

The arduino code is very simple; two pins are set to analog read, the value is then translated to on/off pulses with digital write and sent via two pins to the LTFC enable/disable pin.  If you can't tell, I almost always start with an arduino example and build onto it for ease...in this case there are some erroneous lines of code as bonus!

After I get the PCB back (and working!), I'll post that, for now, here's a schematic and code:



ltf1.jpg
p.s.  The schematic is missing a 120 ohm resistor at the ground of the 3.5mm jack.  This will allow for the LED's to remain on when plugged into anything with a coil (i.e. headphones, speaker, etc).  Also, when the battery drops below 5 volts, the 5 volt based Arduino will stop working, whereas the LTFCs, which are tied to a 3 volt regulator, will continue to function.  This could be solved by using the 3.3 volt Arduino pro mini.  And maybe, there will be a version two.

------
//fun trick noisemaker, syncopator, tc 2010



int sensorPin = 3;
int sensorPin2 = 2; // select the input pin for the potentiometer
int ledPin = 9;   // select the pin for the LED
int ledPin2 = 8;
int sensorValue = 0;  // variable to store the value coming from the sensor
int sensorValue2 = 0;
int x = 100;
int x2 = 100;
int y = 0;
int y2 = 0;
float z = .255;
int pwm = 0;
void setup() {
  // declare the ledPin as an OUTPUT:
  pinMode(ledPin, OUTPUT);  
  pinMode(ledPin2, OUTPUT);
    Serial.begin(9600); 
}

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);    
  sensorValue2 = analogRead(sensorPin2);    
  delay(100);
  // turn the ledPin on
 // digitalWrite(ledPin, HIGH);  
  // stop the program for <sensorValue> milliseconds:
  Serial.println(sensorValue);
  Serial.println(sensorValue2);
 
  
  
 if(sensorValue < 670 && sensorValue > 65)
 {
      //pwm = z*sensorValue;
      //Serial.println(pwm);
      //analogWrite(ledPin,pwm);
      Serial.println("yes!");
      y = sensorValue/3;
      digitalWrite(ledPin,HIGH);
      delay(y);
      digitalWrite(ledPin,LOW);
 
 
 }
 
 
 else if (sensorValue > 670)
  {
    digitalWrite(ledPin, LOW);
    
  }
 else
 {
   digitalWrite(ledPin,LOW);
 
      
  }
  
 
 if(sensorValue2 < 670 && sensorValue2 > 65)
 {
      //pwm = z*sensorValue;
      //Serial.println(pwm);
      //analogWrite(ledPin,pwm);
      Serial.println("yestwo!");
      y2 = sensorValue/3;
      digitalWrite(ledPin2,HIGH);
      delay(y2);
      digitalWrite(ledPin2,LOW);
  }
 
 
 else if (sensorValue2 > 670)
  {
      digitalWrite(ledPin2, LOW);
     
      
  }
 else
 {
   digitalWrite(ledPin2,LOW);
      
  }
  
                  
}

Enhanced by Zemanta

No TrackBacks

TrackBack URL: http://www.imlichenit.com/cgi-bin/mt/mt-tb.cgi/10

Leave a comment

About this Entry

This page contains a single entry by admin published on February 16, 2011 10:42 PM.

3 computers, 1 console: sync'd HD playback. was the previous entry in this blog.

nexus one, piecemeal is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.