Arduino multiwii quadcopter

I’m building a quadcopter with pieces from lots of stores like sparkfun.com, hobbyking.com, soldafria.com.br and adafruit.com, here’s a recent photo of him:


Get all the pieces info at http://quadcopter.lucaszanella.com

 

Posted in My Projects | Tagged , , , | 162 Comments

xbee sample code with FTDI


If you received your xbees recently and want to do a super simple test, just connected one xbee to your arduino (xbee rx to arduino tx and xbee tx to arduino rx), and the other xbee to your FTDI board and connect to your computer.

On the arduino, upload this code: (note that if your xbees baud rate isn’t 9600 just change it to your velocity)

void setup () {
  Serial.begin(9600);
}
void loop () {
  for (int i=0; i<255; i++) {
    Serial.println(i);
    delay(100);
  }
}

 

Now open the arduino on your computer, select the serial port of your FTDI cable or breakout board. Click Serial Monitor, you should be able to see data coming from your arduino. This code is a loop that sends values from 0 to 255.

Note: if your baud rate isn’t 9600, you have to change to your baud rate on the serial monitor too.

Posted in Tutorial | Tagged , , , , , , , , , , , , , , , | 3.520 Comments

Laser alarm

With this simple schematic I’ve done you can build your own laser alarm.

1 x NPN 2N3094 transistor

1 x 1000uF capacitor

1 x 10k ohm resistor

1 x photocell (LDR resistor)

1 x buzzer

3v power supply

When the laser perimeter is cutted the alarm is activated!

 

Posted in My Projects, Tutorial | Tagged , , , | 3.647 Comments

Arduino parking sensor on my knapsack

This is a “parking sensor” that I made for my knapsack, but you can use it on your car.

 

You’ll need an arduino board, a ultrasonic range sensor, a 9v battery, a switch and some wires.

This is the code:

//pin 6 = ultrasonic sensor pin

//pin 11 = 5v buzzer

const int pingPin = 6;
int SPKR = 11;
long previousMillis = 0;

void setup() {
  pinMode(SPKR, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  long duration, inches, cm;
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);
  duration = map(duration,  0, 15000, 0, 5000);
  Serial.println(duration);
  unsigned long currentMillis = millis();

  if(currentMillis – previousMillis > (duration/2)) {
    previousMillis = currentMillis;  
  if (duration!=0) {
    if (duration<2000) {
    for (int i=0; i<500; i++) {
      digitalWrite(SPKR, HIGH);
      delayMicroseconds(150);
      digitalWrite(SPKR, LOW);
      delayMicroseconds(150);
    }
    }
  }
}
  delay(100);
}

Posted in My Projects, Tutorial | 3.926 Comments