Pages: [1]   Go Down
Author Topic: Problem about Serial Communication  (Read 526 times)
0 Members and 1 Guest are viewing this topic.
jordan
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

| want to make fire detector circuit in each room in any institution and contact all circuits with arduino mega , and when the fire is done , the pic microcontroller which is contacted with circuit send serial message to arduino then arduino will define the room where the fire occurred .
 but the problem , if two rooms send serial message synchronously.
How can I solve this problem ?
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 610
Posts: 49003
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but the problem , if two rooms send serial message synchronously.
How can I solve this problem ?
How many rooms are you talking about? If there are less than 255, rooms, the "serial message" should be just the room number, as a byte, sent using Serial.write().
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9541
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but the problem , if two rooms send serial message synchronously.

Let the main arduino poll the fire detector arduinos in a loop requesting a status of each detector.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Edison Member
*
Karma: 58
Posts: 2078
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could send a few messages with random intervals.
If you make the interval a few times larger than the message duration (3 to 20 times random), and still have about 5 short messages within a second, the collision is a lot less likely to happen.

Do you use a flame detector or a smoke detector ?
A flame detector could detect a fire faster, but doesn't detect something smoldering underneath something.

If you let the detectors send messages on their own, why not combine that with requesting data from the detectors ? You could use that to request more data, or the battery status.
Logged

jordan
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

explaining more of the project , I want to connect all pic's (16F88) of fire (smoke)detectors (regardless of the number of detectors); with same points (TX,RX) of arduino Mega by cables (I initially did not want to use wireless) , if smoke detector becomes ON, the pic sends serial message to arduino mega(between them two MAX232 chips), but the problem if two detectors send in the same time.
Logged

Offline Offline
Edison Member
*
Karma: 58
Posts: 2078
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You have to tell us more what the problem is.

We gave three good answers (single byte is very short, polling, send more than once).
Logged

jordan
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Let the main arduino poll the fire detector arduinos in a loop requesting a status of each detector.
Did you mean to send serial msg's in a loop by arduino , then the pic send serial msg if detects smoke and recieves special msg.
Logged

Pages: [1]   Go Up
Jump to: