Introduction: Hexabot

SPIBOT
is a 3 servos robot, just like its name implies it is made up of 3 servos, additionally it has an Arduino Uno which controls them and is connected to a Bluetooth sensor used to receive data from a cellphone through an application. It also includes a camera that transmits images directly in order to see what the Hexabot is seeing and it has night vision as a plus.

The materials used were:

- Servos SG5010 x 3

- HobbyKing 30A Regulator x 2

- Turnigy 2200 mAh 11.1v Battery

- Arduino Uno

- Belkin IP Camera

- Acrylic

- Bluetooth HC-05 Sensor

- Cables

- Prototypage Shield

------------------------------------------------------------------------------------------------------------------------------------------------------

SPIBOT es un robot a 3 servos, así como su nombre lo indica esta compuesto por 3 servos, ademas posee un Arduino Uno que los controla y que esta conectado un sensor de bluetooth que sirve para recibir los datos desde un celular por medio de una aplicación. También cuenta con una cámara que transmite la imagen en directo permitiendo ver lo que el Hexabot este viendo, esta cámara aparte tiene visión nocturna

Los Materiales Que utilizamos fueron:

- Servos SG5010 x 3

- Regulador HobbyKing 30A x 2

- Batería Turnigy 2200 mAh 11.1v

- Arduino uno

- Belkin IP Camara

- Acrílico

- Sensor de Bluetooth HC-05

- Cables

- Escudo de prototypage

Este proyecto fue realizado por: Sebastian Muñóz, Santiago Gómez, Kevin Gaspar y Andrés Maya

Step 1: Legs and Body Cutting / Corte Del Acrílico (Cuerpo Y Patas)

In the prototype the external margins are 30x30 so that it may
adjust and have the real measurements the other parts have in real life. In the PDF file “Patas 30x40” are the lateral legs, which are cut in 10mm acrylic; in the other file called “Patas Centrales 30x40” are the legs that go in the center, which are cut in 3mm acrylic. It is important to clarify that in this file you can also find the lateral legs but these are ignored.

PS: The program used for these designs was AutoCAD.

------------------------------------------------------------------------------------------------------------------------------------------------------

En el prototipo las margenes exteriores están del 30x30 para que se escale y así tenga las verdaderas medidas que tienen las partes. En el archivo PDF Patas 30x40 están las patas laterales las cuales se cortan en acrílico de 10 mm; en el otro archivo PDF que se llama patas centrales 30x40 se encuentran las patas que van en el centro, las cuales se cortan en acrílico de 3 mm. Vale aclarar que en este archivo tambien se encuentran las laterales pero estas se ignoran.

PDT: El programa utilizado para estos diseños fue AutoCAD

Step 2: Assemble / Ensamble

The parts of the body are glued with krazy glue and are left to dry until the structure does not move.

For the legs there´s an additional procedure because when you have them cut they are delivered in a flat form. In order to bend them you need heat from a heat gun so that you can bend them little by little until you get the desired position. You have to be very careful when you do this because they can melt or stretch in a non-desired way.

------------------------------------------------------------------------------------------------------------------------------------------------------

Las partes del cuerpo se pegan con pegaloca y se dejan secar hasta que veas que la estructura no se mueve.

Para las patas hay que hacer otro procedimiento ya que al mandarlas a cortar te las entregan planas. Para doblarlas se necesita calor, para lo cual se utiliza una pistola de calor para ir doblando poco a poco hasta que quede en la posición deseada. Hay que tener mucho cuidado a la hora de doblarlas ya que se pueden derretir o estirar de una manera no adecuada.

Step 3: Arduino Connections / Conexiones De Arduino

Connection

Electric System

We will initially explain the connection between the Arduino Uno, the ScrewShield or connection extensor of the Arduino, and the Bluetooth HC-05 modem. (You can also use the HC-06)

The HC-05 modem possesses six pins, among them are: Key, VCC, GND,TXD, RXD, State.

- Key: It is necessary to enter the AT command mode that is used to achieve different configurations of the Bluetooth modem, but we will not concentrate on this because it is not of vital importance.

.VCC: Energy pin. Through it the modem is fed and this operation needs between 3.3-5 volts.

-GND: Ground. It is a ground connection to avoid electrical discharges or damage to anyone handling the modem.

-TXD: It refers to the pin through which the Bluetooth transmits the information.

-RXD: It refers to the pin through which the Bluetooth receives the information.

-States: This pin sends an on or off signal (LOW/HIGH) when having an established connection to another device.

PS:When you are uploading the code to the Arduino, the Bluetooth must be disconnected from the modem because having the serial ports (TXD and RXD) occupied inhibits the Arduino from uploading the code correctly.

The Arduino system is made up of several different pins, digital and analog. For this project we used the digital type, specifically 9, 10, and 11, additional to pins 0 and 1, which are RXD and TXD respectively. Last but not least the ScrewShield is placed on top of the Arduino with the respective pins as is shown in the image. The connection is made through cables but it has to be in the way describe in the PDF document that follows.

Now, as mentioned before, the servos are connected to pins 9, 10, and 11, making reference to right, center, and left leg respectively. The energy and ground of these pins are connected to the battery and in the spot selected with a circle are the voltage regulators. Also from these small circles a red and black cable will emerge to give the camera the energy needed.

------------------------------------------------------------------------------------------------------------------------------------------------------

Conexión

Sistema Eléctrico.

Inicialmente explicaremos la conexión entre el Arduino uno, el ScrewShield o extensor de conexiones de Arduino y el modulo Bluetooth HC-05 (se puede utilizar tranquilamente el HC-06).

El módulo Hc-05, posee 6 pines, entre ellos están: Key, VCC, GND,TXD, RXD, State.

- Key: Es necesario para entrar al modo de comandos AT, que se utilizan para realizar diferentes configuraciones al módulo bluetooth, pero aquí no profundizaremos en ellas ya que no son necesarias.

- VCC: Pin de la Energía, por aquí se alimenta el Modulo, y para estar operativo necesita entre 3.3 a 5 Voltios.

- GND: Tierra, es una conexión a tierra, para evitar descargas eléctricas o daños al que manipule el modulo

- TXD: Hace referencia al Pin por el cual el Bluetooth Transmite la información.

- RXD: Hace referencia al Pun por el cual el Bluetooth Recibe la información.

- State: Este pin envía una señal de encendido o apagado(LOW/HIGHT), al momento de tener una conexión establecida con otro dispositivo.

PDT: cuando estés subiendo el código al Arduino, debes tener desconectado el modulo bluetooth, porque al tener ocupados los puertos serial (TXD y RXD), el software Arduino no podrá subir el código.

El sistema Arduino esté compuesto por diferentes pines, tanto análogos como digitales. En este proyecto utilizamos los digitales, más específicamente lo pines 9,10 y 11, además de los pines 0 y 1 que son también los pines RXD y TXD respectivamente del Arduino.

Y por último el ScrewShield, que se posiciona sobre el Arduino con los pines respectivos como se muestra en la siguiente gráfica. Donde la conexión es por medio de cables, pero la conexión real debe quedar de la siguiente manera: (foto de nuestra conexión del Arduino con el ScrewShield).

Ahora bien, como se mencionó anteriormente,
los servos van conectados a los pines 9,10 y 11, haciendo referencia a las patas derecha, medio e izquierda respectivamente y la energía y tierra de estos, van unidos y conectados a la batería lipo, y en el punto seleccionado con un circulo delgado, van los reguladores de voltaje. También de estos círculos pequeños saldrían un cable rojo y negro respectivamente para darle también energía a la cámara.

Step 4: Movement Script / Código De Movimiento

Code (script)

In this session we will explain how the code to produce the movement works. The #include<> is used to add libraries to your Arduino code. Libraries with modems of information you need so you can use certain external components different from Arduino, like servos in this case.

#include

We have to start by giving a name to the servos we are using so we can easily identify them when we work with them.

Servo rightServo;

Servo leftServo;

Servo midServo;

The Arduino Setup is the method that activates as soon as you turn the Arduino on, here we initialize the Serial so we can send and receive information through the pins, also we link the servos to pins 9, 10, and 11 like we mentioned before. Finally we use the method called SettearServos, which we will explain later on.

void setup() {

Serial.begin(9600);

rightServo.attach(9);

midServo.attach(10);

leftServo.attach(11);

settearServos();

}

The Loop is a method that activates after the Setup but it activates constantly, meaning, every time it finalizes its process, it executes again. First we see if the Serial is enabled, if it is we initialize a character called a, in order to store the information provided from the cellphone to the Bluetooth HC-05. Then we ask the value that a possesses and according to the result we use the method right, left, front, back. At the end of all of this we place the servos at 90 degrees again with the method SettearServos.

void loop() {

if (Serial.available()){

char a = Serial.read();

if (a == 'w'){

adelante();

}

if(a=='s')

{

atras();

}

if(a=='a')

{

izquierda();

}if(a=='d')

{

derecha();

}

settearServos();

}

}

In these methods (adelante, atras, derecha, izquierda) we move the Servos starting from the one in the center because it is the main support of our SPIBOT.

void adelante()

{

midServo.write(80);

delay(250);

rightServo.write(100);

leftServo.write(100);

delay(500);

midServo.write(100);

delay(250);

rightServo.write(70);

leftServo.write(70);

delay(500);

loop();

}

void atras()

{

midServo.write(100);

delay(250);

rightServo.write(100);

leftServo.write(100);

delay(500);

midServo.write(80);

delay(250);

rightServo.write(70);

leftServo.write(70);

delay(500);

loop();

}

void derecha()

{

midServo.write(100);

delay(250);

rightServo.write(100);

leftServo.write(70);

delay(500);

midServo.write(80);

delay(250);

rightServo.write(70);

leftServo.write(100);

delay(500);

loop();

}

void izquierda()

{

midServo.write(100);

delay(250);

rightServo.write(70);

leftServo.write(100);

delay(500);

midServo.write(80);

delay(250);

rightServo.write(100);

leftServo.write(70);

delay(500);

loop();

}

Finally with this method what we do is position the Servos always at 90 degrees so it is easier to move them between 0-90 or 90-180 degrees.

PS: You have to try not to get the limits between 0-180 in order to avoid damage to the Servos.

void settearServos()

{

rightServo.write(90);

midServo.write(90);

leftServo.write(90);

}

------------------------------------------------------------------------------------------------------------------------------------------------------

Código.(script)

En esta sesión te explicaremos cómo funciona el código utilizado para crear el movimiento de la araña

El #include<> se utiliza para agregar librerías a tu código de Arduino. Las librerías con módulos de información que necesitas para utilizar ciertos componentes externos a Arduino, como lo son los servos en nuestro caso.

#include

Se comienza dándole un nombre a los servos q vamos a utilizar y poderlos identificar al momento de trabajar con ellos

Servo rightServo;

Servo leftServo;

Servo midServo;

El Setup de Arduino, es el método que se activa al momento de encender el Arduino, aquí inicializamos el Serial, para poder recibir y enviar información por los pines, además enlazamos los servos a los pines 9, 10 y 11 como ya habíamos mencionado anteriormente. Por último llamamos el método llamado settearServos, que pasaremos a explicarlos luego.

void setup() {

Serial.begin(9600);

rightServo.attach(9);

midServo.attach(10);

leftServo.attach(11);

settearServos();

}

El Loop, es un método que se activa luego del setup, pero este se activa constantemente, es decir, cada vez que termina sus procesos se vuelve a ejecutar. Aquí inicialmente miramos si el Serial está habilitado, si está habilitado inicializamos un Carácter llamado a, para guardar la información proporcionada desde el celular al bluetooth HC-05. Luego preguntamos cual es el valor que posee a y según el resultado, se utiliza el método derecha, izquierda, adelante o atrás. Al final de todo esto, ponemos los servos de nuevo en 90 grados con el método SettearServos

void loop() {

if (Serial.available()){

char a = Serial.read();

if (a == 'w'){

adelante();

}

if(a=='s')

{

atras();

}

if(a=='a')

{

izquierda();

}if(a=='d')

{

derecha();

}

settearServos();

}

}

En estos métodos (Adelante, Atrás, Derecha, Izquierda) movemos los servos, iniciando por el del medio, el cual es el apoyo principal de nuestro SPIBOT.

void adelante()

{

midServo.write(80);

delay(250);

rightServo.write(100);

leftServo.write(100);

delay(500);

midServo.write(100);

delay(250);

rightServo.write(70);

leftServo.write(70);

delay(500);

loop();

}

void atras()

{

midServo.write(100);

delay(250);

rightServo.write(100);

leftServo.write(100);

delay(500);

midServo.write(80);

delay(250);

rightServo.write(70);

leftServo.write(70);

delay(500);

loop();

}

void derecha()

{

midServo.write(100);

delay(250);

rightServo.write(100);

leftServo.write(70);

delay(500);

midServo.write(80);

delay(250);

rightServo.write(70);

leftServo.write(100);

delay(500);

loop();

}

void izquierda()

{

midServo.write(100);

delay(250);

rightServo.write(70);

leftServo.write(100);

delay(500);

midServo.write(80);

delay(250);

rightServo.write(100);

leftServo.write(70);

delay(500);

loop();

}

Por último, en este método, lo que hacemos es posicionar los servos siempre a 90 grados, para tener la facilidad de moverlos entre 0 y 90 o 90 y 180

PDT: Debes procurar no llegar a los límites de 0 o 180 para evitar daños en los servos.

void settearServos()

{

rightServo.write(90);

midServo.write(90);

leftServo.write(90);

}

Step 5: Application / Aplicación

APPLICATION FROM APP INVENTOR

1. Create a new project from the app inventor application (http://ai2.appinventor.mit.edu)

2. In Connectivity Options, drag “BluetoothClient” to the app screen.

3. In Layout Options put a “HorizontalArrangement” with 70px height and automatic adjustment towards the sides.

4. Below the Layout expressed before, drag another Layout from the same type with 80px height and automatic adjustment towards the sides.

5. Inside the anterior Layout, place another Layout from the same type with 135px width and automatic adjustment of height.

6. Beside the last Layout, drag a button from the User Interface Options with 70px width and 70px height.

7. Create another Layout below the anterior one, with 80px height and automatic width.

8. Drag another Layout of 60px width and automatic height inside the one before.

9. Beside place a 70x70px button.

10. Beside the button place another Layout of 75px width and automatic height.

11. Next to the Layout place a 70x70px button.

12. Underneath, place a Layout of 80px height and automatic width.

13. Inside the Layout place another Layout of 135px width and automatic height adjustment.

14. Place a 70x70px button next to the Layout.

15. To leave a space between the controls and the Bluetooth connection, leave a Layout beneath with an automatic width and 20px height.

16. Put another Layout in the inferior part with an automatic width and 80px height.

17. Inside the last Layout put another one with 80pxwidth and automatic height.

18. In the User Interface, look for a “ListPicker” and drag to the last side of the Layout. Leave it with a 70x70px.

BLOCKS

When you are finished making the Interface, proceed to the blocks option located on the right superior edge of the page.

1. On the list in the left side look for “ListPicker” and click it to open a new menu, then look for the option ending in “.BeforePicking” and drag it to the screen.

2. In the same list look for the “ListPicker” option and then look for an option in green that says “set.ListPicker.Elementsto”. Then fit this one inside the space of the anterior option.

3. Look for the modem “BluetoothClient” in the list and in menu, look for “BluetoothClient.AdressesAndNames”, and fit it in the anterior option.

4. In the list, look for “ListPicker” and in the new menu, look for the option that ends in “.AfterPicking”, and drag it to the screen.

5. In the “ListPicker” form the list, look for “Set.ListPicker.Selection.To”, in green, and fit it with the anterior option.

6. In the list, look for the “BluetoothClient” modem and then look for “call.bluetoothClient.Connectaddresses”, and fit it with the anterior.

7. In the list, look for “ListPicker” and the “ListPicker.Selection” and fit it with the one before.

BUTTONS

In the same interface we used to Program the Bluetooth, we will program the buttons.

1. In the list look for “Button1” and then “When.Button1.Click”, and drag it to the screen.

2. In the list, look for “BluetoothClient” and the “call.BluetoothClient.SendText”, and fit it with the previous one.

3. Then look for “Text” in the list, and then look for the option in white that is inside the apostrophe, and fit it with the anterior one.

This same procedure is used with the rest of the buttons. Inside the black space of the text, put the character assigned in the programing for that predetermined movement.

------------------------------------------------------------------------------------------------------------------------------------------------------

APLICACIÓN DESDE APP INVENTOR

1. Se crea un nuevo proyecto desde la plataforma app inventor (http://ai2.appinventor.mit.edu)

2. En opciones de conectividad se arrastra hasta la pantalla de la pp el “BluetoothClient”

3. En las opciones de Layout se pone un “HorizontalArrangement” con alto de 70 px, y ajuste automático hacia los lados.

4. Debajo del Layout anterior se arrastra otro del mismo tipo, con un alto de 80 px, un ajuste automático hacia los lados.

5. Dentro del anterior se pone otro Layout del mismo tipo con una anchura de 135 px, y ajuste automático de altura.

6. Al lado del último Layout puesto se arrastra un botón desde las opciones de la interfaz de usuario, con 70 px de ancho y 70 px de alto.

7. Se procede a crear otro Layout debajo del anterior, con 80 px de alto y ancho automatico.

8. Dentro, se arrastra otro Layout de 60 px de ancho y ajuste automático de alto.

9. Al lado se pone un botón de 70 x 70 px.

10. Al lado del botón se pone otro Layout de 75 px de ancho y ajuste automático de alto.

11. Junto al Layout se pone un botón de 70 x 70 px.

12. Debajo se procede a poner un Layout de 80 px de alto, y de ancho ajuste automatico.

13. Dentro del Layout, se pone otro Layout de 135 px de ancho y un ajuste automático de alto.

14. Luego se pone un botón al lado del último Layout de 70 x 70 px.

15. Para dejar un espacio entre los controles y la conexión bluetooth se deja un Layout debajo con un ancho automático y un alto de 20 px.

16. Se pone otro Layout en la parte de abajo con un ancho automático y un alto de 80 px.

17. Dentro de este Layout se pone otro Layout con un ancho de 80 px y alto automático.

18. En la interfaz de usuario se busca un “ListPicker” y se trae hasta al lado del último Layout, y se deja con un alto y ancho de 70 px.

BlOQUES

Cuando se acaba de hacer la interfaz, se procede hacía la opción de los bloques que está ubicado en la parte superior derecha de la página.

1. En la lista de la parte izquierda se busca el “ListPicker” y se click que abrirá un nuevo menú, allí se busca la opción que termine en “.BeforePicking” y se arrastra a la pantalla.

2. En la misma lista se vuelve a buscar “ListPicker” y ahora buscamos una opción en color verde que diga “set.ListPicker.Elemnts to” y se encaja dentro del espacio de la opción anterior.

3. En la lista se busca el módulo “BluetoothClient” y en el menú buscamos “BluetoothClient.AddressesAndNames” y se encaja en la anterior opción.

4. Se busca en la lista el “ListPicker” y en el nuevo menú se busca la opción que termina en “.AfterPicking” y se arrastra a la pantalla.

5. En el “ListPicker” de la lista se busca “Set.ListPicker.Selection.To” en verde, y se encaja con la anterior.

6. En la lista se busca el módulo de “BluetoothClient” y luego buscamos “call.bluetoothClient.Connectaddresses” y se encaja en la anterior.

7. En la lista buscamos nuevamente a “ListPicker” y luego buscamos “LisPicker.Selection” y la encajamos en la anterior.

BOTONES

En la misma interfaz donde configuramos el bluetooth, configuraremos los botones.

1. Buscamos en la lista el “Button1”, y luego “When.Button1.Click”. y la arrastramos a la pantalla.

2. En la lista buscamos “BluetoothClient” y luego buscamos “call.BluetoothClient.SendText” y encajamos con el anterior.

3. Luego en la lista buscamos “Text” y buscamos la opción que aparece en blanco dentro de comillas y la encajamos con la anterior.

Este mismo procedimiento se hace con el resto de los botones. Y dentro del espacio en blanco del texto se pone el carácter que se ha asignado en la programación para su movimiento predeterminado.