Printoo Blimp

Printoo Blimp

Material Required

  • Printoo Core
  • DC Motors Drivers & two Motors
  • Bluetooth 4.0 Module
  • Solar Cell Connector
  • LiPo battery
  • Smartphone
  • Balloons & Helium tank
  • Balsa wood

Schematic

Schematic: Blimp

Schematic: Blimp

Code

Download from GitHub

  1. /***************************************************************************************
  2. * © 2014 YD Ynvisible, S.A.
  3. *
  4. * FileName:        Blimp.ino
  5. * Dependencies:    Servo.h and SoftwareSerial.h
  6. * Processor:       ATmega328
  7. * IDE:             Arduino 1.0.5
  8. *
  9. * Description:
  10. * Driving a BLIMP (with 2 DC motors + servomotor) through a smartphone via Bluetooth 4.0
  11. * Sending '1', '2', '3' or '4' via a mobile phone terminal allows several controls
  12. ****************************************************************************************/
  13.  
  14. #include           //Servo library
  15. #include  //Software Serial Port
  16. #define RxD 6
  17. #define TxD 7
  18.  
  19. SoftwareSerial blueToothSerial(RxD,TxD);
  20. Servo servo1;
  21.  
  22. int motor1_pwm=11; //Motor1 PWM
  23. int motor1_dir=12; //Motor1 Direction
  24. int motor2_pwm=9;  //Motor2 PWM
  25. int motor2_dir=8;  //Motor2 Direction
  26. char recvChar =0;
  27.  
  28. void setup()
  29. {
  30.   pinMode(RxD, INPUT);
  31.   pinMode(TxD, OUTPUT);
  32.   pinMode(motor1_pwm, OUTPUT);
  33.   pinMode(motor1_dir, OUTPUT);
  34.   pinMode(motor2_pwm, OUTPUT);
  35.   pinMode(motor2_dir, OUTPUT);
  36.   digitalWrite(motor1_pwm,LOW);
  37.   digitalWrite(motor1_dir,LOW);
  38.   digitalWrite(motor2_pwm,LOW);
  39.   digitalWrite(motor2_dir,LOW);
  40.  
  41.   servo1.attach(14); //analog pin 0
  42.  
  43.   setupBlueToothConnection();
  44. }
  45. void loop()
  46. {
  47.  
  48.   if(blueToothSerial.available()){      //check if the pipe is free
  49.     recvChar = blueToothSerial.read();
  50.     Serial.print(recvChar);
  51.   }
  52.   Servo::refresh();              
  53.   if(recvChar=='1'){
  54.     analogWrite(motor1_pwm,0);     //motor pointing down OFF
  55.     digitalWrite(motor1_dir,LOW);
  56.     analogWrite(motor2_pwm,200);   //back motor ON
  57.     digitalWrite(motor2_dir,LOW);
  58.     servo1.write(90);              //servo at the center
  59.   }
  60.   if(recvChar=='2'){
  61.     analogWrite(motor1_pwm,0);     //motor pointing down OFF
  62.     digitalWrite(motor1_dir,LOW);
  63.     analogWrite(motor2_pwm,200);   //back motor ON
  64.     digitalWrite(motor2_dir,LOW);
  65.     servo1.write(45);              //servo to the right
  66.   }
  67.   if(recvChar=='3'){
  68.     analogWrite(motor1_pwm,200);   //motor pointing down ON
  69.     digitalWrite(motor1_dir,LOW);
  70.     analogWrite(motor2_pwm,0);     //back motor OFF
  71.     digitalWrite(motor2_dir,LOW);
  72.     servo1.write(90);              //servo at the center        
  73.   }
  74.   if(recvChar=='4'){
  75.     analogWrite(motor1_pwm,0);     //motor pointing down OFF
  76.     digitalWrite(motor1_dir,LOW);
  77.     analogWrite(motor2_pwm,200);   //back motor ON
  78.     digitalWrite(motor2_dir,LOW);
  79.     servo1.write(135);              //servo to the left
  80.   }
  81.  
  82. }  
  83.  
  84. void setupBlueToothConnection(){
  85.   blueToothSerial.begin(9600); //Set BluetoothBee BaudRate to default baud rate 9600
  86.   delay(10); // This delay is required.
  87.   blueToothSerial.print("AT+RENEW"); //Restore all setup value to factory setup
  88.   delay(10); // This delay is required.
  89.   blueToothSerial.print("AT+ROLE0"); //make it a slave
  90.   delay(10); // This delay is required.
  91. }
  92. //END
/***************************************************************************************
* © 2014 YD Ynvisible, S.A.
*
* FileName:        Blimp.ino
* Dependencies:    Servo.h and SoftwareSerial.h 
* Processor:       ATmega328
* IDE:             Arduino 1.0.5
*
* Description:
* Driving a BLIMP (with 2 DC motors + servomotor) through a smartphone via Bluetooth 4.0
* Sending '1', '2', '3' or '4' via a mobile phone terminal allows several controls 
****************************************************************************************/

#include           //Servo library
#include  //Software Serial Port
#define RxD 6
#define TxD 7

SoftwareSerial blueToothSerial(RxD,TxD);
Servo servo1;

int motor1_pwm=11; //Motor1 PWM
int motor1_dir=12; //Motor1 Direction
int motor2_pwm=9;  //Motor2 PWM
int motor2_dir=8;  //Motor2 Direction
char recvChar =0;

void setup()
{
  pinMode(RxD, INPUT);
  pinMode(TxD, OUTPUT);
  pinMode(motor1_pwm, OUTPUT); 
  pinMode(motor1_dir, OUTPUT); 
  pinMode(motor2_pwm, OUTPUT); 
  pinMode(motor2_dir, OUTPUT);
  digitalWrite(motor1_pwm,LOW);
  digitalWrite(motor1_dir,LOW);
  digitalWrite(motor2_pwm,LOW);
  digitalWrite(motor2_dir,LOW);
  
  servo1.attach(14); //analog pin 0
  
  setupBlueToothConnection();
}
void loop()
{ 

  if(blueToothSerial.available()){      //check if the pipe is free
    recvChar = blueToothSerial.read();
    Serial.print(recvChar);
  }
  Servo::refresh();              
  if(recvChar=='1'){
    analogWrite(motor1_pwm,0);     //motor pointing down OFF
    digitalWrite(motor1_dir,LOW);
    analogWrite(motor2_pwm,200);   //back motor ON
    digitalWrite(motor2_dir,LOW);
    servo1.write(90);              //servo at the center 
  }
  if(recvChar=='2'){
    analogWrite(motor1_pwm,0);     //motor pointing down OFF
    digitalWrite(motor1_dir,LOW);
    analogWrite(motor2_pwm,200);   //back motor ON
    digitalWrite(motor2_dir,LOW);
    servo1.write(45);              //servo to the right
  }
  if(recvChar=='3'){
    analogWrite(motor1_pwm,200);   //motor pointing down ON
    digitalWrite(motor1_dir,LOW);
    analogWrite(motor2_pwm,0);     //back motor OFF
    digitalWrite(motor2_dir,LOW);
    servo1.write(90);              //servo at the center        
  }
  if(recvChar=='4'){
    analogWrite(motor1_pwm,0);     //motor pointing down OFF
    digitalWrite(motor1_dir,LOW);
    analogWrite(motor2_pwm,200);   //back motor ON
    digitalWrite(motor2_dir,LOW);
    servo1.write(135);              //servo to the left
  }

}  
  
void setupBlueToothConnection(){
  blueToothSerial.begin(9600); //Set BluetoothBee BaudRate to default baud rate 9600
  delay(10); // This delay is required.
  blueToothSerial.print("AT+RENEW"); //Restore all setup value to factory setup
  delay(10); // This delay is required.
  blueToothSerial.print("AT+ROLE0"); //make it a slave
  delay(10); // This delay is required.
}
//END

Video