Project showcase
'Roger Bot' the Pet Rover

'Roger Bot' the Pet Rover © GPL3+

Roger Bot can be custom programmed, in addition to its built-in Bluetooth program for its robotic arm and rover capabilities.

  • 2,718 views
  • 0 comments
  • 14 respects

Components and supplies

Necessary tools and machines

3drag
3D Printer (generic)
Smoothing File
Screw Driver (plus)
Screw Driver (minus)
Electric Drill with drill bits of different size
Super Glue
Hand held Saw
Allen wrench s w 1  39667 1511201106 fhdaoyzy3o
OpenBuilds Allen Wrench
Socket wrench
Fluke Multimeter
09507 01
Soldering iron (generic)

Apps and online services

About this project

ROGER BOT

The design concept of Roger Bot is based on two main features. The robotic arm functions and the the rover maneuverability functions. In addition to this, several sensors have been installed on the rover to retrieve sensory data and display them upon request on a LCD display. All the parts were designed using CATIA V5 software and exported as STL files and printed on a 3D printer.

Roger Bot is designed for indoors and will not be able to handle bumpy and crooked grounds although it performs well on smooth flat surfaces. This is a downfall on the drive capabilities for now and I hope to address this in the future with your input. It has a tripod style wheel arrangement with ample width between the back two wheels so that mild to intense robotic arm movements will not topple Roger Bot over. The three supports with rolling ball wheels on the underbelly of the rover acts as an additional support for the robot arm on the rover.

Another fact that I want to highlight at this point is that as I started to design initially my plan was to control the steering of the rover using a servo motor attached to the front wheel, but with testing later I had found out that the distance between the two back wheels were too large hence even with full steer from the front wheel very little turn was resulted by the rover. So I have just left the design as it is for now and used the opposite turning of the two back wheels at the same time for the turning movements in clockwise and anticlockwise direction.

The drive capabilities of the rover are powered by stepper motors and the robotic arm is powered by servo motors. These are controlled by an Arduino Mega 2650 which is seated at the back of the rover.

Roger Bot also has the capability to play music and record audio of up to about 10 seconds and play it back. All the functions of Roger Bot are controlled via Bluetooth with a dedicated APP created using MIT App Inventor 2.

Roger Bot in surveillance mode

Please click this link to visit my youTube channel to watch more videos of RogerBot.

THE BUILD

For clarification I have divided the build into three main parts, which are:

  • The body
  • The head
  • The arm

THE BODY

All the structural members of the body are 3D-printed except for the wheels. It consists of two plates fixed with vertical screw in beams. The gap between the two plates are used for housing the voltage regulator modules, two 11.1 V LiPo batteries, one 7.4 V LiPo battery and one 9 V normal battery. Clips are screwed to the bottom side of the top plate for routing the wires from the sensors, the voltage regulator modules, the steering servo and head rotation servo and Stepper Motors. The bottom face of the top plate has the three support legs with screw in ball wheels attached to the bottom of each support leg. The ball wheels on the legs can be screwed in or out to a desired level for distribution of load and overall balance of Roger Bot.

Two side structures are attached on either side of the top plate that house the two stepper motors used for the rover movements of Roger Bot. Two speakers respectively for the mp3 player and the voice recorder module are fixed on top of these side structures. The wheels were purchased separately for this project. They are connected to the shafts of the motors with metal couplings. The collar that holds the wheel and the coupling are 3D-printed.

The fwd of the top plate is fixed the head mount structure which houses the steering assembly (with the bearing) and head assembly. On top of the head mount structure is a mini breadboard with the blutooth module, PIR sensor and the transistors and resistors used in the circuitry for the mp3 player module and the voice recorder module.

The mid section of the top plate houses the structural member that hold the base rotation servo for the robot arm.

The aft of the top plate is allocated for the box which holds the Arduino Mega board, two stepper motor drivers and two mini breadboards and circuitry for the wiring and connections. RGB leds and normal leds are also housed inside the box for a more colorful look. These can be controlled via the dedicated APP for Roger Bot. On top of the box are fixed the LCD display (with I2C LCD backpack for optimizing pins on the Arduino Mega) and the cooling fan for the two stepper motor drivers.

THE HEAD

The head assembly consists of the housing structure for the steering and head rotation servos. The head of Roger Bot houses the sonic sensors for measuring the distance and two RGB led Modules which can also be controlled. The sonic sensors are used in the surveillance mode for avoiding obstacles and moving around. In surveillance mode, the gripper head of Roger Bot can be swapped with a camera holder which can hold a RunCam2. Sadly the camera is not automated but its something I would like to learn and explore with the help of the Arduino community.

THE ARM

The arm is mounted on the base servo motor with a 3D-printed round beam with a hole in the middle. I used a 5 mm diameter metal SS rod cut into the length of the short beam and inserted it to the hole in the beam to give additional strength. The arm has six degrees of freedom including the gripper mechanism. The gripper uses a screw mechanism which loosens and tightens the the bolt attached to one of the grip clamps. Two hollow rods(not too sure of the material but is strong and rigid enough) is used as guide rails for the clamps. A kill switch is at the end of the gripper to revert back a few steps forward after the clamp is fully loosened. As of yet I haven't programmed the kill switch but all the necessary hardware is ready for it to be programmed. The gripper uses a high torque small stepper motor which is light in weight and easy to program.

A counter weight of 100 g is used at the mid arm section for countering the moment forces of the arm. Also it assists in the overall balance of the arm when in motion.

HOW IT WORKS

To further explain on how it works, I'll divide it into five main parts:

  • Audio capability
  • Mechanical movement capability
  • Interaction capability
  • Power management

AUDIO CAPABILITY

The two modules used for audio are the MP3 module and the voice recorder module.

MP3 Audio Sound Player Decoder Module

This module comes with built in switches for play/pause, next, previous, repeat buttons. The modification I made to the circuitry is to add four npn transistors to control the functions of these buttons via Bluetooth through the APP. The mini bread board behind the head of Roger Bot is used for making all the connections with the module and the transistors. The 'collector' pins of the transistors are connected to the ground, the 'base' pins are connected to the digital pins respectively of the Arduino Mega, and the 'emitter' pins are soldered to the left leg of the push buttons for each function. When the signal is 'HIGH' on any of the digital pins the 'base' pin allows the current to flow thereby completing the circuit.

Voice Recorder (ISD 1820)

The ISD1820 is a voice recorder module that can record sound up to 10s and playback. Similar to the MP3 module, the ISD1820 also comes with push buttons for Record and Playback. In addition to this this module comes with connecting options with the Arduino with its pin out for record and playback functions. By simply setting a 'HIGH' or 'LOW' on any of these pins enables or disables the functions respectively. The pins are connected to digital pins on the Arduino Mega. Since this module runs on 3.3 V, it was necessary that the signals sent from the Arduino board also were of 3.3 V although Arduino runs on 5 V. Therefore a simple voltage divider resistor circuit is connected with the help of the mini bread board behind the head of Roger Bot to step down the 5 V to 3.3 V.

MECHANICAL MOVEMENT CAPABILITY

The mechanical movements of the arm, movements of the steering front wheel and the head will be explained here in addition to the stepper motors and their respective drivers.

Roger Bot arm conrol functions

The robotic arm consumes six servos in total. Five servos out of this have a rotation angle limit of 300 degrees and the servo used for rotating the gripper has a rotation angle limit of 180 degrees. The steering servo also have a limiting angle of 180 degrees. Finally the head servo has a limit rotation angle of 180 degrees. All the servos except the head servo performs best at 8 V and the head servo is supplied with 4 - 6 V. The power leads of the servos are supplied power via a 16 V 100mF capacitor for smoothing the servo movements. The base of the arm is powered by two servo motors and after assembling I found out that one servo was off by 5.5 degrees from the other so I adjusted that in the program.

The two bipolar stepper motors (Nema 17) used for driving Roger Bot uses two A4988 drivers. A small 5 V cooling fan is mounted on top of the box right above the two drives for cooling and a transistor is used as an electronic switch for blutooth control. It takes some tweaking to get the right amount of step and torque of the motors for the rover to move smoothly.

A small high torque 4 phase small stepper motor (28BJY-48) is used in the gripper for tightening and loosening the grip. It is driven by a ULN2003 driver. The driver is placed below and in between the two audio modules.

INTERACTION CAPABILITY

Interaction with the Roger Bot is made via Bluetooth connection through the dedicated APP designed using the MIT App Inventor 2. It supplies sensory data when requested and displays them on the LCD display though I2C.

The HC-05 Bluetooth modules is connected to the Arduino Mega using the RX and TX pins and communicates via serial port. The Bluetooth module is paired with the dedicated APP built using MIT App Inventor 2.

The HC-SR04 Sonic sensor's VCC is connected to 5 V with the GND pins grounded and Echo and Trig pins to digital pins of the Arduino Mega. Data from this sensor is used in the 'surveillance mode' of Roger Bot.

The LM35 Temperature sensor module and DHT11 humidity sensor's VCC is connected to 5 V with the GND pin grounded and The signal pin of the LM35 is connected to analog pin on Arduino Mega and the DHT11 to digital pin. These two sensors are located under the top plate where the batteries are located.

The PIR sensor and light sensor also is connected and with the 5 V VCC and GND to ground with the signal wire of light sensor is connected to analog pin and the signal wire of PIR sensor is connected to digital pin on Arduino Mega.

POWER MANAGEMENT

  • 11.1 V LiPo Battery - Used to power the five 300-degree servos and the ULN2003 driver.
  • 11.1 V LiPo Battery - Used to power the two 18-degree servos and the two stepper motors for driving the rover.
  • 7.4 V LiPo Battery - Used to power most of the LEDs, LCD and the 5V voltage required to run most modules.
  • 9 V Normal Battery - Used to power the Arduino Mega board, cooling fan and few LEDs.

The voltage from the two 11.1 V LiPo batteries are stepped down to 8 V for powering the servos using the voltage step down module. Direct 11.1 V is used from the batteries to power the three stepper motors (two drive motors and gripper motor). All connections are made on breadboard and took me quite awhile manage all the wires in a small confined box.

Code

Roger Bot Main CodeArduino
I have tried to explain the code through commented out section. Most of the functions defined will be self explanatory.
/*
aux1, aux2 and aux3 will send 2byte number 9200, 9300, 9400 respectively which can be used for additional programs within the main code.
written by: hannu_hell
Special shoutout to youtuber Robojax, How to Mechatronics, Mert Arduino for this code is not purely mine and i have tweaked sections of various codes from the above mentioned authors to suit my project.
What i have written is in no way perfect and i would be happy to accept any modifications. Thanks.

ROGER BOT 

  Pin No      Description                                                           
    
  TX          Transmit Serial Communication to Bluetooth module                     
  RX          Receive Serial Communication to Bluetooth module                      
  2           Signal to Servo 4                                                    
  3           Signal to Servo 5                                                    
  4           Signal to Servo 3                                                     
  5           Signal to Servo 1                                                     
  6           Roger Head Right LED (Red)                                            
  7           Roger Head Right LED (Yellow)                                         
  8           Roger Head Right LED (Green)                                          
  9           Roger Head Left LED (Green)                                           
  10          Roger Head Left LED (Yellow)                                          
  11          Roger Head Left LED (Red)                                             
  12          RGB and Blue LED                                                      
  13          Red LED set                                                           
  A1          LM 35 Temperature Signal                                              
  A2          Photocell Signal                                                      
  A15         Driver Cooling Fan                                                    
  22          N/A                                                                   
  23          PIR Signal                                                            
  24          N/A                                                                   
  25          N/A                                                                   
  26          N/A                                                                   
  27          IN 1 Gripper Motor                                                    
  28          Signal to Servo 6 (Base Rotation Servo)                               
  29          IN 2 Gripper Motor                                                    
  30          Signal to Servo 7 (Steering Servo)                                    
  31          IN 3 Gripper Motor                                                    
  32          Signal to Servo 2                                                     
  33          IN 4 Gripper Motor                                                    
  34          Left Side Drive Motor LED                                             
  35          TRIG Sonic Sensor                                                    
  36          Drive Motor 1 DIR Pin                                                
  37          Drive Motor 1 STEP Pin                                               
  38          Drive Motor 2 DIR Pin                                                 
  39          Drive Motor 2 STEP PIN                                                
  40          Drive Motor 1 Arm Pin                                                 
  41          Drive Motor 2 Arm Pin                                                 
  42          MP3 - Previous Signal                                                 
  43          Gripper End Stop Switch                                               
  44          MP3 - Next Signal                                                     
  45          DHT11 - Humidity Signal                                               
  46          MP3 Play/Pause Signal                                                 
  47          MP3 Repeat Signal                                                     
  48          ISD1820 Voice Record                                                  
  49          ISD1820 Voice Playback                                                
  50          Right Side Drive Motor LED                                            
  51          Signal to Servo 8 (Head Servo)                                        
  52          ECHO Sonic Sensor                                                     
  53          MP3 Power Signal                                                     
  SDA         LCD Display via IIC                                                   
  SCL         LCD Display via IIC                                                  

*/

#include <Servo.h> 
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <dht.h>
dht DHT;
#define DHT11_PIN 45

Servo myservo1, myservo2, myservo3, myservo4,myservo5,myservo6,myservo7,myservo8; 
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7,3, POSITIVE);


        int _step = 0; 
        const int Pin1 = 27; 
        const int Pin2 = 29; 
        const int Pin3 = 31; 
        const int Pin4 = 33; 
        const int sleep = 40;
        const int sleep2 = 41;
        const int stepPin = 37;
        const int dirPin = 36;
        const int stepPin2 = 39;
        const int dirPin2 = 38;
        const int redLed = 13;
        const int rgbLed = 12;
        const int rightsideLed = 50;
        const int leftsideLed = 34;
        const int rec = 48;
        const int playback = 49;
        const int head1redLed = 11;
        const int head1yellowLed = 10;
        const int head1greenLed = 9;
        const int head2redLed = 6;
        const int head2yellowLed = 7;
        const int head2greenLed = 8;
        const int trigPin = 35;
        const int echoPin = 52;
        const int humidity = 45;
        const int tempPin = A1;
        const int fan = A15;
        const int mp3Power = 53;
        const int mp3Play = 46;
        const int mp3Next = 44;
        const int mp3Previous = 42;
        const int mp3Repeat = 47;
        long duration;
        int distanceInch, distanceCm, avedist90, avedist60, avedist120;
        boolean dir;// false=clockwise, true=anticlockwise


void setup()
{ 
  lcd.begin(16, 2);
  

  pinMode(Pin1, OUTPUT);  
  pinMode(Pin2, OUTPUT);  
  pinMode(Pin3, OUTPUT);  
  pinMode(Pin4, OUTPUT);
  pinMode(50, OUTPUT);
  pinMode(34, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
  pinMode(48, OUTPUT);
  pinMode(49, OUTPUT);
  pinMode(A15, OUTPUT);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(tempPin, INPUT);
  pinMode(53, OUTPUT);
  pinMode(42, OUTPUT);
  pinMode(46, OUTPUT);
  pinMode(47, OUTPUT);
  pinMode(44, OUTPUT);
  
  for (int i = 36; i<42; i++){
    pinMode(i, OUTPUT);
  }
  for (int j = 6; j<12; j++){
    pinMode(j, OUTPUT);
    delay(5);
    digitalWrite(j, LOW);
  }

  
  
//ON START-UP THREAD---------------------------

  lcdmain();
  delay(3000);
  lcd.clear();
  digitalWrite(redLed, LOW);
  digitalWrite(rgbLed, LOW);
  digitalWrite(rightsideLed, LOW);
  digitalWrite(leftsideLed, LOW);

  for (int k = 0; k<16; k++){
    lcd.setCursor(k, 0);
    lcd.print("Arming..");
    delay(500);
    lcd.clear();
  }
  
  myservo1.attach(5); 
  myservo2.attach(32);
  myservo3.attach(4);
  myservo4.attach(2);
  myservo5.attach(3);
  myservo6.attach(28);
  myservo7.attach(30);
  myservo8.attach(51);
  
  delay(1000);
  
// armCheck(); This function is for checking if all the arm servos and movements are ok. i have commented it out for now.
  
  lcd.setCursor(5, 0);
  lcd.print("Ready for");
  lcd.setCursor(5, 1);
  lcd.print("Bluetooth");
  delay(1000);
  lcd.clear();
  lcdmain();
  delay(100);
  Serial.begin(9600);

}



void loop()
{
  
  if(Serial.available()>= 2 )
  {
     
        unsigned int servopos = Serial.read();
        unsigned int servopos1 = Serial.read();
        unsigned int realservo = (servopos1 *256) + servopos;
        Serial.println(realservo);

          if (realservo >= 1000 && realservo < 1180) {
          int servo1 = realservo;
          int servo2 = realservo;
          servo1 = map(servo1, 1000, 1176, 0, 176);
          servo2 = map(servo2, 1000, 1180, 180, 0);
          myservo1.write(servo1);
          myservo2.write(servo2+5.5);
          delay(25);
          }
          
          if (realservo >= 2000 && realservo < 2136) {
          int servo3 = realservo;
          servo3 = map(servo3, 2000, 2136, 20, 145);
          myservo3.write(servo3);
          delay(15);
          }
          if (realservo >= 3000 && realservo < 3180) {
          int servo4 = realservo;
          servo4 = map(servo4, 3000, 3180, 0, 180);
          myservo4.write(servo4);
          delay(15);
          }
          if (realservo >= 4000 && realservo < 4180) {
          int servo5 = realservo;
          servo5 = map(servo5, 4000, 4180, 0, 180);
          myservo5.write(servo5);
          delay(20);
          }
          if (realservo >= 5000 && realservo < 5180) {
          int servo6 = realservo;
          servo6 = map(servo6, 5000, 5180, 0, 180);
          myservo6.write(servo6);

          delay(15);
          }
          if (realservo >= 6000 && realservo < 6180) {
          int servo7 = realservo;
          servo7 = map(servo7, 6000, 6180, 0, 180);
          myservo7.write(servo7);
          delay(2);
          }
          
          if (realservo == 7000) {
            grippertightMove(3000, 1.2);
          }
          if (realservo == 7100) {
            gripperlooseMove(3000, 1.2);
          }
          if (realservo == 7200){
            forwardMove(60, 15);
          }
          if (realservo == 7300){
            reverseMove(60, 15);
          }
          if (realservo == 7400){
            clockwiseMove(50, 15);
          }
          if (realservo == 7500){
            anticlockwiseMove(50, 15);
          }
          if (realservo == 7600){
            forwardMove(30, 15);
          }
          if (realservo == 7700){
            reverseMove(30, 15);
          }
          if (realservo == 7800){
            digitalWrite(redLed, HIGH);
            digitalWrite(rgbLed, HIGH);
            digitalWrite(rightsideLed, HIGH);
            digitalWrite(leftsideLed, HIGH);
          }
          if (realservo == 7900){
            digitalWrite(redLed, LOW);
            digitalWrite(rgbLed, LOW);
            digitalWrite(rightsideLed, LOW);
            digitalWrite(leftsideLed, LOW);
          }
          if (realservo == 8000){
            record(8000);
          }
          if (realservo == 8100){
            playBack(8000);
          }
          if (realservo == 8200){
            powerSave();
          }
          if (realservo == 8300){
            analogWrite(fan, 1023);
          }  
          if (realservo == 8400){
            SURVEILLANCE(100, 2000);
          }
          if (realservo == 8500){
            SENSORDATA();
          }
          //if (realservo == 8600){
            //WATCHDOG();
          //}
          //if (realservo == 8700){
            //AUX button1
          //}
          //if (realservo == 8800){
           //AUX button2
          //}
          //if (realservo == 8900){
           //AUX button3
          //}
          if (realservo == 9000){
            digitalWrite(mp3Play, HIGH);
            delay(250);
            digitalWrite(mp3Play, LOW);
            delay(10);
          }
          if (realservo == 9100){
            digitalWrite(mp3Next, HIGH);
            delay(250);
            digitalWrite(mp3Next, LOW);         
          }
          if (realservo == 9200){
            digitalWrite(mp3Previous, HIGH);
            delay(250);
            digitalWrite(mp3Previous, LOW);          
          }
          if (realservo == 9300){
            digitalWrite(mp3Repeat, HIGH);
            delay(250);
            digitalWrite(mp3Repeat, LOW);       
          }
          if (realservo == 9400){
            digitalWrite(mp3Power, HIGH);
          }
            
}
}

// DRIVE MOTORS FUNCTIONS DEFINED BELOW--------------------------
void forwardMove(int fwdPace, int fwdpaceDelay){
            digitalWrite(sleep, HIGH);
            digitalWrite(sleep2, HIGH);
            delay(5);
            digitalWrite(dirPin, HIGH);
            digitalWrite(dirPin2, LOW);
              for(int fwd=0; fwd<fwdPace; fwd++){
              digitalWrite(stepPin, HIGH);
              digitalWrite(stepPin2, HIGH);
              delay(fwdpaceDelay);
              digitalWrite(stepPin, LOW);
              digitalWrite(stepPin2, LOW);
              delay(fwdpaceDelay);
              }
            digitalWrite(sleep, LOW);
            digitalWrite(sleep2, LOW);
            delay(5);
}

void reverseMove(int rvsPace, int rvspaceDelay){
            digitalWrite(sleep, HIGH);
            digitalWrite(sleep2, HIGH);
            delay(5);
            digitalWrite(dirPin, LOW);
            digitalWrite(dirPin2, HIGH);
              for(int rvs=0; rvs<rvsPace; rvs++){
              digitalWrite(stepPin, HIGH);
              digitalWrite(stepPin2, HIGH);
              delay(rvspaceDelay);
              digitalWrite(stepPin, LOW);
              digitalWrite(stepPin2, LOW);
              delay(rvspaceDelay);
              }
            digitalWrite(sleep, LOW);
            digitalWrite(sleep2, LOW);
            delay(5);
}

void clockwiseMove(int clkPace, int clkpaceDelay){
            digitalWrite(sleep, HIGH);
            digitalWrite(sleep2, HIGH);
            delay(5);
            digitalWrite(dirPin, HIGH);
            digitalWrite(dirPin2, HIGH);
              for(int clk=0; clk<clkPace; clk++){
              digitalWrite(stepPin, HIGH);
              digitalWrite(stepPin2, HIGH);
              delay(clkpaceDelay);
              digitalWrite(stepPin, LOW);
              digitalWrite(stepPin2, LOW);
              delay(clkpaceDelay);
              }
            digitalWrite(sleep, LOW);
            digitalWrite(sleep2, LOW);
            delay(5);
}

void anticlockwiseMove(int aclkPace, int aclkpaceDelay){
            digitalWrite(sleep, HIGH);
            digitalWrite(sleep2, HIGH);
            delay(5);
            digitalWrite(dirPin, LOW);
            digitalWrite(dirPin2, LOW);
              for(int aclk=0; aclk<aclkPace; aclk++){
              digitalWrite(stepPin, HIGH);
              digitalWrite(stepPin2, HIGH);
              delay(aclkpaceDelay);
              digitalWrite(stepPin, LOW);
              digitalWrite(stepPin2, LOW);
              delay(aclkpaceDelay);
              }
            digitalWrite(sleep, LOW);
            digitalWrite(sleep2, LOW);
            delay(5);
}


// GRIPPER MOTOR FUNCTIONS DEFINED-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

void grippertightMove(int grptightPace, int grptightpaceDelay){
          for (int grptight=0; grptight<grptightPace; grptight++){     
          switch(_step){ 
              case 0: 
              digitalWrite(Pin1, LOW);  
              digitalWrite(Pin2, LOW); 
              digitalWrite(Pin3, LOW); 
              digitalWrite(Pin4, HIGH); 
              break;  
              case 1: 
              digitalWrite(Pin1, LOW);  
              digitalWrite(Pin2, LOW); 
              digitalWrite(Pin3, HIGH); 
              digitalWrite(Pin4, HIGH); 
              break;  
              case 2: 
              digitalWrite(Pin1, LOW);  
              digitalWrite(Pin2, LOW); 
              digitalWrite(Pin3, HIGH); 
              digitalWrite(Pin4, LOW); 
              break;  
              case 3: 
              digitalWrite(Pin1, LOW);  
              digitalWrite(Pin2, HIGH); 
              digitalWrite(Pin3, HIGH); 
              digitalWrite(Pin4, LOW); 
              break;  
              case 4: 
              digitalWrite(Pin1, LOW);  
              digitalWrite(Pin2, HIGH); 
              digitalWrite(Pin3, LOW); 
              digitalWrite(Pin4, LOW); 
              break;  
              case 5: 
              digitalWrite(Pin1, HIGH);  
              digitalWrite(Pin2, HIGH); 
              digitalWrite(Pin3, LOW); 
              digitalWrite(Pin4, LOW); 
              break;  
              case 6: 
              digitalWrite(Pin1, HIGH);  
              digitalWrite(Pin2, LOW); 
              digitalWrite(Pin3, LOW); 
              digitalWrite(Pin4, LOW); 
              break;  
              case 7: 
              digitalWrite(Pin1, HIGH);  
              digitalWrite(Pin2, LOW); 
              digitalWrite(Pin3, LOW); 
              digitalWrite(Pin4, HIGH); 
              break;  
              default: 
              digitalWrite(Pin1, LOW);  
              digitalWrite(Pin2, LOW); 
              digitalWrite(Pin3, LOW); 
              digitalWrite(Pin4, LOW); 
              break;  
              } 
          _step--; 
       
          if(_step<0){ 
          _step=7; 
          } 
             if(_step>7){ 
          _step=0; 
          } 
          delay(grptightpaceDelay);
          
  }
}

void gripperlooseMove(int grploosePace, int grploosepaceDelay){
           for(int grploose=0; grploose<grploosePace; grploose++){ 
              switch(_step){ 
              case 0: 
              digitalWrite(Pin1, LOW);  
              digitalWrite(Pin2, LOW); 
              digitalWrite(Pin3, LOW); 
              digitalWrite(Pin4, HIGH); 
              break;  
              case 1: 
              digitalWrite(Pin1, LOW);  
              digitalWrite(Pin2, LOW); 
              digitalWrite(Pin3, HIGH); 
              digitalWrite(Pin4, HIGH); 
              break;  
              case 2: 
              digitalWrite(Pin1, LOW);  
              digitalWrite(Pin2, LOW); 
              digitalWrite(Pin3, HIGH); 
              digitalWrite(Pin4, LOW); 
              break;  
              case 3: 
              digitalWrite(Pin1, LOW);  
              digitalWrite(Pin2, HIGH); 
              digitalWrite(Pin3, HIGH); 
              digitalWrite(Pin4, LOW); 
              break;  
              case 4: 
              digitalWrite(Pin1, LOW);  
              digitalWrite(Pin2, HIGH); 
              digitalWrite(Pin3, LOW); 
              digitalWrite(Pin4, LOW); 
              break;  
              case 5: 
              digitalWrite(Pin1, HIGH);  
              digitalWrite(Pin2, HIGH); 
              digitalWrite(Pin3, LOW); 
              digitalWrite(Pin4, LOW); 
              break;  
              case 6: 
              digitalWrite(Pin1, HIGH);  
              digitalWrite(Pin2, LOW); 
              digitalWrite(Pin3, LOW); 
              digitalWrite(Pin4, LOW); 
              break;  
              case 7: 
              digitalWrite(Pin1, HIGH);  
              digitalWrite(Pin2, LOW); 
              digitalWrite(Pin3, LOW); 
              digitalWrite(Pin4, HIGH); 
              break;  
              default: 
              digitalWrite(Pin1, LOW);  
              digitalWrite(Pin2, LOW); 
              digitalWrite(Pin3, LOW); 
              digitalWrite(Pin4, LOW); 
              break;  
              } 
          _step++; 
          if(_step>7){ 
          _step=0; 
          } 
         if(_step<0){ 
          _step=7; 
          }
          delay(grploosepaceDelay); 
         
        } 
}


// SERVO MOTORS' FUNCTIONS DEFINED BELOW--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


void dualservoSetposition(int servoAngle){
  int servo1 = servoAngle;
  int servo2 = servoAngle;
  servo1 = map(servo1, 0, 176, 0, 176);
  servo2 = map(servo2, 0, 180, 180, 0);
  myservo1.write(servo1);
  myservo2.write((servo2)+5.5);
}

void servo3Setposition(int servo3Angle){
  int servo3 = servo3Angle;
  servo3 = map(servo3, 0, 136, 0, 136);
  myservo3.write(servo3);
}

void servo4Setposition(int servo4Angle){
  int servo4 = servo4Angle;
  servo4 = map(servo4, 0, 180, 0, 180);
  myservo4.write(servo4);
}

void servo5Setposition(int servo5Angle){
  int servo5 = servo5Angle;
  servo5 = map(servo5, 0, 180, 0, 180);
  myservo5.write(servo5);
}

void servo6Setposition(int servo6Angle){
  int servo6 = servo6Angle;
  servo6 = map(servo6, 0, 180, 0, 180);
  myservo6.write(servo6);
}

void servo7Setposition(int servo7Angle){
  int servo7 = servo7Angle;
  servo7 = map(servo7, 0, 180, 0, 180);
  myservo7.write(servo7);
}

void servo8Setposition(int servo8Angle){
  int servo8 = servo8Angle;
  servo8 = map(servo8, 0, 180, 0, 180);
  myservo8.write(servo8);
}

void dualservoMove(int dualservoAngle, int dualservodesiredAngle, int dualservostepDelay){
  if (dualservodesiredAngle > dualservoAngle){
    for (dualservoAngle; dualservoAngle < dualservodesiredAngle; dualservoAngle++){
      int servo1 = dualservoAngle;
      int servo2 = dualservoAngle;
      servo1 = map(servo1, 0, 176, 0, 176);
      servo2 = map(servo2, 0, 180, 180, 0);
      myservo1.write(servo1);
      myservo2.write((servo2)+5.5);
      delay(dualservostepDelay);
      }
  }
  if (dualservodesiredAngle < dualservoAngle){
    for (dualservoAngle; dualservoAngle > dualservodesiredAngle; dualservoAngle--){
      int servo1 = dualservoAngle;
      int servo2 = dualservoAngle;
      servo1 = map(servo1, 0, 176, 0, 176);
      servo2 = map(servo2, 0, 180, 180, 0);
      myservo1.write(servo1);
      myservo2.write((servo2)+5.5);
      delay(dualservostepDelay);
      }
  }
}

void servo3Move(int servo3Angle, int servo3desiredAngle, int servo3stepDelay){
  if (servo3desiredAngle > servo3Angle){
    for (servo3Angle; servo3Angle < servo3desiredAngle; servo3Angle++){
      int servo3 = servo3Angle;
      servo3 = map(servo3, 0, 136, 0, 136);
      myservo3.write(servo3);
      delay(servo3stepDelay);
      }
   }
   if (servo3desiredAngle < servo3Angle){
    for (servo3Angle; servo3Angle > servo3desiredAngle; servo3Angle--){
      int servo3 = servo3Angle;
      servo3 = map(servo3, 0, 136, 0, 136);
      myservo3.write(servo3);
      delay(servo3stepDelay);
      }
    }
}

void servo4Move(int servo4Angle, int servo4desiredAngle, int servo4stepDelay){
  if (servo4desiredAngle > servo4Angle){
    for (servo4Angle; servo4Angle < servo4desiredAngle; servo4Angle++){
      int servo4 = servo4Angle;
      servo4 = map(servo4, 0, 136, 0, 136);
      myservo4.write(servo4);
      delay(servo4stepDelay);
      }
   }
   if (servo4desiredAngle < servo4Angle){
    for (servo4Angle; servo4Angle > servo4desiredAngle; servo4Angle--){
      int servo4 = servo4Angle;
      servo4 = map(servo4, 0, 136, 0, 136);
      myservo4.write(servo4);
      delay(servo4stepDelay);
      }
    }
}

void servo5Move(int servo5Angle, int servo5desiredAngle, int servo5stepDelay){
  if (servo5desiredAngle > servo5Angle){
    for (servo5Angle; servo5Angle < servo5desiredAngle; servo5Angle++){
      int servo5 = servo5Angle;
      servo5 = map(servo5, 0, 136, 0, 136);
      myservo5.write(servo5);
      delay(servo5stepDelay);
      }
   }
   if (servo5desiredAngle < servo5Angle){
    for (servo5Angle; servo5Angle > servo5desiredAngle; servo5Angle--){
      int servo5 = servo5Angle;
      servo5 = map(servo5, 0, 136, 0, 136);
      myservo5.write(servo5);
      delay(servo5stepDelay);
      
      }
    }
}

void servo6Move(int servo6Angle, int servo6desiredAngle, int servo6stepDelay){
  if (servo6desiredAngle > servo6Angle){
    for (servo6Angle; servo6Angle < servo6desiredAngle; servo6Angle++){
      int servo6 = servo6Angle;
      servo6 = map(servo6, 0, 136, 0, 136);
      myservo6.write(servo6);
      delay(servo6stepDelay);
      }
   }
   if (servo6desiredAngle < servo6Angle){
    for (servo6Angle; servo6Angle > servo6desiredAngle; servo6Angle--){
      int servo6 = servo6Angle;
      servo6 = map(servo6, 0, 136, 0, 136);
      myservo6.write(servo6);
      delay(servo6stepDelay);
      
      }
    }
}

void servo7Move(int servo7Angle, int servo7desiredAngle, int servo7stepDelay){
  if (servo7desiredAngle > servo7Angle){
    for (servo7Angle; servo7Angle < servo7desiredAngle; servo7Angle++){
      int servo7 = servo7Angle;
      servo7 = map(servo7, 0, 136, 0, 136);
      myservo7.write(servo7);
      delay(servo7stepDelay);
      }
   }
   if (servo7desiredAngle < servo7Angle){
    for (servo7Angle; servo7Angle > servo7desiredAngle; servo7Angle--){
      int servo7 = servo7Angle;
      servo7 = map(servo7, 0, 136, 0, 136);
      myservo7.write(servo7);
      delay(servo7stepDelay);
      
      }
    }
}

void servo8Move(int servo8Angle, int servo8desiredAngle, int servo8stepDelay){
  if (servo8desiredAngle > servo8Angle){
    for (servo8Angle; servo8Angle < servo8desiredAngle; servo8Angle++){
      int servo8 = servo8Angle;
      servo8 = map(servo8, 0, 136, 0, 136);
      myservo8.write(servo8);
      delay(servo8stepDelay);
      }
   }
   if (servo8desiredAngle < servo8Angle){
    for (servo8Angle; servo8Angle > servo8desiredAngle; servo8Angle--){
      int servo8 = servo8Angle;
      servo8 = map(servo8, 0, 136, 0, 136);
      myservo8.write(servo8);
      delay(servo8stepDelay);
      
      }
    }
}

// ISD VOICE RECORD FUNCTIONS DEFINED--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void record(int recordTime){
  digitalWrite(rec, HIGH);
  delay(recordTime);
  digitalWrite(rec, LOW);
  delay(10);
}

void playBack(int playbackTime){
  digitalWrite(playback, HIGH);
  delay(playbackTime);
  digitalWrite(playback, LOW);
  delay(10);
}

// MISC FUNCTIONS------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void powerSave(){
  digitalWrite(mp3Power, LOW);
  digitalWrite(redLed, LOW);
  digitalWrite(rgbLed, LOW);
  digitalWrite(rightsideLed, LOW);
  digitalWrite(leftsideLed, LOW);
  analogWrite(fan, 0);
  digitalWrite(head1redLed, LOW);
  digitalWrite(head1yellowLed, LOW);
  digitalWrite(head1greenLed, LOW);
  digitalWrite(head2redLed, LOW);
  digitalWrite(head2yellowLed, LOW);
  digitalWrite(head2greenLed, LOW);
}

void lcdmain(){
  lcd.setCursor(5, 0);
  lcd.print("RogerbOt");
  lcd.setCursor(5, 1);
  lcd.print("inc.");
}

void armCheck(){
  lcd.setCursor(5, 0);
  lcd.print("Roger Arm");
  lcd.setCursor(5, 1);
  lcd.print("Check..");
  delay(1000);
 
  
  dualservoSetposition(95);
  delay(500);
  servo3Setposition(90);
  delay(500);
  servo4Setposition(90);
  delay(500);
  servo5Setposition(90);
  delay(500);
  servo6Setposition(90);
  delay(500);
  servo6Move(90, 150, 50);
  delay(500);
  servo6Move(150, 90, 50);
  delay(1000);
  servo6Move(90, 60, 50);
  delay(500);
  servo6Move(60, 90, 50);
  delay(1000);
  dualservoMove(95, 120, 50);
  delayMicroseconds(30);
  servo3Move(90, 110, 35);   
  delayMicroseconds(30);  
  servo4Move(90, 70, 35);  
  delayMicroseconds(30);  
  servo5Move(90, 170, 5);
  delayMicroseconds(3000);  
  servo5Move(170, 90, 5);
  delayMicroseconds(30);  
  servo4Move(70, 90, 35);
  delayMicroseconds(30);  
  servo3Move(110, 90, 35);
  delayMicroseconds(30);    
  dualservoMove(120, 95, 50);
  
  delay(1000);
  
  dualservoMove(95, 75, 60);
  delay(500);  
  servo3Move(90, 70, 50);   
  delay(500);  
  servo4Move(90, 110, 50);  
  delay(500);
  servo5Move(90, 10, 5);
  delay(500);
  servo5Move(10, 90, 5);
  delay(500);
  servo4Move(110, 90, 50);
  delay(500);
  servo3Move(70, 90, 50);
  delay(500);  
  dualservoMove(75, 95, 60);

  delay(1000);

  lcd.clear();
  lcd.setCursor(5, 0);
  lcd.print("Arm Check");
  lcd.setCursor(5, 1);
  lcd.print("Completed");
  delay(1500);
  lcd.clear();
}

int surveillance(){

digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distanceCm = duration*0.034/2;
distanceInch = duration*0.0133/2;
lcd.setCursor(0,0); 
lcd.print("Distance: "); 
lcd.print(distanceCm); 
lcd.print(" cm");
delay(10);
lcd.setCursor(0,1);
lcd.print("Distance: ");
lcd.print(distanceInch);
lcd.print(" inch");
return distanceCm;
}


int accuracy90(){
  lcd.clear();
  delay(10);
  servo8Setposition(90);
  delay(1000);
  surveillance();
  int dist1 = distanceCm;
  delay(1000);
  lcd.clear();
  surveillance();
  int dist2 = distanceCm;
  delay(1000);
  lcd.clear();
  surveillance();
  int dist3 = distanceCm;
  delay(15);
  avedist90 = ((dist1 + dist2 + dist3) / 3);
  return avedist90;
}

int accuracy60(){
  lcd.clear();
  delay(10);
  servo8Move(90, 60, 10);
  delay(1000);
  surveillance();
  int dist1 = distanceCm;
  delay(1000);
  lcd.clear();
  surveillance();
  int dist2 = distanceCm;
  delay(1000);
  lcd.clear();
  surveillance();
  int dist3 = distanceCm;
  delay(15);
  avedist60 = ((dist1 + dist2 + dist3) / 3);
  return avedist60;
}

int accuracy120(){
  lcd.clear();
  delay(10);
  servo8Move(50, 120, 10);
  delay(1000);
  surveillance();
  int dist1 = distanceCm;
  delay(1000);
  lcd.clear();
  surveillance();
  int dist2 = distanceCm;
  delay(1000);
  lcd.clear();
  surveillance();
  int dist3 = distanceCm;
  delay(15);
  avedist120 = ((dist1 + dist2 + dist3) / 3);
  return avedist120;
}

void SURVEILLANCE(int limitDist, int driveDelay){ 
while(Serial.available() < 2){
 
            accuracy90();
            int AD90 = avedist90;
            delay(1000);
            accuracy60();
            int AD60 = avedist60;
            delay(1000);
            accuracy120();
            int AD120 = avedist120;
            delay(1000);
            servo8Move(120, 90, 10);
            delay(1000);
            lcd.clear();
            delay(20);
            lcdmain();
    
            if ((AD90 < limitDist) && (AD60 < limitDist) && (AD120 < limitDist)){
            reverseMove(50, 15); 
                if(AD120 > AD60){
                  anticlockwiseMove(90, 15);
                  delay(driveDelay);
                }
                if (AD120 < AD60){
                  clockwiseMove(90, 15);
                  delay(driveDelay);
                }
            }
           
            if ((AD90 > limitDist) && (AD60 > limitDist) && (AD120 > limitDist)){
            forwardMove(80, 15);
            delay(driveDelay);
                if(AD120 > AD60){
                  anticlockwiseMove(90, 15);
                  delay(driveDelay);
                }
                if (AD120 < AD60){
                  clockwiseMove(90, 15);
                  delay(driveDelay);
                }
            }
            
            if ((AD90 < limitDist) && (AD120 < limitDist) && (AD60 > limitDist)){
            clockwiseMove(90, 15);
            delay(driveDelay);
            forwardMove(50, 15);
            delay(driveDelay);

            }

            if ((AD60 < limitDist) && (AD120 < limitDist) && (AD90 > limitDist)){
            forwardMove(50, 15);
              if (AD120 < AD60){
                  clockwiseMove(90, 15);
...

This file has been truncated, please download it to see its full contents.
RogerBot Arduino Code
This is the main code for controlling RogerBot via the dedicated bluetooth APP.

Custom parts and enclosures

RogerBot Catia V5 files
These are the CATIA V5 files. Im sorry but i made some changes to some parts after printing them its not refelcted on the design files. They are 1- 'Roger_Armsecondservo2.CATpart', had to be sawed off a bit from the top to accomodate for the top part of arm. 2- 'Roger_Armrotationbase.CATpart', i have made some cutouts from the servo wires, 3- 'Roger_bottomplate.CATpart', i have sawed off the front part where the two legs with the ball wheels go through. The legs do not go through them and the bottomplate is held in place with a bolt (M6) through the top plate with the neccessary spacing for batteries and other accessories.

Schematics

RogerBot Schematic Diagram
This is the schematic diagram for the servos, drive motors and the sensors onboard RogerBot. The schematic for the audio modules are shown in the story section.
Rogerbot schematic diagram dyxhcjykdg

Comments

Similar projects you might like

Trash Built BT Line Drawing Bot - My Bot

Project tutorial by jegatheesan

  • 644 views
  • 0 comments
  • 5 respects

Big Track Rover "ENHANCED EDITION" Obstacle Avoidance Bot

Project showcase by Sam

  • 1,338 views
  • 1 comment
  • 3 respects

'Gesture Bot' with Hand Gestures

Project showcase by hannu_hell

  • 4,133 views
  • 2 comments
  • 13 respects

Probability | Autonomous Rover

Project in progress by UniverseRobotics

  • 14,289 views
  • 19 comments
  • 70 respects

Android App-Based Home Automation System Using IOT

Project tutorial by Team Autoshack

  • 43,128 views
  • 21 comments
  • 121 respects

Candy Dispenser with Google Assistant

Project tutorial by Arduino “having11” Guy

  • 17,290 views
  • 1 comment
  • 60 respects
Add projectSign up / Login