| 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 ?
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().
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.
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.
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.
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).
zoomkat:
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.