Serial Port Data Logger Timestamp

Simple guide to using processing software to log data from your Arduino through the Serial port. The data will be log and save as a csv table for easy of use with other software. Processing is used for a variety of projects, from visual arts to research. Here is the website for Processing: They have simple tutorials to get you started and a reference page to help with understanding the code. Items you will need: Arduino Software(including attached sensor of your choice) - We will be using the button project from my previous instructable to aid in this project, but a simple button input, like the StateChange example Arduino provides, will also work. Processing Software We will skip over the Arduino hook-up part, and go straight to the the code and output.


Screen-shot of the Termite utility

A simple data logger for the Arduino analog pins; #define LOG_INTERVAL 1000 // mills. RTC_DS1307 RTC; // define the Real Time Clock object; // for the data logging shield, we use. We begin by initializing the Serial port at 9600 baud.

Termite is an easy to use and easy to configure RS232 terminal. It uses aninterface similar to that of 'messenger' or 'chat' programs, with a large windowthat contains all received data and an edit line for typing in strings to transmit.Highlights of the utility are the ease of installation (possibly with pre-configuredsettings) using a heuristic search for the appropriate COM port and, as was mentioned,its user-friendliness.

Other features are:

  • Plug-in interface for pre-processing or alternativeviews of the data, logging received data to a file, adding a toolbar to Termite,keyboard macros, and other functionality that you may think of.
  • A history of commands that you typed, withauto-completion.
  • Resizeable main window, with a 'keep window on top' option, multilingual user interface.
  • Ability to run with pre-configured settings froma read-only medium (no installation is necessary).
  • Support for non-standard Baud rates (MIDI, DMX512).
  • Different colouring for transmitted and received data (blue=transmitted,green=received).
  • Data can be forwarded between two RS232 ports.
  • Search dialog for transmitted/received text (right-click pop-up menu).
  • Save or print the contents of the transmitted/receivedtext (right-click pop-up menu).

Downloads & license

Termite 3.4 is copyrighted software that is free for personal and commercial use.You may use it and distribute it without limitations. You may however not removeor conceal the copyright. There are no guarantees or warranties whatsoever; useit at your own risk.

The example plug-in filters are distributed under thezlib/libpng (opensource) license.

Termite version 3.4 - complete setup (332 KiB)
A self-extracting setup that contains Termite and all plug-ins anddocumentation (but excluding the source code for these plug-ins). This setupis provided to conveniently and quickly install Termite. (Note that Termitedoes not require installation, but it may just be convenientto do so.)
Termite version 3.4 (program only) (76 KiB)
Termite RS232 terminal in a ZIP archive. Just unzip and run; Termite writesnothing in the registry, no installation or uninstallation is required.
GNU Unifont as a TrueType file (3.2 MiB)
The GNU Unifontallows showing control characters as characters, rather than ashexadecimal digits between brackets. No installationof this font is needed; just unzip the font into the same directory as whereTermite resides.
'Time stamp' filter, including source code (36 KiB)
A filter that adds a time-stamp to received data. For those who want towrite their custom plug-in filter(s), the commented source code that this ZIPfile also contains may serve as a starting point.
'Hexadecimal View' filter, including source code (32 KiB)
A filter that shows the received data as a hex dump instead of as plaintext, and that also allows you to send non-ASCII bytes by typing hexadecimalvalues on the transmit line. This ZIP file contains a compiled filter aswell as commented source.
'Highlight' filter, including source code (41 KiB)
A filter that shows any received text that matches one of several patternsin a different (user-selectable) colour. The patterns are regular expressions.This ZIP file contains a compiled filter as well as commented source. It usesthe SLRE libraryfor matching regular expressions. The source code for theSLRE library isnot included in the above ZIP file, and must be downloadedseparately.
'Status LEDs' filter, including source code (27 KiB)
This plug-in filter shows the status of the auxiliary modem and handshakinglines (CTS, DSR, RI and CD) and it allows you to toggle the RTS and DTR lines.The ZIP file contains a compiled filter as well as commented source code.
'Log file' filter, including source code (34 KiB)
This plug-in filter writes all data that it receives to a log file (new datais appended to existing data). The ZIP file contains a compiled filter aswell as commented source code and project files for Microsoft Visual Studio.
'Function Key macros' filter, including source code (28 KiB)
This plug-in filter transmits a user-defined string of text on the press ofa function key (keys F1 to F12 are currently supported). The ZIP file containsa compiled filter as well as commented source code.
'Automatic Reply' filter, including source code (48 KiB)
This plug-in filter checks the incoming text or data for keywords or patterns.When it detects such a pattern, it automatically transmits a user-definedreply. The 'pattern' used for matching is regular expression. A seriesof such match/reply rows can be used to handle a simple handshake protocol.The ZIP file contains a compiled filter as well as commented source code.This filter uses the SLRE libraryfor matching regular expressions. The source code for theSLRE library isnot included in the above ZIP file, and must be downloadedseparately.
Writing plug-in filters for Termite (124 KiB)
Programmer's documentation (Adobe Acrobat format).
Translating Termite (92 KiB)
A guide to add a translation of the user interface of Termite (Adobe Acrobatformat).

Recent changes (version 3.4)

  • Bug fix in handling the backspace character in received text.
  • Bug fixes in handling the display of forwarded data (received data thatis re-transmitted on a second port).
  • The time-stamp filter now has a setting to time-stamp every new line(instead of only time-stamping after a minimum delay has been passed).
  • The documentation for writing plug-in filters has been updated.

Usage

Termite focuses on text data, and specifically text that is sent and receivedas strings terminated with 'new-line' characters. It has no provisions fortransferring files or binary data. (That said, with the 'hexadecimal view' plug-in,you can send and receive bytes as hexadecimal values, and you may write a'plug-in' filter for file transfer as well).


The user interface of Termite, here pictured with the 'Status LEDs' plug-in active

The interface of the Termite program has one large (initially empty) text area,which is called the 'reception view'. Above it is a set of buttons in a 'buttonbar' and below it is a 'transmit' line into which you can type a line of text.The utility automatically opens the RS232 port for which it was set up. It showsthe current configuration at the left in the button bar. If these are not correct,you can use the button Settings to choose a different port orconfiguration. The Settings dialog also allows you to enable/disable'local echo' and/or to append a line termination to every string that you send.

Received bytes with values below ASCII 32 (the space character) are displayed aseither a control character like , or as twohex characters between square brackets. So [08] stands for the'backspace' character and [1B] is the Escape key. There is anexception for the tab, carriage return and line feed characters(ASCII 9, 13 and 10 respectively); these cause spacing (tab) or aline break.
Whether you see the control character or [08] for the backspacekey, depends on whether the 'Unifont' font is present and configured in the settings.
If you wish to send a non-ANSI/ASCII character, you need the'hexadecimal view' plug-in filter, see 'Downloads' above.

After connecting a serial cable between the PC and the remote device (or remotePC, in which case you must use a null-modem cable) and configuring the port, youcan send data by typing text in the transmit line and pressing the 'Enter' key.Any data that the remote device sends, will appear in the reception view.Optionally, the text that you transmit is copied to the reception view (theoption is called 'local echo', you will find in in the dialog under theSettings button). To distinguish the received data from the echoed data,the echoed text is coloured blue, whereas the received data is green.

The remaining functionality is straightforward: the Clear button clearsthe reception view, the About button gives copyright information and theClose button terminates the utility.

One 'hidden' feature is the ability to disconnect the RS232 port, without terminatingthe utility. You can close an RS232 connection with a click in the status fieldin the upper left corner of the window (left of the button bar). Anotherclick on that line re-opens the connection with the current settings.You can use this to 'free' the port temporarily for another application.


Click here to disconnect, or re-connect

Edit history

To speed up entering repetitive commands, Termite keeps a history of recentlysent commands. This history is in a circular queue with the most recent commandat the top.

To browse through the history, use the 'arrow up' and 'arrow down' keys. If youtype in a few characters in the 'transmit' edit line, Termite will use the historyto auto-complete the entry. Pressing the arrow up and arrow down keys then browsethrough the entries that match in the first letters. For example, if you havesent the words 'test', 'top', 'view' and 'set' previously, and you type theletter 't' on the edit line, Termite will first auto-complete this to either'test' or 'top' (depending on which word you sent last) and the arrow keys willtoggle between 'test' and 'top'. If you clear the edit line and then use the arrowkeys, Termite will loop through the entire history of 'test', 'top', 'view' and'set'.

Auto-completion and history matching are case sensitive, by the way.

Auto-completion is enabled by default, but can be disabled through theSettings dialog.

Scrolling

By default, Termite scrolls its reception window so that the most recentlyreceived text is displayed. In case you want to look back at text that hasscrolled out of the reception view, just scroll the text back into view. Termitewill stop to scroll to the end every time it receives new data.

To make Termite restart with its automatic scrolling to newly received data,scroll the reception view manually to the end of the data.

In other words, Termite only scrolls up text to show newly received data if itis already at the end of the current data.

Printing, searching text, clipboard support

Some additional functions are available from a pop-up menu that appears when youright-click in the reception view.

The 'Copy' command copies only the selected text to the clipboard if a selectionexists, and copies all text in absense of a selection. Likewise, the 'Save' commandsaves only the selected text to a file if a selection exists (and all text ifno selection exists).

Configuration

Termite stores the configuration in an INI file (see the next section for thelocation of the INI file). This way, Termite remembers its settings betweensessions.

When distributing Termite, you may wish to include an INI file with pre-sets.You can run Termite directly off a CD-ROM, but the utility will not be ableto store its configuration in the INI file if the INI file resides on aread-only medium. A typical INI file is below.

Most of these settings can be chosen from the 'Settings' dialog. This meansthat to get an appropriate INI file, you can launch Termite, adjust the settings(including activating any plug-in filters that you wish to use),and voilà: you have your pre-configured INI file.

A few more configurations can be done by editing the INI file directly (using atext editor like Notepad). These are the keywords Caption,TxColour and RxColour in the [Options]topic. The Caption item allows you to change the titlebar of the main Termite window. Add the item Caption (below topic[Options]) and set it to the string that you wish to have displayed—for example, the model name of the product for which you are distributing apre-configured Termite. The items TxColour and RxColourallow you to change the colours for transmitted and received text (from the defaultblue and green respectively). The syntax for the colours must be #rrggbb,where rr, gg and bb are two hexadecimaldigits. So for example, #FF0000 is bright red and #808000is dark yellow.

INI file location

Termite accesses the INI file from one of two directories, depending on thestart-up situation.

  • Termite first tries to locate a file called 'Termite.ini' in the applicationdirectory (i.e. the directory that the Termite '.EXE' file resides in). If itcan open (or create) 'Termite.ini' in the application directory for read/writeaccess, it uses that file.
  • If either the application directory does not permit read/write access (e.g.Termite is launched directly from a read-only medium), or the Termite.ini fileis marked 'read-only', Termite creates a directory under the 'Application Data'folder of the current user's 'Local Settings'. This new directory is called'Termite', and the INI file is stored there.
    The first time Termite uses the sub-folder below the current user's Local Settings,it also copies the 'Termite.ini' file from Termite's application directory (ifit exists). This allows one to store pre-configured INI file on a CD-ROM diskand still allow the user to change the configuration.

RS232 port scan

Most RS232 settings for a device can be chosen by the developer (the Baud rate andthe number of data and stop bits are usually determined by the other device). Onesetting that the developer cannot foresee, however, is what COM port theuser will attach it to. For this reason, Termite contains a 'port lookup' functionplus a simple 'port scanning' protocol.

The 'port lookup' function only works with virtual COM ports, such as USB-to-serialcables. Since Microsoft Windows has drivers pre-installed for USB devices simulatinga serial port, it is a popular design. To use the port lookup function,put the complete device name of the virtual COM port at the 'Port='setting. You can find the device names in the registry below the path'HKEY_LOCAL_MACHINEHARDWAREDEVICEMAPSERIALCOMM'.For example, for a common Prolific USB-to-serial cable, the setting in the INIfile might read:

If using the device name of a serial port is not an option, for example, becauseyour hardware has a real serial port instead of a virtual one, you canalternatively use the 'port scanning' protocol. To activate this protocol, set'Port=0' below the '[Settings]' section. Port scanningchooses the first port for which the two following conditions hold:

  • the port is not already open (in use);
  • after setting the DTR line, the remote device pullsDSR up.

Port scanning cannot be selected from the Settings dialog, youhave to edit the INI file to activate it.

The tests for port scanning are primitive. They do not check what device or programis hooked at the other end. The only thing that you know after a port scan is thatsomething is connected to the port and that no other program is currentlyusing that particular port.

In the old days, it had become common practice to connect the DTRand DSR pins in the connectors of the cable (sometimes even atboth ends). This is bad practice, because with such cables you cannot evendiagnose cable connection problems. Yet, such cables still exist, and the portscan may be fooled by it.

The DRT/DSR handshake usually works with USB-to-RS232 converter cables too.

Non-standard Baud rates

The MIDI protocol is essentially the RS232 protocol over a current-loop physicallayer and with a Baud rate of 31250 bps —for details, see the article'A MIDI to RS232 adapter'.

Likewise, DMX512 is essentially the RS232 protocol over an RS485 physical layerand with a Baud rate of 250,000 bps.

Termite presents you with a list of standard Baud rates, but it allows you toenter different values. The key issue is that the RS232 hardware must supportthe Baud rate that you select. All RS232 hardware and all USB-to-RS232 converterplugs support the standard Baud rates, but only few support non-standard Baudrates. We have tested non-standard Baud rates successfully with USB-to-RS232converters based on the FT232R chips from FTDI.

Forwarding data between two RS232 (virtual) ports

You can use Termite to put a PC (or laptop) between two systems and monitor theirRS232 communication. The PC or laptop that Termite runs on must have two RS232ports. Instead of connecting both systems together, you connect both with thePC that runs Termite. Then, you have to choose one port as the primary port andthe other as the 'forward' port, see the Settingsdialog of Termite.

With forwarding set up, all data received on the primary port is transmittedthrough the forward port. All data received on the forward port is transmittedthrough the primary port. The 'sent/received colouring' of Termite is also stillin effect: data received on the primary port is in green and data received on thesecondary port is in blue.

In this configuration, Termite would typically only be used to monitor thecommunication between two devices. If you type in text on the edit line andtransmit it, this text is only sent through the primary port.

In the above diagram, Termite runs on a computer that sits between two othersystems/devices. If one of these systems is also a computer (running MicrosoftWindows), the set-up may be simplified by running Termite on that system. Thedual RS232 port needed for Termite may be replaced by a virtual COM port pair,such as the com0comnull-modem emulator.

A virtual null-modem creates two ports that exist only in software. Any datapresented to one port of this pair is retransmitted at the other port —the sameas how port forwarding works in Termite. If you connect an application to oneport of the pair and Termite to the other port, the application now talks toTermite. When Termite is then configured to forward transmitted/received datato a physical port (to which the other system is connected), the two systemscommunicate as before and Termite intercepts all data.

Filters (plug-ins)

Plug-in filters allow you to extend Termite in several ways:

  • Append or insert text or data to what is received (for example, the 'timestamp'sample filter inserts the relative time of reception to every packet of datathat Termite receives).
  • Remove received data from Termite's queue (before Termite processes it), forexample to automatically dump it to a file or to process it separately.
  • Create windows with different views of the received data. In combination withthe ability to remove data from Termite's queue, this allows you to filterout different kinds of data from a complex stream, and display each kind inits own way.
  • Handle function keys (for short-cuts or user-defined macros).

On start-up, Termite collects all plug-in filters that are in the same directoryas the Termite application itself. You can enable and disable a filter in theSettings dialog of Termite (see above). Installing a filter is thereforea mere matter of copying the file to the correct location and enabling it.

Convert compiled html help file to pdf online free. Converting CHM to PDF is easy and quicker. The files are kept private and the download link is exclusively available to you. CHM is an extension of the file format for Compiled HTML, which is mostly used by the help program of Microsoft that is HTML-based. Free online tool to convert chm (Compiled HTML Help File) files to pdf (Portable Document Format File). No download required. Convert CHM to PDF - Convert your file now - online and free - this page also contains information on the CHM and PDF file extensions. Step 1 Select files or URL you wish to convert. Convert CHM (Microsoft Compiled HTML Help) to PDF (Portable Document Format) online with CloudConvert. No registration required.

Optionally, filters may have their own configuration options. Termite launchesthe filter's configuration dialog when the filter is enabled. To access theconfiguration dialog of a filter that is already enabled, double-click on thefilter name (you must double-click on the name, not on the 'check box').Typically, a filter stores its configuration in the same INI file as the oneTermite uses (Termite passes the path to this INI file to the filter when itloads the filter).

Technically, a filter is a DLL with a few special functions (of which only oneis mandatory). The filename extension must be '.flt' instead of '.dll' for afilter. In the Settings dialog, Termite uses the filename minus the '.flt'extension for the filter name. See the short documentWriting plug-in filters for Termitefor details on writing filters. To get you started, the sample filters 'Timestamp','Hexadecimal View' and 'Status LEDs' come with full commented C source code.

Translating Termite

If you wish to translate Termite (or correct translations), first get thedocument 'How to translateTermite'. The process is simple, and requires only a simple text editor.

If you wish, you can send the translated files to us (we will gladly accept them).Note that by sending us your translations, you license us to include them infuture versions of Termite.

Rationale and alternatives

I made Termite because I needed a utility for monitoring RS232 data coming fromthe hardware devices that we develop. We do that in-house, but devices regularlyneed to be monitored after installation.. at a customers site.. by our customers.Therefore, my design requirements were for the utility to be easy to set up, torun 'out of the box' with preconfigured settings, and to run directly from aCD-ROM or USB stick without requiring installation.

One Piece Episode 165 Anime English Dubbed at www1.animeselect.tv Watch One Piece Episode 165 English Dubbed, Download One Piece Episode 165 in mp4 format for free. Info: if One Piece Episode 165 is not working or broken, please use the report button thank you. Download and Watch One Piece (2003-2004) Season 6, Episode 165 Full-HD DVD 720p + 1080p Online, One Piece Luffy S06 Episode 165 'English Subs&quo. One Piece (Dub) Episode 165. One Piece (Dub) Episode 165 at gogoanime. Category: TV Series. Add to Favorites. One Piece (Dub) Episode 164. One piece 165 download episodes of the office.

Over time, I added features that were needed for specific communication requirementsthat we stumbled upon, such as non-standard Baud rates, port forwarding, time-stampingreceived data and sending/receiving hexadecimal values. The last two items werelater removed from the utility itself, for the sake of keeping the basic utilitysimple, and added back as plug-in filters.

In case Termite is not what you are looking for, some alternatives are:

  • The Serial Port Monitorby Eltima Software has the ability to sniff communication from another program(without requiring a special cable) and the ability to monitor multiple serialports at the same time. Serial Port Monitor handles RS485/422 as well as RS232,and supports Modbus RTU and Modbus ASCII protocols.
  • The HyperTerminal applet that comes with Microsoft Windows, or the third-partyHyperTerminal Private Edition.
  • MCS Electronics providesthe free 'simpleterm' utility amongst its downloads. (Choose 'Downloads', then'BASCOM'. Then select the 'MCS Simple Terminal' from the list.)
  • YAT, two freewareserial terminals are listed on the site of LakeviewResearch: a small and simple terminal by Dieter Fauth and a full-featuredterminal by Maettu.
  • 'Terminal' by [email protected]++, a free terminal that supports text and hexadecimaldisplay, macros, scripting, graphic visualization and more.
  • 'Termie',which started as an open-source clone of Termite, but now has some features thatTermite lacks, while lacking some of Termite's features.