Help with serial communication between Arduino and VP-Systems camera controller

Hello,

I am trying to use an Arduino Mega to communicate with a VP-Systems CAMremote and am having a hard time establishing communication. This CAMremote is a pretty neat little device that allows nearly full control of most professional cameras using a variety of different input methods.

Link to unit:

For my application I'm trying to use a Mega to establish serial read/write communication with the device but am so far unsuccessful. Initially I'm trying to write something very basic to just read the status of the camera as a test of the system. Once I am successful with this I intend to put the command list into a library and use various button/dial inputs to call different commands and send them over serial to the controller.

Command list:
https://vp-systems.eu/cr_uart.html#TV

The documentation is a little unclear to me but my interpretation is that I can simply send string/char array commands and should receive similar format responses, code below.

void setup() {
  Serial.begin(9600);   //default serial to/from computer
  Serial2.begin(9600);  //using serial Bus 2 on pins 16/17
}

void loop() {

  Serial2.write("camstat<CR>");

  Serial.println(Serial2.read());

  delay(1000);
}

This code is returning -1 when I'd expect OK, ERR, or NR based on the protocol list. I'm confident that my settings are configured properly in the CAMremote and that my wiring between the Arduino and device is proper so the issue seems to be with how I'm sending and receiving commands.

The obvious solution is contacting the company (which is really just one person in Finland) for advice which I have done and have gotten no additional useful information as yet.

I'd appreciate any light y'all could shed on this.

Communication speed: 9600/115200 baud, 8bit, no parity, 1 stop bit

So, do you know which of the 9600/115200 settings the device is using? Put another way, have you tried the faster baud rate?
The good news is, Serial.begin() happens to default to the parameters you want.

Oh, look, apparently Serial.read() returns -1 - IF THERE'S NO DATA AVAILABLE.

Finally, Serial.write("camstat") isn't quite what you should send. Rather, send
"camstat" followed by the character being represented by the mnemonic. That character is commonly known as "Carriage Return". Do some digging, and you'll likely find out how to embed a carriage return at the end of your "camstat" string.
Hope that helps a bit.
C

So, do you know which of the 9600/115200 settings the device is using? Put another way, have you tried the faster baud rate?
The good news is, Serial.begin() happens to default to the parameters you want.

There are separate settings in the device GUI for 9600 and 115200 baud, neither of which work. Is there any advantage to specifying the 8N1 config if that's the default setting?

Oh, look, apparently Serial.read() returns -1 - IF THERE'S NO DATA AVAILABLE.

Well that certainly confirms that I do not have this working then.

Do some digging, and you'll likely find out how to embed a carriage return at the end of your "camstat" string.

I'll do some excavation, thanks.

The documentation is very clear. You do not send ASCII strings as you tried, but send strictly binary values, shown as HEX in the documentation.

Only a couple commands use the additional HEX parameters, most do not. For example, shoot does not have any additional HEX paraments so are you suggesting to convert this to binary and sending that result?

Camstat is NOT a hex command - though many of the parameters described later are, camstat is not.
C

If I was writing the program, I would make it consistent and have all in HEX, including the X0d for the carriage return ant the end of each command.

Okay I'm starting to get a little bit of success here but obviously have some learning to do regarding serial communication.

The device is able to to receive commands in text form now that I'm using a proper carriage return (\r). However, sending everything in HEX as Paul suggested is likely the best way to proceed. I'm still not getting the the response I'd expect based on what I'm sending but I'm fairly confident it's due to the way in which I'm sending commands.

I think vaguely I need to write something that first checks if there is a connection, sends a command if a connection is found, checks for a response, displays response or okay if no response is expected, resets buffer, then repeats.

I will be using multiple serial lanes in my final project as I will have two cameras each requiring their own CR unit, an XBee for wireless communication, and a motor controller that communicates over I2C. From reading the Serial Input Basics page I found this line "Even at 115200 baud there is still 86 microseconds or 1376 Arduino instructions between characters." and was wondering how I can take advantage of this to keep latency down or if it's not something I should worry about for now.

Okay I ended up getting this mostly going over the last week. What ended up being the main issue is that Arduino Mega's native voltage for serial communication is 5V while the CAMremote seems to only work reliably at 3.3 despite asking for 5V in as power and the MCU being rated for both 5V and 3.3V.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.