Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

advice needed on system implementation

Status
Not open for further replies.

qtommer

Member
hi
im building an SMS controlled multi-socket controlling 3 outlets. as of now , my system is able to control 3 outlets with the default SMS commands as follows.

1) ON A
2) ON B
3) ON C
4) OFF A
5) OFF B
6) OFF C

I am trying to add an additional feature to this controller which is SMS command editing.
Through the SMS Command Editor (VB program) , the user can change the labels used in the commands (A,B and C) into a preferred name (e.g. stove, oven) etc..by typing in the desired label in VB and the string sent to the mcu. the mcu will receive this new string , store it in EEPROM overwriting the previously set values (A,B and C) and these new labels will used as the commands for controlling the handphone.

E.g.
Commands for ON A and OFF A after editing is now:
-ON STOVE
-OFF STOVE


To implement this SMS command function im thinking of using a secondary PIC as an interface between the PC (VB program) and the main PIC (which is interfaced with the phone and controls the multi-socket outlets as well). The reason im using a secondary PIC is because the UART of the main PIC is already connected to a GSM handphone (24/7 of the time). The available UART on the secondary PIC can be connected to the PC Serial Port to receive the string from the PC. When the string is received, the Secondary PIC will then relay this string to the main PIC through an I/O pin (through software serial comm) as an interrupt to the main PIC. The main PIC receives this and stores the new string into the EEPROM.

This is just the main idea for now. I would like to seek any advice on whether this method is the best method to implement or are there any other ways i can go about to accomplish this. All advice is greatly appreciated.
Thanks for your time=)
 
im now doing pic to pic serial communnications whereby im sending a byte from pic A to pic B through an I/O pin in a "freestyle" manner.
At the receiving part how should i implement the receiving of the serially incoming bits and save them into a single register/variable?


pic A(sender) is sending out each bit with a delay of 1ms so im programming the receiver to receive at this speed. An indication that transmission is about to occur (sorta like a start bit) is through a separate I/O line going HIGH.

is my method feasible?

thanks
 
I can't picture your system. I don't think anyone else can, which could be why you haven't got any replies. You may need to add a block diagram.

To control appliances by sending SMSs to a mobile phone you don't need a PC at all. You only need one PIC. Connect a PIC to the serial port of the GSM phone. That can even be bit-bashed if you haven't got a serial port free. You probably need to get the PIC to poll the GSM phone and ask it for what text messages have been received. Also you need to delete text messages once they have been acted on.

I make vehicle tracking systems. Although we now use a PIC with two USARTs, one for the GPS and one for the GSM phone, the first ones had a PIC with just one serial port. That was used for the GPS so the communication to the GSM phone was bit-bashed. The systems are configured by SMS, and the PIC polls the GSM phone for text messages (AT+CMGL=4) and deals with the messages before deleting them.
 
thank you for your reply Diver300=)
i apologize for the lack of clarity

i am aware that i do not need a PC for the purpose of sending SMS to a mobile phone through a MCU. The purpose of the PC is actually as follows:
Imagine a system where i can turn on/off 3 appliances.
hence, the list of SMS command for the system would be:

ON A
ON B
ONC
OFFA
OFFB
OFFC

The purpose of the PC is to change the names A B and C into a desired name..
e.g.

after PC write operation on MCU:
new commands are now

ON STOVE
ON FRIDGE
ON TANK

OFF STOVE
ON FRIDGE
ON TANK

putting the aforementioned on hold, i am no shifting my focus to smaller blocks of the system which at the moment is serial transmission from PIC to PIC without using the UART...
Ignoring my previous post, i now intend to transmit a byte from Port A of a PIC to Port A of another PIC in a parallel.

For the receiving PIC, how can i read the data from the port into a register?
i tried moving the whole PORT into a register using movf PORTA,REG1 but to no avail
is there any method to read the whole port simultaneously?
i have no problem reading an individual pin on a port.

thank you=)
 
thank you for your reply Diver300=)

i tried moving the whole PORT into a register using movf PORTA,REG1 but to no avail
is there any method to read the whole port simultaneously?
i have no problem reading an individual pin on a port.

thank you=)

You just use
Code:
     movf PORTA, w
     movwf  REG1

I still don't see why you want two PICs.

Also it would be possible to configure a PIC to have the different functions renamed. You could have a command that reads:-

"Allocate A cooker" which would be stored by the PIC that receives the SMS. However I would suggest that you get it working with ON A etc first.
 
I still don't see why you want two PICs

The main PIC is connected to the GSM Phone (through the UART) and is continually polling the phone for an incoming message. Hence the PC cannot interface directly to this PIC as the UART is continually in use.
Hence, I am using another PIC to receive the string from the PC (through the UART) and send the received bytes to the main PIC through an I/O port in parallel. When this secondary interfacing PIC receives the string from the PC, it will first send an interrupt to the main PIC. Would this be okay? or is it possible to immediately transmit bytes from the PC serial port directly to an I/O pin of the main PIC?

Also it would be possible to configure a PIC to have the different functions renamed. You could have a command that reads:-

"Allocate A cooker" which would be stored by the PIC that receives the SMS. However I would suggest that you get it working with ON A etc first.

the purpose of the PC is so that the commands can be configured as many times as possible at will as the need arises. Hence, from day to day, i can configure my PIC to save new system commands through the PC. My system is able to work already with the commands ONA, ON B...etc..

You just use
Code:

movf PORTA, w
movwf REG1
yes yes why din i think of that...thank you lots=) giving it a shot now


thanks again=)
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top