iPhone Arduino Extension

iPhone Arduino Extension

iRobbie is the revolutionary app that brings smartphone power to your Arduino project.

  • 3,350 views
  • 5 comments
  • 20 respects

Components and supplies

Apps and online services

About this project


iRobbie is the revolutionary app that brings smartphone power to your Arduino project. iRobbie connects via Bluetooth to the Arduino board. Use the iPhone camera and play with object recognition, object tracking and more. Start learning computer vision and neural networks with iRobbie App! With iRobbie, your Arduino robot can recognize and track over 60 objects, get a responsive touchscreen joystick and even allow you to play music!

Features:

This is just an example that can inspire you to design and build your very own robot to play with the iRobbie App using Arduino compatible boards, parts or kits. HM-10 Bluetooth module connects to the Sensor Shield: RX to TX, TX to RX, GND to "-", VCC to "+" Visit https://www.robbie-app.com to check and download free Arduino programs.

For more information, please visit the iRobbie web site.

Arduino compatible boards, parts and kits are sold separately. Arduino is trademark of Arduino AG, which does not sponsor, authorize or endorse this product.

Code

Robbie_A1.inoArduino
Arduino code. You can also download it from https://www.robbie-app.com
#include <Servo.h>

Servo servo;
int angle = 0;
boolean forward1 = false ;
String bluetoothRead, Str_x, Str_y, Str_p, Str_s;
int x ;
int y ;
int points;
int length;
const int buzzer = 10; 
int s;
unsigned long previousMillis = millis();        // will store last time LED was updated

const long interval = 1000;           // interval at which to blink (milliseconds)

#define ENA 11
#define ENB 6
#define IN1 5
#define IN2 7
#define IN3 8
#define IN4 9
#define DELAY 20

int carSpeed = (y*3);
int speed_Coeff = (1 + (x/50));

void setup() { 
  Serial.begin(9600);
  Serial.flush();
  pinMode(IN1,OUTPUT);
  pinMode(IN2,OUTPUT);
  pinMode(IN3,OUTPUT);
  pinMode(IN4,OUTPUT);
  pinMode(ENA,OUTPUT);
  pinMode(ENB,OUTPUT);
  pinMode(buzzer, OUTPUT);
  stop();
  servo.attach(13);
  servo.write(angle);
}

void loop() {
 int i=0;
  char commandbuffer[200];
unsigned long currentMillis = millis();

  if(Serial.available()){
    
     delay(10);

     while( Serial.available() && i< 199) {
        commandbuffer[i++] = Serial.read();
  
      
     }
     commandbuffer[i++]='\0';
     bluetoothRead = (char*)commandbuffer;
     length = bluetoothRead.length();
     Serial.println(bluetoothRead);
  
     
     if(bluetoothRead.substring(0, 1).equals("x")){
       
       int i=1;
       while(bluetoothRead.substring(i, i+1) != ("y")){
       i++;
       }
       
       Str_x = bluetoothRead.substring(1, i);
       x = Str_x.toInt();
            
       Str_y = bluetoothRead.substring(i+1, length - 2);
       y = Str_y.toInt();

       Str_p = bluetoothRead.substring(length - 2, length - 1);
       points = Str_p.toInt();

       Str_s = bluetoothRead.substring(length - 1, length);
       s = Str_s.toInt(); 

       i = 1;
 
       Serial.println(x);
       Serial.println(y);
       Serial.println(points);
       Serial.println(s);
       Serial.println(length );        
      
       stop();
       carSpeed = (y*2.5);
       speed_Coeff = (1 + (x/50));

  
    if(points == 1){
    forward();
    }
    if(points == 0){
    stop();
    }
    if(points == 2){
    back(); 
    }
  
    if(points == 3){
    fleft(); 
    }

    if(points == 4){
    fright(); 
    }

    if(points == 5){
     left(); 
    }

    if(points == 6){
    right(); 
    }

    if(points == 7){
     bleft(); 
    }

    if(points == 8){
    bright(); 
    }

    if(points == 9){
    findo(); 
    }
     
  
    
    if (s == 7){
    play_do();
    }

    if (s == 6){
    play_re();
    }

    if (s == 5){
    play_mi();
    }

    if (s == 4){
    play_fa();
    }

    if (s == 3){
    play_sol();
    }

    if (s == 2){
    play_la();
    }

    if (s == 1){
    play_ci();
    }
//When an object is detected the iRobbie App will start sending s = 8 to the Arduino. 
//You can use it in your own Arduino code. The commented lines is an example. 

    if (s == 8){
  //    if (millis() - previousMillis >= DELAY)
  //    {previousMillis += DELAY;
 //     if (forward1)
 //     {
 //       servo.write(-- angle);
 //       if(angle == 0)
 //       forward1 = false;
//      }
 //     else
//      {
 //      servo.write(++ angle);
 //       if (angle == 30)
 //       forward1 = true;
 //     }
 //     }
 
      // scan from 0 to 180 degrees
 // for(angle = 10; angle < 90; angle++)  
 // {                                  
//    servo.write(0);               
//    delay(15);                   
//  } 
//      servo.write(90);

 //    }
 // servo.write(-90);

//    }
     
  // now scan back from 180 to 0 degrees
//  for(angle = 90; angle > 10; angle--)    
 // {                                
 //   servo.write(angle);           
 //   delay(15);       
//  } 
//     servomove(); 
    }

}
}
}

void servomove(){
    unsigned long currentMillis = millis();
 if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
  
   for(angle = 0; angle < 60; angle++)  
  {                                  
    servo.write(angle); 
      previousMillis = currentMillis;              
    delay(10);                   
  } 
  // now scan back from 180 to 0 degrees
 for(angle = 60; angle > 0; angle--)    
  {                                
    servo.write(angle); 
  }
      previousMillis = currentMillis;          
    delay(10);  
}
}


void forward(){ 
  analogWrite(ENA,carSpeed);
  analogWrite(ENB,carSpeed);
  digitalWrite(IN1,LOW);
  digitalWrite(IN2,HIGH);
  digitalWrite(IN3,LOW);
  digitalWrite(IN4,HIGH);
  delay(25);
//  Serial.println("Forward");
}

void forwards(){ 
  analogWrite(ENA,carSpeed);
  analogWrite(ENB,carSpeed);
  digitalWrite(IN1,LOW);
  digitalWrite(IN2,HIGH);
  digitalWrite(IN3,LOW);
  digitalWrite(IN4,HIGH);
  delay(25);
 // Serial.println("Forward_slow");
}

void back(){
  analogWrite(ENA,(carSpeed - 20));
  analogWrite(ENB,(carSpeed - 20));
  digitalWrite(IN1,HIGH);
  digitalWrite(IN2,LOW);
  digitalWrite(IN3,HIGH);
  digitalWrite(IN4,LOW);
  delay(25);
 // Serial.println("Back");
}

void backs(){
  analogWrite(ENA,(carSpeed - 20));
  analogWrite(ENB,(carSpeed - 20));
  digitalWrite(IN1,HIGH);
  digitalWrite(IN2,LOW);
  digitalWrite(IN3,HIGH);
  digitalWrite(IN4,LOW);
  delay(25);
//  Serial.println("Back_slow");
}
void left(){
  analogWrite(ENA,x);
  analogWrite(ENB,x);
  digitalWrite(IN1,LOW);
  digitalWrite(IN2,HIGH);
  digitalWrite(IN3,HIGH);
  digitalWrite(IN4,LOW);
  delay(25); 
//  Serial.println("Left");
}

void right(){
  analogWrite(ENA,x);
  analogWrite(ENB,x);
  digitalWrite(IN1,HIGH);
  digitalWrite(IN2,LOW);
  digitalWrite(IN3,LOW);
  digitalWrite(IN4,HIGH);
  delay(25);
 // Serial.println("Right");
}


void fright(){
  analogWrite(ENA,carSpeed);
  analogWrite(ENB,carSpeed/speed_Coeff);
  digitalWrite(IN1,LOW);
  digitalWrite(IN2,HIGH);
  digitalWrite(IN3,LOW);
  digitalWrite(IN4,HIGH);
  delay(25);
//  Serial.println("Forward_right");
}



void fleft(){
  analogWrite(ENA,carSpeed/speed_Coeff);
  analogWrite(ENB,carSpeed);
  digitalWrite(IN1,LOW);
  digitalWrite(IN2,HIGH);
  digitalWrite(IN3,LOW);
  digitalWrite(IN4,HIGH);
  delay(25);
//  Serial.println("Forward_left");
}

void bright(){
  analogWrite(ENB,carSpeed);
  analogWrite(ENA,carSpeed/speed_Coeff);
  digitalWrite(IN1,HIGH);
  digitalWrite(IN2,LOW);
  digitalWrite(IN3,HIGH);
  digitalWrite(IN4,LOW);
  delay(25);
//  Serial.println("Back_right");
}



void bleft(){
  analogWrite(ENB,carSpeed/speed_Coeff);
  analogWrite(ENA,carSpeed);
  digitalWrite(IN1,HIGH);
  digitalWrite(IN2,LOW);
  digitalWrite(IN3,HIGH);
  digitalWrite(IN4,LOW);
  delay(25);
 // Serial.println("Back_left");
}

void findo(){
  analogWrite(ENA,90);
  analogWrite(ENB,90);
  digitalWrite(IN1,HIGH);
  digitalWrite(IN2,LOW);
  digitalWrite(IN3,LOW);
  digitalWrite(IN4,HIGH);


  delay(25) ;    


 }


void stop(){
  digitalWrite(ENA,LOW);
  digitalWrite(ENB,LOW);
 // Serial.println("Stop!");
}


void play_do(){
  tone(buzzer, 533);
  delay(500);        
  noTone(buzzer);     
}

void play_re(){
  tone(buzzer, 587);
  delay(500);        
  noTone(buzzer); 
}

void play_mi(){
  tone(buzzer, 659);
  delay(500);        
  noTone(buzzer); 
}

void play_fa(){
  tone(buzzer, 698);
  delay(500);        
  noTone(buzzer); 
}

void play_sol(){
  tone(buzzer, 784);
  delay(500);        
  noTone(buzzer); 
}

void play_la(){
  tone(buzzer, 880);
  delay(500);        
  noTone(buzzer); 
}

void play_ci(){
  tone(buzzer, 987);
  delay(500);        
  noTone(buzzer); 
}

Schematics

Assembled car
Function of each part:
1. Battery holder with a switch: provide power supply for the vehicle
2. Electric motors + wheels: drive the vehicle to move
3. Acrylic plates: the frame of the car
4. L298N motor driving board: drive the motors to rotate
5. UNO controller board: the brain of the car
6. V5 sensor expansion board: combined with the UNO, make the connection become more easier
7. Bluetooth module HM-10: provide the Bluetooth connection with iPhone and iRobbie App
8. Smartphone stand: hold the smartphone on the car

You can find an example of detailed instructions and diagrams here: https://www.elegoo.com/tutorial/Elegoo%20Smart%20Robot%20Car%20Kit%20V2.0.2019.03.19.zip
Ardwebappstore1 zwtv1xuaov

Comments

Similar projects you might like

Arduino Robot w/ GoPro and FPV iPhone Control via Bluetooth

Project in progress by AlxArd

  • 6,309 views
  • 7 comments
  • 38 respects

Buddy, the 3D-Printed Arduino Social Robot

Project showcase by Slant Concepts

  • 7,421 views
  • 6 comments
  • 64 respects

Arduino RC Car with I2C Display!

Project showcase by DABOD

  • 1,192 views
  • 0 comments
  • 5 respects

Gesture Controlled Trainable Arduino Robot Arm via Bluetooth

Project tutorial by KureBas Robotics

  • 21,801 views
  • 53 comments
  • 149 respects

Bluetooth Controlled Car

Project tutorial by JANAK13

  • 17,201 views
  • 20 comments
  • 45 respects
Add projectSign up / Login