MSP430 MAGIC CUBE

on Friday, June 27, 2014







Hi everyone . i did led fun project using msp430 launchpad.This project has four leds are triggered by msp430 two get different colors. the colors combination of two led color enhanced by paper cube. the color leds used in this project are red,green,blue,yellow. The color mixing is achieved by  simply glow the two led at same time for example when red and yellow leds glow together it produce orange color.
The software used for program the MSP430 is ENERGIA. you can download energia software at the bellow link:

http://energia.nu/download/

CODING:

In this project i used two kind of program

1. Contionusly change the cube color in certain delay.
2.Change color when we push the push button in msp430 launchpad.

Code for contionusly change the cube color in certain delay:

 const int ledPin = RED_LED;
const int green =P1_4 ;
const int blue = P1_7;
const int yellow = P1_6;
void setup()
{
  pinMode(ledPin, OUTPUT);
   pinMode(green, OUTPUT);
    pinMode(blue, OUTPUT);
     pinMode(yellow, OUTPUT);
 
}

void loop()
{
 digitalWrite(ledPin, HIGH);
   digitalWrite(green, LOW);
   digitalWrite(blue, LOW);
   digitalWrite(yellow, LOW);
  delay(3000);
  digitalWrite(ledPin, LOW);
   digitalWrite(green, HIGH);
   digitalWrite(blue, LOW);
   digitalWrite(yellow, LOW);
   delay(3000);
   digitalWrite(ledPin, LOW);
   digitalWrite(green, LOW);
   digitalWrite(blue, HIGH);
   digitalWrite(yellow, LOW);
   delay(3000);
   digitalWrite(ledPin, LOW);
   digitalWrite(green, LOW);
   digitalWrite(blue, LOW);
   digitalWrite(yellow, HIGH);
   delay(3000);
   digitalWrite(ledPin, HIGH);
   digitalWrite(green, LOW);
   digitalWrite(blue, LOW);
   digitalWrite(yellow, HIGH);
  delay(3000);
  digitalWrite(ledPin, LOW);
   digitalWrite(green, LOW);
   digitalWrite(blue, HIGH);
   digitalWrite(yellow, HIGH);
   delay(3000);
  digitalWrite(ledPin, HIGH);
   digitalWrite(green, HIGH);
   digitalWrite(blue, HIGH);
   digitalWrite(yellow, LOW);
  delay(3000);
  digitalWrite(ledPin, LOW);
   digitalWrite(green, HIGH);
   digitalWrite(blue, LOW);
   digitalWrite(yellow, HIGH);
   delay(3000);
}



Code for change color when we push the push button in msp430 launchpad:


 const int  buttonPin = PUSH2; 
const int ledPin = RED_LED;
const int green =P1_4 ;
const int blue = P1_7;
const int yellow = P1_6;

int buttonPushCounter = 0;   // counter for the number of button presses
int buttonState = 0;         // current state of the button
int lastButtonState = 0;     // previous state of the button

void setup() {
  // initialize the button pin as a input:
  pinMode(buttonPin, INPUT_PULLUP);
  // initialize the LED as an output:
  pinMode(ledPin, OUTPUT);
   pinMode(green, OUTPUT);
    pinMode(blue, OUTPUT);
     pinMode(yellow, OUTPUT);
  // initialize serial communication:

}


void loop() {
  // read the pushbutton input pin:
  buttonState = digitalRead(buttonPin);

  // compare the buttonState to its previous state
  if (buttonState != lastButtonState) {
    // if the state has changed, increment the counter
    if (buttonState == HIGH) {
      // if the current state is HIGH then the button
      // wend from off to on:
      buttonPushCounter++;
   
    }
 
  }
 
  lastButtonState = buttonState;

 
  if (buttonPushCounter== 2) {
     digitalWrite(ledPin, HIGH);
   digitalWrite(green, LOW);
   digitalWrite(blue, LOW);
   digitalWrite(yellow, LOW);
  }else if(buttonPushCounter == 3)
  {
    digitalWrite(ledPin, LOW);
   digitalWrite(green, HIGH);
   digitalWrite(blue, LOW);
   digitalWrite(yellow, LOW);
 
  }else if(buttonPushCounter == 4)
  {
   digitalWrite(ledPin, LOW);
   digitalWrite(green, LOW);
   digitalWrite(blue, HIGH);
   digitalWrite(yellow, LOW);
 
  }
  else if(buttonPushCounter == 5)
  {
   digitalWrite(ledPin, LOW);
   digitalWrite(green, LOW);
   digitalWrite(blue, LOW);
   digitalWrite(yellow, HIGH);
 
  }  else if(buttonPushCounter == 7)
  {
   digitalWrite(ledPin, HIGH);
   digitalWrite(green, LOW);
   digitalWrite(blue, LOW);
   digitalWrite(yellow, HIGH);
 
  } else if(buttonPushCounter == 6)
  {
   digitalWrite(ledPin, LOW);
   digitalWrite(green, LOW);
   digitalWrite(blue, HIGH);
   digitalWrite(yellow, HIGH);
 
  }else if(buttonPushCounter == 8)
  {
   digitalWrite(ledPin, HIGH);
   digitalWrite(green, HIGH);
   digitalWrite(blue, HIGH);
   digitalWrite(yellow, LOW);
 
  }
  else if(buttonPushCounter == 9)
  {
   digitalWrite(ledPin, HIGH);
   digitalWrite(green, LOW);
   digitalWrite(blue, HIGH);
   digitalWrite(yellow, LOW);
 
  }
  else if(buttonPushCounter == 10)
  {
   digitalWrite(ledPin, LOW);
   digitalWrite(green, HIGH);
   digitalWrite(blue, LOW);
   digitalWrite(yellow, HIGH);
 
  }
 else {
   digitalWrite(ledPin, LOW);
   digitalWrite(green, LOW);
   digitalWrite(blue, LOW);
   digitalWrite(yellow, LOW);
  }
 
}










POV USING MSP430 LAUNCHPAD

on Tuesday, June 17, 2014




         Hello every one here i give more detail about how to built this project POV using MSP430 LAUNCHPAD. for this project i wrote library file Pov.h to work with Energia software. you can download that and use it for more easy programming.  for do this project you need two steps.
         
  • design custom module.
  • using library file for programming.
DESIGN CUSTOM MODULE:

circuit diagram:




  •  it is important necessary to connect 47k ohm resistor with msp430g2231 ic RST pin. then only the ic will work.
  • my library file has limitation that it can work with only five leds to display words in pov display.
  • in this i am using MSP430G2231 IC which has 2KB flash memory. so it can display small words alone in POV display. i suggest to use MSP430G2553 IC which has 16KB flash memory so it help to show more than one words in our POV display. The library file also support for MSP430G2553 only thing we need to change is that pin declaration in programming.
 USING LIBRARY FILE FOR PROGRAMMING:

download my library file in zip format here.

  • extract the library file 
  • copy the extracted folder "Pov".
  • open energia software folder.
  • then open hardware folder -> msp430->library.
  • then paste the Pov folder in library folder.
  • click the energia application.
  • goto file->examples-> pov->pov_hello.
  • it will open example program for pov.
  • compile it and upload it in MSP430 LAUNCHPAD.
  • then unplug the ic and insert it in custom module.
all done . you are ready to go with this project.

 if you don't have energia software download it from here.
http://energia.nu/download/


fun using this Pov projects





THIS IS MY PET NAME VIKI SHORT FORM OF VIGNESHRAJA







                                               THANK YOU FOR WATCHING