GPRS or Edge Howto? #5350
Replies: 2 comments
-
Posted at 2014-11-01 by @allObjects CC3000 module provides this connectivity - see http://www.espruino.com/CC3000. It's on my list. The GPS part I have implemented - see http://forum.espruino.com/conversations/255759/. If got the CC3300 Wifi board a while ago, but I'm working on some other items right now - last but not least because default connectivity for my display and and are using the same SPI and control pins. Posted at 2014-11-01 by @gfwilliams Right now I don't have a GPRS/EDGE module that I've tested (or have modules for) I'm afraid. It's on my list of things to get and try out though. It seems like a lot of GPRS modules use AT commands to allow you to make TCPIP connections, and they're very similar to the ESP8266 discussed here - there's some code at that link to make an HTTP connection to the module and it should be pretty easy to modify it so you can use it with a GPRS module. I'll be adding support for the ESP8266 to Espruino itself quite soon, and I plan to make sure it'll work with a GPRS module too. By the way there's also some code here to handle SMS text messages, so you could always send readings via that (although that probably isn't what you want). Posted at 2014-12-10 by net-tobi Hello, are there any news regarding the support of a GPRS module? Which module would you suggest? We are highly interested in using Espruino in combination with a GPRS module for one of our projects. The idea is to build an Espruino based Sensor device which can be used in an outdoor area. The device shall deliver Sensor data to our Servers in the Cloud via GPRS. Best, Tobias Posted at 2014-12-10 by @gfwilliams Hi net-tobi, At the moment there is no built-in GPRS module support (except for some code on the forums for sending text messages)... But as I'm adding ESP8266 WiFi support, and the protocol is similar (but not identical) to many GPRS modules, I'll be adding proper support in maybe 3 months' time. The module that I will be getting working is the one that seems to get used a lot with Arduino - the SIM900A. Right now you can still use this module with Espruino - you'll just have to write some code to drive it. You wouldn't be able to use Espruino's built-in HTTP client and server, but it would be pretty easy to get enough working to send data to a server in the cloud. If you're interested I can give you some pointers? Posted at 2014-12-11 by net-tobi Hi Gordon, thank you for your fast response. For the device prototype I start using a WiFi module now. The final version will use a GPRS module when it is offically supported. Best, Tobias Posted at 2015-03-02 by net-tobi Any news about the implementation of GPRS support? Posted at 2015-03-02 by @gfwilliams Not really I'm afraid. I've been experimenting with finding a way to create something common to ESP8266 and GPRS, and it looks very promising. I now have a SIM900 module (seems common for Arduino) here that I'll be using to develop with when I get time though. Someone else is actually developing support for their own product and seems happy to contribute back, so hopefully they will share some of their code soon too. For the next few weeks at least I have to focus on the Pico, but after that I should have more time to get this sorted. Sorry about the delay... Posted at 2015-03-09 by @joakim I'd be interested in learning what product that is, if you can share that with us? :) One alternative for 2G/3G connectivity is SparqEE CELL, it seems pretty easy to work with over UART: It comes with a SparqeeSIM card, and their plans are actually very cheap if you send very little data. And unlike a few other solutions, it works almost everywhere (with increasing price though): Posted at 2015-03-15 by user49225 For me GPRS is a must.. Sparqee looks interesting Posted at 2015-03-16 by net-tobi For me it is very important as well Posted at 2015-03-16 by @gfwilliams @cknight posted up about his project here: http://forum.espruino.com/conversations/264103/ I'm actually working on this now, and have Espruino calling into JS for network access. I'll get it working with the ESP8266 first, and will then tweak it for the SIM900. Posted at 2015-03-26 by @joakim This one just came out: Cellular modules are getting cheaper! The Dash is just $49 for early birds, and their global SIM is much cheaper than SparqSIM. $1/1MB/month is pretty nice, or even $0.55/500K/month! Incidentally, Konekt is what SparqSIM actually uses behind the scenes. I guess the Konekt guys saw the interest around SparqEE and thought they could do it even cheaper and better. Posted at 2015-03-26 by @joakim Hm, the Dash has a Cortex M4, 12 analog inputs and 31 GPIOs. Doesn't say which exact chip it has, but "it works like an Arduino". Should be possible to run Espruino directly on the module right..?? Posted at 2015-03-26 by @joakim There's also the conspicuously similar Spark Electron: But it's not dual 2G/3G, it's monthly rates are 3 times as high as Konekt's, and it's not active in as many countries. No thanks. Posted at 2015-03-26 by @gfwilliams Hmm, I wonder what the chip is in the Konekt - they talk of Python so it might be running Micro Python... $0.55/mo is really exciting though - if that's actually not just a 'KickStarter special' it'll be the start of a lot more people using it. 500K is absolutely loads for embedded stuff. The modules must be able to get cheaper too - the SIM900s modules on eBay are £12 each, and it wouldn't cost much to shove an ARM on one of them. Posted at 2015-03-26 by @joakim I just noticed some specs for the chip: "Cortex M4 1MB, 16 MHz, 32.768 KHz, Sleep Timer". Does that offer you any clues? They also say:
You're right about SIM900, but it's only 2G, which is already being phased out in the US and Australia, and possibly other regions to follow soon. So SIM900 isn't really an option for me, at least not if you're creating a product to be used in various countries. (Makes you wonder how long 3G has left..) Dash uses u-blox Sara which is 2G+3G, but it has variants for either Americas or Europe/Asia and I don't know which one it is (I just asked on Kickstarter). Dash Pro uses u-blox Lisa which is 3.75G and works just about all over the world. One thing is certain, the world of mobile networks is messy. Posted at 2015-03-26 by LawrenceG It's not just Konekt hardware it's their whole platform that excites me. I've got some of their SIMs and should be able to test the beta platform next week so will let you know how I get on. BTW I had to draw this diagram to get my head around their platform http://industrialinternet.co.uk/iot-2/konekt-io-architecture it might be of help to others. Posted at 2015-03-27 by @gfwilliams It looks very cool to have a platform that can take SMS as well as TCP/IP - that's perfect for a lot of us, as you can get pay as you go SIMs with sensible price text messages in every high street shop. The think I don't get is that u-blox Lisa is crazy expensive - €150 one-off. They must have a massive volume discount available. Posted at 2015-03-27 by LawrenceG Part of the cost issue is carrier approval for the modem/device. In the EU telcos require GCF approval http://www.globalcertificationforum.org/ of at least the modem and increasingly the device (Dash/Electron etc.) before it's approved. With high street PAYG SIMS you don't get any SIM management tools as you do with M2M sims. My M2M provider charges £3.30 a month for 1Mb for a Global SIM. Also most M2M providers don't like talking to me as I'm a one-man-band not some "big corp". For me Konekt/Electron are like citizen band for the IoT. Posted at 2015-03-27 by @joakim @lawrenceG Thanks for sharing the diagram, Konekt looks like a great platform when you see it all together like that! It's really worth it just to have all that abstracted away for you, and you get to focus on the fun stuff. @gfwilliams Lisa sells for just €43.99 here, and you can get Sara for €10 less. (Nice names for modules, but that sounded a bit odd.) Btw, I got an answer from Konekt. They'll let backers pick which variant of Sara they want, meaning which region the Dash should work in. (Dash Pro is worldwide though.) Posted at 2015-04-21 by net-tobi Any news on the official GPRS support (SIM900 module)? I saw a remark in the issue list on GitHub about that, a few weeks ago. Posted at 2015-04-21 by @gfwilliams @net-tobi - not there yet. It's on my desk but I haven't been able to find the SIM I had kicking around (and my phone's one didn't work for me). I'll get it done during the next month I hope. However things have moved on - it's actually at the stage where someone else could easily do it now if I'm taking too long. The ESP8266 driver is all JavaScript, and hopefully isn't too painful to figure out. All the AT command handling is there already. So basically all you have to do is take that file and modify it for the SIM900, which is remarkably similar... datasheet here - take a look at Chapter 8 (TCPIP) Posted at 2015-05-18 by net-tobi Is there someone in the community who already implemented a working driver for the SIM900a module based on NetworkJS? Posted at 2015-05-18 by @gfwilliams I bought a sim card over the weekend and am looking at it this morning. It turns out that the SIM900A doesn't work in the UK out of the box and you've got to update the firmware though - which I'm still struggling to do. Posted at 2015-05-18 by @gfwilliams Hmm - well that was a waste of a morning. Looks like my module is dead. It couldn't see any cell towers and it couldn't read the SIM card, even after a firmware update. I've just ordered a different SIM900 module, so hopefully I'll have more luck with that. Posted at 2015-05-18 by net-tobi Oh... this is annoying. Which module do you exactly have? I have this one: http://imall.iteadstudio.com/im140318007.html This is pretty good. Posted at 2015-05-19 by @gfwilliams That one looks good - mine was a very cheap Chinese one off eBay. The simple way to check is to put a SIM card in, plug it into power, and then see if after a while the light goes from blinking every 0.8s to blinking every 3 sec. Mine never did :) Posted at 2015-06-01 by net-tobi Hello all, I started writing a driver for the SIM900A today based on the ESP8266 driver.
I got stuck at sending a HTTP-Request through NetworkJS. What happens is, that the send-method is called over and over and after a few retries it stops. I can not see any response from the server currently. I assume that there are subtle differences in the use of the AT+CIPSEND command for ESP8266 and SIM900A. Any ideas? Here you find the code:
Posted at 2015-06-02 by @gfwilliams What get shown when you call It looks like it might just send back the result data without I think you need to send the Posted at 2015-06-02 by net-tobi I think the problem is within the AT lib. It just handles lines which end with \r\n. On the SIM900 you have to wait for "> " before sending the data after sending AT+CIPSEND=... The "> " is not ending with \r\n therefore it is not sent back to the callback provided to at.cmd() My send method currently looks like this:
Posted at 2015-06-02 by net-tobi I added the CIPHEAD=1 setting to init and I took the send method of the ESP8266 driver now and I call at.debug() in the callback. It now looks like this:
The output is the following:
Posted at 2015-06-02 by @gfwilliams You probably want to call It looks to me like the While the AT command module doesn't have an easy way to respond to just Posted at 2015-06-02 by net-tobi Hello again, the entire at.debug() trace is the following:
Posted at 2015-06-02 by net-tobi I cannot see any "0, SEND OK" responses and I currently have no idea why. Posted at 2015-06-02 by @gfwilliams Thanks - as you say, no response even to the first Have you tried just sending the CIPSEND command manually and seeing if you can get it to go sending something simple? It might be it wants a newline after the text that's sent? The other option is to go for Ctrl+Z terminated mode:
That'd be easier but will cause you problems if you want to send binary data. Posted at 2015-06-02 by net-tobi Hello again, I tried it manually. When I wait for the "> " to appear, it works:
Do you have an idea how I can wait for "> " using the AT-lib? Best, Tobias Posted at 2015-06-02 by @gfwilliams Ok, great! Yes, It's possible using Posted at 2015-06-02 by @gfwilliams Ok, turns out there's a very annoying bug in the interpreter! Try:
Posted at 2015-06-02 by net-tobi Thank you Gordon. I tried it, but it doesn't work for me :(
Posted at 2015-06-02 by @gfwilliams Can you add some debug code to make sure the It looks possible it's getting confused by the leading newlines. You could hack it in for now by changing the line to:
I'll see about modifying the AT command thing a bit more Posted at 2015-06-02 by @gfwilliams Ok, maybe try now - without the Posted at 2015-06-02 by net-tobi Great to see good progress :) I should react somewhere to "0, CLOSE". What I do not see currently is that the responses which are coming in are sent back to the HTTP-Lib.
Posted at 2015-06-02 by net-tobi Closing is as well now working well. Do you have an idea why the response doesn't show up in the HTTP lib? Here is the entire code:
Posted at 2015-06-02 by net-tobi I replaced +IPD by +RECEIVE and the Handler-Function is getting called. But no response is being shown in the HTTP lib Posted at 2015-06-02 by @gfwilliams Great! The response is coming back prefixed with
Sorry for not getting this sorted for you last time - I've been a bit busy. I did buy the second GPRS module, from a UK seller, but I still wasn't getting a mobile connection so couldn't get anything working :( Posted at 2015-06-02 by @gfwilliams Maybe take a look in the If the If you changed the text in Posted at 2015-06-03 by @gfwilliams Did you get this working in the end? Posted at 2015-06-03 by net-tobi Hi Gordon, I am currently testing the driver in my project. When everything is working fine, I'll send you the code of it, so you can publish it as module here, if you like. Best, Tobias Posted at 2015-06-06 by net-tobi Hello Gordon, I tested the driver again. I currently have the issue that the http status code is not correctly read by the HTTP lib on close. What I get on a HTTP-Request in res.statusCode is the String "\nHTTP/1.1". Is this a problem with with receiveHandler-Function? Best, Tobias Posted at 2015-06-08 by net-tobi I have reproducable problems again with the Pico. [CTRL+C] echo(1) doesn't help here. I just get it working when disconnecting it from USB and from the power source. It happens in the sim900 driver when the method init is getting called. I currently have the problem very often using other code but I was not able to reproduce it. This is the output (after that it hangs):
As well the Pico sends some weird characters sometimes when connecting it to USB (no init function has been set which could produce that):
Posted at 2015-06-08 by net-tobi Regarding the HTTP Status code: I can see that some of the data is not getting passed correctly to the attributes of the Response-Object. See here:
Posted at 2015-06-08 by @gfwilliams edit: sorry - I didn't see these extra posts until my response appeared. I'll take a look tomorrow. Posted at 2015-06-08 by net-tobi Thank you. I attached the most recent version of the sim900 lib. Regarding the problem that Espruino hangs do you think that has something todo with Serial1 as discussed here? http://forum.espruino.com/conversations/255152/#comment12325361 I experienced that when I first connect the pico to USB and then start the sim900 module the problem doesn't exist. I'll try to set USB.setConsole() in onInit tomorrow and check if that solves the problem. Attachments: Posted at 2015-06-08 by DrAzzy I see in there references to username and password - I'm confused, I thought that the SIM900 only required the SIM card. How do you get the APM, username and password? I'm planning to use one of these once my plan expires so I can get my parents and I onto a family plan so I can get SIMs for less than $40-60/month. Posted at 2015-06-08 by net-tobi The apn, username and password depends on the service provider you are using. In the most cases these are the same for all users and you can find it on the support pages of the providers. Here is a list with some apn settings: http://www.hw-group.com/products/HWg-Ares/HWg-Ares_GSM_APN_en.html Posted at 2015-06-09 by @gfwilliams Your hanging could be something to do with the console moving to Serial1 I guess. Have you tried forcing it to USB in onInit? If some code hung, the the input buffer could get full from the responses from the SIM900, which might mean that Ctrl+C no longer worked. It seems strange though. The errors you were getting with the newline at the start of the HTTP request - do they also happen on the very first HTTP request you make? I have a hunch that it might be rubbish that's left over from previous HTTP requests. Posted at 2015-06-09 by net-tobi Hi Gordon, the USB.setConsole() in onInit seems to solve the problem. I can't reproduce it now. Yes the problems with the HTTP request happen in the very first request as well. It's not just the newline. There should be the status code instead of the HTTP version. Best, Tobias Posted at 2015-06-09 by net-tobi Let me know when I should test something again regarding the HTTP problem. Posted at 2015-06-09 by @gfwilliams
Yes, but that's probably a result of the newline at the start - I think the code that splits the HTTP response up got confused. Do you think you could do a request with Posted at 2015-06-09 by net-tobi Sure. Here is the output:
Posted at 2015-06-09 by net-tobi I can see there that the last character of the HTTP-Body as well is not parsed correctly. The correct string is "Hello World!" Posted at 2015-06-09 by @gfwilliams Ok, thanks! that's really handy. So it's actually not the GSM code at all, it's the SIM900 that's sending the extra newlines:
Now I can't find any info on I've had to add a second handler called receiveHandler2, because unfortunately the newline after the
Posted at 2015-06-09 by net-tobi That works!!!! Great! I tested it with small and big files and it seems to send that \r\n after each +RECEIVE Thank you so much Gordon! Posted at 2015-06-09 by net-tobi This is the entire driver which is working for me. If you like you can publish it as official module. Attachments: Posted at 2015-06-09 by @gfwilliams Wow, great - thanks! Yes, I'll try and stick it online as a module. Posted at 2015-06-15 by net-tobi Hello Gordon, I have a problem with the use of at.register('>') in the following code of the GPRS driver:
How can it handle multiple sockets with it? In the AT lib I can just register for some chars once. The next call of the send function for another (or for the same) socket tries to register for '>' again or sends a new AT+CIPSEND without waiting for ">" which leads the communication to an inconsistent state. I tried to set the socket to "Wait" until ">" comes in for the particular socket, but requests for other sockets were still able to send. In the ESP8266 driver the problem was not existing because you send the data directly after AT+CIPSEND, which is - unfortunately - not working with the SIM900. Do you have an idea how to solve the problem? Best, Tobias Posted at 2015-06-15 by DrAzzy No, it is a problem on ESP8266 as well; the moment more than one connection is open at once, everything hits the fan. Posted at 2015-06-16 by @gfwilliams The ESP8266 problem is because of their stupid use of I guess the problem here is that Why not add your own variable to track whether you're waiting or not?
Posted at 2015-06-16 by net-tobi Hello Gordon, I tried to solve it like this yesterday night:
But for some reason I ran into a deadlock situation where busy was set to true but no SEND OK came in to remove it in some cases. I will try your solution without waiting for SEND OK and give you a feedback. Posted at 2015-06-16 by net-tobi Okay we have to wait for SEND OK, otherwise data can be lost. My solutions from yesterday works now. I saw that the LOW_MEMORY flag was set during execution. I compressed the code now and it seems to work stable. Here you find the current version of the driver. Attachments: Posted at 2015-06-16 by @gfwilliams It might be worth adding a timeout - Maybe just use the callback argument of Posted at 2015-06-16 by net-tobi Please see the post above. Okay, If I experience further problems with it, I will add a timeout. Posted at 2015-06-16 by @gfwilliams Thanks - I posted just a few secs after you, so didn't realise you'd sorted it out :) Posted at 2015-06-16 by net-tobi Hi Gordon... It is annoying... Again problems with GPRS. When the sim900 is ready for receiving data after AT+CIPSEND it sends:
When I use the following code:
It removes the "> " from the AT buffer but leaves "\r\n" in it which can cause problems for subsequent requests (maybe for the +RECEIVE handler as well). I tried as well to register for "\r\n> ". That didn't solve that for me. How would you handle that? There are as well situations like
or
Posted at 2015-06-16 by net-tobi maybe by extending the features of the AT lib? Posted at 2015-06-16 by @gfwilliams I'm not sure the issue is quite as simple as that. If you look at the AT module code responsible it would appear to be doing the right thing... It looks to me like it copes with the cases where the line starts with Posted at 2015-06-16 by net-tobi Yes this is as well part of the problem. My close handlers are not getting called if the line starts with \r\n or \r or \n. See here:
This unfortunately happens sometimes, for example a few seconds ago I had the situation:
The close handler has not been called here :( |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-06-16 by @gfwilliams Ok, well you can test in a controlled manner using the Loopback like this:
Now that actually works, so I think you have some other problem there. However the following doesn't:
That was an issue with the AT module, which I've just updated and fixed. But your other issue ( If you want to fix it on the existing firmware, you just need to register a handler for
Posted at 2015-06-16 by net-tobi The new AT lib did it! Thank you so much Gordon! It works much more stable now. I'll test it tomorrow intensively. Posted at 2015-06-18 by net-tobi It is working well without any changes being necessary in the driver I uploaded here a few days ago. So you can use it as module. As well if someone else needs help regarding the SIM900 hardware I will of course help to get it running. Posted at 2015-06-18 by @gfwilliams That's great, thanks! I plan to come up with a page on the Espruino website for it soon! Posted at 2015-06-18 by net-tobi @gfwilliams : I have to say thank you for the great support! Posted at 2015-06-18 by @gfwilliams No problem - glad you got it working - and thanks for getting stuck in and actually making the module in the first place! It's something I should have done myself, but I now have 2 GSM modules, neither of which seem to be able to get a signal! Posted at 2016-06-15 by bmckay Hey Guys - I'm new to IoT but am working on a project that needs to connect to cellular data as it will be a mobile type device. Did this thread end up with the ability to use GPRS data using the SIM900 hardware? Thanks for helping a n00b get his feet wet! Posted at 2016-06-16 by @gfwilliams Yes, absolutely! There's a page with some information on how to do it here: http://www.espruino.com/SIM900 It's pretty easy - you just need to ensure the GSM module has a good power supply, and that you know your mobile carrier's access point details (it's easy enough to google). If you've got other questions it might be better to post up in a new thread though - this one's getting a bit long! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-01 by fobus
Hello,
I'm really sorry about this question, may be it is already discussed, but I can't find any answer.
I want to design a simple tracker hardware that sends location data to server over "http", Location data will be gathered from GPS module (http://www.espruino.com/GPS) but I can't find a GPS or EDGE module. Is there a gprs or edge module to connect the device to internet?
Thanks all.
Beta Was this translation helpful? Give feedback.
All reactions