MX029 - GSM Remote Control

Forum to discuss articles which have been published in Matrix Multimedia's article zone. If you have any comments or questions regarding the articles please post them here.

Moderators: Benj, Mods

Post Reply
User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

MX029 - GSM Remote Control

Post by JohnCrow »

Article: http://www.matrixmultimedia.com/article.php?a=504

If you have any questions or comments on the article, please post them below.
1 in 10 people understand binary, the other one doesn't !

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Basic GSM Remote Control

Post by JohnCrow »

GSM Remote Control
Updated Version


The first version of my GSM remote control was fairly basic with little feedback.
This version has been greatly improved.

The basic hardware configuration has not been altered, except I'm using the standard matrix LCD E-block rather than my custom 4 line display

Sending a binary string i.e. 10100010 (Lowbyte first) will turn on / off the 8 control channels
Bits 1 -4 low nibble
Bits 5-8 high nibble

Initial status is still powered up all off.

When first powered up the local display will show
Finding Network

Once initalised it will show
Network Setup OK

The system then shows

Waiting….
It will stay in this state until a message is received.

The local display will reflect what has been received.


When the control string has been received and applied it is sent back to the control phone for confirmation.


It is now possible to send a single character control to the device.

2 = Status request
This sends the current status of the channels back to the control phone as a binary string i.e. 10010001

3 = All Channels Off
This turns off all channels.
A message confirming this is sent back to the control phone.

4 = All Channels On
This turns on all channels.
A message confirming this is sent back to the control phone.

3 & 4 can be confirmed by sending 2 (Status Request) if required.

Further commands can be added if needed by extending the decision loops.

Any other entry will return a Unknown Command message.
GSM Remote Control Working System V2 - No Phone Number.fcf
GSM Remote Control V2
(22.36 KiB) Downloaded 1664 times
Last edited by JohnCrow on Sun Aug 21, 2011 7:20 pm, edited 2 times in total.
1 in 10 people understand binary, the other one doesn't !

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Basic GSM Remote Control

Post by JohnCrow »

Added a security update
Program checks that the received phone number matchs the one stored in the system.
If they dont match, the txt message is ignored with no feedback

This way, if a message was sent in error, the sender does not know what has received the message.
GSM Remote Control V3 - No Phone Number.fcf
GSM Remote Control V3
(22.82 KiB) Downloaded 1647 times
1 in 10 people understand binary, the other one doesn't !

maan_q
Posts: 3
Joined: Wed Oct 26, 2011 9:52 pm
Has thanked: 3 times
Contact:

Re: MX029 - GSM Remote Control

Post by maan_q »

Thanks sir John Crow for this project,
MY question how i can change the numbers 2,3,4 to characters for example AC1ON ,AC1OFF,Status . ?
regards

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: MX029 - GSM Remote Control

Post by JohnCrow »

Hi
I think that should be possible. For example in the "Decode Message Macro"

Where I look for 2 , 3 ,or 4 you will need to compare for a text string.
Sorry I dont have time to modify it at the moment.
1 in 10 people understand binary, the other one doesn't !

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: MX029 - GSM Remote Control

Post by Spanish_dude »

Looks awesome, very well done John.

Nicolas

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: MX029 - GSM Remote Control

Post by Enamul »

Hi John,

Excellent work! :)

I am trying to use that with wavecom supreme 10 modem so that if anyone doesn't have GSM module can try with standard modem.

I will post the schematic and program soon..

Thanks,

Enamul
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: MX029 - GSM Remote Control

Post by Enamul »

Hi,

I have re-implement John's V3 in FC v4.5 which is compatible with V5 as well. So V4 user can easily use this program. This program can be used by the users who have GSM board (EB066) but also those who don't have EB066 but have RS232 board (EB015) and also those don't have any of those.. :D ..by just making a simple circuit using the schematic given the last page of the pdf in the following link:
http://www.matrixmultimedia.com/resourc ... 5-30-2.pdf

It's pretty simple..just need MAX232 IC and few other components..If anyone still confused..I can post a schematic avoiding the patch...

ok..Now move to the circuit connection of the current post:

PIC 16f877A, 20MHz, LCD>PORTB (DATA>RB0-4, RS>RB4,EN.RB5), Relays(8)>PORTD,

As I have said in my last post, I want to implement this for general purpose GSM/GPRS modem. i have chosen Wavecom Supreme 10 modem which is available to me right now. Although the AT commands we are using in this program are almost similar in most of the modems.

Modem connection via EB015 (custom made max 232 board) >> PORTC
RTS>PORTC0
CTS>PORTC4
TX>PORTC6
RX>PORTC7

Move to Code:

For details description about code, in this forum page John has described everything..I have just modified few things...

To Ben:

Code: Select all

char FCD_GSM0_CheckNetworkStatus()
{
	
	//0 = not connected
	//1 = connected
	//255 = no reply

		char retval = 0;

		FCD_GSM0_SendCommand("AT+CREG?",8,1);		//Check network status

		if ( FCD_GSM0_StringReceive() == 0)
			return 255;

		if ( GSM_STRING_ARRAY[7] == '0' || GSM_STRING_ARRAY[7] == '1' && GSM_STRING_ARRAY[9] == '1' || GSM_STRING_ARRAY[9] == '5')
			retval = 1;
	    FCD_GSM0_StringReceive();
		FCD_GSM0_StringReceive();
		Wdt_Delay_Ms(100);

		return retval;

}
I have modified
if ( GSM_STRING_ARRAY[7] == '0' || GSM_STRING_ARRAY[7] == '1' && GSM_STRING_ARRAY[9] == '1' || GSM_STRING_ARRAY[9] == '5')
because I have tried in different modems in other projects, after AT+CREG? command..some modem returns.. +CREG: 0,1 while connected to network but some modem returns +CREG: 1,5 which generally shows in roaming mode but some modem normally shows this..

So using the default code you can't ever get connected.

Rest of the things are ornamentation...John I really like your code! Nice work.

Still anyone needs clarification feel free to ask :)

Thanks,

Enamul
Attachments
GSM_Remote_Control-using modem.fcf
(21.25 KiB) Downloaded 1391 times
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MX029 - GSM Remote Control

Post by Benj »

Hello Enamul,

Thanks for the heads up on the code and for providing a working fix. I will make the changes to the master C file so these mods will be in the next release.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: MX029 - GSM Remote Control

Post by Enamul »

Hi,

You are welcome :)

Enamul
Enamul
University of Nottingham
enamul4mm@gmail.com

maan_q
Posts: 3
Joined: Wed Oct 26, 2011 9:52 pm
Has thanked: 3 times
Contact:

Re: MX029 - GSM Remote Control

Post by maan_q »

Sir John Crow ,
can you tell me whats error in my project,
Flowcode1.fcf
(9 KiB) Downloaded 1305 times

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: MX029 - GSM Remote Control

Post by JohnCrow »

Hi maan_q

Try this one. Ive tried it on my GSM board and its working, (but not quite as you want :? )

What Ive done is to have it turn on an LED at each stage
Bit 1 - Network ok
Bit 2 Incoming data
Bit 4 Message Received

By doing this you can tell where the program getting to each part of the flowchart
(You can delete this once you looked at it.)
Simple Txt Works.fcf
(9 KiB) Downloaded 1328 times
Ive kept the flowchart in FC4

Note - from the FC4 Help File

Compare$(string1, string2, compare_type)
Compares the two strings, parameters 1 and 2, and returns a BYTE value corresponding to the following results:
0 = strings are identical
1 = string1>string2
255 = string2>string1
It does not seem to see the received string as identical to the one stored in the compare (Option 0)
Using option 1 allows it to turn on the leds.

Try printing the received string to the LCD and see if the its what you expect.
Also you could try setting the string length in variables to match the length of the strings you are using.
Let me know how you get on, if not I'll have another look tomorrow for you.
1 in 10 people understand binary, the other one doesn't !

maan_q
Posts: 3
Joined: Wed Oct 26, 2011 9:52 pm
Has thanked: 3 times
Contact:

Re: MX029 - GSM Remote Control

Post by maan_q »

THanks Sir John Crow ,
I have tried the program with a little modify is working very good you can see below,
Attachments
Simple Txt Works.fcf
(10.5 KiB) Downloaded 1252 times

BEANBAGS
Posts: 7
Joined: Thu Feb 07, 2013 7:40 pm
Has thanked: 3 times
Contact:

Re: MX029 - GSM Remote Control

Post by BEANBAGS »

Hi guys,

Sorry for dragging up an old thread, I am doing a GSM based project and was looking through the forums, I am using the EB066 with a development board at this stage. I am not all the familiar with flowcode and was wondering what port is used on the development board for it. I have being using port C and have being trying to send a simple SMS but am failing too. I found a program on here that test the network connection and am sure that I am unable to connect a network.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MX029 - GSM Remote Control

Post by Benj »

Hello,

For the EB066 to work correctly you first need a non contract type SIM card. i.e. a SIM which you need to buy credit for. Contract SIM cards are encrypted so you need to know the encryption keys for the network which the providers do not usually release to the public.

When the EB066 connects to the mobile network the LED flash pattern changes to about 200ms on and 3s off. If this remains stable then you should have a stable connection to the network.

The GSM board should connect to the port which has the hardware UART on your device. This is usually portC but you can check by looking at the chip diagram in Flowcode and finding the RX and TX pins. You then should refer to the EB066 datasheet for details of how to route the signals correctly using the patch system.

If you are unable to get a stable signal then there was a bit of a bug in the v1 EB066 boards which means that SIMS on the 800MHz band work well but other bands do not work so well. I seem to remember posting a list of network providers in different countries and their associated band here on the forums so let me know if you need this info and I will have a search.

lewisrendal
Flowcode V4 User
Posts: 61
Joined: Tue Feb 01, 2011 7:21 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: MX029 - GSM Remote Control

Post by lewisrendal »

Hi John,

I hav just got my version 2 eb066 eblock and powered up with the sample program you have, i'm using the 18f4455 instead of he 4550 very simular.

When power is applied is the led lite up ?

The lcd sits there just saying finding network ??

Unfortunatly matrix don't have the datasheet on this module just the old one ?

Thanks for your help

James

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: MX029 - GSM Remote Control

Post by JohnCrow »

Hi James

If I remember I have used both the 4550 and the 4455 pics for this.
I was not aware a new version of the board had been released. I should think it will be compatible as far as the flow code macros work.

First thing I can suggest, you are using a prepay (pay as you go) sim rather than a contract type one as these wont work.

Are you using FC4 or FC5
1 in 10 people understand binary, the other one doesn't !

lewisrendal
Flowcode V4 User
Posts: 61
Joined: Tue Feb 01, 2011 7:21 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: MX029 - GSM Remote Control

Post by lewisrendal »

Hi John,

Yes I have had to wait for over one month for it to arrive.

I'm using version v4.5 flowcode.

I have pay as you go sim, one orange and one virgin, both do the same just sit there saying finding network...

Being one of the first eb066-002 to be released maybe the answer ?

I have attached the program which includes the virgin number only.

Thanks for your help

James
Attachments
GSM Remote Control V3 - 18f4455.fcf
(22.82 KiB) Downloaded 1064 times

saad.sharif
Posts: 16
Joined: Sun Nov 10, 2013 12:35 pm
Has thanked: 4 times
Been thanked: 1 time

Re: MX029 - GSM Remote Control

Post by saad.sharif »

hi enamul
i am using sim900d modem i am still confused how to connect with the file u attached above... please can u give me the layout how to do connection with pic and gsm modem...

margaretdavid
Posts: 2
Joined: Fri Feb 07, 2014 11:49 pm
Location: new york
Contact:

Re: MX029 - GSM Remote Control

Post by margaretdavid »

hmmm great thank for sharing this information

lewisrendal
Flowcode V4 User
Posts: 61
Joined: Tue Feb 01, 2011 7:21 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: MX029 - GSM Remote Control

Post by lewisrendal »

HI Ben,

Do you have any idea why the telit module accepts the at+cpbw command but the sim900 does not and returns the error cme 03 "operation not allowed"

In the sim900 manual it says enter - at+cpbw,"99999",129,"fredbloggs"
But in flowcode I have to write "at+cpbw,99999,129,fredbloggs" (is this the issue why) if yes then how can I send the above, flowcode will not let me.

Thanks for any help

Regards
James

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: MX029 - GSM Remote Control

Post by kersing »

lewisrendal wrote:In the sim900 manual it says enter - at+cpbw,"99999",129,"fredbloggs"
But in flowcode I have to write "at+cpbw,99999,129,fredbloggs" (is this the issue why) if yes then how can I send the above, flowcode will not let me.
Hi James,

Could you try entering \" (backslash followed by double quotes) where the manual lists quotes, so the example string would be:
"at+cpbw,\"99999\",129,\"fredbloggs\""

Jac
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

lewisrendal
Flowcode V4 User
Posts: 61
Joined: Tue Feb 01, 2011 7:21 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: MX029 - GSM Remote Control

Post by lewisrendal »

Hi Jac,

Thanks for helping, have tried this one and same error cme 03 comes back ?

When I send at+cpbw=10 (which erases number in position 10) this works and sends back "ok" and when I check using the m2m solution software the number has gone when I read the phonebook. but it does not like at+cpbw,number,code,text"

Even if I try to allocate a position i.e at+cpbw=10,number,code,text" this does not work either, yet they work with the telit 865 module ?

Most bizzare !?

Regards
James

lewisrendal
Flowcode V4 User
Posts: 61
Joined: Tue Feb 01, 2011 7:21 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: MX029 - GSM Remote Control

Post by lewisrendal »

Hi Jac,

Thanks for your help, I forgot to add the "=" it does not work doing it my way, but when I do the command your way e.g "at+cpbw=,\"99999\",129,\"fredbloggs\"" it works !!!

Clever Man, Thanks again

James :mrgreen:

lewisrendal
Flowcode V4 User
Posts: 61
Joined: Tue Feb 01, 2011 7:21 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: MX029 - GSM Remote Control

Post by lewisrendal »

Hi,

Has anyone had any dealings with DTMF. i.e at+ddet = 1
Answer call:-
Then how to receive the numbers via serial port when keys pressed ?

Many Thanks
James

Post Reply