Go Down

Topic: 2 x RS232 ASCII input -> 1 x RS232 output... (Read 206 times) previous topic - next topic

deadbeat

Hi All,

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!

Kang

Robin2

I would not like to pretend I fully understand what you want to do however it sounds like it should be possible.

A diagram of the proposed data flows would be a big help.


In your title you say RS232 but an Arduino does not work at RS232 voltage levels and you may need RS232 to TTL converters such as the MAX232.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

deadbeat

Hi R,

Thanks for the reply. I say RS232 but I guess it's standard serial which may not be voltage driven. I need to do a little more research to be honest.

I've attached a diagram which might help.

Kang

Robin2

Image from Reply #2 so we don't have to download it. See this  Image Guide



...R
Two or three hours spent thinking and reading documentation solves most programming problems.

wvmarle

1) 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.

2) 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.

3) 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.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

deadbeat

Thanks for the pic embed R. My bad!

wvmarle:

1 - It's defo RS23, and voltage is 5v so i'll need the TTL converter. No biggie, just another thing on the list!

2 - Serial data protocol is:
Baudrate: 9600/no parity/no handshaking
Bits: 8
Stopbit: 1

3 - I'll have a look into it.

Thanks for the response!

deadbeat

I don't think SoftwareSerial will do the trick, unless i'm missing something. Does that require a permanent PC connection?

From the brief reading i'm doing, there are some limitations/annoyances with this. I need to do more reading to fully understand.

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.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Robin2

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

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

wvmarle

@deadbeat is using a Mega so there is no need for SoftwareSerial

...R
Based on what was written in the first message currently he's not using anything.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

deadbeat

Hi guys,

My preference is the mega. I think it offers the best options and overall reliability.

Kang

Go Up