HeavyMetal TTY control program

Saturday, 20 November 2010 23:19 Javier Albinarrate
Print

2012-04-08 Note: New version with bugfixes is out, enjoy it!

HeavyMetal is a perl based software with a Tk/Tcl based GUI, which allows your PC (be it Windows or Linux) to interact with a teleprinter (TTY) over the good old RS-232 serial port.

The software allows you to access different internet services, as well as be accessed by different types of clients. We could describe HeavyMetal as a kind of chat/messaging server, with support for many protocols, and above all the ability to interact with these old steel monsters we lovely call TTYs. One basic problem we face with TTYs is the need to feed them with suitable data, as well as the need to impress those who come home showing the top tech from the early XXth century still interacting with all the top tech of the XXIst century...

Diagram



HeavyMetal was developed by Bill Buzbee from 2001 to 2006. You can access his webpage here, where you can get version 1.27

Between May and November 2010, I took the task of entirely rewriting the code into a more expandable codebase, while adding support for sessions and many new cool features. At the same time I kept the GUI more or less as it was.

Now in 2012 I was forced to give another jump due to changes in the ActivePerl distribution (they dropped the Tk extension I was using), so as I had to rewrite pretty much the whole GUI into a new module (Tkx). I obviously took the chance to make many changes that were in the ToDo list.

Version History

HeavyMetal v3.0

HeavyMetal v3.1.000

HeavyMetal v3.1.001

HeavyMetal v3.1.002


HeavyMetal v3.1.003

HeavyMetal v3.1.004 (Being worked right now)

Searching for downloads? Click here.

Screenshots

The window now is tabbed and has all the relevant configuration in several tabs.

Here you can see the main HOST tab:

Host Window


And here you have the Serial ports tab:


Serial Ports




To use a serial port with a teletype you need a current source appropriate to your teletype, with an RS-232 connector (DB9). The circuit that actually handles the current to voltage translation is actually just a few transistors and resistors, it is very easy to do. That circuit/board is connected on one side on the serial port of the PC and on the other to the teletype connector.


Hardware: RS232 to Current Loop Converter

I made my own at 3AM on night, just from components on my junk box, after all it is something that can be done with just 3 transistors. Now, as I don't have the schematics nicely done in a graphic, and there are many schematics out there, I am just including a well known one:

John Nagel's Current loop Converter: http://www.aetherltd.com/connecting.html

Installation notes

As HeavyMetal is written in perl, it needs a suitable perl environment with some perl modules loaded.

For Linux there is a file readme-linux.txt in all distributions, with detailed steps. I highly recommend installing ActivePerl for Linux, rather than trying to compile the modules for your native perl (you will loose a lifetime trying to).

For Windows you simply have to download ActivePerl, install it (use the 32 bits version NEVER the 64 bits one because you will regret doing so), and then install the modules mentioned below using the ppm tool (it even has a GUI) that comes with ActivePerl.

If you don't want to download a perl environment, then you can choose the EXE version. Just extract the contents of the ZIP and execute the heavymetal.exe file. Keep in mind that the FIRST time you execute it, you will have to wait till it extracts its contents before getting the GUI.

The following perl modules are required:

Some of these modules might already come with your perl installation. Also other modules may be required which are not mentioned here (yeah I might have forgotten something). When HeavyMetal initializes, it displays the list of modules being loaded and if there was any error it will mention so. If the missing module is required, the error will be fatal and the initialization will terminate. If the missing modules is optional, the feature that uses that module will automatically be disabled.

The best you can do is to simply run it and install every module that HeavyMetal complains about. When none is missing, you are done!

To install the perl modules, you have to use the ppm tool. After installing ActivePerl in Windows, you will find the Perl Package Manager (friendly name ppm), if you open it you will see a simple GUI with a huge list of available packages. simply select the ones that you need to install, and press the install button on top (green arrow).

Optionally you could install from command line, in which case it is "ppm install WhateverModule".


Download

Older versions (for archaeological purposes)


ToDo / Wishlist

  1. Basic support for modems and AT commands, so you can connect two TTYs over a regular phone line.
  2. User & Password authentication opposite to the simple password security of today.
  3. Add SSH option

FAQs

Q. Is it Windows only? How about Linux?

HeavyMetal is written in perl, and it will run in linux if you have a perl environment correctly installed with the proper perl modules installed. I was able to test it in Linux, thanks to Jim Haynes, and to make it work you will have to follow the step by step instructions included in the readme-linux.txt file.

Q. Sessions? What for?

Probably the first thing you will notice different from the older versions of HM, is that instead of dumping the same text into the host window and the TTY, we now have sessions, as many as you like, which have independent buffers. This is vital to make use of advanced features, like tunneling TTYs over the internet, using MSN, etc etc

Keep in mind that the session 0 with default user "HOST", is the session for the windows of HeavyMetal itself.

For now, session 1 with default user "TTY" is always the serial port.

For most commands you can use the session id or the username interchangeably, only a few commands requires explicitly the session id.

Use $LIST to see the sessions

Q. What username should I use to login?

Right now there are 2 global passwords, one for guest access and another for full access. These passwords are NOT associated to any username. So when you login, you may use any name which consists of letters, numbers, "-" and "/".

This name is only used for identification purposes, not for authentication, so I recommend using your callsign if you have one.

Keep it short, because when printing lists it will be truncated, and it also bothers when printing it as prefix in the TTY if that is enabled.

Q. How do I send the output of a command to the TTY instead of to the Host window? 

 As we now have sessions with independent buffers, as a side effect, whatever command you execute in the host, it will not print the results in the TTY, but only in the HOST window. The solution for this is simple, because HeavyMetal 3 allows you to copy any output to any session. Just use the $SEND command like this:

The target is the session name or session ID, i.e. "TTY" or 1 for the TTY session.

 Per example:

This would print out the results of the weather command into the TTY

Also, much more simpler, in the GUI in the Serial Ports tab you have an option "Copy commands' output from HOST to TTY", that will make allow you to execute the commands on the GUI but output also on the TTY.

Q. I execute a command from the menu (i.e. RTTY Art, Weather, etc) and I see the output in the window but not in the TTY. What's wrong?

 It happens what is explained in the question above. The menu is just a fancy way to execute a command, but that command output will be local to your session only and will not be displayed at the TTY.

There is however a simple solution for the menu, you have an option which says "Copy commands' output from HOST to TTY" in the "Serial Ports" tab.

Q. What's up with targets and sources?

 As mentioned we have sessions, so we need to somehow control who sends what to whom, and who you want to receive from. To control this there are two simple commands:

If you want to change these settings for your session, simply do:

You can also use the keywords ALL for all sessions or if you want to play with advanced features, IN for inbound sessions, OUT for outbound sessions.

You can also change the target and source of other sessions, in that case you will use 2 parameters, like this:

Think of it like a switchmaster, with in/out wires. Messy? well, to make things simpler, you have another command :)

This will setup your source and target, and also notify the other party of the event. The other party should also do a $CHAT command with your session (which will be in the notification) as parameter.

Q. How can I enable the mail (POP3/SMTP) features?

Simply enter the required information in the Configs tab of the GUI.

Or, issue the following commands:

 Note: The Email account, is sometimes your full email these days. Also, the configs names are not case sensitive, but the values you enter, specially the password, will surely be.

Q. How can I enable the MSN client?

Simply enter the required information in the Configs tab of the GUI. 

Or issue the following commands:

Once connected you can use:

Q. How can I enable the Telnet server of HM3?

Simply enter the required information in the Configs tab of the GUI and enable it by clicking the Enable checkbox.

Or use the following command:

If you want to change the listening port, which by default is 1078, you can:

Note: Remember to turn telnet off and on again after changing the listening port

Q. How can I connect remotely to the Telnet HM server?

You need to use a telnet client, like HyperTerminal or telnet.exe which comes with Windows or any other telnet client, like putty.

With windows telnet in your windows command line you would need to use the following:

 Per example:

 Note: You may need to turn localecho off at your client, because HeavyMetal by default eachoes the characters back to you. On the other hand if you disable the echo at  HeavyMetal config, then you will have to turn localecho at your client :) (Yeah that echo nightmare has been with telnet since... ever) You also have the command $ECHO ON/OFF but only after login.

Once you are connected you have to login with the following command

Q. How can I connect two TTYs over Internet using the a Telnet pipe?

You first start an outbound telnet session, from one HeavyMetal to the other. You then send a remote command for login. And after you are logged (with the proper permission level) you authorize the session as a gateway. Just send these commands, and note that the double $$ in login is correct.

Q. How do I send a remote command?

 When you have a telnet connection between 2 HeavyMetals, you may need to send a command to be executed at the remote HM. You basically want to avoid your local HM to interpret the command.

 In this case, simply escape the first $ character with another $, like this

Per example:

Q. Can you add HeavyMetal support X news service?

HeavyMetal now supports RSS news feeds, simply go to the Favorites tab and add it (remember saving the configs), or via configs (either edit heavymetal.cfg or use the $CONFIG command)

In the cfg file:

-RSS.Feed.YOURFEEDNAME=http://feed-url-here

Using commands

$CONFIG +RSS.Feed.YOURFEEDNAME http://feed-url-here

$SAVECONFIGS

Q. Can HeavyMetal use the LPT Parallel port instead of the COM Serial port?

 Sorry, I will never add LPT support because it is an utter mess doing so, and also is synonym of performance and timing problems. Also remember that perl is a high level language so it is not adequate for doing that. Buy a cheap RS232 USB serial port for that, just make sure it supports the baud rate of your TTY.

Q. Can HeavyMetal support many serial ports, or a virtual serial port?

Right now it supports 2 serial ports, but it is easily extensible. If you need more contact me and I will pass you a customized version. I don't want to clutter more the interface.

Q. Can HeavyMetal add support for sound and tones?

I will not do so directly in software because it is yet another mess. But I plan to study simple ways, like.. can we use the MIDI synthesizer? Or even better, lets use another software to do that, see the next question.

Q. Can HeavyMetal interact with another software? Like MMTTY, etc

If the software supports TCP ports, (i.e. telnet) then you already can do so with the $TELNET command to establish an outbound connection to the software.

Another way could be using virtual COM ports. One program connects to a given COM and HM connects to another COM and both virtual COMs are linked with a nullmodem virtual cable. I have done this and works just fine.

Q. Win64 issues?

Okey... here it comes...Use the EXE version, that should work just fine.

Now, if you really want to install the ActivePerl, then what you have to download is the 32 bits version, and the AllowIO used to enable the low speeds of the serial ports is also 32 bits. So as longs as everything is 32 bits, you should be fine. If you find trouble, contact me, we can troubleshoot together using TeamViewer.

Q. Software updates

Once you are up and running, you can use the command:

$VERSION CHECK

to see if there are new builds or fixes.

And you can automatically update to the latest build of your version doing:

$VERSION UPDATE

These commands are also available from the Help menu.

IMPORTANT NOTE: While writing this  have just realized that if you are using the EXE version, not a single thing will be updated. The perl file will be  downloaded but that is what it is used by the EXE version, and nothing will prevent you from doing that. So... if you have the EXE version, you then need to download the new EXE package from this webpage.

Also, keep in mind that the update, takes care of the HeavyMetal perl file, but not of your Perl environment and modules, so you may need to install new perl modules, if the changes between versions are important. Worst case you can go back to the backup file located in the tmp subfolder, or simply manually download the full new version from this page.

Q. What is HMNet?

It is a simple directory to see who is available for chat, or with a TTY ready to play with you. For now it is underused. You just have to configure it in the Configs tab, and then use the commands $HMNET ON/OFF and $HMNET LIST. You have them available in the Internet menu.

Q. What happened to the $TOPNEWS and $HISTORY commands?

With v3.1 there were many enhancements, the $TOPNEWS command (which btw was based in page scrapping and was already broken) became totally unnecessary, now you can have the exact same output via RSS using $NEWS AP.

As for the $HISTORY, which was broken as well, it may be replaced in the future with better page scrapping, OR if you find a suitable RSS feed with "Today in history" go ahead and just configure it in the RSS News tab.

Q. I connected my TTY, and when I do a $RYRY I see some errors like "RYRYGYG etc"?

That is almost surely an error with the stop bits. The baud rate would be mostly fine otherwise it would look like total garbage. So the next thing you have to do is to try with 2 stop bits. That will almost surely fix it. On some other cases it may need some tweak to the divisors used for setting the baud rate, in that case contact me, and we will fix it together.

Q. The $WEB command to surf the web sucks!?

Yes it does... Most of the internet today is simply not intended to be browsed using text only, the $WEB command does a good try at scrapping most of the text and displaying it as best as it can, but the truth is that it is a miracle that you can do so at all, and that in most websites, you might get trash too mixed with the text.



Commands Help

Ok ok.... I have a pile to write here... in the meanwhile use the $HELP command.You can also use:

You will see a little comment for each command for now.. sorry, I plan to include more help specific to each command.

BTW commands and special characters are prefixed with $ (unlike older versions of HM).

$NEWS

Since v3.1 the $NEWS approach was totally changed to be based in RSS feeds.

Now all you need to do is to configure the feed you want to use in the RSS Feeds tab, and use the $NEWS command as explained below. An important numbers of feeds from news agencies is available preconfigured. There is no limit in the number of Feeds you can configure, and something VERy interesting is that I made two new cool features, FULL retrieval of the news directly from the newspaper website, and historical records repository.

$NEWS Output FeedName

 Where Output can be any of the following:

If Output is ommited, SUMMARY is assumed by default.

$WEATHER

Since v3.1.001 there was a serious enhancement of the WEATHER command because the NOAA FTP became extremely unreliable with missing and ghost cities (seriously outdated forecasts, even months old). So I implemented several variations of the command. The command now has the following syntax

$WEATHER SOURCE LOCATION

Where SOURCE can be any of the following supported sources:

Additionally, and before trying to find out what source you have determined, if you provide a suitable input and a matching RSS Feed is configured in HM (RSS News tab), that Feed will be retrieved instead. This allows you to customize your reports, and typically is used along with the Yahoo Weather RSS Feeds which as they use a custom ID, they MUST be preconfigured in this way before trying to use them.

$WEATHER CC SC City
Example: $WEATHER US NY New York
Matching RSS Feed: WEATHER.US.NY.NEWYORK
$WEATHER CC City
Example: $WEATHER UK London
Matching RSS Feed: WEATHER.UK.LONDON

Where CC is the two letters ISO Country Code and SC is the 2 letters US State Code.


Finally, the Source can be ommited, in which case the source will be what is defined as Default Source in the Configs tab. Typically WWO which is the best option.

Example: $WEATHER Buenos Aires, AR


$METAR

This is a very complex aviation weather report which includes two standards which have been used for decades called METAR and TAF. This service is available via the ADDS for most worldwide airports.



Last Updated on Thursday, 19 March 2015 22:21