Tuesday, March 04, 2008

Connecting a solar panel to Arduino

Someone asked me if it was possible to connect a solar panel to an Arduino board and then read the information in Max/MSP.

This setup was only tried with inside lighting. A different data range will be present if natural sun light is used.


Please Note
• The solar panel used in this example was rated at 2V and 25mA.
• Do not use a solar panel rated in excess of 5V. Doing so may damage the Arduino
• If data values appear incorrect, try scaling the byte 'data' in the Arduino sketch as it is captured. The analog inputs read data at 10 bit. However, a single, serially-printed value can only hold 8 bits of information.
• The data range with this particular solar panel is 0 < 6 using power-efficient, indoor lighting at night.

Hardware Connections

• USB to Arduino
• Positive terminal of solar panel (marked as red or with a plus sign) to Arduino Analog In 0
• Negative terminal of solar panel (marked as black or with a minus sign) to Arduino Ground




Arduino Code

byte data;
void setup() {

Serial.begin(57600);
}
void loop() {

data = analogRead(0);

Serial.print(data);

delay(10);

}



Max/MSP Patch

Here is an example of a very simple Max/MSP patch. The value of the solar panel determines the frequency of a sinewave as being of the harmonic series with a fundamental of 100Hz.

6 comments:

Ben said...

Now that would have been cool to do in forum.

Well done on keeping the blog up to date; you're one of the only postgrads who bothers anymore.

Sebastian Tomczak said...

Oh, hey Ben. Hope you are goin well and all that.

This would have been fun? Didn't we connect an LDR to the Arduino (as far as i recall)? The outcome is so much more sensitive and playable, and the range of data is much larger.

Also, i really enjoyed your piece at the end of year show 2007 -- nice work.

Ben said...

Indeed we did, however I figured an actual solar panel would be a little more dynamic.

Cheers for that, it was my Perspectives composition. I don't even know what mark I got. You know Stephen...

Sebastian Tomczak said...

What do you mean with the term more dynamic? An LDR has a pretty good range of data and reacts reasonably fast...

HaRi-HaRi di DaLam HidupKu said...

hye..it is ok if i using solar cell 5V 50mA?

mbiencegroup said...

To my mind one and all must go through this.