Escolar Documentos
Profissional Documentos
Cultura Documentos
ROBOTICS
Your task is to make a collection of articles from newspapers and magazines related
to ROBOTICS (not just computing in general). Your collection can even include
video taped material from TV, but must not include hand-drawn pictures.
NOTE: Photocopies will not attract any marks. You may include photocopies of
particularly interesting items, but marks are only awarded for actual articles
obtained from newspapers and magazines. You may also not include any material cut
from quality books. - DON'T destroy books by cutting pieces from them!!
Presentation:
The material should be presented in 'scrap book' format, or in a loose leaf file, with
each article glued onto a separate page.
You have approximately half the unit to collect this material. Don't wait until the last
minute to begin collecting.
Contact friends, neighbours, other family members, etc and ask them to keep an eye
out for suitable material. The fact that your family may not have access to many
papers/magazines will not be accepted as an excuse for an inadequate collection!
NOTE: One of your later assignments deals with past, present and future
developments in Robotics. The material you collect will be very useful when
preparing these assignments.
Enigmaelectronica
Robotics - Computer Control
ROBOTICS
Your task is to prepare a report about the way Robots impact on Society.
Your report should be around 4 to 5 pages long (including pictures, etc) and may
concentrate on any one of the above topics, or deal briefly with a number of topics.
Presentation:
Your report must be wordprocessed. The pictures may be cut out and stuck on, or
hand drawn. (Extra marks will be awarded for computer graphics.)
Newspapers (your collection), magazines, libraries (school and council), TV, radio,
CDs, etc.
Enigmaelectronica
Robotics - Computer Control
ROBOTICS
Your task is to prepare an oral report about safety issues relating to using electrical
devices in robotics. You will present your report to the class towards the end of the
unit.
NOTE: Don't wait until the end of the unit to start preparing your material.
Possible Topics:
Fuses
Earth Leakage Detectors
The "Earth" system
Double insulation
Artificial breathing
Cardiac massage
Insulation
Just a few minutes. You may refer to your notes while you are speaking, but if you
simply read out what you have written down you will not get high marks.
The school library, Science staff, council libraries, Western Power (SECWA).
We have some pamphlets on the topic, but you should not rely exclusively on them.
Enigmaelectronica
Robotics - Computer Control
ROBOTICS
History of Robotics
Your task is to write a two to three page report on the development of Robotics
over the past 100 years, or so. (You are going to prepare a report later on the
future developments of Robotics, so don't include anything other than past and
existing examples.)
You may choose to look at a range of topics from the above list, or spend all of
your time on just one topic.
Remember - DON'T include any future developments, or Science Fiction. You will
look at furture developments later.
Enigmaelectronica
Robotics - Computer Control
ROBOTICS
Your task is to write a two to three page report on possible future developments of
Robotics. You may include areas such as Science Fiction and 'movie' predictions
such as the robots from Star Wars and The Terminator, but you must also comment
on the possibility of each example you give actually happening. (It is unlikely for
example that 'humanoid' robots will become widespread becuase it is easier and
cheaper to make a real human rather than an 'android'.)
Science Fiction
Movies
Novels
Comics
Videos
Text books
Scientific reports
"Think Tanks"
CD ROM
You will receive most marks for original work. You should discuss in your own
words the possibilities of each example actually becoming a reality.
Enigmaelectronica
Robotics - Computer Control
ROBOTICS
Evaluating Software
Your task is to write two to three pages comparing the features of two programming
languages which may be used for Robotic Control.
(ii) Flexibility:
- Can you do exactly what you wanted?
(iv) Cost
The Computing Department has access to Pascal, Logo for Windows, Quick Basic
and Visual Basic. If you have another package at home you may include it in your
comments.
Enigmaelectronica
Robotics - Computer Control
ROBOTICA
Gerson Hernández
Enigmaelectronica
Enigma Software
Enigmaelectronica
Robotics - Computer Control
Early computers used a data bus 8 lines wide. Most modern personal computers
now have a data bus 16, or 32 lines wide. (If you look at a motherboard you can
actually see the data bus as a set of parallel copper tracks inter-connecting all the
Integrated Circuits (ICs) to the Cental Processing Unit (CPU).)
Data Bus
Data moves along the data bus as a byte up to 32 bits wide in much the same way
as cars would travel along a 32-lane highway.
Each bit moves in parallel with all the others. This form of data transfer is therefore
called: Parallel Transfer.
There are times when it is much more economical to send data along a single
conductor with each bit travelling one behind the other. This type of data transfer
can be compared to cars moving one behind the other along a single-lane roadway.
Enigmaelectronica
Robotics - Computer Control
Data moves along the conductor as a series of bits. This form of data transfer is
therefore called Serial Transfer.
Parallel Serial
There are eight output lines at the Centronics printer port. When the computer
wants to send a character to the printer it must switch each of the eight data lines
either HIGH, or LOW to represent the required byte pattern. The printer then
interprets the received pattern of HIGHs and LOWs and prints the character.
Enigmaelectronica
Robotics - Computer Control
If we imagine that eight tiny globes are connected one to each of the printer port
output data lines we can get a better idea of the process involved:
Enigmaelectronica
Robotics - Computer Control
eg 1. If the byte 11001001 is sent to the printer port, the following pattern will
result:
Enigmaelectronica
Robotics - Computer Control
2. Draw the pattern of globes when the letter "A" is sent to the printer port.
Binary Arithmetic:
Hopefully you can see how easy it is to control individual printer port data lines by
sending the appropriate byte. The difficulty is that you can't send a byte in the form
used in the examples above. You must first convert the byte into its equivalent
decimal (or Hex) form. To be able to do a binary to decimal conversion you need
to know a little more about Binary numbers ...
From a computing point of view, "1" corresponds to ON, or +5volts and "0"
corresponds to OFF, or zero volts (also called "ground").
The table below outlines the basics of the binary counting system:
• 0000 0001
•• 0000 0010
••• 0000 0011
•••• 0000 0100
Enigmaelectronica
Robotics - Computer Control
••••• 0000 0101
•••••• 0000 0110
••••••• 0000 0111
•••••••• 0000 1000
Another way to view binary numbers is to re-write the 'place' values as powers of
two.
ie 27 26 25 24 23 22 21 20
OR
128 64 32 16 8 4 2 1
00101010 = 0 + 0 + 32 + 0 + 8 + 0 + 2 + 0 = 42
128 64 32 16 8 4 2 1 Decimal
Value
1 1 0 0 1 1 0 0 = 205
0 1 1 0 0 0 0 1 = 97
1 0 0 0 0 0 1 0 = 130
1 0 0 0 0 1 1 1 = 135
a) 11001110
Enigmaelectronica
Robotics - Computer Control
b) 00101010
c) 10101010
d) 11111111
128 64 32 16 8 4 2 1 Decimal
Value
- 8 output-only lines
- 5 input-only lines
- 4 input/output lines
- GROUND (zero volts)
The diagram below indicates the pin numbers of each line and its name.
Enigmaelectronica
Robotics - Computer Control
NOTE: Only one pin needs to be 'grounded'. Pins 18 to 25 are all connected
together internally.
For OUTPUT control we are interested in pin numbers 2-9 and GROUND.
We will look at input using pins 10, 11, 12 ,13 and 15 at a later time.
In Pascal the command is: Port[888] := 128 (Where 888 is the usual 'address' of
the printer port.)
Enigmaelectronica
Robotics - Computer Control
The Table below summarises the values used to control individual pins at the
printer port:
NOTE1: To turn ALL pins OFF, send all pins LOW. eg Port[888] := 0
NOTE2: The printer port has a 'latch'. Previous values remain in effect until
overwritten by the next command. ie If a line is turned ON, it remains ON until
turned OFF again.
In the previous examples, we imagined that small globes were connected to the
printer port. If you in fact connected globes directly to the output lines of the port
you would certainly cause serious damage to the computer. The interface described
Enigmaelectronica
Robotics - Computer Control
below uses tiny currents from the computer, amplifies them and then switches
external devices without placing extra load on the computer itself.
The heart of the interface you will be using is the "transistor". A transistor is an
electronic switch. One way to think of a transistor is like the electronic version of a
water tap. Small movements of the 'spigot' are used to control large water flow.
The large current flowing through the transistor may be used to drive components
such as a Light Emitting Diode (LED), or larger devices such as a relay which in
turn switches even larger currents!
You now have the basics needed to understand how to control 'robotic' devices
connected to a computer. Following sections will look at input sensing and larger
projects based on the new skills you have acquired.
Enigmaelectronica
Robotics - Computer Control
To prevent damage to the port an "74LS244" IC is used to 'buffer' the input lines.
The buffer IC provides a degree of isolation and also ensures that the input signal
is 'clean' so that the computer can read it properly.
Each of the input lines is 'tied' HIGH using a 100kΩ resistor and then switched
directly to Ground (LOW) using a simple make/break switch.
There are four buffered input lines used on the interfaces you will be using.
The following table contains pin numbers and data information for the printer port:
10 D6 64
12 D5 32
13 D4 16
15 D3 8
Enigmaelectronica
Robotics - Computer Control
In BASIC the command is: InValue = INP 889
In each case above, InValue will be a byte (as a Decimal) corresponding to the
combined state of all of the input lines. The programmer (you) must then write the
code required to find out the ON/OFF state of EACH of the input lines! This is
done using the technique called "ANDing".
It's much easier to see what is going on if the bytes are written one under the other,
but remember, this is NOT addition!!
11001100
AND 10001001
--------------
IS 10001000
To work out the result of ANDing, you compare the corresponding bit of each
byte. If they are BOTH "1", then that bit in the result is also "1".
Enigmaelectronica
Robotics - Computer Control
Consider the situation where all input pins at the printer port are LOW, except pin
10. If you 'read' the state of the port with "InValue := Port[889]", the result will be
64. (ie the byte is 0100 000 meaning D6 is HIGH)
If only one pin at a time were switched HIGH, the process of decoding would be
very simple, but not very realistic!
To be able to decode the state of individual pins, you must apply the concept of
ANDing.
One way to view the situation is that each input line at the port connects to its
corresponding bit in a byte. When a switch is closed, that bit changes from HIGH
to LOW. (ie from "1" to "0")
Remember, we are only concerned with pins 10, 12, 13 and 15 which connect to
D6, D5, D4 and D3. (That is why all the other bits are "0" - we will ignore them!)
If the first button is pressed, the byte changes to: 00111000. When it is released,
the byte changes back to 01111000 again.
If the second button is pressed, the value will be: 01011000. The third button
produces 01101000 and so on ...
Hopefully you can see the pattern. The next step is to apply what we can see into
code the computer can work with.
Believe it or not, that is precisely what you brain did to work out the examples
above!!
The same sequence is used with 32, 16 and 8 to decode D5, D4 and D3 (ie to detect
the state of switches connected to pins 12, 13 and 15).
Notice the slightly different syntax for ANDing with BASIC. In line 300, the AND
is performed to test to see if "TempState" is TRUE. If TempState is TRUE then D4
must be HIGH and the variable D4$ is set to "OPEN". If TempState is FALSE then
its value as set in line 100 remains as "CLOSED".
**
NOTE
Remember that the input lines are tied HIGH by resistors on the interface. InValue
will AND to TRUE with the switch open and FALSE with the switch closed!
1. Write the Pascal code to detect the state of a switch connected via the interface
card to pin 13 of the printer port.
2. Write the WinLogo V3.7 code required to detect the state of a switch on pin 15
of the printer port.
Enigmaelectronica
Robotics - Computer Control
Evaluating
5.4 Assesses own products and processes
Robotics 5.2 - Computer Control according to specified design requirements,
including ethical criteria and by comparison with
similar products and processes.
Unit Code: 8452
Enigmaelectronica
Robotics - Computer Control
SPECIFIC OBJECTIVES
ASSESSMENT
The student will:
Reports
Prepare a brief report identifying the dangers (Robots and Society) 10%
present in using mains- connected computers for (History) 10%
Robotic control. (Future Developments) 10%
Evaluating Software 10%
Describe the four main types of robots: Manually Final Project 20%
operated, Sequence, Playback, Intelligent. Oral Report 10%
(Safety Issues)
Describe at least three different uses of computer- Test 30%
controlled machinery in industry. eg Lathes,
milling machines, industrial robots, PLC devices, TOTAL 100%
etc.
Enigmaelectronica
Robotics - Computer Control
Enigmaelectronica
Robotics - Computer Control
Robotics 8452 Computer Control
1. ASSIGNMENT
Distribute Oral Report assessment
item and discuss briefly.
2. Discuss past, present and predicted future ROBOTS AND SOCIETY Videos
developments in Robotics. Discuss general impact of Robotics in: Texts
The Home, The Workplace, General Society. Worksheets
ASSIGNMENT
Distribute Robots and Society assignment
sheet and discuss scope.
ASSIGNMENT
Distribute History of Robotics assignment
sheet and discuss scope.
Enigmaelectronica
Robotics - Computer Control
SESSION OBJECTIVES CONTENTS RESOURCES
ASSIGNMENT
Distribute Future Developments assignment sheet
and discuss scope.
6. Design, write and evaluate programs to control INTRODUCTION TO BINARY DIGITS Exercise sheets
devices connected to a computer. Discuss Binary counting and briefly relate it to Binary to decimal demonstration device.
the operation of computers.
Have students practice converting from Binary
to Decimal and back.
Use demonstrations to consolidate the concepts.
7. Design, write and evaluate programs to control INTRODUCTION TO COMPUTER CONTROL Output demonstration module.
devices connected to a computer ... continued Introduction to programming. (Using the most
appropriate language for the group.) Access to a Centronics printer port or
Relate Binary concepts to direct control of a Serial to Parallel interface.
device connected to the Centronics Printer Port.
(For this activity a parallel port is essential.)
Discuss Serial versus Parallel transfer and relate
the 'parallel' activity to control of Serial ports.
Demonstrate code used for Serial control.
Enigmaelectronica
Robotics - Computer Control
Robotics 8452 Computer Control
8. Write algorithms to represent the sequence of WRITING ALGORITHMS Algorithm Activity Sheets
events taking place in programs. Students to work in groups to construct
algorithms to solve problems presented by the
Exhibit co-operative work habits. teacher.
9 - 13 Design, write and evaluate programs to control CONTINUE PROGRAMMING Algorithm/Problem Solving Activity
devices connected to a computer. Students continue working in groups to solve Sheets.
Robotics-related problems, write algorithms and
Design software to control devices connected construct simple 'control' programs.
to a computer.
14. Write a report comparing two different SOFTWARE EVALUATION - ASSIGNMENT Student must be given access to at least
software packages used to control devices Introduce a second package to the students and TWO different software packages.
connected to a computer. allow them to use it to duplicate the same control eg Macintosh: Pascal, Lego Lines, Lego
previously achieved with their first package. Control Lab.
Enigmaelectronica
Robotics - Computer Control
SESSION OBJECTIVES CONTENTS RESOURCES
Enigmaelectronica
Robotics - Computer Control
Robotics 8452 Computer Control
NOTES:
Only 32 Sessions are programmed at this time. It is assumed that the full programme of 40 Sessions will evolve over time.
The Final Project is programmed for two full weeks. It may eventuate that more time will be needed to satisfactorily achieve the aims of the Project.
Students may work in groups of no more than THREE to produce the Final Project and share a common mark for the finished product.
Since one of the major objectives of this Unit is to foster co-operative work habits, the issue of just which student does what is of minor significance.
If students in the group have no complaints about the efforts of individuals in the group and are willing to 'share' their mark, so be it!
Enigmaelectronica
Robotics - Computer Control
Unit Test
____________________________________________________________________
(1 mark)
2. What was the first Robot? (What did it look like? What could it do?)
____________________________________________________________________
(2 marks)
a)___________________________________________________________________
b)___________________________________________________________________
(2 marks)
a)___________________________________________________________________
b)___________________________________________________________________
(2 marks)
5. Give two examples of how/where Robots are not used at present, but may be used in the
future.
a)___________________________________________________________________
b)___________________________________________________________________
(2 marks)
____________________________________________________________________
(1 mark)
Enigmaelectronica
Robotics - Computer Control
Robotics 8452 - Computer Control
Name: .............................................
Unit Test
1. Write the Pascal code you would use to send "231" to the printer port at address "888".
____________________________________________________________
(2 marks)
Use the following table to answer questions ...
0000 0001 1
0000 0010 2
0000 0011 3
0000 0100 4
0000 0101 5
0000 0110 6
0000 0111 7
0000 1000 8
2. What Decimal value would you send to the printer port to turn on the first two lines?
__________________ (1 mark)
3. What Decimal value would you send to the printer port to turn on the first and third
lines?
__________________ (1 mark)
Answer
a) parallel bytes
b) serial bytes
(1 mark)
5. A "transistor" is best described as:
Answer
a) an electronic 'tap'
b) a memory device
c) a radio device
d) a data line device (1 mark)
____________________________________________________________________
(2 marks)
7. What was the first Robot? (What did it look like? What could it do?)
____________________________________________________________________
Enigmaelectronica
Robotics - Computer Control
____________________________________________________________________
(3 marks)
a)___________________________________________________________________
b)___________________________________________________________________
(2 marks)
a)___________________________________________________________________
b)___________________________________________________________________
(2 marks)
10. Give two examples of how/where Robots are not used at present, but may be used in the future.
a)___________________________________________________________________
b)___________________________________________________________________
(2 marks)
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
(3 marks)
Enigmaelectronica
Robotics - Computer Control
Arrays, Types and Procedures
program Garage;
{(You should not use exactly the same names as used in this example.)
}
type
CusterName = array[1..3] of string[20];
Comments = array[1..3] of string[40];
var
CustName: Custername;
Comment: Comments;
License: string[10];
ElementNum: integer;
begin
CustNm[1] := 'Fred Smith';
CustNm[2] := 'Jill Jones';
CustNm[3] := 'Mary Brown';
end;
begin
Cmnt[1] := 'Likes trout fishing';
Cmnt[2] := 'Children in swimming club';
Cmnt[3] := 'Mad on collecting stamps';
end;
{* MainLine *}
begin
ElementNum := 1;
GetCustNames(CustName);
GetComments(Comment);
writeln('License Number: ');
readln(License);
if License = 'AAA123' then
ElementNum := 1;
Enigmaelectronica
Robotics - Computer Control
if License = 'AAA124' then
ElementNum := 2;
if License = 'AAA125' then
ElementNum := 3;
You could also try case statements along the lines of ....
{* MainLine *}
begin
ElementNum := 1;
GetCustNames(CustName);
GetComments(Comment);
writeln('License Number: ');
readln(License);
case License of
'AAA123','aaa123' : ElementNum := 1;
'AAA124','aaa124' : ElementNum := 2;
'AAA125','aaa125' : ElementNum := 3;
end; {case}
Enigmaelectronica
Robotics - Computer Control
program Garage;
{(You should not use exactly the same names as used in this example.)
}
type
CusterName = array[1..3] of string[20];
Comments = array[1..3] of string[40];
var
CustName: Custername;
Comment: Comments;
License: string[10];
ElementNum: integer;
begin
CustNm[1] := 'Fred Smith';
CustNm[2] := 'Jill Jones';
CustNm[3] := 'Mary Brown';
end;
begin
Cmnt[1] := 'Likes trout fishing';
Cmnt[2] := 'Children in swimming club';
Cmnt[3] := 'Mad on collecting stamps';
end;
{* MainLine *}
begin
ElementNum := 1;
GetCustNames(CustName);
GetComments(Comment);
writeln('License Number: ');
readln(License);
if License = 'AAA123' then
Enigmaelectronica
Robotics - Computer Control
ElementNum := 1;
if License = 'AAA124' then
ElementNum := 2;
if License = 'AAA125' then
ElementNum := 3;
You could also try case statements along the lines of ....
{* MainLine *}
begin
ElementNum := 1;
GetCustNames(CustName);
GetComments(Comment);
writeln('License Number: ');
readln(License);
case License of
'AAA123','aaa123' : ElementNum := 1;
'AAA124','aaa124' : ElementNum := 2;
'AAA125','aaa125' : ElementNum := 3;
end; {case}
Enigmaelectronica
Robotics - Computer Control
Unit Test
1. Write the Pascal code you would use to send "231" to the printer port at address "888".
____________________________________________________________
(2 marks)
Use the following table to answer questions ...
0000 0001 1
0000 0010 2
0000 0011 3
0000 0100 4
0000 0101 5
0000 0110 6
0000 0111 7
0000 1000 8
2. What Decimal value would you send to the printer port to turn on the first two lines?
__________________ (1 mark)
3. What Decimal value would you send to the printer port to turn on the first and third
lines?
__________________ (1 mark)
Answer
a) parallel bytes
b) serial bytes
(1 mark)
5. A "transistor" is best described as:
Answer
a) an electronic 'tap'
b) a memory device
c) a radio device
d) a data line device (1 mark)
____________________________________________________________________
(2 marks)
Enigmaelectronica
Robotics - Computer Control
7. What was the first Robot? (What did it look like? What could it do?)
____________________________________________________________________
____________________________________________________________________
(3 marks)
a)___________________________________________________________________
b)___________________________________________________________________
(2 marks)
a)___________________________________________________________________
b)___________________________________________________________________
(2 marks)
10. Give two examples of how/where Robots are not used at present, but may be used in the future.
a)___________________________________________________________________
b)___________________________________________________________________
(2 marks)
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
(3 marks)
Enigmaelectronica
Robotics - Computer Control
©1997 J P Fuller
Enigmaelectronica
Robotics - Computer Control
Publicado en 1997
J. P. Fuller
48 Portmarnock Circle
MANDURAH
Western Australia 6210
ph (08) 9535 6472
http://www.southwest.com.au
email: jfuller@southwest.com.au
© 1997 J P Fuller
ISBN
0 646 16384 1
Este material es parte del Kit de Robótica y está cubierto por las mismas
condiciones de la licencia. Su duplicación está autorizada para sitios con licencia.
Enigmaelectronica
Robotics - Computer Control
Contents
Prólogo/Agradecimientos 4
Introducción 5
Entradas al computador 8
Software 18
Leyendo voltajes 21
Circuitos típicos 25
Luz 26
Sonido 30
Temperatura
31
Magnetismo 32
Experimentos de Movimiento 34
Comentarios Finales 47
Enigmaelectronica
Robotics - Computer Control
Prólogo
El material contenido en este folleto se refiere a los computadores al uso de
computadores "IBM-compatible" equipados con una tarjeta de juegos estándar .
Si su máquina no tiene una tarjeta de juegos, se puede instalar una por un precio
bastante bajo. Algunos sistemas vienen con un puerto de juegos, asegúrese con su
proveedor que el puerto esté habilitado, ya que algunos proveedores los
inhabilitan para evitar conflictos con otras tarjetas que el usuario pueda agregar.
Hay una cantidad de fabricantes que ofrecen tarjetas de “control” para los
“compatibles”, pero su costo y complejidad suelen limitar su uso en las escuelas.
El uso del Puerto de Juegos puede no ser tan preciso como otras técnicas, pero los
estudiantes lo entienden fácilmente y ¡es mucho más barato!
Espero que el material presentado sea suficientemente práctico para ser de uso
directo para los profesores. Si ellos son motivados a realizar algunos de los
circuitos presentados, mis esfuerzos no habrán sido en vano.
Agradecimientos:
Gracias a Reg Ion por su continuo apoyo técnico. Reg Ion es un técnico jubilado
de Mandurah.
Enigmaelectronica
Robotics - Computer Control
Introducción
Este folleto detalla un número de interfaces, que pueden ser construidas por
estudiantes hábiles y ser usadas con un “compatible” para realizar mediciones y
controlar procesos del “mundo real”. Este, enfáticamente, NO es un libro de
teoría. El propósito es integrar la información necesaria para construir los
dispositivos arriba mencionados, sin demandar un profundo conocimiento técnico
de los usuarios (¡Nosotros!).
Enigmaelectronica
Robotics - Computer Control
Introducción
Pre-requisitos de Diseño:
Hay una cantidad de compañías que se especializan en tarjetas de “control” par
los “IBM compatibles”. La mayor parte de las revistas de computación y
electrónica proveen los nombres de dichas compañías. Si lo que se desea es una
unidad de “demostración”, una tarjeta adquirida en el comercio es una buena
alternativa.
1. De bajo costo
Como regla general, en este trabajo sólo se incluyen circuitos que han sido, en
realidad, construidos utilizando los recursos disponibles en la mayoría de los
colegios de educación secundaria, con componentes adquiridos en la plaza. El
software fue desarrollado utilizando Turbo Pascal Versión 5.0. Con la
excepción de algunos procedimientos que usan el "Graphix Toolbox" y otros
procedimientos y una o dos rutinas que han sido llevadas a Assembler -para
proveer una velocidad aceptable- todo el software presentado es “software de
texto” (software “normal”). En la mayoría de los casos se puede utilizar BASIC,
pero a expensas de la velocidad.
Espero que el material presentado sea fácil de entender y de uso directo en la sala
de clases.
Enigmaelectronica
Robotics - Computer Control
Técnicas de Interfaz
Hay varias maneras de “leer” datos directamente del mundo exterior utilizando
un computador. En la mayoría de los casos las técnicas se centran en el uso de
tarjetas especiales que se incorporan al computador en las “ranuras de
expansión”. Esta manera de hacer las cosas no sólo puede ser de alto costo, sino
también profundiza los sentimientos de los estudiantes en torno al “misterio” que
rodea el funcionamiento de los computadores en general. Uno de los propósitos
del uso de los computadores en la sala de clases debe –por supuesto- ser la
profundización del entendimiento del funcionamiento de estas máquinas y no el
espesamiento del velo que normalmente los rodea.
Entradas al Computador
Enigmaelectronica
Robotics - Computer Control
Ingreso de Señales:
EL PUERTO DE JUEGOS
Enigmaelectronica
Robotics - Computer Control
ESPECIFICACIÓN DE LOS PINS DEL PUERTO DE JUEGOS
(CONECTOR DEL JOYSTICK)
1 +5 Volts
2 D4 Botón 4 (Interruptor)
3 D0 Posición 0 (A a D)
4 Tierra
5 Tierra
6 D1 Posición 1 (A a D)
7 D5 Botón 5 (Interruptor)
8 +5 Volts
9 +5 Volts
10 D6 Botón 6 (Interruptor)
11 D2 Posición 2 (A a D)
12 Tierra
13 D3 Posición 3 (A a D)
14 D7 Botón 7 (Interruptor)
15 +5 Volts
Tierra
Enigmaelectronica
Robotics - Computer Control
En el Puerto de Juegos hay dos circuitos integrados que llevan a cabo todas las
labores de interfaz que necesitaremos.
Líneas de Interruptores
Las cuatro líneas de interruptores ocupan cuatro entradas (de un total de ocho) de
un Circuito Integrado (IC) 74LS244 el que actúa como “estación intermedia”
protegiendo la circuitería interna del computador y “cuadrando” (o
acondicionando) las señales de entrada para asegurar una detección confiable por
parte de la CPU (Unidad Central de Procesos del computador). Cada una de estas
líneas es mantenida “alta” (conectada a 5 Volts) por una resistencia interna para
evitar un falso gatillado. El sensor utilizado debe, por tanto, llevar la línea a
“tierra” (“estado bajo”, alrededor de cero volts) para producir un cambio de
estado de la línea.
Cada módulo “555” es usado en una configuración monoestable (un solo estado
estable: “alto” o “bajo”). Cuando llega un pulso al pin de “gatillado”, la salida va
a “alto” durante un tiempo determinado por un circuito resistencia/condensador.
En el caso del Puerto de Juegos, el condensador es interno y la resistencia
corresponde a una de las cuatro resistencias variables del Joystick o la resistencia
que se conecte externamente.
Cada línea de salida del NE558 entra en las cuatro entradas disponibles del
74LS244 mencionado anteriormente, para propósitos de almacenamiento y
acondicionamiento de la señal..
Enigmaelectronica
Robotics - Computer Control
El software entonces ejecuta una rutina de tiempo para medir la duración del
estado “alto” de cada línea de salida del NE558 y relaciona este número con el
valor de la resistencia externa conectada al puerto.
El Puerto de juegos puede ser “leído” usando comandos en BASIC, tales como:
In ambos casos, el valor retornado para “V” refleja el estado “Alto” o “Bajo” para
cada pin del Puerto de juegos. Se lee como un número binario de 8 bits, en que
“Alto” es un “1” y “Bajo” es un “0”. Cada bit corresponde al estado de cada uno
de los pins D0 a D7 del Puerto de Juegos.
El software debe interpretar el valor retornado como “V” para obtener el valor
real “Alto” o “bajo” de cada línea.
Enigmaelectronica
Robotics - Computer Control
128 64 32 16 8 4 2 1
El estado de las líneas de datos con interruptores aparece en los cuatro bits más
significativos del Byte retornado por “V = Port[512]” es decir, los HSV 128, 64
32 y 16. Los cuatro bits menos significativos reportan el estado de las líneas “A a
D” (Análogo a Digital).
Para decodificar el estado de una línea específica se utiliza una técnica llamada
“ANDing”.
ANDing:
Un poco más:
11000100 11101111
AND 01011011 AND 11110001
es: 01000000 es: 11100001
Enigmaelectronica
Robotics - Computer Control
Por ejemplo:
Enigmaelectronica
Robotics - Computer Control
(Líneas de Datos)
Operación D5 D4 D3 D2 D1 D0
3 AND 2 = TRUE (3 = 2 + 1)
4 AND 2 = FALSE (4 = 4 + 0 + 0)
Dado que las líneas con interruptores del Puerto de Juegos corresponden a los
cuatro bits más significativos, es necesario hacer el ANDing del valor entregado
por "InValue:= Port[512]" con 128, 64, 32 and 16.
Inversión:
Aún nos queda lidiar con una pequeña complicación. Como señaláramos
anteriormente, las líneas con interruptores son mantenidas en estado HIGH por
resistencias conectadas a +5 Volts (pull up resistors) (ver fig. 1). Cuando un
interruptor conectado entre cada línea y tierra se cierra (es decir, se activa) la
línea de datos correspondiente cambia a un estado LOW. El efecto de esta
situación es que cuando los valores leídos en las líneas del Puerto de Juegos es
opuesto al esperado, esto es, uno espera que cuando el interruptor se active (se
cierre) la línea vaya a HIGH, sin embargo va a LOW. Si por ejemplo, la línea D6
tiene su interruptor cerrado las líneas mostrarán el número binario 10111111 (191
decimal) en lugar del 01000000 (64 decimal) esperado. Sin embargo la solución
es simple. Basta con sustraer el número proporcionado por las líneas de 255,
antes de hacer el ANDing. Esta operación invertirá los bits y permitirá realizar el
procedimiento sin problemas.
(Es posible realizar el ANDing con los números no invertidos, pero será
necesario pensar con lógica invertida y operar con FALSEs en lugar de TRUEs.
Personalmente, prefiero la lógica directa.
Enigmaelectronica
Robotics - Computer Control
El código Pascal necesario para invertir es:
Las otras líneas con interruptores son decodificadas “ANDing” “V” con 32, 64 y
128 respectivamente.
NOTE las maneras diferentes en que BASIC y Pascal se refieren al resultado del
ANDing.
Enigmaelectronica
Robotics - Computer Control
Las líneas de entrada con interruptores son relativamente fáciles de decodificar.
La sección anterior provee información acerca de las técnicas básicas
involucradas.
Las líneas Análogo a Digital (A a D, o A/D) son, sin embargo, un poco más
complejas.
Se podría, por ejemplo, obtener un valor de: 10100110 (166 decimal) para
"InValue". Esto nos diría:
1 0 1 0 0 1 1 0
Antes de “leer” las líneas A/D del Puerto de Juegos, se dbe enviar una señal de
control al conversor A/D (ver fig. 1) para iniciar el proceso de decodificación. Se
puede escribir cualquier valor para iniciar este procedimiento. Es el comando
“WRITE” la que inicializa el puerto y no el valor escrito.
Una vez que esta señal es recibida, cada uno de los cuatro bits menos
significativos va a HIGH durante un tiempo determinado por el valor de la
resistencia presente en cada línea. (Entre 0 100 Kohm.)
Enigmaelectronica
Robotics - Computer Control
- Envío de la señal de control
Una vez obtenido un “conteo” (un número) para la línea de datos, el software
debe relacionar este dato “crudo” con el valor de la resistencia.
NOTA: El ejemplo anterior examina sólo UNA de las cuatro líneas A/D. Si se
desea una conversión simultánea de todas las líneas, se debe hacer ANDing de
“PortByte” con 1, 2, 4 y 8 mientras se cuenta durante el estado HIGH de cada
una.
Enigmaelectronica
Robotics - Computer Control
SOFTWARE
Software de Prueba:
En este Kit se incluye un cierto número de programas escritos en Pascal que
ilustran varias técnicas de decodificación (vea en la página 25 una lista de de los
programas incluidos en este Kit)
Mike Leishman de Balga SHS ha escrito una rutina en Assembler para resolver
este problema a los usuarios de Pascal. Para usarla, el archivo “ADA.OBJ” debe
estar en la disquetera “A”.
Esta rutina fue escrita como una “función”, que puede ser llamada en cualquier
momento desde un programa. La función está definida como “ADADCODE” y
es declarada en la forma mostrada a continuación.
VariableName := ADADCODE(Num)
Line1Value := ADADCODE(1);
ULTIMA HORA: A Pascal 5.5 no le gusta la forma del archivo OBJ. Compile
Enigmaelectronica
Robotics - Computer Control
su programa terminado en la versión 5.0
Probando el Software:
Una vez que ha construido su interfaz para el Puerto de Juegos (ver página 9), es
tiempo de probarla.
La aplicación más simple del conversor A/D del Puerto de Juegos es la conexión
de un potenciómetro (resistencia variable) a una de las líneas, como se muestra
abajo:
LINEA D3
PIN 13
POTENCIOMETRO
TIERRA
PIN 4
Si desea experimentar con software listo para usar, se ppueden obtener copias
como parte del la licencia de los manuales de Robótica o podría obtener el
software desde los sitios con licencia para este manual. Vea el Apéndice A para
obtener información más detallada.
Enigmaelectronica
Robotics - Computer Control
Salidas:
Los principios utilizados para controlar dispositivos externos, utilizando conector
para impresoras “centronics” fueron expuestos en el folleto “ROBOTICA”. Si no
ha leído y digerido las secciones relevantes en ese trabajo, es aconsejable hacerlo
antes de continuar. (Vea el Apéndice A para obtener una copia).
(15 = 1 + 2 + 4 + 8 = 00001111)
La interfaz utilizada para manejar dispositivos tales como motores y luces está
basada en el circuito que se muestra a continuación:
Relé
RL 1
De fuente de
SALIDA
Externa
Enigmaelectronica
Robotics - Computer Control
VOLTAJE
Midiendo voltaje:
Como regla general, jamás debe conectar una fuente de voltaje al computador.
Usando un Optoacoplador
A estas alturas, se debe tener una cierta familiaridad con la opción de medir
resistencias con el Puerto de Juegos y –probablemente- ha estudiado
cuidadosamente el software utilizado para decodificar. Ya que el “foto-transistor”
funcionó tan bien para medir niveles de luz, parece razonable utilizar una suerte
de optoacoplador para convertir voltaje en resistencia.
Enigmaelectronica
Robotics - Computer Control
Al Puerto de
V de entrada Juegos
Voltaje ingresado
Nota: La función del diodo y
el condensador es rectifi car
los voltajes alternos y proveer
una medida de su máximo
valor (Peak Voltage)
Este sistema trabaja razonablemente bien, sin embargo, existen factores críticos
que limitan o alteran su funcionalidad. La intensidad que llega al detector, por
ejemplo, será afectada por la distancia al emisor y la luz ambiental.
Enigmaelectronica
Robotics - Computer Control
Usando el 4N28:
Si fluye mucha corriente por el LED en el interior del 4N28 se destruirá. Como
regla general, si va a usar voltajes que excedan 1,8 volts, use una resistencia
limitadora de corriente.
0 V (Tierra)
Vs − Vf
R=
If
If
Vf = 1,8 Volts
Vf
If = 20 mA (0,02 A)
+Vs
Voltaje Resistencia
(Volts) (Ohms)
6 220
9 390
12 560
24 1200
Enigmaelectronica
Robotics - Computer Control
VOLTAJE
Para usar esta técnica, se debe determinar primero el máximo voltaje que se
aplicará al 4N28 y seleccionar un valor para la resistencia limitadora de corriente
en el LED (ver pág. 23). El ejemplo dado en la página 22 usa una resistencia de
10 Kohm (10.000 Ohm) y ha probado ser útil con voltajes de entrada de hasta 10
Volts. Se puede encontrar el valor adecuado para una determinada aplicación
utilizando cuidadosamente el método de prueba y error. ¡Sólo asegúrese que la
resistencia limitadora no cae bajo los valores dados en la tabla de la página 23!
El circuito dado a continuación puede ser utilizado probar y calibrar las lecturas
obtenidas con el 4N28. Comience con unos pocos volts y gradualmente aumente
el potencial aplicado a través de los pins 1 y 2.
Al Puerto de Juegos
Resistencia limitadora
Enigmaelectronica
Robotics - Computer Control
Circuitos
Software:
Con este Kit se entregan algunos “paquetes” de software. Siéntanse en libertad de
modificarlos para sus propios requerimientos. El más simple de ellos detecta el
estado ON/OFF (Activo/Inactivo) de una de las líneas con interruptores en el
Puerto de Juegos. rovided with this 'Kit'. Feel free to modify them for your own
requirements. La decodificación de las “líneas resistivas” requiere rutinas mucho
más rápidas, como ADADCODE de Mike Leishman, que usa una función escrita
en Assembler requerida por el programa principal. Mike se siente feliz de que
usemos su rutina, pero sería apropiado reconocer sus esfuerzos cuando sea
utilizada.
Una vez que se dominen las técnicas de lectura de datos vía Puerto de Juegos, el
siguiente paso es almacenar y presentar la información para usarla en la sala de
clases. Este libro es acompañado por un diskette con programas de muestra que
enseñan técnicas para guardar datos en “estructuras de datos” (arrays), desplegar
los datos directamente en pantalla, en forma gráfica o como obtener “copias
duras” impresas.
Enigmaelectronica
Robotics - Computer Control
Circuitos
Conecte un fototransistor FPT100 entre tierra y una de las líneas A/D del Puerto
de Juegos y use ADADCODE para leer los cambios de resistencia concomitantes
con los cambios de luz.
Al Puerto de Juegos
Vista Inferior
Tierra (Pin 1)
Nota: Se puede conectar una resi stencia entre base y emisor para
reducir la “ganancia” (sensibilidad)
Circuitos
¿Análisis Espectral? -
Enigmaelectronica
Robotics - Computer Control
Lámpara U/V
Al Puerto de Juegos
Al Puerto de Juegos
Filtro U/V
Material de prueba
Una vez más, este experimento sólo proveerá lecturas relativas, pero esto será tan
significativo para los estudiantes como el uso de unidades técnicas absolutas.
Enigmaelectronica
Robotics - Computer Control
respuesta de los sensores y con ello, hacerse de un simple “Analizador de
Espectros”, donde la resistencia del fototransistor dependerá del tipo de filtro y la
clase de fuente luz utilizados.
(Recuerde que la lógica de los filtros de colores están diseñados para dejar pasar
la luz de ese color y no para bloquearla.)
Análisis
Espectral
Luz Roja
Medición de Turbidez -
Hemos visto aplicaciones simples del fototransistor, pero ¿qué tal si lo aplicamos
a experimentos de Química?
Se podría, por ejemplo, usar esta técnica para controlar el tiempo de la reacción
de Tiosulfato de Sodio y Acido Clohídrico.
Enigmaelectronica
Robotics - Computer Control
Turbidez
Al Puerto de Juegos
Si alguna vez han mirado el interior de uno de esos costosos Kits para Prueba de
Agua, probablemente han descubierto que consisten de una fuente de luz y un
fotosensor, muy parecido a nuestro equipo experimental.
Detección de Sonido
En su trabajo relacionado con la interfaz del Puerto de Juegos del computador
Apple, Richard Walding sugiere el uso de este circuito para detectar “nodos” en
experimentos de sonido usando columnas de aire. (Ver Apéndice A, para más
información sobre el trabajo de Richard)
Los micrófonos "Electret" pueden variar en precios, pero los hay desde $1.500 o
menos. También hay de distintos tipos, pero la mayoría de los que venden en el
comercio son apropiados. La información que sigue basta para comenzar a
trabajar.
Enigmaelectronica
Robotics - Computer Control
DETECTANDO SONIDO
Micrófono Electret
Salida al
4N28
Tierra
Vista inferior
NOTA: Se puede utilizar la línea de 5 Volts del Puerto de Juegos para energizar
este circuito. Conecte, además, la Tierra (Ground) de este circuito a la tierra del
computador Y la tierra del circuito con el 4N28
Cambios de Temperatura:
El método más simple para leer temperatura es usar un “Termistor”. Las
variedades más comunes son las de 1 Kohm y 10 Kohm, y cuestan menos de
$1000.
Enigmaelectronica
Robotics - Computer Control
Medición de Temperatura
Enigmaelectronica
Robotics - Computer Control
Salida
Detector de Flujo
Di sparador
Amplificador Tierra
de Schmidtt
Operacional
Lado marcado
Al Computador
Tierra
Para mis experimentos usé una barra magnética “Alnico”, del tipo incluido en los
Kits de Ciencias para colegios. Cuando el polo Sur del imán se acerca a la cara
marcada del IC su salida cambia de High a Low. De acuerdo a las
especificaciones del IC, éste responde hasta frecuencias de excitación de 100
KHz.
Enigmaelectronica
Robotics - Computer Control
ingresados en un contador. En una aplicación de esta naturaleza la pequeña
distancia requerida no es un problema. Sin embargo el diseñador debe asegurarse
que el eje no oscile, al menos durante condiciones normales de operación.
Motor Eléctrico
Imanes
Tubo de Vidrio
Péndulo con un
Imán
Parada
Por supuesto, el computador puede programarse para realizar todos los cálculos
necesarios y, simplemente, entregar los resultados de tiempos, cambios de
momentum, etc. a los estudiantes, pero es discutible si esto lleva a una mejor
comprensión de la Física involucrada.
N. del T. En países del tercer mundo y aquellos en vías de desarrollo que aún son
usuarios del conocimiento y la tecnología, puede ciertamente cambiar su
percepción del computador como instrumento dispensador de información,
entretención y algunos programas que facilitan ciertas tareas y convertirlo en un
versátil y maravilloso instrumento de exploración del mundo circundante, junto
con estimularlo para explorar avenidas de la imaginación conducentes a la
creación de tecnologías, rompiendo el rol de usuarios.
Un Típico Air-track -
Al Puerto de Juegos
Fotosensores
Al Puerto de Juegos
Enigmaelectronica
Robotics - Computer Control
Intervalos de Tiempo
Al Puerto de Juegos
Al Puerto de Juegos
En este caso, proporcionará información acerca del tiempo que cada sensor está
“activado” y los intervalos entre eventos. Se requiere algún trabajo de calibración
Enigmaelectronica
Robotics - Computer Control
y manipulación de los datos, pero al menos sirve para comenzar.
Es una tarea simple establecer un ciclo de conteo para determinar el tiempo que
un interruptor permanece cerrado. Esta técnica puede ser utilizada, por ejemplo,
con el “Air Track” para determinar la velocidad de una “tarjeta” de longitud
conocida.
Distancia
Al Puerto de Juegos
Tiempo “Cerrado”
Distancia
Velocidad =
Tiempo (cerrado )
Duration Timing
Una vez que se sabe cuanto tiempo la línea D4 ha estado Low, el cálculo de la
velocidad del deslizador es muy simple.
Enigmaelectronica
Robotics - Computer Control
APENDICE B
Los diagramas para todas las interfaces en este folleto están dibujados a escala,
dos veces el tamaño real. Para producir el diagrama a tamaño real, use la opción
“Reducción al 50%” del menú "Configurar Página..."
Fabricación de PCBs
ATENCIÓN - ¡¡La solución corrosiva no debe ser usada por los estudiantes!!
Para prototipos pequeños se puede usar Veroboard. Estos son tiras de cobre pre-
perforado pegado subre un sustrato aislante. Pero tenga cuidado, encontrar fallas
en circuitos complejos producidos de esta manera, puede ser una verdadera
pesadilla.
Un bloque de 10 terminales se adquiere por un bajo precio en las casas del ramo.
Enigmaelectronica
Robotics - Computer Control
Se puede usar una tira completa para conectar un cierto número de componentes
al mismo tiempo o cortarlo en subunidades para conectar los componentes
individualmente.
Interruptor
Al Puerto de Juegos
Al Puerto de Juegos
Enigmaelectronica
Robotics - Computer Control
APENDICE C
Resorte
Interruptor “Reed”
Expansión/Contracción
Potenciómetro lineal
Barra Metálica
Al Puerto de Juegos
Calor
Enigmaelectronica
Robotics - Computer Control
Velocidad:
Potenciómetro de 10 vueltas
Al Puerto de Juegos
Mesa
Peso
Enigmaelectronica