I have a pool controller that talks RS485 that I want to monitor and hack into so I can control it from an Arduino. I've prowled all over the net and haven't found a description of someone that has done this. I'll need to monitor the communication for a while to build up data on the comm protocol and then start injecting commands until I'm comfortable that I can control it.
Suggestions on RS485 adapters, shields and such would be appreciated. I plan on interfacing this to an Xbee and going wireless so I don't want to tie up pins 0 and 1 on the arduino. Heck, I might get lucky and be able to do it directly off the Xbee if there is something out there that can do the serial TTL to RS485 conversion for me. Isn't that what the Xbee transparent mode was designed to do?
I've already taken a close look at the DFrobot shield you mentioned above. I couldn't tell what the pin usage was and the schematic they supply is either wrong or the shield won't work. They show the CTS pin of the Xbee connected to the reset bus and that would cause problems. They don't have sample code for most of the features and what they do have appears to be lifted off this forum (actually the old one). It's not much fun following traces on a board to learn how to use it when a minimum of documentation would get you started. Too bad though, this could be a nice shield. The linksprite card http://www.linksprite.com/product/showproduct.php?id=18&lang=en: looked intriguing, but similarly, it doesn't have enough information to use either.
I realize that, as hobbyist, we should be up to the challenge of figuring out how these things work (if they do) and share the information with our peers. But it wouldn't take the engineer that designed it more than a couple of hours to document the devices.
I remember looking at the SparkFun breakout board when I was searching, but somehow it didn't sink in. I guess I was suffering from information overload and some neuron broke down. This board (or a homebuilt equivalent) and the cool tutorial you pointed out should do the trick really well.
I knew someone on this board would have an answer for me. Thanks again.
Let me say this, it was a whole lot easier than I expected to get the 485 to work. So far I've only tested on a PC using hyperterminal but I can read data from the pool controller just fine. I used a USB port on my pc to an FTDI controller (FTDI Friend + extras [v1.0] : ID 284 : $14.75 : Adafruit Industries, Unique & fun DIY electronics and kits) connected to the 485 converter and it worked on the second try. The first try had the RX and TX reversed.
I inherited a different problem now that I will have to work through. The pool controller is constantly sending data. It runs at 19.2 and is constantly sending data. This makes reading it a bit of a problem since anything I hook to it will be constantly receiving data. I guess I'll have think about this a while and my idea of just having an XBee connected will get dropped in favor of some kind of processor to filter through all the traffic and only send to me what needs to be sent.
My neighbor whined about how much money this project was going to cost. I pointed him to the various control devices for swimming pools and showed him the price of one of them that does what I've described so far. The greater than $200 cost difference has him singing a different tune now.
I continued this project to the point where I have decoded a significant portion of the protocol and implemented my first interface to the pool controller. Catching all the traffic from the controller was a bit of a pain, but by setting flags and then dealing with them later I am able to decode the state of the various pool items: filter, variable speed motor, waterfall, solar heater, etc and present them on command. After a number of false starts I was able to send commands to the controller and get it to do things for me. It turned out that the TimeAlarm library was especially useful to set an event to happen a couple of seconds down the road and go back to catching protocol packets.
I'm not done with this project, it still needs to be put in a box and stuck to the wall near the controller. I plan on adding it to my XBee network so truly remote control is possible. From there it's just a small step to a web interface addition to my house controller system.
Man, once you get started on this stuff, it can actually be fun and useful. It's described under the 'Swimming Pool' tab at the top of my page at draythomp.blogspot.com
Yep, my last three power bills were less than U$100. That's less than 25% of the highest bill even after the rate increases they've gotten over the last couple of years. I don't expect that to continue however.
If you look at the temperatures here in the heat, we may be in for a nice long hot summer and I will be cranking on the ol' air conditioners to make it livable and they really suck the amps. Swamp (evaporative) coolers just don't do it when the temps get way up there. However, I think I have seen the last of the unexpected high bill until the next energy crises.
It was cool when I called the power company. One has to keep in mind that the people you talk to are just folks like us. They were amazed at what could be done and applauded. One of them, the guy that changed out my meter, took copies of my schematics and called me a couple of times for advice on his own system. The ones that you want to taunt don't answer the phone.
OK, my voyage into RS485 is done. I completed the pool interface, mounted it in a weather resistant box and stuck it to the wall near my pool electronics. I can now click on a button in a web browser and the command is taken off the web, sent through and XBee and caught by my new device which will control the pool functions. So, I can set in my chair and turn on the waterfall out in the yard. Granted, something like this is never truly done, I'll be messing with it from time to time streamlining something or other, but IT WORKS.
Yes I did get it to work. If you check on the other page, I posted a link to my blog where I describe it in detail and posted the code for the device. I had to move it to a mega2560 though because the constant load of softwareserial bit banging at 19K was causing eratic operation. When I put the code on the 2560 it settled right down and has been working fine for quite a while. The entire code was too big to post here.
draythomp I found this thread very interesting, I am trying to setup my mega 2560 with a dfrobot rs485 shield and a W5100 Ethernet controller that has an micro sd card on it. I will look at your blogspot and have a look at the sketch and if there is no issue use some of it on my project. Thanks
Ps if anyone has any info please let me know. Thanks M