Hi everyone!
I have spent quite a portion of time troubleshooting my recent project, which involves having and arduino UNO controlling programmable PSU Rohde&Schwarz®HMP2020. However, I was not successful in establishing a communication with the supply whatsoever. I am using an RS232 cable, the connection being following:
Arduino ---RX,TX,5V,GND--->module with TTL to RS232 converter MAX3232 and a female RS232 port---RS232 cable---PSU.
The cable input: TX(pin 2),RX(pin 3),GND(pin5).
The cable output: TX(pin 2),RX(pin 3),GND(pin5), pins 1+6 to pin 4, pin 7 to pin 8.
The PSU uses SCPI commands in form of strings to set various configurations. I also set the PSU appropriately to RS232 interface, baud rate etc.
Code:
#include <SoftwareSerial.h>
#define rxpin 12
#define txpin 13
SoftwareSerial RS232(rxpin,txpin);
char character;
void setup() {
RS232.begin(9600);
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
character = Serial.read();
}
if (character == "1") {
RS232.println("*IDN?") // SCPI command to initialize connection with PSU
RS232.println("INST OUT1"); //choose output
RS232.println("VOLTAGE 5"); // Set voltage to 5V
}
}
If I use a direct USB connection to PC and run the HMP program with terminal, the connection works. However, in my case it does not, and also when the cable is connected, the display of PSU stops working and the cooling runs a little louder, maybe this is a faulty soldering on my part, I will try to find out.
Even when I was using another cable, the communication could not be established. Please, any help will be greatly appreciated! Thanks!