Jon Ina
Created April 29, 2021

BCR (Bluetooth Controlled Robot)

Simple Bluetooth Robot Project

BeginnerShowcase (no instructions)1
BCR (Bluetooth Controlled Robot)

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Pololu Mini Maestro (12 Channel)
×1
MG996R Servo
×3
DC Motor, 12 V
DC Motor, 12 V
×2
DC to DC voltage regulator
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
Toggle Switch, Toggle
Toggle Switch, Toggle
×1
Dual H-Bridge motor drivers L293D
Texas Instruments Dual H-Bridge motor drivers L293D
×1
Linear Regulator (7805)
Linear Regulator (7805)
×1
7.4V LiPo Battery
×1

Software apps and online services

MIT App Inventor 2
MIT App Inventor 2
Arduino IDE
Arduino IDE
Inkscape

Story

Read more

Custom parts and enclosures

BCR Bottom

BCR Top

Schematics

Schematic for BCR

Schematic for BCR

Code

Code for BCR

Arduino
#include <PololuMaestro.h>
#include <SoftwareSerial.h>

SoftwareSerial maestroSerial(10, 11); //range of bottom sensor 2000 to 10,000, range of mid servo 1500-6500,end servo range is 3000-10,000
MiniMaestro maestro(maestroSerial);

#define INPUT1 4
#define INPUT2 9
#define INPUT3 8
#define INPUT4 7
#define ENABLE1 6
#define ENABLE2 5


int input = 0;
int baseAngle = 6000;
int midAngle = 1500;
int endAngle = 4000;


void setup() {
  Serial.begin(9600);
  maestroSerial.begin(9600);
  pinMode(INPUT1, OUTPUT);
  pinMode(INPUT2, OUTPUT);
  pinMode(INPUT3, OUTPUT);
  pinMode(INPUT4, OUTPUT);
  analogWrite(ENABLE1, 0);
  analogWrite(ENABLE2, 0);
  digitalWrite(INPUT1, LOW);
  digitalWrite(INPUT2, LOW);
  digitalWrite(INPUT3, LOW);
  digitalWrite(INPUT4, LOW);

  for(int y = 0; y <= 2; y++){
    maestro.setSpeed(y,25);
    maestro.setAcceleration(y,127);
  }

  maestro.setTarget(0,midAngle);
  maestro.setTarget(1,baseAngle);
  maestro.setTarget(2,endAngle);
}

void loop() {
  if (Serial.available()> 0) {
    input = Serial.read();
    
      switch(input){
      case 97:
      analogWrite(ENABLE1, 255);
      analogWrite(ENABLE2, 255);
      digitalWrite(INPUT1, LOW);
      digitalWrite(INPUT2, HIGH);
      digitalWrite(INPUT3, HIGH);
      digitalWrite(INPUT4, LOW);
      input = 0;
      break;
      case 98:
      analogWrite(ENABLE1, 255);
      analogWrite(ENABLE2, 255);
      digitalWrite(INPUT1, HIGH);
      digitalWrite(INPUT2, LOW);
      digitalWrite(INPUT3, LOW);
      digitalWrite(INPUT4, HIGH);
      input = 0;
      break;
      case 99:
      analogWrite(ENABLE1, 255);
      analogWrite(ENABLE2, 255);
      digitalWrite(INPUT1, HIGH);
      digitalWrite(INPUT2, LOW);
      digitalWrite(INPUT3, HIGH);
      digitalWrite(INPUT4, LOW);
      input = 0;
      break;
      case 100:
      analogWrite(ENABLE1, 255);
      analogWrite(ENABLE2, 255);
      digitalWrite(INPUT1, LOW);
      digitalWrite(INPUT2, HIGH);
      digitalWrite(INPUT3, LOW);
      digitalWrite(INPUT4, HIGH );
      input = 0;
      break;
      case 101:
      analogWrite(ENABLE1, 0);
      analogWrite(ENABLE2, 0);
      digitalWrite(INPUT1, LOW);
      digitalWrite(INPUT2, LOW);
      digitalWrite(INPUT3, LOW);
      digitalWrite(INPUT4, LOW);
      input = 0;
      break;
      case 102:
      baseAngle = baseAngle + 150;
      maestro.setTarget(1,baseAngle);
      break;
      case 103:
      baseAngle = baseAngle - 150;
      maestro.setTarget(1,baseAngle);
      break;
      case 104:
      maestro.setTarget(0,midAngle);
      maestro.setTarget(2,endAngle);
      break;
      case 105:
      maestro.setTarget(0,6500);
      maestro.setTarget(2,6000);
      break;
    }
    
    }
    
    
    
  


}

Credits

Jon Ina

Jon Ina

1 project • 0 followers

Comments