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);


Anonymous said...

Hi again

Just found this solar panel USB MIDI controler project and thats perhaps even better for me than the LDR project you posted previous!

However I'm afraid the sketch you posted wouldn't compile in Arduino software so I didn't get beyond that.

I'm using a Freetronics 11 (Arduino Uno) copy board where you used the teensy however I didn't get past compile.

Is there anything missing from the sketch / code for the solar panel USB MIDI? Can it realy be as simple as hooking the solar panel to Arduino and loading that simple code?

Any advice guru?