Main Site Documentation

Sensor data to SQL


#1

Folks,

I have been searching this forum and others but I keep coming up empty handed. I am working on a project similar to Michael Dodaro’s “Sending Sensor Data” project (http://mikedodaro.net/2011/12/13/sending-net-gadgeteer-sensor-data-to-a-rest-web-service/). I am trying to use the WCF REST service to send sensor data to a SQL database but have been unsuccessful. Both the device and the local PC are on the same network and the PC can ping the device.

When I run the WCF Service under localhost, how am I to get data from my Gadgeteer device to the “localhost”? I tried using the IP address of the PC running the service but that didn’t seem to work. Are there any other options for populating a SQL database with data from a .NET Gadgeteer device? I do not have an SD Card attached to the device…I just want to send the data to a database.

Please help! I’m about to give up on this project!


#2

I would concentrate on why this doesn’t work.

Sending data from the device through a web service is a good way to go.


#3

Step by step check al the elements.

Is the web service running as it should? verify by talking to the web service with a test page (not from gadgeteer)
Is the gadgeteer app running ok? what’s showing in the debug window? network config data from the debug window?

Are there any errors?


#4

I tried to understand what was happening, but without knowing what you tried to do, it is difficult.


#5

Many others already do this, so this is something specific to your environment/application. Remember, in cases like this Network Monitor is your friend, so you can see the communications that are sent from the Gadgeteer device to the PC.

Remember though, the IP address the Gadgeteer device gets will be just any old network address. You probably need to confirm that it’s on a valid “network” (address, subnet mask, default gateway) for your actual network. “localhost” is a concept that makes it easy for a PC to get to “itself” over the “network” (even though it’s done in the internals of the IP stack), and is useless for communicating between two devices on a network. You need the real IP address of the devices to communicate.


#6

I can send data to my webservice use FEZ Cerbuino Bee With RN-XV_WiFly.
The sensor data send to my webservice then store in the SQL server.
Then I can get data from my android phone.

The most hard thing is the WCF webservice. You may sure your WCF webservice is working well, you can access it by IE or Chrome.
And localhost is not works for me, WCF webservice should be public.
But you can’t test the post using IE or Chrome.
I recommend you use https://code.google.com/p/rest-client/ to test your webservice.

The IIS setting make me craze, hard to use.
You may reference my simple post
http://www.tinyclr.com/codeshare/entry/666


#7

ASP.NET MVC Web API is really easy to set up and use:


#8

Is there a firewall on your pc? Win7 installs one by default. You can try and disable it then try again…


#9

@ Tzu - Thank you for the link to the Google rest-test widget. I was able to send data to my rest service running on the local host. I will look over your Wi-fly code. I saw where you called the WCF in your code but not sure where you’re sending the data. I’ll dig into it a little

@ GMod(Errol) - I have disabled the firewall. All the PC’s and the Gadgeteer module can be pinged. I just can’t hit the rest service running using the “local host” IP address. From everything I’ve read, this can’t be done without deploying the service to IIS so I will investigate this as an option. Since my WCF REST service does not contain a .svc file, I’m struggling with getting IIS to see it.

@ Brett - I will checkout the Network Monitor. I didn’t get it downloaded last night. I assume you’re referring to the Microsoft Network Monitor.

@ Architect - I looked at the WebAPI on www.asp.net. I’ll try to work through the tutorials to see if that can be a viable option.

Thank you all for your help. Tzu’s rest test link was probably the biggest help. At least now I know that my REST service is running. I just need to get it deployed to IIS to be able to run it over the network.


#10

Why don’t try a different approach: using tcp socket the send raw data from client to socket. I’m using it the pass RFID data from client to server and back. Have a look at supersocket at codeplex and build your own stable socket server for gathering all kinds of data.