A beginner question on remote controlling the Arduino UNO R3. Currently, I use software by XOJO to control a home automation system designed many years ago. Recently I also started controlling IOT devices through the XOJO software by sending Jason scripts to static IP addresses which works fine. The other day I picked up a Super Starter Un R3 Project kit and realized Arduino's potential for updating my satellite controller for the radiant floor heating system. Currently, I have two control units. One controls the lion's share of managing the home near my Mac via a USB interface. Inputs, outputs, temperatures, and light sensors. The remote, which is controlled through the main controller bus takes care of all heating functions such as pumps, zone valves, mixing valves, boiler on/off control, electronic filter, three-speed fan for passive solar gain, and a dehumidifier.
So I head off in the right direction with my studies to accomplish this, would the W5100 Ethernet Shield for Arduino UNO R3 be the right device to use for communications. I would run ethernet CAT5 to the remote controller and replace the current controller with an Ethernet Shield and one of the Arduino UNO R3 boards. I would then work with the remote controller directly through XOJO instead of using the bus in the main control unit.
Does this sound like a reasonable direction for this project? Any suggestions on researching this future?
On the low end is the Arduino Uno. It can do amazing timing stuff.
On the high end is the Raspberry Pi. It has a full linux operating system and is not Arduino.
Between those two are many Arduino boards and other "Arduino-compatible" boards.
The Ethernet Shield with W5100 is an old solution. That is very basic Ethernet and I advice not to use it. If something went wrong, then a socket can be occupied and never released. Not all libraries deal with that.
The ESP32 is a Arduino-compatible board with Wifi. That is a higher level and is very useful.
Or are you thinking about the Ethernet Shield only to communicate between Arduino boards ? That would be a bad solution. The good old RS-485 is much better for that.
A MKR Zero board with a RS-485 MKR shield would be a good solution.
There are libraries to deal with JSON data. The Arduino Uno might not have enough memory for that.
Have you installed the Arduino IDE and made the led on the Uno board blink ?
First of all thank you very much for your suggestions. Looking at your suggestions I have some thoughts and a question. I will be sending commands to the remote controller which is 40 feet away from the main computer running XOJO software. I'm looking for reliability and believe WiFi would not be my first choice. Hard wire is generally better I believe for reliability.
Currently, I interface from my computer running XOJO to my primary WIZ-232 controller via an FT232RL FTDI USB to TTL Serial Adapter Module. To create the connection to the RS-485 MKR Shield for the remote controller 40 feet away, would you use another USB to RS-485 adapter of some nature connected to another USB port? Any suggestions on that adapter?
Yes, the XOJO software can create a serial socket as I do for the USB to RS232 currently being used for the main controller. I think the next step would be to understand the API and what the data needs to look like being sent from XOJO to the satellite controller. I'm assuming it makes no difference as to whether the communication link is RS-232 or RS-485. Correct drivers at the host computer should convert USB to RS-485 signals and the RS-485 shield should connect. Am I on the right track with this line of thought? Does the shield send info through its SPI to the MKR Zero board automatically or is a sketch needed on it? Please bear with me this is mostly all new to me.
So far I've only seen examples that interface RS-485 MKR shield/Arduino module to another RS-485 MKR shield/Arduino module such as https://www.youtube.com/watch?v=PvMRZRC5yRQ or the documentation you pointed out.
I'm now trying to determine what the serial data command packets need to look like being sent from XOJO running on the PC and being sent to an RS-485 MKR shield, such as for turning on an output pin. I see the sketch info but not what is being transmitted to the other RS-485 MKR shield.
As I poke around it looks like I can define in a sketch on the MKR Zero board what an input serial string can do such as turn an output pin on or off at the MKR Zero board. Connect Any Physical Switch To A Computer Using An Arduino Over USB. 255 might tell the Zero board I have a string of data for you and then a 3 to turn pin 3 on or off and then a 1 or 0 to turn it on or off. Is this a valid approach for controlling the MKR Zero board from my PC?
It depends on your programming skills how the communication is.
Suppose you build a full command interpreter, then you could send: "LED,13,ON" followed by CR LF.
If you want it simple, then you can send: "A1" followed by CR LF, ('A' is for led 13, 1 is on).
If you want it super simple to start with, then you could send a single character for every command. Fore example: "A" for led 13 on and "a" for led 13 off, without CR or LF.
The Carriage Return and Line Feed (CR LF) is a good indication for the end of the command. If you read one of those, then you know that a full command has been read and you can start to interpret it.
When using the command Serial.println("Hello"); it sends "Hello" followed by CR LF.
This starts to make sense. Getting started with a new technology for me is always a challenge. I believe you nailed it with the RS-485 coms. I thank you for the direction. The remote will need to be able to monitor a couple of temperatures for the hydronic mixing valve and boiler and then control a multitude of devices. Pumps, zone valves, stepper motor for the mixing valve, a three speed fan, electronic filter, boiler on/off and dehumidifier. I’m looking forward to the challenge.
Maybe 20 years ago I did the second rewrite for my home automation system with a program language called Realbasic. The first one was basic on a Commodore 64, over 30 years ago. Recently during COVID I decided to convert the RS-232 coms to the controller to a USB connection. A total rewrite followed. Realbasic morphed into a more robust programming tool called XOJO. For $100 I thought it was well worth the price since I already understood the language and only use one platform, OSX.
The MKR Zero was suggested in conjunction with the Ethernet 485 shield, but I'm not sure the 3.3v limitation is a good thing. In other words, would it be effective for driving relay boards? Maybe that's not an issue with optocoupler isolation. Can the MKR 485 shield be connected to other boards with more capacity? Or is there a better combination for an RS-485 receiver and micro-controller? Can the Arduino MKR 485 Shield interface to other microcontrollers with different form factors?
Maybe the MKR2UNO Adapter would be a way to connect the Ethernet shield to an UNO or microcontroller with more capacity or one with 5v capacity.