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




Thursday, 25 April 2013


Two LEDs Running at Different Speeds

int ledOnePin = 13;
int ledTwoPin = 12;

void setup() {               
  pinMode(ledOnePin , OUTPUT); 
  pinMode(ledTwoPin , OUTPUT); 
}

void loop() {
    initializeLed(ledOnePin , 500);
    initializeLed(ledTwoPin, 1000);
}

void initializeLed(int led, int time) {
  digitalWrite(led, HIGH);
  delay(time);
  digitalWrite(led, LOW);
  delay(time);
}

Two LEDs Running

int ledOnePin = 13;
int ledTwoPin = 12;

void setup() {               
  pinMode(ledOnePin , OUTPUT); 
  pinMode(ledTwoPin , OUTPUT); 
}

void loop() {
    initializeLed(ledOnePin , 1000);
    initializeLed(ledTwoPin, 1000);
}

void initializeLed(int led, int time) {
  digitalWrite(led, HIGH);
  delay(time);
  digitalWrite(led, LOW);
  delay(time);
}

Blink LED Mostly On

int ledPin = 13;

void setup() {
  pinMode(ledPin , OUTPUT); 
}

void loop() {
    initializeLed(ledPin, 1000, 1);
}

void initializeLed(int led, int onDelay, int offDelay) {
  digitalWrite(led, HIGH);
  delay(onDelay);
  digitalWrite(led, LOW);
  delay(offDelay);
}

Blink LED Mostly Off

int ledPin = 13;

void setup() {             
  pinMode(ledPin , OUTPUT); 
}

void loop() {
    initializeLed(ledPin, 1, 1000);
}

void initializeLed(int led, int onDelay, int offDelay) {
  digitalWrite(led, HIGH);
  delay(onDelay);
  digitalWrite(led, LOW);
  delay(offDelay);
}

Tuesday, 23 April 2013

The Changed Blink Program 


int ledPin = 13;
void setup()   {
pinMode(ledPin, OUTPUT);
}
void loop()
{
digitalWrite(ledPin, HIGH);
delay(100);
digitalWrite(ledPin, LOW);
delay(100);
}


I changed the timer so that the light will blink so fast it doesn't look like it's blinking.

The Blink program

int ledPin =  13;
void setup()   {              
pinMode(ledPin, OUTPUT);   
}
void loop()                   
{
 digitalWrite(ledPin, HIGH);
 delay(1000);
 digitalWrite(ledPin, LOW);
 delay(1000);
}

Monday, 22 April 2013


LED YouTube Video 4




This was a simple project but I thought it looked cool and could be something fun to try. He mentioned where he got the idea from and provided links to useful websites in the description.

LED YouTube Video 3




I liked this project as it showed plenty of uses for the cube as well as advice on getting the hardware and information about each activity. I also liked it because you can use the Arduino Uno to run it.

Sunday, 14 April 2013

LED YouTube Video 2

http://www.youtube.com/watch?v=cQhBm_EgB0w



This is an extremely cool project where they build a ring that spins around and has LEDs attached to it, to create certain shapes including a globe. They provide a link to more information including code and layout.

LED YouTube Video 1



I found this video interesting as he showed what a made board is to look like and he described what he used. A good thing about this is you can talk to the author and he will send you the code if you want.

Useful Sites - Part 2




























Arduino Clone









Monday, 18 March 2013

LED Project

This LED project makes the lights light up to the end and then reverse when the button is pushed.


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

void setup()
{
  pinMode(button1Pin, INPUT);
 
  int index;

  for(index = 0; index <= 7; index++)
  {
    pinMode(ledPins[index],OUTPUT);
  }
}

void loop()
{
  int button1State = digitalRead(button1Pin);
 
   if (button1State == HIGH)
   {
     oneAfterAnotherLoop();  // Light up all the LEDs in turn
   }
   else
   {
     turnOff();
   }
}

void oneAfterAnotherLoop()
{
  int index;
  int delayTime = 100; // milliseconds to pause between LEDs
 
  for(index = 0; index <= 7; index++)
  {
    digitalWrite(ledPins[index], HIGH);
    delay(delayTime);              
  }                                

  for(index = 7; index >= 0; index--)
  {
    digitalWrite(ledPins[index], LOW);
    delay(delayTime);
  }              
}

void turnOff()
{
  digitalWrite(ledPins[7], LOW);   //Turn off LED #7
  digitalWrite(ledPins[6], LOW);   //Turn off LED #6
  digitalWrite(ledPins[5], LOW);   //Turn off LED #5
  digitalWrite(ledPins[4], LOW);   //Turn off LED #4
  digitalWrite(ledPins[3], LOW);   //Turn off LED #3
  digitalWrite(ledPins[2], LOW);   //Turn off LED #2
  digitalWrite(ledPins[1], LOW);   //Turn off LED #1
  digitalWrite(ledPins[0], LOW);   //Turn off LED #0
}










Sunday, 3 March 2013

Useful Sites - Part 1


http://arduino.cc/en/Guide/Environment


http://processing.org/reference/environment/


http://fritzing.org/developer/fritzing-part-format/


http://2013embedded.blogspot.co.nz/


http://gcc.gnu.org/