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.

Comm's between 3 Pics

Status
Not open for further replies.

pixman

Member
Hi

I want to do a project and need to have comm's between 3 pics. Data transmit and receive in both directions.

I will have 1(master) pic and 2(slave). The master must be able to communicate to the slaves and the slave to the master.
Is this possible with USART.

I have done a search but nothing comes up.
I have searched on google and have found I2C can be used, but no examples.
I will use assembly, Still not learnt C.
would like to use pic18f if possible.

David
 
Probably the easiest option is to simply connect them via the serial ports, looping through from one to the other - allocate each one an address, and send 'packets' of data which get passed down the line until it arrives at the correct address - this doesn't limit you to three devices either.
 
What I'm trying to do is make a house alarm system with a GSM modem (modem will use SMS and Voice).
It will have a key pad for setting / resetting the alarm with different types of settings. Night setting will deactivate some sensors.
Away setting will enable all sensors.
I have the PIC to GSM sorted via RS232.
The problem is that the main control unit will be hidden with the GSM unit.
The keypad will be near the Door.
The keypad will be a 4 x 4 type, it will have a LCD screen.
The keypad will double as a phone keypad.
So the door keypad will have to send commands to the main unit to either set/reset the alarm or act as a keypad for cell phone.
A MIC and Speaker will be built into the keypad console.
 
I see lots of posts about using GSM modems.I wonder how do you connect to the cell network? Do you need to open a special account with a cell company? I looked at the Web sites of cell companies here and they don't seem to offer any services except with phones, tablets etc.
 
Just use a pic with 2 UARTs like the 18F24J11. Even in quantities of 1 they're only $2.50.

Edit, you also get the advantage that you can work with inverted RS232 signals with the above chip. Handy if your GSM needs inverted signals - saves a max232.

Mike.
 
Last edited:
I'm with Nigel here, you have a Master/ Slave relationship on the network. Make each node addressable and use RS-485 driver chips to bus them all together. You can then use the Uarts for communication with the Master polling each of the Slaves for status. The upside of doing this is that it makes it really easy to detect or pinpoint a failed/ failing node in the system.
 
...or act as a keypad for cell phone.
A MIC and Speaker will be built into the keypad console.

What sort of distance are you thinking between nodes?

How are you planning to get the audio signal from the keypad back to the controller?
 
The audio will be hard wired to GSM modem.
The distance will be no more than 30 meters from keypad to main unit(master) and GSM.
 
RS485 or CANBUS are probably the two main contenders. RS485 is simpler, more flexible and can be handled by any PIC with a UART (or bitbanged on pretty much anything else), CANBUS has collision detection, automatic checksums and acknowledgement built in, so it is far more reliable and easier to detect when something has gone wrong.
 
This is a completely different scenario to how you initially described it, I would simply use the UART to feed the GSM modem, and use a second software serial port for the input from the keypad - easy as that.
 
I see lots of posts about using GSM modems.I wonder how do you connect to the cell network? Do you need to open a special account with a cell company? I looked at the Web sites of cell companies here and they don't seem to offer any services except with phones, tablets etc.

You simply use a GSM modem, either a module or a chip and build your own.

You then insert a SIM card, either PAYG or account, and use it exactly as a normal phone SIM card.

However, as SIM cards expire, you need the system to 'wake up' and send texts at regular intervals - in the alarm application I did for a friend I wrote it so you could configure the alarm by sending it texts (during the initial setup period, as it then shuts down so it can't receive), including how often it sent the regular texts.
 
That does seem like a simpler option. If the GSM is controlled by a separate PIC (and if so, does it need to be?) and the keypad needs to talk directly to the GSM PIC then a bus is needed, but if it is just the central PIC that talks to the GSM and the keypad then yeah, two separate 232 links would probably be better.
 
I am trying to find a pic18f43k22 locally. It has 2 uart. that would make life easy, if not I will use 1 on board and 1 software.
 
Uhum, 18F24J11, dual UART and RTC built in.

Seems like a no-brainer to me.

Edit, posted at same time.

Mike.
 
The S.A. suppliers don't have stoke and will only bring in a min quantity.
However they have requested a sample of a pic18f45k22, it will arrive in a week.

I need it in a dip package and the more i/o the better.
 
I need to look into this. Noone seems to sell SIM cards here, only when you buy a phone.

However, as SIM cards expire, you need the system to 'wake up' and send texts at regular intervals - in the alarm application I did for a friend I wrote it so you could configure the alarm by sending it texts (during the initial setup period, as it then shuts down so it can't receive), including how often it sent the regular texts.

Does this mean that you can send texts even after the SIM card expares?
 
I need to look into this. Noone seems to sell SIM cards here, only when you buy a phone.

You can buy SIM cards here pretty well everywhere, even supermarket checkouts have them.

Does this mean that you can send texts even after the SIM card expares?

No, if the SIM card has expired (not been in contact for too long) then it's totally dead and can't ever be used. In order to send texts it has to still be active, and have credit as well. I was given a special 'text only' SIM card while working on the alarm project, this provided unlimited texts with no ongoing costs - but it also expired and no longer works :(
 
Status
Not open for further replies.

Latest threads

Back
Top