Saturday, December 27, 2008

New release

New client release available here:

https://sourceforge.net/project/showfiles.php?group_id=209352&package_id=251216&release_id=584596

can handle both SI5 and SI6 cards. SI6 decoding was done by new project delevoper, smellyfis. Thanks man!

Friday, March 28, 2008

Perl client released

Today I updated the perl client with all the features and options the Win32 client has.

I badly need an SI 6 card to see how the raw binary data coming from the serial port can be cracked.

Thursday, March 27, 2008

Win32 client released

Thanks to MSVC++ Express I was able to write a reliable Win32 client, si_reader.exe with the following features:

- Read data from serial port ( serial main station or USB station with USB-Serial bridge driver for Win32 )
- Alternatively read data from input file created by client
- Save data to file (later to be used by client to send data to FreePunch server)
- Send data to FreePunch server

Tuesday, March 4, 2008

Linux kernel support for BSM7-D-USB

Just realized yesterday, that recent kernel versions (2.6.24.x) support BSM7-D-USB main stations. It took a while to update the kernel, mainly following the instructions on this page, but it was worth waiting:

The USB main station immediately showed up as /dev/ttyUSB0 and was able to use the perl script posted earier to get the serial data. Note that the USB station was put is Autosend mode. I also set the baud rate to 4800 using the SiConfig Win32 application, but surprisingly the speed was 38400 regardless. Make sure speed is set to 38400 in the script below.


=>perl si_reader.pl /dev/ttyUSB0
Perl version: 5.008008
OS version: linux
Loading Unix modules

opened serial port /dev/ttyUSB0 as /dev/ttyUSB0
Len: 187
023110053f561000100140a410021000100010001000100010001000100010006540a4eeeeeeee100556eeee281002e6
000eeee1000eeee1000eeee1000eeee1000eeee10001000eeee1000eeee1000eeee1000eeee1000eeee10001000eeee1


How cool is that, now this really settles the USB driver part and time to start on the web application.

Monday, February 25, 2008

LCD proto shield for Arduino


I have bought this great proto shield on eBay for my arduinos. It is great for debugging and it was really a steal.

Working on the arduino serial reader right now.

Monday, December 31, 2007

Win32 client to read serial data

After trying the perl client on Win32 I realized it is not going to work (will not work easily). First of all installing all perl accessories was a pain in the neck on windows ( ActivePerl + Win32::API + Win32::SerialPort ) and most probably no user will venture into that. I did and soon realized that the Win32::SerialPort library is not working the same way as Device::SerialPort on linux. Instead of finding out why this is happening, I wrote a standalone Win32 executable that is not dependent on complicated installations.

I was looking for a free C/C++ compiler for Windows and I found that a version of VC++ was free. After some googling I wrote a client that reads the serial port and dumps the data on the console. As with the perl client my TODO list includes logging and sending data to a web server. Current code is available in the projects CVS repository. Usage example:


si_reader.exe com4



The si_reader.exe client reads both the serial and USB inputs (from a virtual com port), although they are different for the same SI card (both main stations are in autosend mode). Hope this mystery will be revealed soon, for now I am in urgent need of some web/database application that receives and understand raw data.

Tuesday, November 20, 2007

The BSF7-RS232 main station has arrived

Thanks to Joe Scarborough, the local SportIdent dealer I got a really good price on this little hardware, that arrived yesterday evening.

BSF7-RS232

First, I used the SI Manger software on Windows to make sure the station is set up to read SI cards and the Autosend box is checked. This makes things somewhat simple as the station just sends card data out to the serial port without any input from the computer.

All I needed now is a client on the PC, that reads the binary input from the serial port. Perl makes a lot of sense for a lot of reasons, most of all portability. I am a beginner in perl at best, but after hours of googling I came up with the following script that does the job:

#!/usr/bin/perl

use strict;
use vars qw($OS_win);

BEGIN {
$OS_win = ($^O eq "MSWin32") ? 1 : 0;
print "Perl version: $]\\n";
print "OS version: $^O\\n";

if ($OS_win) {
print "Loading Windows modules\\n";
eval "use Win32::SerialPort";
die "$@n" if ($@);
}
else {
print "Loading Unix modules\\n";
eval "use Device::SerialPort";
die "$@\\n" if ($@);
}
}

die "\\n\\nno port specified\\n" unless (@ARGV);
my $port = shift @ARGV;

my $serial_port;
if ($OS_win) {
$serial_port = new Win32::SerialPort ($port,1);
}
else {
$serial_port = Device::SerialPort->new ($port );
}
die "Can't open serial port $port: $^E\\n" unless ($serial_port);

my $name = $serial_port->alias;
print "\\nopened serial port $port as $name\\n";

$serial_port->databits(8);
$serial_port->baudrate(4800); # or 38400 depending on the station setup
$serial_port->parity("none");
$serial_port->stopbits(1);

my $count = 0;
my $hexa = "";
my $timeout;
my $time_on = 0;
while (1) {

my $char = $serial_port->input;

if ($char) {
$time_on = 0;
my $len = length $char;

$count += $len;

$hexa .= unpack("H$($len*2)",$char);

if($count >= 1000) {
print "Len: $count\\n".$hexa."\\n";
$hexa = "";
$count = 0;
}

} else {
if($time_on) {
if($timeout < time) {
$time_on = 0;
if($count) {
print "Len: $count\\n".$hexa."\\n";
$hexa = "";
$count = 0;
}
}
}
else {
$time_on = 1;
$timeout = time + 2;
}
}

select(undef, undef, undef, 0.1);
}


I named it si_client.pl, so it starts like this:

$ si_client.pl /dev/ttyS0


Yes, /dev/ttyS0 is the serial port on my linux box the device is connected to. Although I never tried, the script should work on Win32 as well (use COM1, etc. for the portname). Note, that your perl installation might not have the SerialPort library, in which case do this on Ubuntu:

$ sudo apt-get install libdevice-serialport-perl

or something similar on a different platform.

Note, that this client needs some more work as we want to send the raw card data to a webserver.