Project showcase
3D Printed and Expandable Robot for Arduino

3D Printed and Expandable Robot for Arduino © CC BY-NC-SA

This is a very versatile robot with a multitude of features, the chassis can be 3D printed, and there is a lot of room for expansion.

  • 3,487 views
  • 4 comments
  • 20 respects

Components and supplies

Necessary tools and machines

Regular screwdriver
mini screwdriver
3drag
3D Printer (generic)

About this project

This is a nice project that you can continue to work on and modify as you learn more Arduino projects. This tutorial goes through the complete build for the Bluetooth enabled robot in the first half of the video. As long as you have a 3D printer this project is really easy to do and the electronic parts cost only around $30-$35. It takes in total about 35 hours to 3D print, but can be assembled and programmed in around 30 minutes. Requires only 2 screwdrivers to build and does not require any soldering. 

I wanted to design this thing to be inexpensive and use common parts, so this robot uses 9V batteries currently. They run out pretty quickly with a lot of use, so I will probably end up designing a new piece that allows for the use of rechargeable lithium ion batteries and Adafruit power booster. Also, if anyone knows of a good 3D printing service, so people without printers can make this, it would be much appreciated, I got an initial estimate of over $1000 so I was discouraged from wasting any more time uploading the files elsewhere.

Creative Commons License: Attribution Non-Commercial- Share Alike

Step 1: Gather 3D printed parts, tools, and electronic components.

First gather all the 3D printed parts that can be downloaded from Thingiverse. The .stl files are included in a .zip in the attachments.

Parts list with links can be found here: http://WireBeings.com/code.html

Full instructions can be found here: http://www.instructables.com/id/WireBeings-an-Expandable-Robot-Chassis-for-Arduino/

Code

Bluetooth Voice Control Arduino
#include <SoftwareSerial.h> 

String command;
int incomingByte = 0;  


int enA = 10;//robot's right motor 
int in1 = 9;
int in2 = 8;

int enB = 5;//robot's left motor
int in3 = 7;
int in4 = 6;

      
int bluepin=A1;//RGB LED pins      
int redpin=A2;    
int greenpin=A3;   
   

void stop()
{
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);  
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
}

void forward()
{
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  
  analogWrite(enA, 150);//change speeds here 0-255

  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);

  analogWrite(enB, 150);//change speeds here 0-255

  delay(500);//change delay value here to go more forward or less forward
  stop();
}


void backward()
{
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
 
  analogWrite(enA, 150);//change speeds here 0-255

  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);

  analogWrite(enB,150);//change speeds here 0-255

  delay(500);
  stop();
}

void right()
{

  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);

  analogWrite(enA, 230);//change speeds here 0-255

  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);

  analogWrite(enB, 230);//change speeds here 0-255
  delay(1000);
  stop();
}

void RGB (int R, int G, int B){

    analogWrite(redpin,R);
    analogWrite(greenpin,G);
    analogWrite(bluepin,B);
}

void setup() {
  RGB(0,0,255); //blue
  Serial.begin(9600);
  pinMode(enA, OUTPUT);
  pinMode(enB, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT); 
}

void loop() {
  while (Serial.available()){ 
  delay(10); 
  char instruction = Serial.read(); 
  if (instruction == '#') {
    break;
    } 
  command = command + instruction; 
  } 

  
  if (command.length() > 0) {
    Serial.println(command);
       if (command == "*forward") {
              forward();
        }  else if (command == "*backward"){
          backward();
          } else if (command == "*turn"){
            right();
          } else if (command == "*red"){
          RGB(255,0,0);
          } else if (command == "*green"){
            RGB(0,255,0);
          } else if (command == "*blue"){
            RGB(0,0,255);
          } 

          

command ="";  
  }

} 
Obstacle Avoiding CodeArduino
int enA = 10;
int in1 = 9;
int in2 = 8;

int enB = 5;
int in3 = 7;
int in4 = 6;

int trigPin = 2;
int echoPin = 4;
long duration, cm, inches;

int redpin=A1;  
int greenpin=A2;      
int bluepin=A3;

void setup() {

  pinMode(enA, OUTPUT);
  pinMode(enB, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);

  Serial.begin (9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);

}

void forward()
{

  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);

  analogWrite(enA, 180);

  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);

  analogWrite(enB, 180);
}

void backward()
{

  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);

  analogWrite(enA, 150);

  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);

  analogWrite(enB, 150);
  
}

void stop()
{
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);  
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
}

void avoid()
{
  //STOP
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);  
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
  //BACKUP
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  analogWrite(enA, 150);
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
  analogWrite(enB, 150);
  delay(1000);
  //TURN
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  analogWrite(enA, 140);
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
  analogWrite(enB, 140);
  delay(.001);
  
  
}

void RGB (int R, int G, int B){

    analogWrite(redpin,R);
    analogWrite(greenpin,G);
    analogWrite(bluepin,B);
}

void loop()
{
  RGB(0,0,255); //blue
  delay(1000);

  forward();

  int duration, distance, inch;
  digitalWrite(trigPin, HIGH);
  delay(100);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;
  inch = (distance * 0.3937);

  //Sets object detection distance to 4.5
  if (inch < 15) {
    RGB(255,0,0); //red
    avoid();
    delay(1000);
    forward();
    delay(2000);
   }

}
Bluetooth Control Arduino
int incomingByte = 0;  
#include <SoftwareSerial.h> 
int enA = 10;//right motor (robot's right)
int in1 = 9;
int in2 = 8;

int enB = 5;//left motor (robot's left)
int in3 = 7;
int in4 = 6;

      
int bluepin=A1; //define RGB LED pins     
int redpin=A2;    
int greenpin=A3; 

int speed = 150; //change speed here, can range from 0 to 255.
   
     
void setup()
{

RGB(255,0,255);//blue

Serial.begin(9600); //Use serial monitor at 9600 for debugging and controlling from computer 
Serial.println("Motor test!");

  pinMode(enA, OUTPUT);
  pinMode(enB, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);

}


void left()
{
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);

  analogWrite(enA, speed);

  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);

  analogWrite(enB, speed);
}

void right()
{

  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);

  analogWrite(enA, speed);

  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);

  analogWrite(enB, speed);
}

void forward()
{
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);

  analogWrite(enA, speed);

  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);

  analogWrite(enB, speed);
}

void backward()
{

  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);

  analogWrite(enA, 100);

  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);

  analogWrite(enB, 100);
}

void stop()
{
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);  
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
}

void RGB (int R, int G, int B){

    analogWrite(redpin,R);
    analogWrite(greenpin,G);
    analogWrite(bluepin,B);
}

void loop()
{


    
    if (Serial.available() > 0) {
    incomingByte = Serial.read();
    }
   
  

 switch(incomingByte)
  {
     case 'S':
        
      { stop();
       Serial.println("Stop\n"); 
       incomingByte='*';}
      
     break;
     
     case 'F':
      
     {  forward(); 
       
       Serial.println("Forward\n");
       incomingByte='*';}
     break;
    
      case 'B':
        
    {   backward();
       
       Serial.println("Backward\n");
       incomingByte='*';}
     break;
     
     case 'R':
    
     {  
       right(); 
       Serial.println("Rotate Right\n");
       incomingByte='*';}
     break;

     
       case 'L':

      { 
       left();    
       Serial.println("Rotate Left\n");
       incomingByte='*';}
     break;
     
     case 'W':
        
      { 
       RGB(255,0,0);//red
       Serial.println("Red Eyes");
       incomingByte='*';}
     break;
     
    case 'V':
        
      { 
       RGB(0,255,0);//green 
       Serial.println("Green Eyes");
       incomingByte='*';}
     break;        
  }
    
}

Custom parts and enclosures

3D Files
Individual .stl files with full design in one .123dx file.
QuoteParts.zip

Schematics

Connections1
Connections1
Connections2
Connections2
Connections3
Connections3

Comments

Similar projects you might like

Otto DIY+ Arduino Bluetooth Robot Easy to 3D Print

Project tutorial by Team Otto builders

  • 48,215 views
  • 117 comments
  • 162 respects

Littlearm 2C: Build a 3D Printed Arduino Robot Arm

Project tutorial by Slant Concepts

  • 4,404 views
  • 1 comment
  • 32 respects

3D Printed R2-D2 with an Arduino Core

Project showcase by Raul Antonio

  • 3,245 views
  • 1 comment
  • 4 respects

2WD Voice Controlled Robot with Arduino and BitVoicer Server

Project tutorial by Marcio Tamagushi

  • 10,205 views
  • 11 comments
  • 32 respects

Tertiarm - 3d Printed Robot Arm

Project tutorial by Karagad

  • 8,054 views
  • 2 comments
  • 18 respects

Elliot the Line Follower Robot

Project showcase by SMM2

  • 6,120 views
  • 5 comments
  • 15 respects
Add projectSign up / Login