folks,
many of you will have seen the page I'm maintaining on my efforts to introduce an emonbase that uses GPRS instead of ethernet.... Wanted to get some discussion on it, so I'm putting this in the forum. I'll try to update the original page, so that it ends up a neat(ish) white paper and I'll us this for more general discussion.
So, today I've attached my log from this morning ; I'm not clear on the difference between receiving an ACK and getting the response I expect from the SM5100B. An ACK tells me the server received the data from a handshake perspective, while the lack of an STCPD: 1 from my SM5100B tells me it's an O2 or a SM5100B issue ; i.e. GPRS or device issue ; think I need to google GPRS call flows ...
have a good weekend,
Eamonn
Re: Emonbase using GPRS instead of Ethernet
Today, I managed to read the server response......before the socket closed.
When I tried to send to the following to www.google.com 'GET /search?q=arduino HTTP/1.0’ or even just 'GET / HTTP/1.1'
I got back the following.....
+SSTR:1,HTTP/1.0 400 Bad request
Connection: close
Content-Type: text/plain
Date: Wed Nov 2 :: 1eeeetodobudto as4
Now, though SoftwareSerial will be too slow to keep up with the Sm5100B [9600 is tooo slow], this error says I need to go read http://www.w3.org/Protocols/rfc2616/rfc2616.html and see what I'm doing wrong.....
I'll go again, and try to clean it up.....
Eamonn
Re: Emonbase using GPRS instead of Ethernet
I just did a HTTP GET with the SIM900 GPRS shield and OKG, so I'll try to do a POST tomorrow and get some emoncms.org feeds updated.
Eamonn
Re: Emonbase using GPRS instead of Ethernet
I can post the word HELLO to emoncms.org and I get an OK back..... But not when I try to post http://emoncms.org/api/post?apikey=MYAPIKEY&json={power:274} for some reason.
I think I have the syntax worked out for the SIM900 but need to know if I should be sending the whole URL to emoncms or just part of it .
log from tonight:
AT+HTTPPARA="CID",1
OK
AT+HTTPPARA="URL","emoncms.org/api/post?"
OK
AT+HTTPDATA=56,20000
DOWNLOAD
-THEN I enter "apikey=MYAPIKEY&json={power:274}"
and get an error.
However, if I just enter HELLO [ having specified AT+HTTPDATA=5,20000 above beforehand, I get the following type of response which looks good.
OK (then I ented the AT+HTTPACTION=1 below)
AT+HTTPACTION=1 (and it returns the following, showing the HTTP 200 response)
+HTTPACTION:1,200,424
it'll be Wednesday evening before I get another shot.....
Eamonn
Re: Emonbase using GPRS instead of Ethernet
Hi Guys,
I also like the idea of using 3G.
Using Wr703n router from TP-LInk that supports ethernet, wifi and 3G (3G with addition of 3G dongle). This cost about 16€ on ebay, comes in Chinese. You've then two choices use in Chinese ( using google translater or cheat sheet available on google search) alternatively reflash with openwrt and have full control. I've tended towards later. The wifi works great with emonbase and Raspberry Pi, however I've found 3G hit and mis at first, but I have two emonbases working for a month ok without having to be powercycled.
Additional note the emonbase multimode saved me a fortune by lowering bandwidth costs and also made it more reliable.
I'm now tending towards Raspberry Pi and will test 3G as soon as cable arrives (USB 2.0 Female to Dual USB A Male Power Y Cable), reason Pi doesn't have enough power to keep 3G dongle powered on its USB. Great work above guys it would be great to have a robust 3G solution.
Cheers
Peter
Re: Emonbase using GPRS instead of Ethernet
Thanks for that. nice looking option!
Eamonn
Re: Emonbase using GPRS instead of Ethernet
log file from this mornings test ; no joy yet but I will stay knocking on this door until it opens :-)
Eamonn
Re: Emonbase using GPRS instead of Ethernet
sim900 update ; well more questions really...
Merrry Christmas! Maybe I'm a bit early, but an music gig on TV was interrupted by my wife putting on a Christas CD last Saturday, so I know we've arrived :-)
I've bolded the sim900 command/response below
Would anyone be able to tell me if this should work. i.e. would it be valid in terms of emoncms[ maybe it's a Trystan Q] but I'll throw it out there.
I need to enter http param specifying the URL, but seem to be constrained w.r.t. length. i.e. if I specify the following it doesn't work .... I'm not sure what the maximum length can be for http paramvalue
AT+HTTPPARA="URL","http://emoncms.org/api/post?apikey=MYAPIKEY&json={power:274}"
It returns an error [lit... ERROR] because the string is too long
I got a 200 [OK] response from emoncms.org with the following but don't see any update on my inputs .....
Step 1: URL as follows...... AT+HTTPPARA="URL","http://emoncms.org/api/post.php"
Step 2: pass in apikey=MYAPIKEY&json={E:2} using
AT+HTTPDATA=50,20000 // so my string is 50bytes long, please give me 20 seconds to get it sent
When I get the DOWNLOAD prompt, I enter apikey=MYAPIKEY&json={E:2} and get the 200 response as follows
+HTTPACTION:1,200,0
Note, I used E:2 because 50 seems to be the max length!; i.e power:273 etc throws back errors.. http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.2.2 does allow for ? in the http URL so I think it's just a length issue....i.e. I should be able to pass in http://emoncms.org/api/post? as the URL.... this doesn't work though. Might be down to simcom's tcpip implementation.
Eamonn.
Re: Emonbase using GPRS instead of Ethernet
Greetings all, I'm in the same project described here. That is, I need to send energy data via a GPRS module SIM900. If anyone can help me with information ....
Currently I have error when executing the command AT + HTTPINIT (boot a "mistake" as retoro). And do not get conctarme with emoncms server. Any help is good.
Thank you..!
Re: Emonbase using GPRS instead of Ethernet
José, really not sure. I haven't tried this in a while. I spent months working on it but the results were not consistent.
I used a tool called 'Terminal' https://sites.google.com/site/terminalbpp/ to test out the commands. Have you tried this?
Eamonn