Connecting your computer to a Robot – Serial/USB Connection

There are a several reasons you may want to connect your computer to your robot.  At the very least you can use the connection to send programs to the robot that you have stored on your computer.  For robots that have built-in BASIC your system will become the screen and keyboard for the microcomputer brain in the robot. With the connection established you can work interactively with BASIC to develop programs.  On a PC running Windows I usually use HyperTerminal but any serial terminal package can be used.  On Linux systems minicom is an option.

Although some newer robots may use a USB connection, most older robots will use an RS-232 Serial port to connect the robot to a computer.   In particular the HERO robots (1, Jr, 2000, and Arm trainer) all use a serial connection to connect to host computer.   Most computers used to have a serial port but lately those have been dropped and you’ll find only USB ports on new systems and will need a USB to Serial adapter.

The HERO 2000 and Arm trainer base both came standard with a 25-pin Serial port that normally used 9600 baud, 8 data bits, no parity, 1 stop bit, no flow control.  The Serial port was an option on kit built HERO Jr robots but came standard on all factory built units.  The HERO Jr serial port is normally set to use 9600 baud, 7 data bits, even parity, 1 stop bit, no flow control.  The HERO 1 robot used a small adapter board that plugs into the breadboard area on the head for Serial support.  There is also an optional USB interface now that can take its place and acts just like a Serial port once plugged in.  The serial parameters for the HERO 1 are 9600 baud, 7 data bits, even parity, 1 stop bit, no flow control.  Depending on your configuration you may need to use 9600 baud, 7 data bits, no parity, 1 stop bit, no flow control for the HERO 1.  Depending up if you are using a USB to Serial adapter you may need to adjust the settings for your specific configuration.  A simple chart that shows the serial parameters for each robot.

  • HERO 1 – (9600, 7, N, 1) or (9600, 7, E, 1)
  • HERO Jr – (9600, 7, E,1)
  • HERO 2000 – (9600, 8, N, 1)
  • Arm Trainer – (9600, 8, N, 1)
It is important to note there is no flow control used.  None of the hardware handshaking signals or even XON/XOFF protocol in use to tell either device that the receiving end needs a moment to catch up.  This is why we will end up tweaking a couple of the ASCII file transfer settings to throttle the communications a bit to ensure that the robot won’t miss a character.  The end of line delay can be important for many systems and particularly BASIC.  Whenever you enter a line of BASIC code many versions of BASIC will take extra time to tokenize the code before storing it into memory.  Adding an end of line delay can give the target system (robot in this case) time to process the data and get ready for the next line.

Connecting your computer to the robot

If your computer has an available COM port with a DB-9 connector then all you need is a standard external modem cable.  If you have a null modem (or other odd cable) the pinout will be different and it won’t work.  An example of cables that would work:

If your computer doesn’t have a COM port available (most newer systems dropped them) then you’ll need to get a USB to serial adapter.  There are a few different chipsets used to convert the USB to a serial port.  Common ones are FTDI, Silicon labs, and Prolifix.  I tend to use adapters based on the FTDI chipset and have the best luck with those.  When you plug one of these adapters into your computer it will show up as a COM port and act like the old built-in COM ports.  The new COM port that would be higher than any of the #’s you had before.  If that isn’t happening then it isn’t being recognized by your computer.  Either the driver isn’t installed, there is an issue with the USB port on your system, or the cable is defective.  I think some newer systems come with both USB 2.0 and USB 3.0 ports and I as I recall the USB 3.0 ports were supposed to have a blue connector.  If it is in the USB 3.0 port then I would try plugging into a USB 2.0 port.

These USB to serial converter cables usually have a DB-9 at the end for the serial connection which is just like the connector most PC’s had.  With that you can use the serial external modem cable previously mentioned or you can use a small DB-9 to DB-25 adapter.

If you are having trouble making a reliable connection it may help to turn off the FIFO buffers for the serial (COM) port.  It it more important to turn off the FIFO buffer going to the robot than turning off the one for receiving data sent from the robot.  Sometimes the settings for the FIFO buffers are tricky to find.  One way to bring that up is using the Device manager on your computer then go under Ports (COM & LPT) and select the COM port you are interested in.  From there you should see a tab for Port Settings and a button for Advanced settings.  There you should be able to get at those settings and disable the buffer.  If there isn’t a checkbox to disable the buffers you can set them to the lowest value which has the same effect.

Configuring HyperTerminal for use with a Serial connection

If you are running Widows then HyperTerminal works well once configured.  When you create a new connection it may want to force you to enter an area code since this could be used for a dial up modem. All you need to do is enter that and ignore the rest since we’re using a direct connection. First set the COM port settings (Baud rate, Parity, Stop bit, flow control) to match the robot you would like to connect.  Then adjust the ASCII settings which will control how files are sent to the robot.  You can find them under:

File –> Properties –> Settings tab  –> ASCII setup button.

That is where you add a 50ms-100ms line delay and 5ms character delay.  These settings are used when you send an ASCII file to the robot (BASIC listing, S1/S9 binary image, etc) and don’t really matter for receiving from the robot to working interactively with it.  It is more important on the HERO 1 and HERO Jr to help ensure that the robot it ready to receive the next character and won’t lose any.  You can try different settings for better performance as the ones mentioned are a bit conservative.

For HyperTerminal to connect the phone symbol should be active.  If everything is connected right and the settings match (baud rate 9600 baud, 7 data bits, no flow control, etc) then you should see a Wintek BASIC prompt when you start BASIC.

Working with S1/S9 binary images for a HERO 1

On the robot side you enter 3 A to tell the robot to wait for an S19 formatted file to come from a PC through the serial interface.  On HyperTerminal use “Transfer” then Send Text File.  Pick the S19 file on your PC and it will send it to the robot.  As long as you configured the ASCII options to add the character and line delays it should transfer without errors. Once complete the program will be stored in the robots memory.  It will stay there until it is overwritten or you turn off the robot. You can download data to store in the memory of the robot or you can send programs to the robot. If you’ve sent a program then you’ll need to know the entry point (start address of the code) and also if it is a machine language program or it needs to be started in interpreted mode.

To get an image of memory from the robot to the PC you can turn on logging (under Transfer, Capture text) and on the robot use 3 9 then the beginning and ending addresses of the memory area you want to send to the PC.  It will then send up the memory area specified to the PC in the Motorola S1/S9 format.  Once it is complete you can either stop logging and edit that in notepad to use or you can copy it out of the HyperTerminal window.  In some cases the I’ve seen the text get corrupted if you copy it from the HyperTerminal window so you need to double check that if you use that method.

Sending BASIC programs (and bringing them back) uses the same technique.

To send those .h1 files to the robot you just start BASIC on the robot and once you see the BASIC prompt then you can use the transfer file options to send an ASCII file.  On the menu bar you should see an option for “Transfer”. Under that select “Send Text File”. Navigate to the HERO 1 BASIC program you want to send then hit open. Just pick one of the .h1 programs.  The robot can’t tell the difference if you are just an extremely fast typist or your PC is sending the file…

HERO BASIC Programs run on the HERO 1 robot itself.  The only programs you use on the PC is something like notepad for offline editing/cleaning up programs and a Terminal package like HyperTerminal to talk to the robot.  Once you start BASIC on the robot and see the prompt in the terminal screen you can then send an ASCII txt file and select one of those BASIC programs.

Working with the HERO Jr, HERO 2000, and arm trainer work the same way.

The HERO 1 wireless remote and the HERO 2000 Remote console both have serial ports on them but those use different parameters and aren’t covered here.  Eventually I will add details on those as well.  The HERO 1 wireless remote is transmit only to the robot while the HERO 2000 remote console uses a two way link.  It can also act in a pass though mode so it will act like a wireless serial link.

If you have other terminal packages that work well with the robots (I’ve heard TerraTerm is good) please let me know and I can update this page.