Connect 2 Arduinos in master/slave relationship with APC220s

I need to remotely control heaters and monitor temperatures remotely from about 80 ft. from the house. I'd like to not have a PC involved for power reasons. I planed for the master Arduino to have an LCD display for monitoring and a keypad to command heaters on/off. I've found information on transmitting from an APC220, but nothing on receiving commands from one, or data. Is this a possibility, or am I dreaming? I have 2 Uno's and 2 APC220's, the keypad and LCD and the temperature and relay modules already. I wrote a sketch for the temp and control of heaters, now I just need to get the Uno's talking to each other.
Jim

The protocol you use between the two APC220s is left up to you. You should start by brushing up on your Serial functions.

If you can describe more precisely each type of message that the each of the master and slave need to transmit you'll get better help.

The slave has an RTC, and sends data once a minute in ASCII. Message protocol is :

slave transmits

ff hex - begin transmission
heater number - 1
ff hex - separator
heater 1 temp
ff - separator
heater 1 status - off/on/faulted
ff - separator
....
heater number - n
ff - separator
heater n temp
ff - separator
heater n status
00 hex - end of transmission


master sends on keypress

ff hex - begin command
heater number - 1
ff - separator
heater 1 on/off command
ff - separator
....
heater number - n
ff - separator
heater number n on/off command
00 hex - end of transmission

The master also has an RTC and a data logger logging the slave's data. Any heater faulted will be automatically shut down.

Jim

You don't need the separators, but if used they should be a value that's not likely to be some form of default like FF. Personally I'd get rid of them

I'd add a simple checksum at the end of the frame and I'd also be inclined to add some form of acknowledge so you know the heater on/off command was received.

Given that you have a heater number that implies you will have more then one at some point. Is this the case? If so your protocol will have to change dramatically.


Rob

Yes, there are 5! I'm sending the number first so the Arduino's know which to apply commands to, and which heater's data they receive. I thought that immediate feedback is not needed as 1 minute later I will know if command took. Thing are not critical enough to require millisecond feedback.
What protocol change are you referring to? I thought that if you sent the device number first the Arduino then would be able to apply to the proper device. I'm a noob, trying to learn, I want to learn proper technique!
I'm hoping to do this as winter temperatures drop to as low as -25F here at 8000 ft. I'm going down to Denver for a few days so further responses will be slow.

Jim

What protocol change are you referring to?

With multiple slaves transmitting at will you have the chance of two or more transmitting at the same time. This will cause problems with the master receiving code.

The easiest way around this is to have the master controlling when each slave transmits.

To get data from the slaves

Master sends, slave1 report command
Slave1, 12 degrees

Master sends slave2 report command
Slave2, 23 degrees

Master sends slave3 report command
Slave3, 42 degrees

Sort of thing.

Sending commands is easier and you can do what you've suggested, all slaves that aren't addressed will ignore the command.

Also wireless is not the most reliable way to transmit data, hence my suggestion for a checksum.

If you're happy without the acknowledging it sounds like that would be OK. If things don't get hotter after turning on a heater you can try again.


Rob

If I had multiple slaves, you are right. I am controlling 5 heaters with one slaved Arduino.

Jim

I am controlling 5 heaters with one slaved Arduino.

OK, I get it.


Rob