element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Robots with Wheels
  • Challenges & Projects
  • Project14
  • Robots with Wheels
  • More
  • Cancel
Robots with Wheels
Blog Robots with Wheels - CupRobot
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Robots with Wheels to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: carmelito
  • Date Created: 2 Apr 2018 4:50 PM Date Created
  • Views 3714 views
  • Likes 13 likes
  • Comments 8 comments
  • 3d pritning
  • ardintermediate
  • robot
  • arduino_projects
  • morobotsch
  • robotwheelsch
  • arduino_classic
  • openarduinoch
  • arduino
Related
Recommended

Robots with Wheels - CupRobot

carmelito
carmelito
2 Apr 2018

This month’s theme Robot on Wheels had me excited, and though I have been kind off busy at work, I knew I had to post a project. I have been working on a 3D design to create a simple robotic platform which is easy to 3D print. This is the second version of the 3D printed parts with improvements, and I have called it the -  CupRobot, as I am using a cold coffee cup to protect the electronic components image, but feel free to suggest a name if you come with something more interesting, or some enhancements you would like to see with the bot.

 

image

Here is a picture of the 3D printed parts, you can use PLA or ABS and you will not require any support material while 3D printing. STLs files for the 3D printed parts attached.

#1 base to hold the motors

#2 holder for the Arduino Uno

#3 back wheel

#4 holder for the AA battery holder

#5 in addition if you plan to add an ultrasonic sensor you will need to 3D print another holder, which king of gives the CupRobot its eyes image..

 

image

 

For putting the components together you will need 4-40 screws and nuts, which you can get at your local hardware store.

image

 

Here are the circuit connections using the Sparkfun motor driver(TB6612FNG) and Arduino Uno.

  • PWMA on the motor driver connected to pin# 5
  • AIN1 to pin# 1
  • AIN2 to pin# 2
  • PWMB to pin# 6
  • BIN1 to pin# 11
  • BIN2 to pin# 12

And for the ultrasonic sensor(HC-SR04) connected to

  • Trigger Pin  to Arduino pin #9
  • Echo Pin to Arduino pin #10

 

image

 

Here is video demo of the CupRobot in action..

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

Arduino code used to test the movement, as you see in the video above.

//Sample code for Project14-Robots with Wheels - CupRobot project - Basic version
//Motor Driver Pin Connections to Arduino Uno
int STBY = 4; //standby
//Motor A -left
int PWMA = 5; //PWM pin for Speed control
int AIN1 = 1; //Direction
int AIN2 = 2; //Direction
//Motor B - right
int PWMB = 6; //PWM pin for Speed control
int BIN1 = 11; //Direction
int BIN2 = 12; //Direction
//Ultrasonic  sensor pins numbers
const int trigPin = 9;
const int echoPin = 10;
long duration;
int distance;
//Change this value to adjust the senstivity of the HC-SR04
const int maxDistance = 15;


void setup() { 
  //Setting the trigPin as an Output
  pinMode(trigPin, OUTPUT); 
  //Setting  the echoPin as an Input
  pinMode(echoPin, INPUT);
  //Setup Motor pins
  pinMode(PWMA, OUTPUT);
  pinMode(AIN1, OUTPUT);
  pinMode(AIN2, OUTPUT);
  pinMode(STBY, OUTPUT);
  pinMode(PWMB, OUTPUT);
  pinMode(BIN1, OUTPUT);
  pinMode(BIN2, OUTPUT);
  //Starts the serial communication to help debugging
  Serial.begin(9600); 
}


void loop() {
  // Clear the trigPin
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  //Sets the trigPin to HIGH state for 10 micro seconds
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  //Reads the echoPin, returns the sound wave travel time in microseconds
  duration = pulseIn(echoPin, HIGH);
  //Calculating the distance
  distance= duration*0.034/2;
  //Prints the distance on the Serial Monitor- use this to modify the maxDistance above
  Serial.print("Distance: ");
  Serial.println(distance);
  
  if(distance < maxDistance){ //obstacle detected in front, move back and then turn left
   move(100,'B');
   delay(100);
   turn(150,'L');
   delay(200);
  }else{ //keep moving foward
    move(100,'F');
  }
  delay(200);
  
  
  //uncomment this section, and comment the if-else section above to test the direction of the motor spining
  /*turn(200,'L');
  delay(300);
  move(220,'B');
  delay(300);
  turn(210,'R');
  delay(300);
  move(220,'F');
  delay(300);
  stop();
  delay(600);
  */
}


//Driving the CupRobot functions
void turn(int speed,char side){
  digitalWrite(STBY, HIGH);//enable the standby pin
  if(side == 'L'){ //left turn
    digitalWrite(AIN1, HIGH);
    digitalWrite(AIN2, LOW);
    analogWrite(PWMA, speed);
    digitalWrite(BIN1, LOW); //Stop motor B
    digitalWrite(BIN2, LOW);
    analogWrite(PWMB, speed);
  }else{ //Right turn
    digitalWrite(AIN1, LOW);//Stop motor A
    digitalWrite(AIN2, LOW);
    analogWrite(PWMA, speed);
    digitalWrite(BIN1, HIGH);
    digitalWrite(BIN2, LOW);
    analogWrite(PWMB, speed);
  }


}


void move(int speed,char moveDirection){
digitalWrite(STBY, HIGH);//enable the standby pin
if(moveDirection =='B'){
    digitalWrite(AIN1, LOW);
    digitalWrite(AIN2, HIGH);
    analogWrite(PWMA, speed);
    digitalWrite(BIN1, LOW);
    digitalWrite(BIN2, HIGH);
    analogWrite(PWMB, speed);


}else{
    digitalWrite(AIN1, HIGH);
    digitalWrite(AIN2, LOW);
    analogWrite(PWMA, speed);
    digitalWrite(BIN1, HIGH);
    digitalWrite(BIN2, LOW);
    analogWrite(PWMB, speed);
  }
}


void stop(){
//disable standby
  digitalWrite(STBY, LOW);
}

Attachments:
CupRobotSTLs.zip
  • Sign in to reply

Top Comments

  • jomoenginer
    jomoenginer over 7 years ago +5
    Very cool. I've been looking for a top to my bot and this certainly gave me some ideas. Nice job!
  • carmelito
    carmelito over 7 years ago in reply to dubbie +4
    Awesome, thanks. For designing, I currently use Fusion 360, but if your just getting started with 3D design Tinkercad is a good place to start. When I started with 3D design a few years back I started…
  • three-phase
    three-phase over 7 years ago +4
    Great little robot, extra marks for including some re-cycling. Kind regards
  • micver
    micver over 6 years ago

    Hi very cool!

    I'm very very very new !

    Could you give a connection plant to help me and I think many other people image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • aspork42
    aspork42 over 7 years ago

    This is awesome image

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • three-phase
    three-phase over 7 years ago

    Great little robot, extra marks for including some re-cycling.

     

    Kind regards

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jomoenginer
    jomoenginer over 7 years ago

    Very cool.   I've been looking for a top to my bot and this certainly gave me some ideas.   Nice job!

    • Cancel
    • Vote Up +5 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • carmelito
    carmelito over 7 years ago in reply to dubbie

    Awesome, thanks. For designing, I currently use Fusion 360, but if your just getting started with 3D design Tinkercad is a good place to start. When I started with 3D design a few years back I started with 123D design and still use it to edit/remix STL files. With respect to a 3D printer, I use Flashforge creator Pro..

     

    Good luck with your design and please post an update on your progress, if possible, so that you can get feedback/tips and tricks from the other community members - Carmelito

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube