Showing posts with label arduino. Show all posts
Showing posts with label arduino. Show all posts

Thursday, 26 March 2015

brain wave controled robot with mindwave headset

 brainwave controled robot

In this tutorial we discuss about how to control ur robot with ur brain
 components need 
  • arduino board (i used arduino uno)
  • driver ic (l293d)
  • mind wave head set
  • dc motor
  • battery
  • robot chasis
  • pc or laptop(must have bluetooth)
software needed
  • arduino ide
  • mindwave mobile
  • communication bridge
steps,,,
  • install mindwave mobile on your pc
  • install arduino ide
make the body of robot
         


the green coloured board is the motor driver module ,u can buy it as it is or make this with the l293d 

connect the driver with the 9,10,11,12 pins of arduino 



now your robot is ready , 
now you can control your robot with your attention,,,!!!!! is it cool?????
for that u want the mindwave headset



         switch on ur head set and pair it with ur computer or laptop, the name of the device is mindwavemobile
  • open mind wave mobile on your pc
then u will get a window like this

select brainwave visualiser



make sure ur headset is turned on,, ten place it on ur head
then u can see ur attention level and meditation level
                              according to this attention level u can control ur robot speed,,
more your attention more your speed.
                       for that open arduino ide and paste the code below
int i;
int x;
void setup() { 
 pinMode(13,OUTPUT);
  pinMode(9, OUTPUT);   
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
Serial.begin(9600);

}
void loop() 

{ if(Serial.available())
{
  x=Serial.read();
if(x<30)
{
for(i=255;i>4;i--)
{digitalWrite(13,LOW);
  delay(10);
   analogWrite(10,i);
   analogWrite(11,i);
}
}
   if(x>30)
{
for(i=5;i<256;i++)
{digitalWrite(13,LOW);
  delay(10);
   analogWrite(10,i);
   analogWrite(11,i);
}}
}}

connect arduino with your pc
upload this sketch to arduino board

after this open the communication bridge ,,

select ports for ur neurosky and arduino.you can find the ports from the device manager

click done .
now u can see ur robot speed is changing according to your attention level.
u can see the graphical representation also.
 now start fighting with your friends,,, check who have more attention.



Wednesday, 19 November 2014

light intensity sensor using arduino

 * led will glow according to the intensity of light
components required
  • arduino uno
  • ldr
  • led
  • 10k resistor
  • wires
code
 


int sensorPin = A0;  
int ledPin = 13; 
int ledPin2 = 12;
int ledPin3= 11;
int ledPin4= 10;
int p = 0; 

void setup() {
  // declare the ledPin as an OUTPUT:
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);  
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3,OUTPUT);
  pinMode(ledPin4,OUTPUT);
}

void loop() {
  // read the value from the sensor:
  p = analogRead(sensorPin);    
  // turn the ledPin on
  Serial.println(p);
if(p<820) 
  {
    digitalWrite(ledPin,p);
    digitalWrite(ledPin3,HIGH);
    digitalWrite(ledPin2, HIGH);
    digitalWrite(ledPin4,HIGH);
  }
  else
  {
   
    
    digitalWrite(ledPin, LOW);
    digitalWrite(ledPin3,HIGH);
    digitalWrite(ledPin4,HIGH);}
    if(p<850) //
    { }
    
    else
    { digitalWrite(ledPin3,LOW);
    digitalWrite(ledPin2, LOW);
    digitalWrite(ledPin, LOW);
    digitalWrite(ledPin4,HIGH);
    
 
  }
  if(p>870)
  {digitalWrite(ledPin4,LOW);
  digitalWrite(ledPin,LOW);
  }
}
  
connections
  • connect the led to the arduino board pins(13,12,11,10)
  • connect a 10 k resistor in series with the ldr,
  • connect the free end of resistor to the +5v pin of arduino
  • connect the free end of ldr to ground
  • connect the a0 pin to the ldr 
  • connect all the -ve terminal of led to ground
  • connect arduin to pc 
  • run the code


 
 
 TIP:- u can change the values according to ur surroundings
       :- open serial monitor for viewing the ldr values.( tools->serial monitor)

Saturday, 15 November 2014

simple 7 segment display driver using arduino uno

simple 7 segment display driver using arduino uno
                  Here is a simple code for arduino for driving a 7 segment display.
                     
     arduino 

                                                                                                      disply
   
                          code



            int timer = 500;           // The higher the number, the slower the timing.

void setup() {
  // use a for loop to initialize each pin as an output:
  for (int thisPin = 0; thisPin < 14; thisPin++)  {
    pinMode(thisPin, OUTPUT);    
  }
}

void loop() {
  // loop from the lowest pin to the highest:
  for (int thisPin = 0; thisPin < 14; thisPin++) {
    // turn the pin on:
    digitalWrite(thisPin, HIGH);
    delay(timer);                
    // turn the pin off:
    digitalWrite(thisPin, LOW);
 delay(timer);  
  }

  // loop from the highest pin to the lowest:
  for (int thisPin = 7; thisPin >= 2; thisPin--) {
    // turn the pin on:
    digitalWrite(thisPin, HIGH);
    delay(timer);
    // turn the pin off:
    digitalWrite(thisPin, LOW);
  }
}

Here this code uses for loop for the selection of o/p pins and also for the state of each pin
steps

  • connect the ground and vcc of the display to the grnd and the +5v pin of arduino respectively.
  • connect the a,b,c,d,e,f, pin of ur display to the output pins(1-13) of arduino. ( u can connect it in any order as u like)
  • connect ur arduino to ur lap or pc
  • coppy the lnk above and paste it to the arduino Ide
  • upload the programme