GSM2 Click Interfacing. #422
Replies: 22 comments
-
Posted at 2014-02-19 by nicolasc_eu Hi, My Sim900 does not accept the newline character. If you try :
The problem persits ? Best regards, |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-19 by @gfwilliams It could well be the newlines that are causing problems. As @nicolasc_eu says, try using Just a note that if you want to send 0x1A, you can do:
but the following won't work:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-19 by nicolasc_eu Oh, sorry for the mistake |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-19 by Hardware_Hacks Thanks for the replies will give this a go tonight and let you know the outcome. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-19 by Hardware_Hacks I've managed to get a couple of messages to come through based on the following code:
Where msg is just a string of text to test with. However it is hit or miss it seems whether a message sends. I get a SMS probably once every 4 or 5 restarts of the device and re-flashing with the code. I seem to be getting loads of garbled text coming back from the GSM module as I had in my first post. This seems to mess up the commands being sent also as sometimes if I send a command using Serial4.print("AT+blahcommand"); I then see in my terminal a mash e.g.:
I never sent "AAT+CMGS" I actually sent "AT+CMGS". Also the spurious data coming back is everywhere.. I've tried messing with the baud rates to no avail. Further example:
That is using a low baud of 2400. I get similar issues with high baud. The lower baud however always results in the "ERROR" message, the higher bauds atleast register something but I still get the garbled outputs which means nothing. The parsing script I use for Serial4.ondata is:
Im attempting to pick up /n /r and > (which is returned when the GSM wants you to enter the SMS text). Sorry for the long and incoherent post but theres lots of small issues. I know the module is functioning at least as I have received text messages, saying that though the messages are also garbled e.g. It seems to be sending the messed up text and then appending my actual "test" message on the end. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-19 by DrAzzy Have you read this thread, particularly the bit about PDU encoding? http://forum.espruino.com/conversations/626/#comment7811 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-20 by @gfwilliams It's possible that it's also just a bad electrical connection from TX of the module to the Espruino... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-20 by Hardware_Hacks I'll check the tx connection and also the board power. I need Max of 2amps and also 5v. I've been using the bat pin on the espruino and I think it isn't strong enough to meet these requirements. I'll also have a mess with the tx line. I'll try it on a different serial first to see if the spurious data coming back drops off. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-20 by @gfwilliams @Hardware_Hacks there's a 1 Amp thermal fuse on the Espruino board, so that could cause you problems. If powering from USB, the PC is only guaranteed to provide 500mA too. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-21 by Hardware_Hacks Thanks for all the help on this guys. I have just wired up the GSM module to a 1000mAh battery with 3A output and only using the Espruino for reading the RX and TX lines. The text messages now come through it seems every time and the AT commands are more responsive. I am still getting some spurious data coming through the lines but not half as bad as before here is what I am seeing:
The text message I receive is:
Subsequent messages are better:
With the message received at the phone being:
Is there a check I can put in place to remove these weird characters? Currently using:
For serial data handling. For anyone else with similar issues to this thread, power was the killer for me it seems. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-21 by Hardware_Hacks Ignore the last message.. It now seems to be working fine. Must have been some dodgy wiring! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-24 by @gfwilliams :) Great, glad it's going! It's really good to see some GSM stuff. Hopefully soon we could get some kind of library working - being able to read text messages would be awesome. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-23 by Hardware_Hacks Just found this library which I think I might butcher up and create a module for us: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-23 by Hardware_Hacks Just had a quick look through and since I'm still a js newbie I'm guessing I need to do the following:
Ok I'm stuck already @gordon any tips? I don't mind doing the leg work :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-24 by @gfwilliams That sounds about right... There is some basic event emitter stuff - check the reference (however it applies to all objects right now, not via a special EventEmitter class). However you might be best off using callbacks instead... Especially as there's no Personally I'd just look at what it's doing and reimplement it... That would probably be easier than trying to convert, and you'd probably get a nicer result |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-24 by Hardware_Hacks I agree and its kind of what I was doing in my basic set up. Time to brush up on callbacks then :) Thanks for the pointers |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-09 by Alex Hi Gordon, Thanks for all the great work so far! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-09 by @gfwilliams @alex: I've just created an issue for this: espruino/Espruino#318 I'm not 100% sure when it will come - will you need to bind arguments, or just If you don't need args, you can always workaround it for now by doing:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-09 by Alex Hi Gordon, thanks for the reply! I'm dynamically constructing a function that is passed to an object. That object will then be free to call the function with it's own this. The reason why I dont simply use apply in the object (which will work too ofcourse) is that our current backend binds the this of the object to the function beforehand so the input files are already finalized. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-09 by Alex Hi Gordon, it seems using the code in your example crashed the espruino. I did find a workaround which will suffice for now but using the bind() function would be much neater. I have branched the bug off on my git, maybe it can help you identify a problem. I'm using the 1.60 firmware. My Git is here: https://github.com/AlexDM0/espruinoEVE |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-09 by @gfwilliams Might be a 1v60 issue I guess... I'm using a pre-release build here with a few more fixes/changes. Maybe create a new post (this is getting a bit off topic ;) and try and narrow it down to a really simple bit of code that crashes - and then I can look at trying to fix it. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-09 by Alex I'll keep it in mind, when I have time to narrow it down I'll make a new topic. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-18 by Hardware_Hacks
Hi All,
I'm a bit stuck when trying to send a text message via my GSM2 Click device which uses the M95 chip.
I have the module accepting AT commands through Serial4 however I really can't get the syntax working correctly to send a SMS message sucesfully.
I can carry out the following commands:
I firstly set the chip to Text Mode:
I then set the number to send the SMS to (I have added in the xxx's for anonymity)
As you can see there is a lot of garbled characters but the output is an "OK" at the end.
I then assume that the Serial4 is sat at the ">" prompt where I would then enter the text for the text message so I go ahead with the following command:
From here I know I need to send a CTRL+Z character at the prompt to send the message so I carry out the following:
However.. I receive nothing. I would expect to see an ID number pop up and the message to go through to my phone.
Any ideas where I am going wrong here I've been messing around with all the variants I can think of - changing the Serial.write to print and print to println with no luck.
Beta Was this translation helpful? Give feedback.
All reactions