Pages: [1]   Go Down
Author Topic: Help with AC project  (Read 1149 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

New River, Arizona
Offline Offline
God Member
*****
Karma: 16
Posts: 906
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Couple of questions, are the little radios you're going to use XBees or some other device.  You said zigbee and I'm a little unclear.  However, every one of these I've seen has some kind of address that identifies it; that's what you want to use to identify the device.  If you're using XBees, just use the device address to correspond to a location where a vent control is or where a temperature sensor is.  I could describe this a little more if I knew the devices.
Logged

Trying to keep my house under control http://www.desert-home.com/

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24321
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am still a beginner with arduino, I will take as much help as possible, thanks!
I've helped everyone else by removing the duplicate of this post in another section.

DO NOT CROSS-POST - IT WASTES TIME.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes Im using XBee radios.

I am planning on my protocol to look similar to this:

(start byte)-(address byte)-(sensor 1 data)-(sensor 2 data)-(end byte).

It would help if you understood the flow. Each uno would send the sensor data to the mega, the mega would analyze the data and send the correct settings back to each uno. Each uno will then analyze the settings and use a motor to turn the vent blades for the air flow calculated by the mega. A xbee will be attached to each arduino board. All the xbees attached to the unos on the vents will be programmed to talk to the xbee on the mega only. So when the mega sends out a 'string', it will be broadcasted to all the xbees. I will leave it up to each uno to read the data and determine what it should do. I cannot do this with the xbees since the xbees have no programmable logic within themselves to read the 'string'.

Does that help make it clearer? And thanks for helping!
Logged

New River, Arizona
Offline Offline
God Member
*****
Karma: 16
Posts: 906
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I've done something somewhat similar.  The tactic I used was to name each device and send strings.  So, "device1,on,10<cr>" would mean device1 turn on for 10 seconds or something similar.  All the devices listen and when they see their name, they would do whatever followed.

They send back status periodically as a similar string, "device1,on"  would mean device1 is on right now.  Then you can expand it to several items in the list and more complex parsing to get information around the house.  My swimming pool sends something on the order of "Pool,m high,l off,f off,T 80,t 80<cr>" and that would mean the pool motor is on high, the light is off, the fountain is off, water temperature is 80F and the air temperature is 80F.  This message gets sent every couple of minutes by the pool controller and received by a device that controls the entire house.  To change something on the pool, I just send a string like "pool,motorhigh<cr>"

So, I use tactics like naming each device and having it respond to its name as well as say its name in each update it sends.  I use comma separated fields to make it easy to parse out data using strtok() and simple state machine code to record and do things with it.  In the past I wrote all the code to decode the XBee data stream in series 2 API mode 1 using broadcast.  I don't recommend broadcast anymore because when your network grows past some critical point you overload it.  Broadcast can clog up a network if you have a lot of devices (I had 7 when it started causing problems). 

I'm slowly changing my devices to use the arduino XBee library.  Recently it was updated to use software serial and alternate ports on the mega2560, so I can plug into a particular device and watch what is going on when some problem comes up; I don't have to tie up the serial port just to use the library.  The library has a learning curve all its own and currently requires you to use API mode 2 which causes some minor complications when you try to read a packet off the air with a sniffer of some kind.  However, it's nice to use library routines to get the address of the sending XBee instead of having to write the code for each device.  I may modify the library to allow API mode 1 at some point for my own network.
Logged

Trying to keep my house under control http://www.desert-home.com/

Central Indiana, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 202
So many projects, so little time...and money!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

HVAC zoning from a single system is a complicated animal.  You should have the product data for your equipment so you can determine the minimum allowable airflow for your system.  If you close too many dampers, your airflow goes down and the static pressure goes up.  If you're using a gas furnace, it can cause high temperature limit trips in heating.  In cooling, it can cause indoor coil freeze-up problems, and ultimately cause failure in your air conditioner.  Lack of airflow in a cooling system can prevent all of the refrigerant from being boiled off in the indoor coil (evaporator coil).  Since you can't compress a liquid, you have problems.

All of this being said, you should have a leaving air temperature sensor installed so you can take action to shut the system down before some of these things become problems for your system.  I can provide more information for you if you like.  Let me know.
Logged

Pages: [1]   Go Up
Jump to: