BUILT YOUR OWN H- BRIDGE CIRCUIT USING NPN TRANSISTER

on Thursday, July 17, 2014


            Hi everyone .here i am showing my project building H-bridge circuit to control the dc motor rotation direction. In this circuit i am using 4 NPN TIP122 transistors. here i am using msp430 to produce two control inputs to access the h bridge circuit. you can use what ever micro controller u have. just produce 0,1 bit to rotate motor in clockwise direction. 1,0 bits to rotate in counter clockwise direction and 0,0 bits to stop the motor  and you can use this circuit in robot making,rc,etc to control dc motor direction of rotation.


CIRCUIT:




PROGRAM CODE:

Here is the program for this project. i use energia software to program msp430 launchpad
to download energia software click the link bellow:
http://energia.nu/download/


const int buttonPin = PUSH2;     // the number of the pushbutton pin
const int motorPin1 =  P1_0;
const int motorPin2 =  P1_6;

// the number of the LED pin

// variables will change:

int buttonState = 0;         // variable for reading the pushbutton status

void setup() {

  pinMode(motorPin1, OUTPUT);   
  pinMode(motorPin2, OUTPUT);  
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT_PULLUP);    
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {    
      
  digitalWrite(motorPin1, HIGH);
  digitalWrite(motorPin2, LOW); 
  }
  else {
   
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, HIGH);
  }
}

                                                        
DIRECT CIRCUIT USE H BRIDGE WITH OUT PROGRAM:

                 Use the push button to control motor without controller. for that assemble the circuit bellow. for one button push motor rotate clock wise. for another button push motor rotate anti clock wise. don't push two button at same time.




                                                              Thank you for watching.

MSP430 SERIAL COMMUNICATION USING ENERGIA AND PROCESSING -2

on Thursday, July 3, 2014









HI every one . here i achieve serial communication of msp430 launchpad using energia software. here i read the analog value of light intensity from ldr voltage divider circuit. convert the analog value into 10 bit digital value. and print the value in serial port. and finally read the serially printed value for show the value variation graph form using processing software.

to download energia software:
http://energia.nu/download/

to download processing software:
https://www.processing.org/download/?processing


CIRCUIT:




ENERGIA CODING:

void setup() {
  // initialize the serial communication:
  Serial.begin(4800);
}

void loop() {
  // send the value of analog input 3:
  int data = analogRead(A3);
  Serial.println(data);
// serially print the analog value

}











PROCESSING CODE:

import processing.serial.*;

Serial myPort; // The serial port
int xPos = 1; // horizontal position of the graph

void setup () {
  // set the window size:
  size(400, 300);
 myPort = new Serial(this, "COM13", 4800);   // select the com port in which port launchpad  
                                                                           //connected in your computer.
  // don't generate a serialEvent() unless you get a newline character:
  myPort.bufferUntil('\n');
  // set inital background:
  background(0);
}
void draw () {
  // everything happens in the serialEvent()
}

void serialEvent (Serial myPort) {
  // get the ASCII string:
  String inString = myPort.readStringUntil('\n');

  if (inString != null) {
    // trim off any whitespace:
    inString = trim(inString);
    // convert to an int and map to the screen height:
    float inByte = float(inString);
    inByte = map(inByte, 0, 1023, 0, height);

    // draw the line:
    stroke(127,34,255);
    line(xPos, height, xPos, height - inByte);

    // at the edge of the screen, go back to the beginning:
    if (xPos >= width) {
      xPos = 0;
      background(0);
    }
    else {
      // increment the horizontal position:
      xPos++;
    }
  }
}


                                                 Thank you for watching