Home » Master

Category Archives: Master

Login with your Social Account

ANTBOT

This robot is a curious explorer, which can maneuver on plane surfaces without falling down edges. Furthermore, it senses obstacles in its way and avoids them. These features and the design with the two arms naming the robot only to start with, there are a lot more this electric ant is capable of; 3 IR-Sensors allow a robust line tracking at higher speeds while the kick mechanism enables you to play football with it in the manual control mode!

YouTube Preview Image

The construction is quite straight forward as well as the Arduino programming, only the construction of the kick mechanism might be a bit challenging. Nonetheless this project is recommendable for beginners. So here is a brief overview.

Electronic Hardware:

  • 1 Arduino Nano v3
  • 1 Arduino Nano I/O Shield
  • 3 IR Sensor TCRT5000
  • 1 Ultrasound Sensor HC-SR04
  • 1 Buzzer
  • 1 Bluetooth Module HC-05
  • 2 Continuous Rotation Servos FS90R
  • 1 Servo Motor SG90
  • 1 Pack of 20 Female-to-Female Jumper Wires
  • 1 Power Bank

Other Materials

  • Laser Cut (see below)
  • 2 FS90R Wheels
  • 1 Castor Wheel
  • Metal Wire
  • Strong Glue
  • Miscellaneous parts for the kick mechanism

Scheme of the Laser Cut Design

Fritzing Scheme

Programming

Since we used an Arduino Nano and realized rather simple robotic tasks we used the Arduino Software to write and debug the code. In order to keep the code clean and adaptable we previously discussed which functions are necessary as well as how they should be implemented. Most tasks rely on simple sensor data analysis speaking of value thresholds for the states “detecting” and “not detecting”. To skip communication and starting troubles code snippets of previous tasks were very helpful as we all only had a little experience writing in C. After all we used simple drive commands and sensor reading functions to have a general basis for the three main tasks.

For the edge detection and obstacle avoidance we use threshold analysis for both outer IR sensors and the ultrasound sensor. To avoid getting stuck we use random turns and turning times when avoiding edges and obstacles.

The line following also works on a threshold analysis detecting the black line with a very high value. In this case we use the outer sensors to detect the robot leaving the line. As soon as we detect that we turn towards the line until the middle sensor detects it again. That way we avoid swiping heavily and still stay on the line accurately enough regarding the velocity.

The remote control is realized via a Bluetooth module that is paired with a mobile phone. Via simple state commands through the app we access a switch case loop in which different actions are run depending on the command. Furthermore we looped the function and implemented a stop button so that the user only needs to push a button once. Especially during the planning the group work was essential to combine all ideas into one code structure.

App Design for the Manual Control

Working as a Group

As we did the project for a university course we used digital tools to obtain an efficient work flow. Communicating via a messenger in a group of three was helpful to divide the currently faced work equally and to solve upcoming problems quickly. A shared folder allowed working on the same files. Therefore, only few meetings were held.

  • One to finalize the project proposal
  • One after the arrival of the parts
  • One to resolute constructing issues
  • One to connect and test the electronics
  • One to finalize and test the robot

Although everyone worked on every task during the project each person had a clear responsibility for a specific topic while getting the robot to work:

  • Assembly: Peter
  • AppInventor: Maurizio
  • Arduino Code: Fabian

Wall-Etsii (DYOR UPV)

1. Introduction

The next document collects the different parts of the documents, evidences and photos created to create and programme the robot.

This creation has different parts:

  • At the beginning, it was necessary to create a proposal to have an idea about the design and the tasks.
  • On the one hand, the next part consisted on build the robot body with 3D printer and adjust the pieces.
  • On the other hand, the electronics is the basis of the robot, it’s necessary to check each sensor separately with the code and the modification necessaries.
  • Another important part was the app, it’s important to connect the robot with the mobile to control it.
  • Finally, the electronics are assembled on the body and it is checked and adjusted to obtain the results wanted.

On the next points, we develop these different parts and talk about the problems that appear in everyone.

 

2. Robot Design Proposal

Initially, we must to have an idea about the robot to make up, the plans, the functions and the format of the app to create us robot Wall-Etsii.

This initial proposal provided to the teacher, excluding the student names, was the next information:

 

2.1. Robot’s name:

Wall-Etsii

 

2.2. Autonomous task 1:

Follow the line: the robot must follow any kind of line drawn on the floor.

 

2.3. Autonomous task 2:

Avoid obstacles and find an alternative road: the robot must detect the different objects and change the direction to avoid crash with them.

 

 

2.4. Mobile phone interface sketch:

2.5. List of materials:

 

Ítem Nombre Cantidad
1 ARDUINO NANO I/O SHIELD 1
2 SEGUILÍNEAS TCRT5000 1
3 MATRIZ LED 8×8 MAX7219 2
4 SENSOR ULTRASONIDOS HC-SR04 1
5 ALTAVOZ PASIVO (BUZZER) 1
6 PAR RUEDAS SERVO FS90R 2
7 SERVO ROTACION CONTINUA FS90R 2
8 20 CABLES DUPONT HEMBRA-HEMBRA 2
9 ARDUINO NANO v3 1
10 MODULO BLUETOOTH SPP-C 1

 

 

2.6. Electronic diagram:

 

2.7. 2D Design or 3D (if you have a 3d printer) or sketch of any other manufacturing method:

 

 

3. Design and assemble of the pieces

The initial proposal has some changes to adjust better the model and some initial pieces have problems with the build and time to print them.

In the next images, some of these changes could be appreciated with respect to the previous design:

In the next image, the new body robot in 3D view:

Some differences in relation to the initial proposal are: the arms (not printed), the eyes in brown are shorter than the proposal and the traction is with caterpillar.

4. Electronic Connections and programming

The electronic connections also are changed in comparison with the initial idea and proposal.

For example, the line follower is not installed on the robot for problems with the sensor. At the beginning, this sensor was installed, programmed and proved, but the robot fell down the table and it broken.

Another change is the Bluetooth connection, where initially was connected to the Rx and Tx pines, on the finally diagram, it is connected on the second and fourth pines.

The previous mentioned changes and another difference in relation to the first model can be contemplated on the next image:

In conclusion, the changes could be a little significant, the servos are included and some elements could be connected in other different initial pines.

But in general, the electronic connection is like the proposal independently the pines where the elements are connected, this only has influence on the programming code.

 

 

5. Mobile application (App)

The mobile app was created with three different screens: the select mode screen, the manual control mode and the obstacle avoid mode.

5.1. The menu

In this screen, it has two buttons to permit the selection mode or the exit button to close the app and return from the mobile.

The programming from this screen is the most singular and easy, where it only has three conditions and three actions:

 

5.2. Manual control mode

On the first mode of control, the user has the totally control of the robot and can control the robot with the mobile inclination.

The screen shows the buttons to connect the robot with the mobile, the start and stop buttons and the value of the accelerometer inclination from the ‘x’ and ‘y’ axes to have an idea about where the robot must be running.

In comparison with the previous and next screens, this is the most complex programming code on the app:

 

5.3. Obstacle avoid mode

The last screen shows, like the previous screen, the buttons to connect the robot and the mobile and the start and stop buttons.

The programming level from this screen is medium, with some code like the previous screen, but most simple.

 

6. Assembly, connection and results

The last chapter describes how the robot was assembled. The first step was connecting every components and assembling the pieces of Wall-ETSII. The connection and assembly can be seen in the following images:

dav

After that, the app and the algorithm were programmed with the app inventor 2 and the Arduino IDE software:

sdr

Finally, when the algorithm and the app had been transferred to the robot and the power source had been connected, Wall-ETSII was completed. The next images show the final robot’s appearance:

dav

 

 

7. Conclusion

To conclude the report, we are going to summarize the work done.

  • First of all, we may to mention the problems which have been arisen from the design of the robot to the final performance. For example, the line follower was broken, so we decided to delete the mode “Line follower”. As we can see, the important conclusion that we can extract is every problem was solved.

 

  • We have learned some technical knowledges about mobile robotic. In this field, we can include the knowledges related with sensors, microcontrollers and algorithms we can use for avoid obstacles, follow lines or reach a point.

 

  • We have learned too that every design has some defects or differences with the final performance. This is the case of the pieces of the Wall-ETSII’s body.

 

  • Another aspect that we have to learn was the programming. We learned to programme with app inventor 2 and IDE with some videos and with some help of internet.

 

  • We have noticed the importance of the good synchronization between the information the mobile phone send to the microcontroller and backwards.

 

  • Finally, to sum up, Wall-ETSII is a robot perfectly functional which can be handled manually with the mobile phone and which has an automatic mode where the robot avoid obstacles.

 

 

ANEXO I: YOUTUBE VIDEOS

 

YouTube Preview Image

 

YouTube Preview Image

 

YouTube Preview Image

 

YouTube Preview Image

 

 

ANEXO II: ARDUINO PROGRAM

 

#include “LedControlMS.h”
#include “binary.h”
#include <Servo.h>
#include <SoftwareSerial.h>

int speakerPin = 5;
int Pin_echo = 9;
int Pin_trig = 10;
int I=8;
int D=6;
int tones[ ] = {400,300,200};
int duracion, cm, modo;
int arranca, encendido, obstaculo, direccion;
LedControl lc1=LedControl(13,11,12,1); //(DataIn,CLK,LOAD,num matrices)
Servo ServoI;
Servo ServoD;
SoftwareSerial BT1(4,2); //Rx Tx

void setup() {
Serial.begin (9600);
BT1.begin(9600);
pinMode(speakerPin,OUTPUT);
pinMode(Pin_trig, OUTPUT);
pinMode(Pin_echo, INPUT);
ServoI.attach(I);
ServoD.attach(D);
for (int i=0; i< 1; i++){
lc1.shutdown(i,false);
lc1.setIntensity(i,8);
lc1.clearDisplay(i);
}
despertar(lc1);
allpinslow();
obstaculo=0;
}

void loop() {
while(1){
modo=BT1.parseInt();
if(modo==40) break;
if(modo==20) break;
}
if(modo==40){
while(1){
arranca=BT1.parseInt();
digitalWrite(Pin_trig, LOW);
delayMicroseconds(2);
digitalWrite(Pin_trig, HIGH);
delayMicroseconds(5);
digitalWrite(Pin_trig, LOW);
duracion = pulseIn(Pin_echo, HIGH);
cm = duracion / 29 / 2;
Serial.print(“Distancia:”);
Serial.print(cm);
Serial.println(” cm”);
encendido=Check_Protocol(arranca);
if(encendido==1){
if (cm>80){
ServoI.write(180);
ServoD.write(0);
parpadear(lc1);
obstaculo=0;
}
else if (cm<80){
if(cm>40){
ServoI.write(88);
ServoD.write(90);
if(obstaculo==0){
ruido();
obstaculo=1;
}
ServoI.write(180);
ServoD.write(180);
}
else if(cm<40){
chocar(lc1);
ServoI.write(0);
ServoD.write(180);
}
}
}
if(encendido==0){
ServoI.write(88);
ServoD.write(90);
}
if(arranca==100){
ServoI.write(88);
ServoD.write(90);
despertar(lc1);
break;
}
}
}
if(modo==20){
while(1){
direccion=BT1.parseInt();
if(direccion==200){
ServoI.write(88);
ServoD.write(90);
}
if(direccion==0){
ServoI.write(88);
ServoD.write(90);
}
if(direccion==1){
ServoI.write(180);
ServoD.write(180);
}
if(direccion==2){
ServoI.write(0);
ServoD.write(0);
}
if(direccion==5){
ServoI.write(0);
ServoD.write(180);
}
if(direccion==6){
ServoI.write(180);
ServoD.write(0);
}
if(direccion==100){
ServoI.write(88);
ServoD.write(90);
break;
}
}
}
}

 

void chocar(LedControl lc){
lc.setRow(0,0,B11000000);
lc.setRow(0,1,B00110000);
lc.setRow(0,2,B00001100);
lc.setRow(0,3,B00000011);
lc.setRow(0,4,B00000011);
lc.setRow(0,5,B00001100);
lc.setRow(0,6,B00110000);
lc.setRow(0,7,B11000000);
}

void despertar(LedControl lc){
lc.setRow(0,0,B00111100);
lc.setRow(0,1,B01000010);
lc.setRow(0,2,B10000001);
lc.setRow(0,3,B10011001);
lc.setRow(0,4,B10011001);
lc.setRow(0,5,B10000001);
lc.setRow(0,6,B01000010);
lc.setRow(0,7,B00111100);
}

void parpadear(LedControl lc){
lc.setRow(0,0,0×00);
lc.setRow(0,7,0×00);
lc.setRow(0,1,0xFF);
lc.setRow(0,6,0xFF);
delay(100);
lc.setRow(0,0,0×00);
lc.setRow(0,7,0×00);
lc.setRow(0,1,0×00);
lc.setRow(0,6,0×00);
lc.setRow(0,2,0xFF);
lc.setRow(0,5,0xFF);
delay(100);
lc.setRow(0,0,0×00);
lc.setRow(0,7,0×00);
lc.setRow(0,1,0×00);
lc.setRow(0,6,0×00);
lc.setRow(0,2,0×00);
lc.setRow(0,5,0×00);
lc.setRow(0,3,0xFF);
lc.setRow(0,4,0xFF);
delay(100);
lc.setRow(0,0,0×00);
lc.setRow(0,7,0×00);
lc.setRow(0,1,0×00);
lc.setRow(0,6,0×00);
lc.setRow(0,2,0xFF);
lc.setRow(0,5,0xFF);
lc.setRow(0,3,B10011001);
lc.setRow(0,4,B10011001);
delay(100);
lc.setRow(0,0,0×00);
lc.setRow(0,7,0×00);
lc.setRow(0,1,0xFF);
lc.setRow(0,6,0xFF);
lc.setRow(0,2,B10000001);
lc.setRow(0,5,B10000001);
delay(100);
lc.setRow(0,0,B00111100);
lc.setRow(0,7,B00111100);
lc.setRow(0,1,B01000010);
lc.setRow(0,6,B01000010);
}

void allpinslow(){
ServoD.write(90);
ServoI.write(88);
}

int Check_Protocol(int arranca){
if(arranca==40){
allpinslow();
arranca=0;
return 1;
}
if(arranca==200){
allpinslow();
arranca=0;
return 0;
}
}

void ruido(){
for (int i = 0; i < 3; i++){
tone(speakerPin,tones[i]);
delay(500);
}
noTone(speakerPin);
}

 

Dogbot

Description
Dogbot is your ideal companion. He can’t get you back the ball you threw at him, but he is capable of tasks that require a certain degree of intelligence and no jaws. Dogbot was made (not born) with an Arduino Nano as his core controller, with the ATMega 168 processor. He was programmed to avoid obstacles, follow lines and heed voice commands. Training Dogbot to do new tricks is easier than training a real dog!

Hardware and Design
The following components have been used:

  • Arduino Nano v3
  • Arduino Nano I/O Shield
  • IR Sensor TCRT5000
  • LED Matrix 8×8 MAX7219
  • Servo Motor SG90 (x1)
  • Continuous Rotation Servo FS90R (x2)
  • Buzzer
  • Bluetooth Module HC-05
  • FS90R Wheels (x2)
  • Caster Wheel (x1)
  • Ultrasound Sensor HC-SR04
  • 20 Female-to-Female Dupont Jumper Wires

Dogbot has a 150 mm circular base. The ultrasound sensor (his “eyes”) is located in front. Under the eyes is the LED Matrix, which serves as a mouth. It’s main use is adding expressiveness to Dogbot. He may be happy, sad, surprised, or in any state we can draw on the 8×8 matrix.

The wheels have a triangular disposition, with the caster wheel in front and both motor wheels in the back. By using the two independent motors, Dogbot can rotate in place, move forward or swerve slightly in any direction. The main drawback of this setting is that we must do some calibration: when the same order is given to each motor, the speed of the wheels can be different.

The SG90 Servo Motor moves the tail, and as such it is located in the back, between the motor wheels.

The IR sensor is attached on Dogbot’s belly, between the wheels. It is a little offset from the surface, so it can be closer to the floor. The sensor has a very short range (max. 15 mm), so it’s necessary for the line detection application.

Software and Applications

Line following

This is one the easiest applications. Usually it’s done with multiple IR sensors, but in this case we used a single sensor. The basic algorithm is as follows:

void loop()
if digitalRead(sensor):
¬goRight()

else:
¬goLeft()

delay(10);

The code is really straightforward and works like a charm. While it is detecting the line, it goes right, when it stops detecting it, it goes left. The goRight and goLeft functions are implemented so that the robot doesn’t fully turn in that direction; instead one wheel is given slightly more power than the other. By necessity, the motion is a little jerky, we could achieve something smoother with more sensors. The delay controls that “jerkiness”, and increasing it makes it look less like Dogbot is having a seizure. However, too long a delay also increases the risk of losing the line.

To add some flavour, Dogbot shows a happy smile when following the line and is fazed when he loses it. This adds some complexity to the logic but is easy enough to implement.

 

Obstacle Avoidance

This application uses the ultrasound sensor. The sensor works by sending a sound wave and measuring the time until we get it back. As the speed of sound in the air is known (340 m/s approx.), we can convert the time to a distance. The specs tell us we can sense up to 4m ahead, though we don’t need that much. When Dogbot sees something that’s closer than 30 cm, he turns right. With this rudimentary system, he can avoid big obstacles. Sometimes he oversees some thin obstacles, though, like chair legs and such. But in his clumsy way, he gets by. Being round helps: he doesn’t get stuck trying to turn in a wall.

YouTube Preview Image

Voice Commands

What is a dog you can’t order around? Dogbot can’t sit, but he will sing on command! For this application we used the Bluetooth module, the buzzer and a tool called App Inventor 2, generously provided by the MIT. App Inventor 2 let us design an Android app which could connect with Dogbot via Bluetooth. After the pairing of devices is done, Dogbot waits on standby for the next command. Using the Voice Recognition function which comes integrated with every Android system we can command anything we like. Some things that Dogbot understands are:

  • Run
  • Turn Left
  • Turn Right
  • Stop
  • Good Boy! (he wags his tail and smiles)
  • Sing

The app also provides some buttons that can be configured (in the Arduino code) to do any function. The singing part is done by reproducing tones of certain frequencies during different intervals with the buzzer. Some melodies can be found on the Internet, and if you’re musical enough you may even want to write your own.

YouTube Preview Image

Authors

Sergio Alemany Ibor
Gonzalo Ferrer Pastor