TA-ZON-BOT ( Line Follower )

by info93 in Circuits > Robots

1191 Views, 3 Favorites, 0 Comments

TA-ZON-BOT ( Line Follower )

WhatsApp Image 2017-10-27 at 16.26.08.jpeg
WhatsApp Image 2017-11-08 at 12.58.10.jpeg

TA-ZON-BOT

El tazón siguelineas

Hemos realizado este robot siguelineas con la ayuda de los nuestros alumnos, (gracias minimakers).

Ha sido un proyecto express para poder participar en la OSHWDEN de A Coruña.

https://oshwdem.org/2017/06/oshwdem-2017/

traductor google

TA-ZON-BOT

The bowl followsline

We have made this robot following you with the help of our students, (thanks minimakers).

It has been an express project to participate in the OSHWDEN of A Coruña.

https://oshwdem.org/2017/06/oshwdem-2017/

Google translator

Step 1: Componentes

motor-micro-metal-30-1-hp-con-eje-extendido.jpg
array-de-sensores-infrarojos-qtr-8rc-digital.jpg
adafruit-motor-shield-v2-3.jpg

Los componentes que hemos utilizados

han sido los siguientes.

Una pieza redonda de metacrilato. (Podéis utilizar cualquier diseño, nuestra base mide lo justo para colocar el tazón bocabajo).

1 Tazón de desayuno (que sirve para concentrar al robot en la linea).

2 ruedas de un juguete reciclado.

2 motores con las siguientes especificaciones:

Especificaciones (Para 6V):

Dimensiones: 26 x 10 x 12 mm

Ratio de la reductora: 30:1

Diámetro del eje: 3mm (con ranura de bloqueo)

Voltaje nominal: 6Vcc (puede funcionar entre 3 a 9Vcc)

Velocidad de giro sin carga: 1000rpm

Consumo sin carga: 120mA (1600mA con carga)

Torque: 0.6kg/cm (max)

Peso: 10 gramos

Enlace de tienda online: http://tienda.bricogeek.com/motores-dc/1007-motor...

1 placa Arduino UNO (reciclada de un proyecto antiguo)

1 shield para motores Adafruit v2.3: https://www.adafruit.com/product/1438

1 Un porta pilas de 8 pilas AAA(no utilizamos 2 fuentes de alimentación).

6 tornillos y tuercas para unir los elementos como se ve en la imagen

bridas para los motores, una goma elástica para sujetar el porta pilas y un trozo de una lamina de plásticos para la base del porta pilas.

1 array de sensores QTR-8RC con las siguientes características;

Specifications for the QTR-8x Reflectance Sensor Array • Dimensions: 2.95" x 0.5" • Operating voltage: 3.3-5.0 V • Supply current: 100 mA • Output format for the QTR-8A: 8 analog voltages ranging from 0 V to supplied voltage • Output format for the QTR-8RC: 8 digital I/O-compatible signals that can be read as a timed high pulse • Optimal sensing distance: 0.125" (3 mm) • Maximum recommended sensing distance for the QTR-8A: 0.25" (6 mm) • Maximum recommended sensing distance for the QTR-8RC: 0.375" (9.5 mm) • Weight without header pins: 0.11 oz (3.1 g) Lo podéis encontrar en:

http://tienda.bricogeek.com/componentes/257-array-...

Ensamblar todo … próximamente un vídeo más detallado...

The components that we have used have been the following.

A round piece of methacrylate. (You can use any design, our base measures just enough to place the bowl upside down).

1 Breakfast bowl (used to concentrate the robot on the line).

2 wheels of a recycled toy.

2 engines with the following specifications:

Specifications (For 6V): Dimensions: 26 x 10 x 12 mm Ratio of the reducer: 30: 1 Shaft diameter: 3mm (with locking groove) Nominal voltage: 6Vdc (can operate between 3 to 9Vdc) Turning speed without load: 1000rpm Consumption without load: 120mA (1600mA with load) Torque: 0.6kg / cm (max) Weight: 10 grams

Online store link: http://tienda.bricogeek.com/motores-dc/1007-motor-micro-metal-30-1-hp-con-eje-extendido.html

1 Arduino UNO board (recycled from an old project)

1 shield for Adafruit v2.3 engines: https://www.adafruit.com/product/1438

1 A battery holder of 8 AAA batteries (we do not use 2 power supplies).

6 screws and nuts to join the elements as seen in the image

flanges for the motors, an elastic rubber to hold the battery holder and a piece of a sheet of plastic for the base of the battery holder.

1 array of QTR-8RC sensors with the following characteristics;

Specifications for the QTR-8x Reflectance Sensor Array • Dimensions: 2.95 "x 0.5" • Operating voltage: 3.3-5.0 V • Supply current: 100 mA • Output format for the QTR-8A: 8 analog voltages ranging from 0 V to supplied voltage • Output format for the QTR-8RC: 8 digital I / O-compatible signals that can be read as a timed high pulse • Optimal sensing distance: 0.125 "(3 mm) • Maximum recommended sensing distance for the QTR-8A: 0.25" (6 mm) • Maximum recommended sensing distance for the QTR-8RC: 0.375 "(9.5 mm) • Weight without header pins: 0.11 oz (3.1 g) You can find it in:

http://tienda.bricogeek.com/componentes/257-array-de-sensores-infrarojos-qtr-8rc-digital.html

Assemble everything ... soon a more detailed video ...

Step 2: Inspiración

Para probar el funcionamiento del los

motores hemos seguido esta ayuda del blog www.programarfacil.com

https://programarfacil.com/blog/arduino-blog/adafr...

Es un resumen muy bueno de los diferentes motores que controla esta shield.

Para calibrar el sensor QTR-8RC podéis seguir el tutorial de

Y un ultimo enlace que os puede ayudar es este instructable;

https://www.instructables.com/id/Arduino-based-lin...

To test the performance of the engines we have followed this blog support www.programarfacil.com

https://programarfacil.com/blog/arduino-blog/adafruit-motor-shield-arduino/

It is a very good summary of the different engines that this shield controls.

To calibrate the QTR-8RC sensor you can follow the tutorial of

https://www.youtube.com/watch?v=_ZeybIDd80s&list=PLlNY7ygeCIzCuq0jSjPD8_LfcAsPKUcGL&index=6

And one last link that can help you is this instructable;

https://www.instructables.com/id/Arduino-based-line-follower-using-Pololu-QTR-8RC-l/

Step 3: Code

Pruebas siguelineas TA ZON BOT
IMG_20171111_025000.jpg

las conexiones entre el array de

sensores y las placas las hicimos de la siguiente manera:

El Led ON va al pin digital 12

Los 8 sensores van desde el

número 1 al pin 8

número 2 al pin 9

número 3 al pin 2

número 4 al pin 3

número 5 al pin 4

número 6 al pin 5

número 7 al pin 6

número 8 al pin 7

El código va sin repasarlo ( se aceptan sugerencias )

#include <QTRSensors.h>

#include <Adafruit_PWMServoDriver.h>

#include <Wire.h>

#include <Adafruit_MotorShield.h>

// Create the motor shield object with the default I2C address

Adafruit_MotorShield AFMS = Adafruit_MotorShield();

// Or, create it with a different I2C address (say for stacking)

// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);

// Select which 'port' M1, M2, M3 or M4. In this case, M1

Adafruit_DCMotor *motor1 = AFMS.getMotor(1);

// You can also make another motor on port M2

Adafruit_DCMotor *motor2 = AFMS.getMotor(2);

// Change the values below to suit your robot's motors, weight, wheel type, etc.

#define KP .2

#define KD 5

#define M1_DEFAULT_SPEED 50

#define M2_DEFAULT_SPEED 50

#define M1_MAX_SPEED 70

#define M2_MAX_SPEED 70

#define MIDDLE_SENSOR 4

#define NUM_SENSORS 8 // number of sensors used

#define TIMEOUT 2500 // waits for 2500 us for sensor outputs to go low

#define EMITTER_PIN 12 // emitter is controlled by digital pin 2

#define DEBUG 0 // set to 1 if serial debug output needed

QTRSensorsRC qtrrc((unsigned char[]) {8,9,2,3,4,5,6,7} ,NUM_SENSORS, TIMEOUT, EMITTER_PIN);

unsigned int sensorValues[NUM_SENSORS];

void setup()

{

delay(1000);

manual_calibration();

set_motors(0,0);

}

int lastError = 0;

int last_proportional = 0;

int integral = 0;

void loop()

{

Serial.begin(9600); // set up Serial library at 9600 bps

Serial.println("Adafruit Motorshield v2 - DC Motor test!");

AFMS.begin(); // create with the default frequency 1.6KHz

//AFMS.begin(1000); // OR with a different frequency, say 1KHz

// Set the speed to start, from 0 (off) to 255 (max speed)

motor1->setSpeed(70);

motor1->run(FORWARD);

// turn on motor

motor1->run(RELEASE);

motor2->setSpeed(70);

motor2->run(FORWARD);

// turn on motor

motor2->run(RELEASE);

unsigned int sensors[5];

int position = qtrrc.readLine(sensors);

int error = position - 2000;

int motorSpeed = KP * error + KD * (error - lastError);

lastError = error;

int leftMotorSpeed = M1_DEFAULT_SPEED + motorSpeed;

int rightMotorSpeed = M2_DEFAULT_SPEED - motorSpeed;

// set motor speeds using the two motor speed variables above

set_motors(leftMotorSpeed, rightMotorSpeed);

}

void set_motors(int motor1speed, int motor2speed)

{

if (motor1speed > M1_MAX_SPEED ) motor1speed = M1_MAX_SPEED; // limit top speed

if (motor2speed > M2_MAX_SPEED ) motor2speed = M2_MAX_SPEED; // limit top speed

if (motor1speed < 0) motor1speed = 0; // keep motor above 0

if (motor2speed < 0) motor2speed = 0; // keep motor speed above 0

motor1->setSpeed(motor1speed); // set motor speed

motor2->setSpeed(motor2speed); // set motor speed

motor1->run(FORWARD);

motor2->run(FORWARD);

}

void manual_calibration() {

int i;

for (i = 0; i < 250; i++) // the calibration will take a few seconds

{

qtrrc.calibrate(QTR_EMITTERS_ON);

delay(20);

}

if (DEBUG) { // if true, generate sensor dats via serial output

Serial.begin(9600);

for (int i = 0; i < NUM_SENSORS; i++)

{

Serial.print(qtrrc.calibratedMinimumOn[i]);

Serial.print(' ');

}

Serial.println();

for (int i = 0; i < NUM_SENSORS; i++)

{

Serial.print(qtrrc.calibratedMaximumOn[i]);

Serial.print(' ');

}

Serial.println();

Serial.println();

}

}

Bueno a ver que tal se nos da este proyecto “express” en la competición del OSHWDEM.