Go Down

Topic: Arduino/Ethernet Shield HVAC System Monitor (Read 3 times) previous topic - next topic

sr4435

Quote
Which Thermostat are you using that you're communicating to the Arduino with??

I am using the RCS TR16 from http://www.resconsys.com/
I wanted to keep a stand alone thermostat so that it works even if my system doesn't.  It's just more reliable that way. 
It was a little difficult getting the communications to happen.  In order to transmit on the RS485 line via the MAX 485 chip, you have to pull a pin high and then to listen you have to pull it low. I was not getting a reply from the thermostat after sending a request for its status.  I had to use an o-scope to diagnose what was happening on the serial line. It turns out the pin was being pulled low before the serial data finished sending so I had to add a small delay after sending out the serial command. 

wildbill


Thanks for your replys.

The compliled sketch size is only about half of the availabe. 14950 bytes to be exact.

I only count 3 String variables.  Is this what you are refering to?  Or are you talking about all the text in the Serial.print's?

All the text in the Serial.prints. The size of your sketch is not really relevant here - Arduino has very limited RAM - 2K if you're using an Uno and all of that text is stored there.

sr4435

Thanks wildbill.

I have changed my code so almost all of the Serial.print text is in flash.  That has given me much better results.  It is now not hanging/restarting immediately and it ran for about 30 min before I reset it to make another change in the code.  It has still locked up a couple times on me since I made the main changes however. 

I will keep you updated.

wildbill

Another potential issue is the use of the String class. Changing Strings can require dynamic memory allocation, with the accompanying possibility of fragmentation and eventually, a failure because there's no suitable chunk of memory to allocate. May not be your issue, but consider using char arrays instead.

Graynomad

Quote
It turns out the pin was being pulled low before the serial data finished sending so I had to add a small delay after sending out the serial command. 

That's because the function returns when the last character is written to the UART, but at that point it hasn't been transmitted. The delay will get you out of trouble but you really should test the appropriate UART register flag.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Go Up