I am currently trying to create 2x test Rigs using the following bits of kit…
Operating System - Raspberry Pi 400 0r Raspberry 4B running Basic Raspbian
Digital to Analogue convertor - MCP4725 12 Bit DAC
Analogue to Digital convertor - ADS1115 16 Bit I2C ADC
Opto Isolation circuit for Pi protection while using the ADC & DAC
Power Supply - Farnell H 60/50
Electronic load - APM EL200VDC2400W or APM EL00VDC4400W (single mode, not on parallel mode)
The test procedure needs to be run direct from a script and displayed through a GUI to Select a Model Under test from a list or Manually type the Model number in & all test figures/parameters should then be pulled from a variable Table.
I have used NI max control panel on windows 10 PC to check comms and a web browser to get the addressing.
2400W serial address : USB::0x0952::0x6400::0180042227000001::RAW
2400W TCP IP address : TCPIP::162.168.1.201::5025::SOCKET
4400W serial address : USB::0x0952::0x6400::0161722226000002::RAW
4400W TCP IP address : TCPIP::162.168.1.202::5025::SOCKET
So far, I have set Static Ip Addresses on the 2 loads as 192.168.1.201 & 192.168.1.202 while my Raspberry Pi is sat on 192.168.1.105.the devices are connected through a network switch and I am able to ping both Electronic loads from both my Raspberry Pi and my Windows PC.
I am currently communicating with the devices using USB - Serial adapter & generic ID of the Instrument for now.
**>>>*import pyvisa as visa*
<i>*>>>*import time
*>>>*rm = visa.ResourceManager('@py')
*>>>print(*rm.list_resources())
('ASRL/dev/ttyUSB0::INSTR', 'ASRL/dev/ttyAMA0::INSTR')</i>
<i>*>>>*PSU = rm.open_resource('ASRL/dev/ttyUSB0::INSTR')</i>
**>>>*PSU*
<i><'SerialInstrument'('ASRL/dev/ttyUSB0::INSTR')></i>
*>>> print(psu.query('*IDN?'))*
*APM,EL200VDC4400W,0161722226000002,V100R009C01/V100R006C01/V100R005C01,ADVANCED*
I was unable to successfully connect using specific TCP or USB.
The problem I have is I can send a measure/fetch command to the Electronic load for a Voltage or Current & most of the time instead of getting the value back I am simply receiving “SET OK”.
If I repeat the same measure/fetch function 2-3 times I do get the value.
Below samples all typed consecutively…
*>>> psu.query('spec:test?')*
*'OFF\n'*
*>>> psu.query('spec:curr:l?')*
*'OFF\n'*
*>>> psu.query('spec:curr:l?')*
*'OFF\n'*
*>>> psu.query('spec:curr:h?')*
*'0,%\n'*
*>>> psu.query('spec:curr:l?')*
*'0,%\n'*
*>>> psu.query('spec:curr:c?')*
*'0,%\n'*
*>>> psu.query('spec:curr:c?')*
*'0,%\n'*
*>>> psu.query('spec:curr:c')*
*'0,A\n'*
*>>> psu.query('spec:curr:c?')*
*'0,A\n'*
*>>> psu.query('spec:curr:h?')*
*'0,A\n'*
*>>> psu.query('spec:curr:l?')*
*'0,%\n'*
*>>> print(psu.query('FETC:CURR?'))*
*0,%*
*>>> psu.query('FETC:CURR?')*
*'1.9962\n'*
*>>> psu.query('FETC:volt?')*
*'1.9963\n'*
*>>> psu.query('FETC:volt?')*
*'11.9852\n'*
I am assuming at the moment that the issue is merely down to the termination/end characters being mismatched.
You will see a few lines of code where I am trying to counter this but so far not successful in the following attempts.
<i>el.term_chars = 2
el.term_chars = \r\n
el.end_input = last_bit_end_input</i>
el.end_input = term_chars_end_input
I was also thinking The below Extract on page 2 of the " SCPI Communication Protocol for EL Series High-density Programmable DC Electronic Load" manual could be what is causing the problem?
Note 1 pressing the Enter Key
SCPI Command Descriptions
SCPI is a programmable language standard designed especially for programmable instruments. It defines how to communicate with the instruments from an external computer. The APM programmable DC Electronic Load uses SCPI programming language with two categories of commands : basic commands (IEEE-488.2 common commands), and APM programmable DC Electronic Load.
Note: 1) Press the [Enter] key before sending each command.
- There are two ways to send commands containing “” in the commands.
For example,
SYSTem:ERRor[:NEXT]? send : SYSTem:ERRor? or SYSTem:ERRor:NEXT?.
My coding skills are very basic and at most self taught.
Originally I was taught to code with drawing packages (pen up/pen down…) & HTML coding about 20 years ago.
I have also covered Robot and PLC programming over last 2 decades
Jack of all Master on none.
I have created A Dropbox for all my playing around code & Manuals.
test.py, test2.py, test3.py are the scripts I’m using to simply connect to the electronic load and pull some current & voltage Readings back.
Trying to keep it simple I kept everything as single line instruction.
measure.py is the resulting python output from the run scripts within terminal including visa debugging.
Kindest Regards
Dan