Friday, 21 June 2013

Major Project

About 

I am interested in solar power and so for my major project I decided to make the arduino able to measure the voltage the solar panel would produce. If I could get the voltage then I could find out the amps and power of it with some changes to the system. 

I changed the light available to check that everything had been set up properly and that the solar panel was getting the light.

Problems 

I had one big issue with this project which was getting the solar panel to use. I have little money to spend so I needed a cheap panel which I ordered from overseas but there was a problem and they wouldn't arrive until too late. I was thinking about doing another project but I got lucky and found a solar powered bicycle light in a second hand bin at Jaycar. I brought that and canalized the solar panel to use for my project. This was perfect as the solar panel needed to be under 5 volts or it could burn out the Arduino and through research I was certain that this was (if it wasn't I would have needed to add resisters to the project).

Here is the code I used to get and write the output to the monitor:

void setup() {
  Serial.begin(9600);
}

void loop() {
  int sensorValue = analogRead(A0);
  float voltage = sensorValue * (5.0 / 1023.0);
  delay(1000);
  Serial.println(voltage);
}

Here are the photos of the project and the output:





Minor Project

For my minor project I decided to make a set of leds that would light up by sound. I am not certain I got it working properly but here is the code I worked on and pictures of the project. I used a freetronics microphone that I got from Jaycar.


int ledPins[] = {2,3,4,5,6,7,8,9};

const int splSensor = A0;

void setup()
{
  Serial.begin(38400);
}

void loop()
{
  int val = Serial.println(analogRead(splSensor), DEC);
  delay(1000);
  if(val > 500) {
    lightsOnOff();
  }
}


void lightsOnOff()

  digitalWrite(ledPins[0], HIGH);
  digitalWrite(ledPins[1], HIGH);
  digitalWrite(ledPins[2], HIGH);
  digitalWrite(ledPins[3], HIGH);
  digitalWrite(ledPins[4], HIGH);
  digitalWrite(ledPins[5], HIGH);
  digitalWrite(ledPins[6], HIGH);
  digitalWrite(ledPins[7], HIGH);
  delay(200);

  digitalWrite(ledPins[7], LOW);
  digitalWrite(ledPins[6], LOW);
  digitalWrite(ledPins[5], LOW);
  digitalWrite(ledPins[4], LOW);
  digitalWrite(ledPins[3], LOW);
  digitalWrite(ledPins[2], LOW);
  digitalWrite(ledPins[1], LOW);
  digitalWrite(ledPins[0], LOW);
  delay(200);
}