Showing posts with label solar panel. Show all posts
Showing posts with label solar panel. Show all posts

Monday, January 14, 2013

How To Use A Solar Panel for Light to MIDI Control



Mapping a solar panel to MIDI is a quick and easy way to get a simple light controller going.

You will need:
* A micro solar panel (shouldn't cost more than about $4)
* A teensy board
* A small breadboard and two breadboard jumpers
* Alligator leads

Hardware setup is simple - just connect the positive terminal of the solar panel to analog input 0 on the Teensy. Connect the negative terminal of the solar panel to ground.

Software setup is simple too - simply copy and paste the code below and upload it to the Teensy board. The default code will transmit light changes as MIDI continuous controller one.



byte incoming; 
byte data; 

void setup() {
};


void loop() {
  incoming = analogRead(0); 
  incoming = min(incoming, 127);
  if(incoming != data) {
    data = incoming; 
    usbMIDI.sendControlChange(1, data, 1);
    delay(3); 
  }
  
};