Tuesday, September 16, 2014

PLC Elevator

Since the  MicroLogix 1100 has only 10 inputs and 6 outputs, why not design something for it? what about an elevator? So, this post will be an elevator setup for a three story building. We will be using LEGO Mindstorms because we have a few around, but you can design another model. 

Outputs (4 for now): motor up, motor down, up lights and down lights. You may add a motor to open/close the elevator doors. 

Inputs (10): three sensors for floor level sensing, three floor selection buttons (the ones inside the elevator), and four buttons for calling the elevator (the ones outside the elevator)

For now, just the pics:
Debido a que el MicroLogix 1100 tiene solo 10 entradas y 6 salidas, ¿Por qué no diseñar algo con ello en mente? ¿Qué tal un elevador? Este entrada es para un elevator de tres pisos. Usaremos LEGO Mindstorms porque lo tenemos disponible, pero puedes otro estilo. 

Salidas (4 for ahora): subir y bajar para el motor, luces que indican si sube o baja. Puedes añadir otro motor para abrir y cerrar las puertas del elevador. 

Entradas (10): tres sensores para detectar en que piso está, los tres botones de dentro del elevador, y 4 botones fuera del elevador.

Por ahora, solo las fotos:




You need to add the sensors for the floor level: to determine where the elevator is, 1st, 2nd or 3rd floor (I don't have a pic of that one!). You may have to use the best switch you can find  for the job.

You also need the control panel: the buttons and lights. The three buttons inside the elevator and the four buttons outside (one on the 1st floor to go up, one on the third floor to go down, and two for the middle floor to go up and down).


Tienes que añadir los sensores de nivel: para determinar en que piso está el elevador, el 1ro, 2do o 3ro (No tengo esa foto!). Es probable que tengas que buscar el mejor interruptor que sirva para ese trabajo.

También hace falta el panel de control: los botones y las luces. Son los tres botones dentro del elevador y los cuatro fuera de el (uno en el 1ro para subir, uno en el último para bajar, y dos en la mitad para subir y bajar).
The control panel board 
La tarjeta del panel de control
The wired control panel board
La tarjeta del panel de control

Sunday, September 14, 2014

PLC Lights and Switches

The next challenge will use the board on the image below. There are several options with this one. You can use the lights on the right or the traffic lights.

This board has 2 push-buttons (normally open) and two switches with two positions (two outputs per switch) for a maximum of six inputs. The third generation of this board has 5 different switches for a maximum of 9 inputs. There are six LED lights on the right and the wiring for the traffic light also was designed for also controlling 6 outputs (2 green lights, 2 red, lights and 2 yellow lights).


El siguiente desafio usará la tarjeta de la imagen de abajo. Hay varias opciones con esta tarjeta: puedes usar las luces de la derecha o las del semáforo.

Esta tarjeta tiene dos pulsadores (normalmente abiertos) y dos interruptores de doble posición (dos salidas por interruptor) para un máximo de 6 salidas. La tercera generación de esta tarjeta tiene 5 interruptores diferentes para un máximo de 9 salidas. Hay 6 luces LED en la derecha y el cableado del semáforo está diseñado para controlar también 6 luces (2 rojas, 2 verdes y 2 amarillas).


The board will be used for two tasks:
  • Lights and Switches Challenge
  • Traffic Light Coding

La tarjeta será usada para dos tareas:
  • El Desafío de las Luces e Interruptores
  • Programación del Semáforo

The Lights & Switches board / La tarjeta de Luces e Interruptores


1st part of the challenge (warming up):
  • First push button will turn on the yellow light (and turn off the 2nd light if it's on)
  • Second push button will turn on the 2nd LED light (blue color) and off the yellow LED if it is on.
  • The third switch will control the green LED in one position and the red LED in the other position.
  • The last switch will control the last two LED lights (yellow and red).

2nd part of the challenge (still warming up):
  • When pressing the two push-buttons at the same time the LEDs will perform the running pulsating lights, a.k.a. as the Knight Rider car lights or the Cylon lights from Battlestar Galactica.


3rd part "The Challenge":
The program should be able to make the 1st part and the 2nd part of the challenge but on the same code: without the coding for the switches of the first part affecting the running lights code. The should run as if they were individual.

Primera parte del desafío (calentamiento):
  • El primer pulsador activa el LED amarillo (y apaga el 2do LED si está encendido)
  • El segundo pulsador enciende la 2da luz (de color azul) y apaga la amarilla si está encendida.
  • El tercer interruptor conotrolará el LED verde en una posición y la roja en la otra.
  • El último interruptor  controla las últimas dos luces.

2da parte del desafío (aun calentando):
  • Cuando se presionan los dos pulsadores a la vez, los LEDs empezaran la secuencia de luces pulsantes, mejor conocida como las luces del auto de Knight Rider (El auto/coche fantastico/increíble según el país) o las luces Cylon de Battlestar Galactica.

3ra parte "El Desafío":
El programa ahora debe de correr la 1a y 2da parte del desafío en el mismo código sin que el código de la primera parte afecte al de las luces. Deben de correr como si fueran codigos independientes.



After "The Challenge", you can start planning about the traffics light programming.


Después de "El Desafío", puedes planificar acerca de la programación de las luces del semáforo.

If you design your own board, you may improvise as you see fit. My first board (photo below) was not a elegant an clean as the second generation. Si diseñas tu propia tarjeta, tendrás que improvisar según sea necesario. Mi primera tarjeta (foto de arriba) no es tan elegante ni tan limpia como la de la segunda generación.
First prototype board / Primer prototipo de tarjeta

Saturday, September 13, 2014

PLC Programming: 1

First, I need to thank my students: Christian Barresi, Nellie Bonilla, Luis Flores and Amarilys Rivera for creating the first tutorial some time ago (2011). I hope to continue their initial work.

Lets start with the programming language. The MicroLogix 1100 comes from a family of Allen-Bradley controllers made by  Rockwell Automation which uses ladder logic. In summary it's called ladder because the program resembles a ladder. 

It's better to have a quick summary on ladder logic to understand it better. Wikipedia has a nice review to get you up to speed:
http://en.wikipedia.org/wiki/Ladder_logic

Below you will find the test electrical circuit and the program for it.
 
Primero, tengo que dar gracias a mis estudiantes: Christian Barresi, Nellie Bonilla, Luis Flores y Amarlys Rivera por crear el primer tutorial hace ya algún tiempo (2011). Espero continuar su trabajo inicial.

Comencemos con el lenguage de programación. El MicroLogix 1100 viene de una familia de controladores de Allen-Bradley fabricados por Rockwell Automation que utilizan el lenguage LADDER, escalera o de contactos. Se le conoce como escalera por la forma de los programas.

Es mejor tener un sumario rápido del lenguage escalera para entenderlo. Wikipedia tiene un buen resumen para aprenderlo rápido:
http://es.wikipedia.org/wiki/Lenguaje_Ladder

Abajo se encuentra el circuito eléctrico de prueba y su programa.


Electrical diagram/Diagrama eléctrico


Ladder program / Programa en lenguaje escalera

How To Start Programming


Open RSLogix Micro Starter Lite. You can open a New File and choose from the menu the right configuration, or go to the Comms Menu, and select  the option Who Active Go Online. You should be able to see the device with the IP Address you configured earlier. 

Choose the PLC IP Address and hit Create New File. It will pick up the right processor information for the PLC connected, or you can do it manually from the New File menu.






The first time it runs it will load whatever is saved on the PLC memory. See below.

If you want to start programming, you need to select OFFLINE from the first drop down menu on the left. Follow the instructions, until you see a window similar to one on the bottom right.

So, you are ready to start programming.

Como empezar a programar

Abrir  RSLogix Micro Starter Lite. Puedes abrir un archivo nuevo en el menú de New File y escoger la configuración correcta, o puedes ir al menú de Comms y seleccionar la opción de Who Active Go Online. Debería ver el equipo configurado con la dirección IP.


Escoger la dirección IP del PLC y seleccionar  Create New File. Esto configura la informacion correcta del procesador  para el PLC que est;a conectado. También se puede hacer de forma manual desde el menú de New File.





La primera vez que el programa corre va a cargar lo que estaba en la memoria del PLC. Imagen de abajo a la izquierda.

Si quieres programar, es necesario seleccionar OFFLINE en el menú desplegable de la izquierda. Seguir las instrucciones hasta tener una ventana similar a la de abajo.

Finalmente, ya estas listo para empezar a programar.



Get familiar with the options, practice dragging and dropping a few icons. Get the program to look like the one in the image. For the input you need to write I:0/0 so it looks like the figure (Input:zero/zero). For the output you need to write O:0/0 so it also looks like the one in the figure (Output:zero/zero). The last number dictates the physical connection on the PLC. Familiarizate con las opciones, practicando arrastrar y soltar con algunos iconos. Escribe el programa para que luzca similar al de la imagen. Para la entrada es necesario escribir I:0/0 para que quede como en la imagen (Input:cero/cero). Para la salida hay que escribir O:0/0 para que también se parezca a la imagen (Output:cero/cero). El último número es el que indica la conexión física en el PLC.
After that, you need to verify the program, the green check mark icon, for errors (writting zero instead of the letter O, colon, semicolon, period, etc). Once you are ready, you can transfer the program to the PLC, the option is called Download.
Después de ello, hay que verificar el programa con el icono de la marca verde (verify) para posibles errores (un cero en vez de la letra O, dos puntos, punto y coma, puntos, etc). Una vez realizado, ya se puede transferir el programa al PLC, la opción se llama Download.
You may need to change the Mode Switch option on the PLC to proceed (you need to use the ESC and OK buttons to navigate). Follow the on screen recomendations. Manual mode is Program and Run to be executed on the PLC. Remote mode allow you to program and run from the PC. Check image below.

Puede que tengas que cambiar una la opción del Mode Switch en el PLC para continuar (hay que usar ESC y OK para navegar las opciones). Sigue las recomendaciones en pantalla. El modo  manual permite programar (Program) y correr (Run) desde el PLC. El modo remoto permite programar y correr desde el PC. Ver imagen.

Now, check your program: when you activate the switch the light gets turned on.


Ahora a probar el programa: cuando activas el interruptor la luz se debe de enceder.

Congratulations, you are done with your first PLC program! Felicitaciones, has terminado tu primer programa en PLC!

MicroLogix 1100 Wiring

You should get a power line (bottom left corner) and network cable (top left corner), like the picture below.

Depending on the specific model, the MicroLogix 1100 is powered by 12/24V dc or 120/240V ac.
Deberías tener el cable de corriente (esquina inferior izquierda) y el cable de red (esquina superior izquierda), como en la foto..

Dependiendo del modelo en específico, el MicroLogix 1100 es alimentado por 12/24V dc o 120/240V ac.

The MicroLogix 1100 has the 12 inputs located on the top and 6 outputs located at the bottom. Depending on the specific PLC model, you may have 10 digital inputs (12/24V dc or 120V ac) and 2 analog inputs (10V dc) with 6 relay outputs (or two relay outputs and four 24V FET dc outputs).

The model we have available is 120V ac, with 10 digital inputs using 24V dc (and two 10V dc analog inputs) and 6 relays outputs. A relay is just an electrically operated switch.

You can think the PLC senses the digital inputs like a multimeter, if it detects the voltage (24V dc for us) the input is activate. So, you need to connect your inputs to a power supply in order for them to work. You should find a built-in power supply for it on the top row to the left. You will find there is only one screw connector for each input.

The outputs work a bit different since you need 2 screw connectors for every output. You also need to provide your own power supply for the outputs. The good thing is that you can connect 5V dc in one output, 12V dc in other, 24V dc in another, 120V ac in another one and/or 240V ac in yet another output without any problem. Those are independent of each other. Why? Because you can connect anything you need.

El MicroLogix 1100 tiene 12 entradas en la parte superior y 6 salidas en la parte de abajo. Dependiendo del modelo de PLC, puedes tener 10 entradas digitales (12/24V dc o 120V ac) y 2 entradas análogas (10V dc)con 6 salidas con relés (o dos salidas con relés y cuatro con 24V FET dc).

El modelo que tenemos disponible es de 120V ac, con 10 entradas digitales usando 24V dc (más dos entradas análogas de 10V dc) y 6 salidas de relés. Un relé no es más que un interruptor operado eléctricamente.

Puedes pensar que el PLC detecta las entradas como si fuera un multímetro, si detecta el voltage (24V dc para el que tenemos) la entrada está activa. Las entradas necesitan estar conectadas a una fuente de poder para funcionar, para ello se puede usar la que viene con los conectores del lado izquierdo. Encontrarás un conector para cada entrada.

Las salidas funcionan diferente porque tienes dos conectores para cada salida. Aquí se necesita proveer la fuente de poder para las salidas. Lo bueno de ello es que una salida puede estar a 5V dc, otra a 12V dc, otra más a 24V dc, otra a 120V ac y una última a 240V ac sin ningún problema. ¿Por qué? Porque así puedes conectar lo que necesites.
Inputs on the top, outputs on the bottom
Entradas en la parte de arriba y salidas en la de abajo.

Since the inputs require a power supply, we will use the one built-in. You need to place a jumper wire from -24V to the COM (common) connector to complete the electrical circuit. See the example below for the input zero (I/0).

Ya que las entradas necesitan una fuente de poder, usaremos la que viene con el PLC. Hace falta un cableado del -24V a el puerto COM (común) para cerrar el circuito eléctrico. Ver el ejemplo de abajo para la entrada cero (I/0).

One input connection/Una conexión de una entrada

If you need more connections, make sure to place another jumper wire until the next COM port to be able to use the last 6 inputs. Check image below with 5 connected inputs. Si necesitas más conexiones, asegurarse de colocar otro cableado hasta el siguiente puerto COM para usar las últimas 6 entradas. En la imagen de abajo hay 5 entradas conectadas.

Multiple input connections/Conexiones con entradas múltiples.

Inside the PLC: the outputs have relays to open/close circuits and control turning on/off the connected equipment. The image below is the idealized way of how they work (grey color switches for internal components). Dentro del PLC: las salidas tienen relés para abrir/cerrar circuitos y controlar el encendido/apagado de los equipos conectados. La imagen de abajo es una forma idealizada de como trabajan (interruptores en color gris claro para los componentes internos)

Internal relays for outputs behaves like switches
Relés interbos para las salidas se comportan como interruptores 

Let's make a connection with one input and one output. The input can be a switch, a push-button or just a wire. The output can be a light and its power source. The circuit should look similar to the figure below.

Hagamos una conexión con una entrada y una salida. La entrada puede ser un interruptor, un botón tipo pulsador o solo un cable. La salida puede ser una luz con su fuente de poder. El circuito debería ser similar al de abajo.

Connection for one input and one output/Conexión para una entrada y una salida.

The ladder logic program for this one should look like the image below. La programación en lenguage escalera para este circuito debería ser similar a la imagen de abajo.

Input zero activates output zero
La entrada cero activa la salida cero

 
Take care to label your electrical connections so you don't forget what is what. If you need to use all the inputs and outputs, the wiring will look intimidating. It would be better if you can have color cables or color ribbon cables to help you with this task. Otherwise, imagine a circuit like the one below with cables coming from everywhere while you try to discover the order of the connections.


Ten cuidado de rotular las conexiones eléctricas para no olvidar que es cada cosa. Si tienes que usar todas las entradas y salidas, el cableado será intimidante. Sería bueno si puedes tener cables de colores o cable cinta de colores para ayudarte en esa tarea. Sino, imagina que tengas un circuito como el de abajo con cables que vienen de todos lados mientras intentas descubrir el orden de las conexiones.
Multiple inputs and multiple outputs with the same power supply
Múltiples entradas y múltiples salidas con la misma fuente de poder