I'm considering purchasing the Arduino Mega purely for the need for the fact it allows for more than one serial connection.
I've been searching the forums and have gained a lot of info but before i take the plunge, I wanted to run my project past you guys to gain your thoughts and advice on best practice/approach.
Problem:
I have a lighting system (Nikobus) that can be controlled by sending ASCII serial commands to the light controller. I also have 2 control systems that have the ability to control the lighting; Controller 1 - Crestron CP2E. Controller 2 - URC MSC-400.
The problem I have is that I don't have full control over the Crestron. It was installed by a third party who have failed to handover the program config. The Crestron controls lighting amongst other AV in a specific part of the house.
The URC controller is a completely different story, I have FULL control of this and have configured lighting scenes, updated AV equipment etc. as required.
The crux of the problem is that as you know, RS232 is peer-to-peer, which essentially means I can't have two outputs to one input.
Requirement:
To use the Arduino as a controller to take the incoming commands from the Crestron and MSC-400 and pass them through to a single output to the Nikobus lighting controller.
Obviously I'd have to program some logic in to ensure 2 commands and being squirted out at the same time. It's an unlikely scenario but one i need to cater for.
Plan:
Use 2 available serial connections to allow serial passthrough/management to a 3rd serial connection (output).
At some stage in the future i may want to build a web UI to manage lighting scenes etc. remotely but that's not my focus at this stage.
Any advice/guidance/thoughts on this would be greatly appreciated!
check what serial exactly you're dealing with. If it's e.g. RS485 it's current driven, and you need to deal with it through e.g. a MAX485 chip. RS232 is voltage driven, typically around 10V so also that needs a translator for that. There are many different serial protocols, which are not compatible.
find out what serial data protocol is used. Start/stop bits etc. That you need to know to be able to properly communicate with the device.
if speeds are low (<9600 bps), look into SoftwareSerial, this can turn any pair of pins into TX/RX, and you may be able to use a cheaper Uno rather than the Mega.
SoftwareSerial is just like the normal serial, just emulated in software rather than using hardware as the regular serial port. That's why it can't be fast.
wvmarle:
SoftwareSerial is just like the normal serial, just emulated in software rather than using hardware as the regular serial port. That's why it can't be fast.
@deadbeat is using a Mega so there is no need for SoftwareSerial