Just a short one.
I bought one of these things.
It can do 50 volt 5 Amp, I have not looked at the quality of the output (noise, overshoot all unknown to me) but should be alright to control a lamp, a battery or a strip of LED's is my guess.
You can easily control the current and voltage output using a serial port. (a usb-serial-rs485 was provided)
I seems to talk modbus protocol.
To change the baud rate and modbus-slave-address, keep POWER button pressed during power on, this will enter you into the configuration menu.
register list here :
I bought one of these things.
It can do 50 volt 5 Amp, I have not looked at the quality of the output (noise, overshoot all unknown to me) but should be alright to control a lamp, a battery or a strip of LED's is my guess.
You can easily control the current and voltage output using a serial port. (a usb-serial-rs485 was provided)
I seems to talk modbus protocol.
To change the baud rate and modbus-slave-address, keep POWER button pressed during power on, this will enter you into the configuration menu.
register list here :
Register
Map for this device.
Function
|
Description
|
Number
of bytes
|
Decimal
places
|
UNIT
|
Read/Write
|
Register
address
|
| U-SET | Voltage setting |
2
|
2
|
V
|
R/W
|
0000H
|
| I-SET | Current setting |
2
|
3
|
A
|
R/W
|
0001H
|
| UOUT | Output voltage display value |
2
|
2
|
V
|
R
|
0002H
|
| IOUT | Output current display value |
2
|
2
|
A
|
R
|
0003H
|
| POWER | Output power display value |
2
|
1
or 2
|
W
|
R
|
0004H
|
| UIN | Input voltage display value |
2
|
2
|
V
|
R
|
0005H
|
| LOCK | Key lock |
2
|
0
|
-
|
R/W
|
0006H
|
| PROTECT | Protection status |
2
|
0
|
-
|
R
|
0007H
|
| CV/CC | Constant Voltage / Constant Current status |
2
|
0
|
-
|
R
|
0008H
|
| ONOFF | Switch output state |
2
|
0
|
-
|
R/W
|
0009H
|
| B_LED | Backlight brightness level |
2
|
0
|
-
|
R/W
|
000AH
|
| MODEL | Product model |
2
|
0
|
-
|
R
|
000BH
|
| VERSON | Firmware Version |
2
|
0
|
-
|
R
|
000CH
|
| EXTRACT_M | Shortcut to bring up the required data set |
2
|
0
|
-
|
R/W
|
0023H
|
| U-SET | Voltage settings |
2
|
2
|
V
|
R/W
|
0050H
|
| I-SET | Current setting |
2
|
3
|
A
|
R/W
|
0051H
|
| S-OVP | Over-voltage protection value |
2
|
2
|
V
|
R/W
|
0052H
|
| S-OCP | Over-current protection value |
2
|
3
|
A
|
R/W
|
0053H
|
| S-OPP | Over power protection |
2
|
1
|
W
|
R/W
|
0054H
|
| B-LED | Backlight brightness levels |
2
|
0
|
-
|
R/W
|
0055H
|
| M-PRE | Memory Preset Number |
2
|
0
|
-
|
R/W
|
0056H
|
| S-INI | Power output switch |
2
|
2
|
-
|
R/W
|
0057H
|
Here is the test code I wrote, works for me, if it burns down your house, sorry but not my problem. I just post my example code, I make no claims about it.
#!/usr/bin/env python
import random
import minimalmodbus
minimalmodbus.BAUDRATE = 19200
minimalmodbus.TIMEOUT = 0.5 # must be low latency somehow??
minimalmodbus.CLOSE_PORT_AFTER_EACH_CALL = False
def decode_response(b):
if len(b) != 20:
print len(b)
return
rv = {'U-Set': b[0] / 100.0,
'I-Set': b[1] / 1000.0,
'U-Out': b[2] / 100.0,
'I-Out': b[3] / 1000.0,
'P-Out': b[4] / 100.0,
'U-In': b[5] / 100.0,
'Locked': {0: 'OFF', 1: 'ON'}.get(b[6]),
'Protected': {0: 'ON', 1: 'OFF'}.get(b[7]),
'CV/CC': {0: 'CV', 1: 'CC'}.get(b[8]),
'ON_OFF': {0: 'OFF', 1: 'ON'}.get(b[9]),
'Backlight': b[10],
'Model': str(b[11]),
'Firmware': str(b[12] / 10.0),
}
return rv
if __name__ == "__main__":
instrument = minimalmodbus.Instrument(port='/dev/ttyUSB0', slaveaddress=1) # port name, slave address (in decimal)
# instrument.serial.baudrate = 9600
instrument.debug = False # True
for i in range(1000):
try:
temp = instrument.read_registers(registeraddress=0x0,
numberOfRegisters=20)
print decode_response(temp)
v = random.random() * 25.0 # between 0 and 25 volt output setting
i = random.random() * 5.0 # between 0 and 5 amp output setting
print "set to {v:2} V {i:2} A".format(v=v, i=i)
instrument.write_register(registeraddress=0, value=v, numberOfDecimals=2) # set V
instrument.write_register(registeraddress=1, value=i, numberOfDecimals=3) # set I
# set Limit Current and Voltage protection values
instrument.write_register(registeraddress=0x52, value=v, numberOfDecimals=2) # set V
instrument.write_register(registeraddress=0x53, value=i, numberOfDecimals=3) # set I
except (IOError, ValueError) as e:
print e

Reacties