Tutorial.ArduinoSoftwareRS232 History

Hide minor edits - Show changes to markup

June 05, 2010, at 10:20 AM by Equipo Traduccion -
Changed lines 59-60 from:

Ahora escribiremos el código para habilitar la comunicación serie. Este programa simplemente esperará un carácter que llegará por el puerto serie, luego lo transmite de vuelta en mayúsculas por el puerto serie. Esta es una buen programa general para comprobar el puerto serie, deberías ser capaz de extrapolarlo para cubrir tus necesidades de puerto serie. Carga el siguiente código en la placa Arduino:

to:

Ahora escribiremos el código para habilitar la comunicación serie. Este programa simplemente esperará un carácter que llegará por el puerto serie, luego lo transmite de vuelta en mayúsculas por el puerto serie. Este es un buen programa general para comprobar el puerto serie, deberías ser capaz de extrapolarlo para cubrir tus necesidades de puerto serie. Carga el siguiente código en la placa Arduino:

June 05, 2010, at 09:35 AM by Equipo Traduccion -
Changed lines 37-38 from:

(Diagrama de pines del conector serie DB9

to:

(Diagrama de pines del conector serie DB9)

June 05, 2010, at 09:33 AM by Equipo Traduccion -
Changed lines 2-3 from:

En este tutorial vas a aprender como comunicarte con un ordenador usando un circuito de adaptación RS-232 de un sólo canal (MAX3323) y una conexión serie por software en el Arduino. Un tutorial general sobre Software Serial se puede ver Aquí.

to:

En este tutorial vas a aprender como comunicarte con un ordenador usando un circuito de adaptación RS-232 de un sólo canal (MAX3323) y una conexión serie por software en el Arduino. Un tutorial general sobre Puerto serie por Software se puede ver Aquí.

June 05, 2010, at 09:32 AM by Equipo Traduccion -
Changed lines 132-135 from:

Abre tu programa terminal de puerto serie y configuralo a 9600 baudios, 8 bits de datos, 1 bit de stop, sin paridad y sin control de flujo. Pulsa el botón de reset de Arduino. La palabra "hi" debería aparecer en la ventana del terminal seguida de un

Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by an advancement to the next line. Here is a shot of what it should look like in Hyperterminal, the free pre-installed windows terminal application.

to:

Abre tu programa terminal de puerto serie y configuralo a 9600 baudios, 8 bits de datos, 1 bit de stop, sin paridad y sin control de flujo. Pulsa el botón de reset de Arduino. La palabra "hi" debería aparecer en la ventana del terminal seguida de un retorno de carro (CR). Aquí puedes ver una imagen del aspecto del Hyperterminal, la aplicación terminal gratuita preinstalada en windows.

Changed lines 136-137 from:

Now, try typing a lowercase character into the terminal window. You should see the letter you typed return to you in uppercase.

to:

Ahora prueba a teclear un carácter en minúscula en la ventana del terminal. Deberías ver las letras que has tecleado devueltas en mayúsculas.

Changed lines 140-142 from:

If this works, congratulations! Your serial connection is working as planned. You can now use your new serial/computer connection to print debugging statements from your code, and to send commands to your microcontroller.

code and tutorial by Heather Dewey-Hagborg, photos by Thomas Dexter

to:

Si esto funciona, enhorabuena! tu conexión serie esta funcionada tal como querías. Ahora puedes usar tu nueva conexión serie con el ordenador para envíar estados de depuración de tu código, y envíar comandos a tu microcontrolador.

Código y tutorial de Heather Dewey-Hagborg, fotos de Thomas Dexter

June 05, 2010, at 09:23 AM by Equipo Traduccion -
Changed lines 52-54 from:

Connect the TX line from your computer to pin 8 (R1IN) on the MAX233 and the RX line to pin 7 (T1OUT). Connect the ground line from your computer to ground on the breadboard.

to:

Conecta la línea TX de tu ordenador al pin 8 (R1IN) del MAX3323 y la línea RX al pin 7 (T1OUT). Conecta la lína de tierra (GND) de tu ordenador a la tierra de la placa de entrenamiento.

Changed lines 55-60 from:

TX wires Green, RX wires Blue, +5v wires are red, GND wires are black

Program the Arduino

Now we will write the code to enable serial data communication. This program will simply wait for a character to arrive in the serial recieving port and then spit it back out in uppercase out the transmit port. This is a good general purpose serial debugging program and you should be able to extrapolate from this example to cover all your basic serial needs. Upload the following code into the Arduino microcontroller module:

to:

Cable TX Verde, cable RX azul, cables +5V rojos, cables GND negros

Programar el Arduino

Ahora escribiremos el código para habilitar la comunicación serie. Este programa simplemente esperará un carácter que llegará por el puerto serie, luego lo transmite de vuelta en mayúsculas por el puerto serie. Esta es una buen programa general para comprobar el puerto serie, deberías ser capaz de extrapolarlo para cubrir tus necesidades de puerto serie. Carga el siguiente código en la placa Arduino:

Added lines 132-133:

Abre tu programa terminal de puerto serie y configuralo a 9600 baudios, 8 bits de datos, 1 bit de stop, sin paridad y sin control de flujo. Pulsa el botón de reset de Arduino. La palabra "hi" debería aparecer en la ventana del terminal seguida de un

June 04, 2010, at 07:26 PM by Equipo Traduccion -
Changed lines 48-55 from:

Connect pins 1 and 6 to pin 4 and pin 7 to pin 8. Heatshrink the wire connections to avoid accidental shorts.

Enclose the connector in a backshell to further protect the signal and enable easy unplugging from your serial port.

to:

Tapa el conector con una cacasa metálica para proteger la señal y permitir la conexión fácil a tu puerto serie.

Changed lines 51-52 from:
to:

June 04, 2010, at 07:23 PM by Equipo Traduccion -
Changed line 7 from:
  • Cable serie **************
to:
  • Cable serie que permita conectar un extremo a la placa de entrenamiento
Changed lines 39-42 from:

Si no tienes uno hecho, necesitas hacer un cable para conectar el puerto serie (o adaptador USB-Serie) de tu ordenador a la placa de entrenamiento. Para esto, coje un conector DB9 de radioshack.


If you do not have one already, you need to make a cable to connect from the serial port (or USB-serial adapter) on your computer and the breadboard. To do this, pick up a female DB9 connector from radioshack. Pick three different colors of wire, one for TX, one for RX, and one for ground. Solder your TX wire to pin 2 of the DB9 connector, RX wire to pin 3 and Ground to pin 5.

to:

Si no tienes uno hecho, necesitas hacer un cable para conectar el puerto serie (o adaptador USB-Serie) de tu ordenador a la placa de entrenamiento. Para esto, coje un conector DB9 de radioshack. Elige tres colores diferentes de cable, uno para TX, uno para RX y otro para tierra (GND). Suelda el cable TX al pin 2 del conector DB9, el cable RX al pin 3 y GND al pin 5.

Changed lines 43-44 from:

Connect pins 1 and 6 to pin 4 and pin 7 to pin 8. Heatshrink the wire connections to avoid accidental shorts.

to:

Conecta los pines 1 y 6 al pin 4 y el pin 7 al pin 8. Aisla las conexiones de los cables para evitar cortocircuitos accidentales.

Added lines 48-52:

Connect pins 1 and 6 to pin 4 and pin 7 to pin 8. Heatshrink the wire connections to avoid accidental shorts.

June 04, 2010, at 07:17 PM by Equipo Traduccion -
Changed lines 2-17 from:

In this tutorial you will learn how to communicate with a computer using a MAX3323 single channel RS-232 driver/receiver and a software serial connection on the Arduino. A general purpose software serial tutorial can be found here.

Materials needed:

  • Computer with a terminal program installed (ie. HyperTerminal or RealTerm on the PC, Zterm on Mac)
  • Serial-Breadboard cable
  • MAX3323 chip (or similar)
  • 4 1uf capacitors
  • Solderless breadboard
  • Hookup wire
  • Arduino Microcontroller Module
  • Light emitting Diode (LED) - optional, for debugging

Prepare the breadboard

to:

En este tutorial vas a aprender como comunicarte con un ordenador usando un circuito de adaptación RS-232 de un sólo canal (MAX3323) y una conexión serie por software en el Arduino. Un tutorial general sobre Software Serial se puede ver Aquí.

Material necesario:

  • Ordenador con un programa terminal instalado (Hyperterminal o RealTerm en PC, Zterm en Mac, Cutecom en Linux)
  • Cable serie **************
  • Chip MAX3323 (o similar)
  • 4 condensadores de i uF
  • Placa de entrenamiento
  • Cables
  • Placa Arduino
  • LED - opcional, para debug.

Prepara la placa

Changed lines 19-20 from:

Insert the MAX3323 chip in the breadboard. Connect 5V power and ground from the breadboard to 5V power and ground from the microcontroller. Connect pin 15 on the MAX233 chip to ground and pins 16 and 14 - 11 to 5V. If you are using an LED connect it between pin 13 and ground.

to:

Conecta el chip MAX3323 en la placa de entrenamiento. Conecta la alimentación de 5V y tierra (GND) de la placa de entrenamiento a los pines de 5V y GND de Arduino. Conecta el pin 15 del chip MAX3323 a tierra y los pines 16 y 14-11 a 5V. Si estas usando un LED, conéctalo entre el pin 13 y GND.

Changed lines 22-25 from:

+5v wires are red, GND wires are black

Connect a 1uF capacitor across pins 1 and 3, another across pins 4 and 5, another between pin 1 and ground, and the last between pin 6 and ground. If you are using polarized capacitors make sure the negative pins connect to the negative sides (pins 3 and 5 and ground).

to:

Los cables de 5V son rojos, los cables de tierra (GND) son negros

Conecta un condensador de 1 uF entre los pines 1 y 3, otro entre los pines 4 y 5, otro entre el pin 1 y GND y el último entre el pin 6 y GND. Si estás usando condensadores con polaridad asegúrate de que el terminal negativo se conecta a la parte negativa (pines 3 y 5 y GND).

Changed lines 27-30 from:

+5v wires are red, GND wires are black

Determine which Arduino pins you want to use for your transmit (TX) and recieve (RX) lines. In this tutorial we will be using Arduino pin 6 for receiving and pin 7 for transmitting. Connect your TX pin (7) to MAX3323 pin 10 (T1IN). Connect your RX pin (6) to MAX3323 pin 9 (R1OUT).

to:

Los cables de 5V son rojos, los cables de tierra (GND) son negros

Piensa que pines de Arduino quieres usar para tus líneas de transmisión (TX) y recepción (RX). En este tutorial vamos a usar el pin 6 de Arduino para recibir y el pin 7 para transmitir. Conecta tu pin TX (7) al pin 10 del MAX3323 (T1IN). Conecta tu pin RX (6) al pin 9 del MAX3323 (R1OUT)

Changed lines 32-33 from:

TX wire Green, RX wire Blue, +5v wires are red, GND wires are black

to:

Cable TX Verde, cable RX azul, cable 5V rojo, cable GND negro

Changed lines 37-39 from:

(DB9 Serial Connector Pin Diagram)

to:

(Diagrama de pines del conector serie DB9

Si no tienes uno hecho, necesitas hacer un cable para conectar el puerto serie (o adaptador USB-Serie) de tu ordenador a la placa de entrenamiento. Para esto, coje un conector DB9 de radioshack.


September 05, 2006, at 07:56 PM by Heather Dewey-Hagborg -
Changed lines 144-145 from:

code and tutorial by Heather Dewey-Hagborg Photos by Thomas Dexter

to:

code and tutorial by Heather Dewey-Hagborg, photos by Thomas Dexter

September 05, 2006, at 07:56 PM by Heather Dewey-Hagborg -
Added line 144:

code and tutorial by Heather Dewey-Hagborg

August 29, 2006, at 07:07 PM by Heather Dewey-Hagborg -
Changed lines 3-4 from:

In this tutorial you will learn how to communicate with a computer using a MAX3323 single channel RS-232 driver/receiver and a software serial connection on the Arduino. A general purpose software serial tutorial can be found http://www.arduino.cc/en/Tutorial/SoftwareSerial?.

to:

In this tutorial you will learn how to communicate with a computer using a MAX3323 single channel RS-232 driver/receiver and a software serial connection on the Arduino. A general purpose software serial tutorial can be found here.

August 29, 2006, at 07:06 PM by Heather Dewey-Hagborg -
Changed lines 3-4 from:

In this tutorial you will learn how to communicate with a computer using a MAX3323 single channel RS-232 driver/receiver and a software serial connection on the Arduino.

to:

In this tutorial you will learn how to communicate with a computer using a MAX3323 single channel RS-232 driver/receiver and a software serial connection on the Arduino. A general purpose software serial tutorial can be found http://www.arduino.cc/en/Tutorial/SoftwareSerial?.

August 29, 2006, at 07:03 PM by Heather Dewey-Hagborg -
Changed lines 57-58 from:
to:

TX wires Green, RX wires Blue, +5v wires are red, GND wires are black

August 29, 2006, at 07:01 PM by Heather Dewey-Hagborg -
Changed lines 23-24 from:

"+5v wires are red, GND wires are black"

to:

+5v wires are red, GND wires are black

Changed lines 28-29 from:
to:

+5v wires are red, GND wires are black

Changed lines 33-34 from:
to:

TX wire Green, RX wire Blue, +5v wires are red, GND wires are black

August 29, 2006, at 06:59 PM by Heather Dewey-Hagborg -
Changed lines 23-24 from:
to:

"+5v wires are red, GND wires are black"

Changed lines 59-60 from:

Now we will write the code to enable serial data communication. This program will simply wait for a character to arrive in the serial recieving port and then spit it back out in uppercase out the transmit port. This is a good general purpose serial debugging program and you should be able to extrapolate from this example to cover all your basic serial needs. Upload the follwoing code into the Arduino microcontroller module:

to:

Now we will write the code to enable serial data communication. This program will simply wait for a character to arrive in the serial recieving port and then spit it back out in uppercase out the transmit port. This is a good general purpose serial debugging program and you should be able to extrapolate from this example to cover all your basic serial needs. Upload the following code into the Arduino microcontroller module:

August 29, 2006, at 06:55 PM by Heather Dewey-Hagborg -
Changed lines 22-23 from:
to:
Changed lines 26-27 from:
to:
Changed lines 30-31 from:
to:
Changed lines 53-55 from:

to:

August 23, 2006, at 09:09 PM by Heather Dewey-Hagborg -
Added lines 61-64:

//Created August 23 2006 //Heather Dewey-Hagborg //http://www.arduino.cc

August 23, 2006, at 09:05 PM by Heather Dewey-Hagborg -
Changed lines 135-137 from:

If this works, congratulations! Your serial connection is working as planned. You can now use your new serial/computer connection to print debugging statements from your code, and to send commands to your microcontroller.

to:

If this works, congratulations! Your serial connection is working as planned. You can now use your new serial/computer connection to print debugging statements from your code, and to send commands to your microcontroller.

Photos by Thomas Dexter

August 23, 2006, at 09:03 PM by Heather Dewey-Hagborg -
Changed lines 35-36 from:

DB9 Serial Connector Pin Diagram

to:

(DB9 Serial Connector Pin Diagram)

August 23, 2006, at 09:02 PM by Heather Dewey-Hagborg -
Changed lines 32-33 from:

Cables

to:

Cables

Changed lines 35-36 from:

("DB9 Serial Connector Pins")

to:

DB9 Serial Connector Pin Diagram

Changed lines 55-56 from:

Program the Arduino

to:

Program the Arduino

August 23, 2006, at 09:00 PM by Heather Dewey-Hagborg -
Added lines 34-36:

("DB9 Serial Connector Pins")

Deleted lines 48-51:

August 23, 2006, at 08:58 PM by Heather Dewey-Hagborg -
Added lines 43-44:
Added line 48:
Added line 55:
August 23, 2006, at 08:55 PM by Heather Dewey-Hagborg -
Changed lines 22-23 from:

PICTURE

to:
Changed lines 26-27 from:

PICTURE

to:
Changed lines 30-31 from:

PICTURE

to:
Changed lines 48-52 from:

Connect the TX line from your computer to pin 8 (R1IN) on the MAX233 and the RX line to pin 7 (T1OUT).

PICTURE

to:

Connect the TX line from your computer to pin 8 (R1IN) on the MAX233 and the RX line to pin 7 (T1OUT). Connect the ground line from your computer to ground on the breadboard.

August 23, 2006, at 08:11 PM by Heather Dewey-Hagborg -
Changed lines 20-21 from:

Insert the MAX3323 chip in the breadboard. Connect 5V power and ground from the breadboard to 5V power and ground from the microcontroller. Connect pin 15 on the MAX233 chip to ground and pins 16 and 14 - 11 to 5V. Connect a 1uF capacitor across pins 1 and 3, another across pins 4 and 5, another between pin 1 and ground, and the last between pin 6 and ground. If you are using polarized capacitors make sure the negative pins connect to the negative sides (pins 3 and 5 and ground).

to:

Insert the MAX3323 chip in the breadboard. Connect 5V power and ground from the breadboard to 5V power and ground from the microcontroller. Connect pin 15 on the MAX233 chip to ground and pins 16 and 14 - 11 to 5V. If you are using an LED connect it between pin 13 and ground.

Added lines 24-27:

Connect a 1uF capacitor across pins 1 and 3, another across pins 4 and 5, another between pin 1 and ground, and the last between pin 6 and ground. If you are using polarized capacitors make sure the negative pins connect to the negative sides (pins 3 and 5 and ground).

PICTURE

August 23, 2006, at 08:01 PM by Heather Dewey-Hagborg -
Changed lines 3-4 from:

In this tutorial you will learn how to communicate with a computer using a MAX233 multichannel RS-232 driver/receiver and a software serial connection on the Arduino.

to:

In this tutorial you will learn how to communicate with a computer using a MAX3323 single channel RS-232 driver/receiver and a software serial connection on the Arduino.

Changed lines 9-10 from:
  • MAX233 chip (or similar)
  • 1uf polarized capacitor
to:
  • MAX3323 chip (or similar)
  • 4 1uf capacitors
Changed lines 18-21 from:

Insert the MAX233 chip in the breadboard. Connect 5V power and ground from the breadboard to 5V power and ground from the microcontroller. Connect pin 6 and pin 9 on the MAX233 chip to ground and pin 7 to 5V. Connect the 1uF capacitor across pins 6 and 7 so that the negative pin connects to pin 6 and the positive pin to pin 7. Connect pin 10 to pin 16 pin 11 to pin 15 and pin 12 to pin 17 on the breadboard.

to:

Insert the MAX3323 chip in the breadboard. Connect 5V power and ground from the breadboard to 5V power and ground from the microcontroller. Connect pin 15 on the MAX233 chip to ground and pins 16 and 14 - 11 to 5V. Connect a 1uF capacitor across pins 1 and 3, another across pins 4 and 5, another between pin 1 and ground, and the last between pin 6 and ground. If you are using polarized capacitors make sure the negative pins connect to the negative sides (pins 3 and 5 and ground).

Changed lines 24-27 from:

The MAX233 chip has two sets of RS-232 line shifters built in and can handle two simultaneous duplex serial ports. For the purposes of this tutorial we will only being using one port, with corresponding pins referred to as T1IN, T1OUT, R1IN and R1OUT in the MAX233 schematic.

Determine which Arduino pins you want to use for your transmit (TX) and recieve (RX) lines. In this tutorial we will be using Arduino pin 6 for receiving and pin 7 for transmitting. Connect your TX pin (7) to MAX233 pin 2 (T1IN). Connect your RX pin (6) to MAX233 pin 3 (R1OUT).

to:

Determine which Arduino pins you want to use for your transmit (TX) and recieve (RX) lines. In this tutorial we will be using Arduino pin 6 for receiving and pin 7 for transmitting. Connect your TX pin (7) to MAX3323 pin 10 (T1IN). Connect your RX pin (6) to MAX3323 pin 9 (R1OUT).

Changed lines 44-45 from:

Connect the TX line from your computer to pin 4 (R1IN) on the MAX233 and the RX line to pin 5 (T1OUT).

to:

Connect the TX line from your computer to pin 8 (R1IN) on the MAX233 and the RX line to pin 7 (T1OUT).

August 17, 2006, at 08:06 PM by Heather Dewey-Hagborg -
August 17, 2006, at 08:05 PM by Heather Dewey-Hagborg -
Changed lines 32-34 from:

If you do not have one already, you need to make a cable to connect from the serial port (or USB-serial adapter) on your computer and the breadboard. To do this, pick up a female DB9 connector from radioshack. Pick three different colors of wire, one for TX, one for RX, and one for ground. Solder your TX wire to pin 2 of the DB9 connector, RX wire to pin 3 and Ground to pin 5. Connect pins 1 and 6 to pin 4 and pin 7 to pin 8. Heatshrink the wire connections to avoid accidental shorts. Enclose the connector in a backshell to further protect the signal and enable easy unplugging from your serial port.

to:

If you do not have one already, you need to make a cable to connect from the serial port (or USB-serial adapter) on your computer and the breadboard. To do this, pick up a female DB9 connector from radioshack. Pick three different colors of wire, one for TX, one for RX, and one for ground. Solder your TX wire to pin 2 of the DB9 connector, RX wire to pin 3 and Ground to pin 5.

Added lines 35-37:

Connect pins 1 and 6 to pin 4 and pin 7 to pin 8. Heatshrink the wire connections to avoid accidental shorts.

Added lines 39-40:

Enclose the connector in a backshell to further protect the signal and enable easy unplugging from your serial port.

Changed lines 42-44 from:

PICTURE in back shell

to:

August 17, 2006, at 08:02 PM by Heather Dewey-Hagborg -
Added lines 30-31:

Cables

Changed lines 35-36 from:

PICTURE connector soldered,

to:
August 17, 2006, at 08:01 PM by Heather Dewey-Hagborg -
Changed lines 34-35 from:

PICTURE connector soldered, in back shell

to:

PICTURE connector soldered, PICTURE in back shell

August 17, 2006, at 05:45 PM by Heather Dewey-Hagborg -
Changed lines 112-113 from:

Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by a line feed character and/or an advancement to the next line. Here are two shots of what it might look like, one in Hyperterminal the free pre-installed windows terminal application, and one in Realterm, another free application with more advanced options.

to:

Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by an advancement to the next line. Here is a shot of what it should look like in Hyperterminal, the free pre-installed windows terminal application.

Changed lines 115-116 from:
to:
August 17, 2006, at 05:43 PM by Heather Dewey-Hagborg -
Changed lines 112-113 from:

Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by a line feed character and/or an advancement to the next line. Here are two shots of what it might look like, one in Hyperterminal the free pre-installed windows terminal application, and one in Realterm, another free application with more options.

to:

Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by a line feed character and/or an advancement to the next line. Here are two shots of what it might look like, one in Hyperterminal the free pre-installed windows terminal application, and one in Realterm, another free application with more advanced options.

Added lines 117-121:

Now, try typing a lowercase character into the terminal window. You should see the letter you typed return to you in uppercase.

If this works, congratulations! Your serial connection is working as planned. You can now use your new serial/computer connection to print debugging statements from your code, and to send commands to your microcontroller.

August 17, 2006, at 05:26 PM by Heather Dewey-Hagborg -
Changed lines 112-116 from:

Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by a line feed character and an advancement to the next line.

to:

Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by a line feed character and/or an advancement to the next line. Here are two shots of what it might look like, one in Hyperterminal the free pre-installed windows terminal application, and one in Realterm, another free application with more options.

August 17, 2006, at 05:19 PM by Heather Dewey-Hagborg -
Changed line 34 from:

PICTURE connector soldered

to:

PICTURE connector soldered, in back shell

Changed lines 110-112 from:

@]

to:

@]

Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by a line feed character and an advancement to the next line.

August 17, 2006, at 05:02 PM by Heather Dewey-Hagborg -
Changed lines 30-31 from:

If you do not have one already, you need to make a cable to connect from the serial port (or USB-serial adapter) on your computer and the breadboard. To do this, pick up a female DB9 connector from radioshack. Pick three different colors of wire, one for TX, one for RX, and one for ground. Solder your TX wire to pin 2 of the DB9 connector, RX wire to pin 3 and Ground to pin 5. Connect pins 1 and 6 to pin 4 and pin 7 to pin 8. Heatshrink the wire connections to avoid accidental shorts.

to:

If you do not have one already, you need to make a cable to connect from the serial port (or USB-serial adapter) on your computer and the breadboard. To do this, pick up a female DB9 connector from radioshack. Pick three different colors of wire, one for TX, one for RX, and one for ground. Solder your TX wire to pin 2 of the DB9 connector, RX wire to pin 3 and Ground to pin 5. Connect pins 1 and 6 to pin 4 and pin 7 to pin 8. Heatshrink the wire connections to avoid accidental shorts. Enclose the connector in a backshell to further protect the signal and enable easy unplugging from your serial port.

August 17, 2006, at 05:01 PM by Heather Dewey-Hagborg -
Changed line 9 from:
  • MAX233 chip
to:
  • MAX233 chip (or similar)
Added lines 40-110:

Program the Arduino

Now we will write the code to enable serial data communication. This program will simply wait for a character to arrive in the serial recieving port and then spit it back out in uppercase out the transmit port. This is a good general purpose serial debugging program and you should be able to extrapolate from this example to cover all your basic serial needs. Upload the follwoing code into the Arduino microcontroller module:

#include <ctype.h>

#define bit9600Delay 84  
#define halfBit9600Delay 42
#define bit4800Delay 188 
#define halfBit4800Delay 94 

byte rx = 6;
byte tx = 7;
byte SWval;

void setup() {
  pinMode(rx,INPUT);
  pinMode(tx,OUTPUT);
  digitalWrite(tx,HIGH);
  digitalWrite(13,HIGH); //turn on debugging LED
  SWprint('h');  //debugging hello
  SWprint('i');
  SWprint(10); //carriage return
}

void SWprint(int data)
{
  byte mask;
  //startbit
  digitalWrite(tx,LOW);
  delayMicroseconds(bit9600Delay);
  for (mask = 0x01; mask>0; mask <<= 1) {
    if (data & mask){ // choose bit
     digitalWrite(tx,HIGH); // send 1
    }
    else{
     digitalWrite(tx,LOW); // send 0
    }
    delayMicroseconds(bit9600Delay);
  }
  //stop bit
  digitalWrite(tx, HIGH);
  delayMicroseconds(bit9600Delay);
}

int SWread()
{
  byte val = 0;
  while (digitalRead(rx));
  //wait for start bit
  if (digitalRead(rx) == LOW) {
    delayMicroseconds(halfBit9600Delay);
    for (int offset = 0; offset < 8; offset++) {
     delayMicroseconds(bit9600Delay);
     val |= digitalRead(rx) << offset;
    }
    //wait for stop bit + extra
    delayMicroseconds(bit9600Delay); 
    delayMicroseconds(bit9600Delay);
    return val;
  }
}

void loop()
{
    SWval = SWread(); 
    SWprint(toupper(SWval));
}

August 15, 2006, at 11:37 PM by Heather Dewey-Hagborg -
Changed lines 30-31 from:

If you do not have one already, you need to make a cable to connect from the serial port (or USB-serial adapter) on your computer and the breadboard. Instructions for doing this can be found .

to:

If you do not have one already, you need to make a cable to connect from the serial port (or USB-serial adapter) on your computer and the breadboard. To do this, pick up a female DB9 connector from radioshack. Pick three different colors of wire, one for TX, one for RX, and one for ground. Solder your TX wire to pin 2 of the DB9 connector, RX wire to pin 3 and Ground to pin 5. Connect pins 1 and 6 to pin 4 and pin 7 to pin 8. Heatshrink the wire connections to avoid accidental shorts.

PICTURE connector soldered

August 15, 2006, at 11:17 PM by Heather Dewey-Hagborg -
Changed lines 18-19 from:
to:
August 15, 2006, at 10:53 PM by Heather Dewey-Hagborg -
Changed lines 22-23 from:
to:

PICTURE

Changed lines 28-29 from:
to:

PICTURE

Added lines 32-35:

Connect the TX line from your computer to pin 4 (R1IN) on the MAX233 and the RX line to pin 5 (T1OUT).

PICTURE

August 15, 2006, at 10:49 PM by Heather Dewey-Hagborg -
Added line 6:
Added line 8:
  • Serial-Breadboard cable
Changed lines 14-31 from:
  • Light emitting Diode (LED) - optional, for debugging
to:
  • Light emitting Diode (LED) - optional, for debugging

Prepare the breadboard

Insert the MAX233 chip in the breadboard. Connect 5V power and ground from the breadboard to 5V power and ground from the microcontroller. Connect pin 6 and pin 9 on the MAX233 chip to ground and pin 7 to 5V. Connect the 1uF capacitor across pins 6 and 7 so that the negative pin connects to pin 6 and the positive pin to pin 7. Connect pin 10 to pin 16 pin 11 to pin 15 and pin 12 to pin 17 on the breadboard.

Attach:rs232pwr_web.jpg Δ

The MAX233 chip has two sets of RS-232 line shifters built in and can handle two simultaneous duplex serial ports. For the purposes of this tutorial we will only being using one port, with corresponding pins referred to as T1IN, T1OUT, R1IN and R1OUT in the MAX233 schematic.

Determine which Arduino pins you want to use for your transmit (TX) and recieve (RX) lines. In this tutorial we will be using Arduino pin 6 for receiving and pin 7 for transmitting. Connect your TX pin (7) to MAX233 pin 2 (T1IN). Connect your RX pin (6) to MAX233 pin 3 (R1OUT).

Attach:rs232ttl_web.jpg Δ

If you do not have one already, you need to make a cable to connect from the serial port (or USB-serial adapter) on your computer and the breadboard. Instructions for doing this can be found .

August 15, 2006, at 10:23 PM by Heather Dewey-Hagborg -
Changed lines 6-13 from:
    * Computer with a terminal program installed (ie. HyperTerminal or RealTerm on the PC, Zterm on Mac)
    * MAX233 chip 
    * 1uf polarized capacitor
    * Solderless breadboard
    * Hookup wire
    * Arduino Microcontroller Module
    * Light emitting Diode (LED) - optional, for debugging
to:
  • Computer with a terminal program installed (ie. HyperTerminal or RealTerm on the PC, Zterm on Mac)
  • MAX233 chip
  • 1uf polarized capacitor
  • Solderless breadboard
  • Hookup wire
  • Arduino Microcontroller Module
  • Light emitting Diode (LED) - optional, for debugging
August 15, 2006, at 10:22 PM by Heather Dewey-Hagborg -
Added lines 1-13:

RS-232

In this tutorial you will learn how to communicate with a computer using a MAX233 multichannel RS-232 driver/receiver and a software serial connection on the Arduino.

Materials needed:

    * Computer with a terminal program installed (ie. HyperTerminal or RealTerm on the PC, Zterm on Mac)
    * MAX233 chip 
    * 1uf polarized capacitor
    * Solderless breadboard
    * Hookup wire
    * Arduino Microcontroller Module
    * Light emitting Diode (LED) - optional, for debugging 

Share