Author Topic: Bit OT - databases and writing software for serial I/O  (Read 3233 times)

0 Members and 1 Guest are viewing this topic.

Offline mcTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: scotland
Bit OT - databases and writing software for serial I/O
« on: March 30, 2013, 02:48:36 pm »
This is a bit off topic, but I'm hoping some people here have some recommendations, or at least act as a sounding board for my thoughts.

For a bit of background, as part of some voluntary club work I do we run several races throughout the year, which led me to write some scripts in PHP that run on a local webserver, that allow me to input times manually, link them to create a list of results, then display them. The webserver allows some flexibility to link computers and have various displays. All this is done on computers running windows (easily accesible, and I can use any that can connect to a network)

However, I've now developed hardware that will automatically output the times via UART/Serial and into a computer. Now after some searching, PHP on windows only allows you to output/write to Serial using the php-serial class, so I'm looking at alternatives. Ideally I'd like to continue using MySQL, but am not 100% set on that decision.

I had thought writing a windows application that could simply read the serial port, then insert the data straight into the MySQL database, however VisualStudio Express only has MS database facilities (and this project doesn't justify the $$$$ cost of VS Pro to be able to access mysql!).
I could alter the PHP to use a MS database instead, however I was hoping to keep this project cross platform capable and avoid too much operating system lockin.

So what other Programming language packages are there I should consider?
Or where/what should I be looking for to find suitable packages/information?

I'll admit that the last non-web server or hardware programming I done was well over 10 years ago, so I'm open to all suggestions, as I'll be pretty much starting from beginner level :-/
 

Offline ecat

  • Frequent Contributor
  • **
  • Posts: 296
  • Country: gb
Re: Bit OT - databases and writing software for serial I/O
« Reply #1 on: March 30, 2013, 03:16:05 pm »
I know nothing of VisualStudio Express, however this post

http://social.msdn.microsoft.com/forums/en-US/Vsexpressvb/thread/3419849a-87bc-4d5a-9fd8-33c9410f4e26

suggests you may be able to use ODBC which is fastest acting known cure for most database connectivity ailments. The MS ODBC namespace looks to be typical MS gobbledegook

http://msdn.microsoft.com/en-us/library/system.data.odbc.aspx

but I'm sure you can find some examples to get you started.

If all else fails can you just write the values from the serial port to a text file and have the php read the file and store to MySQL?
 

Offline PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5249
  • Country: nl
Re: Bit OT - databases and writing software for serial I/O
« Reply #2 on: March 30, 2013, 03:51:40 pm »
Have a look at MySQL Connector/Net : http://dev.mysql.com/downloads/connector/net/

Keyboard error: Press F1 to continue.
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5162
  • Country: ro
  • .
Re: Bit OT - databases and writing software for serial I/O
« Reply #3 on: March 30, 2013, 03:53:12 pm »
I'm not sure you can't read and/or write with php in Windows.

You should be able to, it's just a bit convoluted.

MODE command sets various serial port modes , just open a command prompt and run mode /?

Here's a php class that seems to support Windows :  https://github.com/rubberneck/php-serial/blob/master/php_serial.class.php

Otherwise you might want to have a look at Free Pascal and the Lazarus IDE for it - if I remember correctly I think it had sample applications for reading/writing to serial port , using mysql with it, and I think also making a basic web server.

So you could make a tiny free pascal app. that would read/write serial port and buffer the data and then either write directly to mysql or from php you could connect to the free pascal app and retrieve the buffered data through a http connection or a windows pipe

« Last Edit: March 30, 2013, 03:55:59 pm by mariush »
 

Offline mcTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: scotland
Re: Bit OT - databases and writing software for serial I/O
« Reply #4 on: March 30, 2013, 04:13:42 pm »
VS Express only supports MS "datasources" via ODBC. If you want non-MS DB support, you've got to pay for VB.

You should be able to, it's just a bit convoluted.

That's the issue. I'm sure with much tweaking it can be done, but I'm wanting something that's as easy to setup as possible.


I probably should of said I'm not set on using PHP/mysql, I'd just rather avoid having to deal with limitations of free versions of paid software. Ideally I'm looking at something capable of having a central database, which can be accessed via any computer without installing anything, however I'm willing to have to install software on the main computer for the purpose of handling the input.

I've just been doing some searching, and either Java or C/C++ via Netbeans looks promising.
 

Offline ve7xen

  • Super Contributor
  • ***
  • Posts: 1195
  • Country: ca
    • VE7XEN Blog
Re: Bit OT - databases and writing software for serial I/O
« Reply #5 on: April 01, 2013, 08:07:56 pm »
Pretty much any scripting language could fill the place of PHP (in much nicer fashion, too :P) here. I'd recommend Python, but you could also easily use Perl or Ruby or .... You probably will have to install the platform-specific serial port modules and SQL interface driver modules. I have used PySerial in the past with good success. You can use Py2exe to bundle all of the required modules and script into a single .exe file you can run on any machine without installing anything once you've got the setup working.
73 de VE7XEN
He/Him
 

Offline MacAttak

  • Supporter
  • ****
  • Posts: 683
  • Country: us
Re: Bit OT - databases and writing software for serial I/O
« Reply #6 on: April 02, 2013, 02:33:49 am »
Yeah, I would go with Python. There are lots of options with it. It supports sql lite natively, and you can find code to use it with mysql and also serial ports. Python itself is an extremely concise and user-friendly language to work with. It was originally created as an aid for teaching programming concepts, so it was kept fairly simple.

I'm a bit biased since I am a contributor to the IronPython core projects, but if you are going to be running this on Windows then I highly recommend checking out Python Tools for Visual Studio (http://pytools.codeplex.com/). This is a first-class development environment - really amazing features actually. You probably wouldn't care about all of the MPI and Cluster support, but the Debug REPL and Intellisense/debugging features are worth it by itself. The IronPython runtime is pretty good too - one of the fastest implementations (close to CPython for many things).

Python Tools is free and open-source (just like IronPython itself). You don't even need to pay for Visual Studio - it can use the free "empty shell" version, which is just the IDE framework. If you already have Visual Studio installed though, it will just extend it with the Python support.


Learning Python will also be useful if you ever pick up a Raspberry Pi.
 

Online amyk

  • Super Contributor
  • ***
  • Posts: 8492
Re: Bit OT - databases and writing software for serial I/O
« Reply #7 on: April 02, 2013, 10:21:11 am »
VS Express only supports MS "datasources" via ODBC. If you want non-MS DB support, you've got to pay for VB.
ODBC is a (cross-platform) standard. There's no reason why it won't work with any other database as long as there's an ODBC driver available.
 

Offline mcTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: scotland
Re: Bit OT - databases and writing software for serial I/O
« Reply #8 on: April 02, 2013, 05:01:26 pm »
Cheers for the suggestions.
I've also now downloaded python to have a play with, however I'm away for work for a few days so won't be able to try it til I get home.
 

Offline Galaxyrise

  • Frequent Contributor
  • **
  • Posts: 531
  • Country: us
Re: Bit OT - databases and writing software for serial I/O
« Reply #9 on: April 02, 2013, 08:39:55 pm »
VS Express only supports MS "datasources" via ODBC. If you want non-MS DB support, you've got to pay for VB.
I don't see how that's possible... ODBC is part of the PlatformSDK, not a part of Visual Studio.  Just include sql.h and link odbc32.lib.   Maybe you're confusing with the IDE's ability to connect to a database and perform queries against it?  (But you don't need that feature; you've got MySQL tools.)

ODBC is a real pain, though.  I highly recommend going through some wrapper layer rather than coding to ODBC directly.
I am but an egg
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf