Hey everybody I need some help,
I am trying to program a system in my house (as a project) that senses the temperature in each room and will control the movable blades on my ac vents. That way I can adjust the flow of air to the area that needs it the most. Ex. If I set my thermometer at 75 degrees, once Room A reaches 75 degrees the system will close the blades on room A's vent so another room (Room B) will get more airflow allowing Room B to cool faster.
I want to use a mega as my main controller and attach an uno to each vent. The unos and mega would communicate wirelessly through some zigbees I have lying around. From my experience with zigbees, whatever I put out on the Arduino's TX pin will be transmitted across the wireless network; no need to worry about zigbee protocols, it is similar to a hard wire connection.
My problem is I need ideas on how to write this program? I need each vent (each has an arduino uno) to send their temperature and motion readings to the main controller (arduino mega), then have the mega calculate the proper air flow for each vent and send the proper flow result to each vent. The only parts I need help with is the communication; calculating the proper air flow I can do on my own. My questions:
How would the mega not mix up the data being sent by two objects it is controlling? If I tell the mega to start reading when it sees a specified start byte, how do I let it know the following bytes will be the temp and motion data (what commands do I use)? I am still a beginner with arduino, I will take as much help as possible, thanks!