Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opinions on getting data into SQL Server from a serial connection

Status
Not open for further replies.

RRinTetons

IS-IT--Management
Jul 4, 2001
333
US
I have weather instruments on six towers on our aerial tramway. I can get the data from those instruments by opening a connection from HyperTerminal via Winsock to an IPAddress:portnumber and sending the string STX,T,ETX (HEX 02 2C 54 2C 03). The data comes back in a delimited block of text that can be parsed into wind speed & direction, temp, barometric pressure, etc. New data is available every 3 seconds. The goal is to collect he data for access by anyone who wants to use it.

One data block looks like:

Code:
A,292,000.46,M,+343.18,+019.23,60,07
B,157,000.71,M,+344.38,+021.28,62,0D
C,344,003.24,M,+338.64,+011.55,60,06
D,032,003.33,M,+338.14,+010.71,60,05
E,032,006.45,M,+337.05,+008.89,60,01
F,351,003.32,M,+338.18,+010.78,60,05

The data is:

Label: A - F for the six towers
WindDirection: in degrees
WindSpeed:
WindSpeedUnits: M = m/s,
SpeedOfSound: Used to correct wind speed measurement
Temp: in Celsius
Staus: (60 = 'good')


I want that data in a table in SQL Server 2005 or 2008. What opinions are there on the best way to open the connection, get the data and put it in a var or ?? in SQL Server ready for parsing?

-
Richard Ray
Jackson Hole Mountain Resort
 
If this were my project...

I would probably use vb.net (or c#.net) to write a windows service. This service would connect to the serial port, read the data, and then insert it in to a sql server table. I recommend a service so that your application can run even though the computer may not be logged in.

The goal is to collect he data for access by anyone who wants to use it.

I would also write a web service so that anyone who wants the data would be able to connect to the web service and request data.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
To clarify, the web service idea only applies if you need to share this data outside your network (which is what I assume you are doing). If all of the sharing occurs within the local network, then standard sql connections would apply.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
I've got a bunch of shared weather and operating data already published in an xml file that's publicly accessible. I'll probably just add this to that resource since folks who are interested in presenting the data in their apps and web sites know to get it there.

Now, about this web service. I'm a neophyte in the C#/vb world. I've got the tools to work with, but I've not done anything of any real consequence. This project *seems* like a reasonable thing to work on. It has the 'connect to the data' task, and the 'put it in SQL Server' task. I've gotten data into SQL Server, but never done any serial connectivity. Does this seems like a reasonable project or would I be biting off more that I might find chewable?

-
Richard Ray
Jackson Hole Mountain Resort
 
For collecting the data, I was recommending a Windows service. The Web service would be a good way to share the collected data with other people/computers.

For the Windows service part.

For the Serial Port/data capture part.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Check, I knew that. My fingers got in front of my brain.

Thanks for the links!

-
Richard Ray
Jackson Hole Mountain Resort
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top