Using Prop to send data to a Web server
eagletalontim
Posts: 1,399
Hello all again! I am interested in converting my home Power Logger project to send data through the web directly instead of having the computer communicate with the Prop and send the same data to my web server. Being able to see the info of the current power usage on the computer is nice, but I will probably convert it to display on a 2x16 display.
What I need to know is how to have the prop connect to my network and send data to my web server via the query string or POST. Right now, I have a VB program that I wrote which constantly pings the Prop (Via Serial Com) and gets all recent readings. Every hour, the VB program sends the Watt hour usage to my web server which is stored in the DB for later viewing. I need to break the tie between the computer and the Prop so I can adjust the power settings on my computer to save power
What can I purchase that will allow me to get the Prop communicating with my web server? Anything premade? I have seen the "Spinneret Web Server" which may be what I am looking for, but I am not entirely sure. Any suggestions?
What I need to know is how to have the prop connect to my network and send data to my web server via the query string or POST. Right now, I have a VB program that I wrote which constantly pings the Prop (Via Serial Com) and gets all recent readings. Every hour, the VB program sends the Watt hour usage to my web server which is stored in the DB for later viewing. I need to break the tie between the computer and the Prop so I can adjust the power settings on my computer to save power
What can I purchase that will allow me to get the Prop communicating with my web server? Anything premade? I have seen the "Spinneret Web Server" which may be what I am looking for, but I am not entirely sure. Any suggestions?
Comments
One very cheap and flexible solution is to use a Raspberry Pi Model A+ and a cheap, tiny, WIFI dongle. Connect you Propeller to the Pi's on board UART port that comes out on it's GPIO header pins. Write a 20 line program for the Pi, in the language of your choice, to communicate with the Prop and exchange data to your web server. One could use XHR or a web socket connection. My preferred way to do this kind of thing currently is with JavaScritpt running under Node.js.
The Pi solution has the great advantage that you can run the propeller-loader on it which means you can now program your Propeller form the Pi. Over the air Propeller programming. Go the whole hog and run the open source spin compiler on the Pi. Or even the SimpleIDE or PropellerIDE.
Of course for simple logger applications you may now find that you don't need the Propeller, the Pi has a bunch of GPIO pins...
But if there is some real-time control/monitoring work going on then a Prop and a Pi can make a great combination.
Available form RS and Element14;
http://uk.rs-online.com/web/p/processor-microcontroller-development-kits/8332699/
http://www.element14.com/community/community/raspberry-pi/raspberry-pi-aplus?ICID=rpimain-topban-rpiaplus
Another nice solution involves using a cheap WIFI router and loading it with OpenWRT firmware. With a bit of delicate soldering one make a serial connection from router to Propeller. We have done this with TP-Link's WR703N and MR3020 routers and the D-LINK DIR-613. They also run propeller-loader and openspin. You may already have such a router or the can be had for 20 dollars. Routers like that with OpenWRT are very reliable setups.
Here is a nice long thread about using such routers with the Prop:
http://forums.parallax.com/showthread.php/156414-WiFi-amp-IOT-for-home-controllers-monitors-using-WR703N-20-routers-and-xx-WRT
The first page of this forum has just the answer with this little module. Much better solution than having to a card sized Pi or router box etc.
http://forums.parallax.com/showthread.php/157167-Preview-of-IoT5500-in-a-WIZ820io-footprint-opt-Propller-uSD
http://forums.parallax.com/showthread.php/157167-Preview-of-IoT5500-in-a-WIZ820io-footprint-opt-Propller-uSD
P.S. I notice the temporary forum code doesn't have any advanced posting options coming up such as embedding URLs.
The down side is in needing a that ethernet cable. Then you might need some nearby switch/router to plug it into, with it's attendant wall wart at which point the small size advantage disappears.
This module was meant for hard-wired installations anyway and as part of a system too, so power is already available. I don't think you'd ever really just run this from a wall-wart although it's possible especially if you can get by with the spare I/O from the module to run some sensors etc. There's up to 7 I/O on the pins plus I2C as well as another 11 I/O on the fine pitch edge pads. The base IoT5500 module is designed to fit into a cutout so that the magjack is level with the host PCB and SMD pads right to the edge allows for a simple solder bridge instead of the standard pins.
The base module can also be controlled directly from a host Prop or CPU with just 4 I/O but you would need to run a fair bit of software to make it work. The better way would be to let the +P8 Prop handle it all including I/O or else or talk to the module via simple RX/TX and let it format up the data and send it off etc.
The +P8 module on it's own also makes for a very compact Prop board with 14 I/O + I2C and includes either 16MB SPI Flash or microSD card and filesystem software including datalogging etc.
PM me if you would like some at the right price, it's mainly shipping that adds up. I will get a shipment off soon for DP where he has volunteered to distribute these locally in the US. (Hang in there Dave)
http://forums.parallax.com/showthread.php/157430-Low-cost-wifi-module-ESP8266
You can find them all over ebay. The firmware is a little rough around the edges but it is hard to beat a $5 Wifi connection!
On other thing I thought of.... I am using my computer's date and time to keep track of time inside the Prop. If the computer is turned off and the Prop does not have the ability to dump the current readings to it, the data is stored in an Array until the computer begins to communicate with it again.
Here is the code I am using right now. Probably quite rough and could use some serious tweaking!
EDIT : I am also using a wall wart already. Got to keep this thing powered for years some how Been running for about 2 years so far with only a few minor glitches. It has helped me get my electric bill from + $200 a month to an average of $180 a month during the summer and under $100 in the winter!
and FTP is there as well.
There is also a webserver in SPIN for Spinneret.
If this will work, I can tie different projects to the same socket server to communicate via web. Am I in over my head?