Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Edit *We have a heart monitor hooked up to to an msp430 with a roving networks wifi module. I would like to connect send some type of a datastream to a webserver so that someone could watch it offsite. I would like to have a datastreaming connection or something to the webserver because I was thinking it is more natural than trying to do a post request every .5 seconds. (I know this isn't super specific but this is the level I am at right now.)

I'm trying to figure out how to stream data (not video or anything big) from a microcontroller to a webserver and forward it to an iOS app. My buddy has a wifi module for our MCU and he claims we just write UART and the wifi module broadcasts our UART signal. So I want to stream that data to a webserver (php). Is there any type of wifi protocol for sending a stream of data to the server? What is the protocol for establishing a datastream connection on the MCU end? What kind of server side code do I need to recieve the datastream?

share|improve this question

closed as not a real question by Walter, GlenH7, Yusubov, gnat, Glenn Nelson Jan 4 '13 at 18:54

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

This seems to me to be more appropriate for SO than Programmers. Are you looking for some type of code answer or an architecture answer? –  Walter Jan 4 '13 at 17:53
Probably a code answer. Maybe I am in the wrong domain. But honestly, I am feeling so overwhelmed with this that any kind of kick in the right direction would help. –  Chase Roberts Jan 4 '13 at 18:00
I've voted to migrate this to SO (I figured you were looking for a code answer). If you want to speed the process up you can flag this question and ask a moderator to migrate it for you. Otherwise you'll need to wait until 4 other users vote to migrate it. –  Walter Jan 4 '13 at 18:02
A good rule to follow is if your question has you in front of your IDE then it belongs on SO. If it has you in front of a whiteboard it belongs on Programmers. –  Walter Jan 4 '13 at 18:03
@GlenH7 I can see it as either, that's why I asked the OP. –  Walter Jan 4 '13 at 18:04

1 Answer 1

up vote 1 down vote accepted

Since you're sending data to a web server, the easiest protocol to use would be an HTTP POST. Wifi modules send Ethernet packets. You'd have to add IP, TCP, and HTTP layers on top of that. The TCP/IP stack is often either provided for a microcontroller, or possibly built-in to the wifi module. You would format a POST packet and send it to the TCP stack. Here's a slightly modified example POST request from this page:

POST /path/script.php HTTP/1.0
From: frog@jmarshall.com
User-Agent: HTTPTool/1.0
Content-Type: application/x-www-form-urlencoded
Content-Length: 32


You wrap that in a TCP header, then an IP header, then an Ethernet header, then write it to the UART, some or all of which you should be able to use existing libraries for. The web server then processes it like a standard POST request from a web browser. In PHP on the server side, the /path/script.php file would get executed and you would access the data with $_POST["home"] and $_POST["favorite flavor"].

The Roving Networks wifi modules have a built-in http client, which makes things a whole lot easier. You set it up by sending $$$ to enter command mode, then send the following commands:

set ip proto 18 // Turn on HTTP mode = 0x10 and TCP mode = 0x2
set dns name www.webserver.com // Set the web server name
set ip host 0 // Turn on DNS
set ip remote 80 // Set the web server port, 80 is standard
set com remote GET$/userprog.php?DATA= // Sample server application
set uart mode 2 // Automatically connect using data trigger mode
exit // exit command mode

When the serial UART data comes in, the module automatically connects to the web server, and sends:

GET /userprog.php?DATA= <users serial data> \n\n

For more information, read the "Built-In HTML Client Modes" section of the manual. There are other configurations that may fit your needs better.

share|improve this answer
Thanks for a great response to a terrible question. Unfortunately I don't know what I don't know, so I can't be much more specific. I did make an edit with a little bit of background about my project but it's probably not the detail you are looking for. –  Chase Roberts Jan 4 '13 at 18:53
See my edit for Roving networks modules specifically. –  Karl Bielefeldt Jan 4 '13 at 18:55
Perfect. Thank you much. –  Chase Roberts Jan 4 '13 at 19:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.