Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 9485 controlling heaters using Python

Hello,

I am attempting to use an NI 9485 SSR module to control a set of Clippard electronic valves I am using for an experiment. Each valve will send a different type of fuel into a combustion chamber for my experiment. 

 

My idea was to use an NI cDAQ-9189 with the SSR module connected to a PC, and write a python script that could send a true/false signal to the SSR in order to only turn on the one valve that I need with the others remaining closed.

 

However, I am unable to get a response from my SSR. The following codes are what I have written so far:

 

First, I used a script from https://github.com/ni/nidaqmx-python to test if my hardware was present.

import nidaqmx as ni

def query_devices():
local_system = ni.system.System.local()
driver_version = local_system.driver_version

print('DAQmx {0}.{1}.{2}'.format(driver_version.major_version, driver_version.minor_version,
driver_version.update_version))

for device in local_system.devices:
print('Device Name: {0}, Product Category: {1}, Product Type: {2}'.format(
device.name, device.product_category, device.product_type))


query_devices()
>> DAQmx 21.8.0
>> Device Name: cDAQ9189-1CEF139, Product Category: ProductCategory.COMPACT_DAQ_CHASSIS, Product Type: cDAQ-9189
>> Device Name: cDAQ9189-1CEF139Mod1, Product Category: ProductCategory.C_SERIES_MODULE, Product Type: NI 9485

 

Then, following the digital output example I was able to come up with the following code for actually sending a command to the SSR. Currently I am only working with one valve, so I only have port 0, line 0 occupied. I also have a voltmeter in parallel to my valve to check for voltage flow across the connection. 

import nidaqmx

task = nidaqmx.Task()
task.do_channels.add_do_chan('cDAQ9189-1CEF139Mod1/port0/line0')
task.start()

value = True
task.write(value)

Which prints:

>> 1

Then I stop the task and close it.

task.stop 
task.close()

The documentation states that the relay is normally open, so I assumed that I could just start the task and keep the relay open by setting it to True. However, I never see any voltage flow through the circuit, nor does the valve open/close. 

 

I also attempted to test the panels using NI MAX, but got no response from the SSR either. Didn't matter if I set the port to high or low.

Screenshot 2022-05-13 145929.png

The final goal is to create a GUI application that would allow me to control all the valves in my system from my PC, without lugging around a huge switchboard and control panel. But as of now, I can't even control a single valve.

 

Can anyone provide me with some insight as to why my method is not working? I am pretty new to python still, so any help will be much appreciated. 

0 Kudos
Message 1 of 4
(127 Views)

I guess the Stop and Close releases the relays. You should not close the task if you want to retain the relay ON.

 

Try adding a long wait (maybe 15 seconds) before task.stop and observe if it turns ON.

 

In the NI MAX test panels, did you click the Start button at the bottom? any changes to the high/low switches will not be sent to the device unless it is running (i.e., click the "Start" button)

-Santhosh
Semiconductor Validation & Production Test
Soliton Technologies
NI CLD, CTD
LabVIEW + TestStand + TestStand Semiconductor Module (2013 - 2020)
NI STS for Mixed signal and RF
0 Kudos
Message 2 of 4
(118 Views)

Thank you for your suggestions Santhosh.

 

I understand the STOP and CLOSE command releases the relay. The issue is that even if I add a timing or just run my code with no STOP and CLOSE commands, I never see a response from my system. 

 

 

SSR Wiring.png

I assume that I have everything wired in correctly. The rudimentary wiring diagram shown above is current test setup. 

 

The same thing occurs when I use the NI MAX test panel. Yes, I remembered to hit the start button (even though it was not shown in the screenshot on the previous post.)

Screenshot 2022-05-16 153523.png

Screenshot 2022-05-16 153553.png

As a precaution, I also ran the Self-Test included in NI MAX and it said "The self test was completed successfully". This makes me assume that the hardware is functioning, just not responding to any command I input.  

0 Kudos
Message 3 of 4
(81 Views)

What is the power source used and what is the load?

 

Your connection diagram seems to be right,

santo_13_0-1652741491326.png

 

-Santhosh
Semiconductor Validation & Production Test
Soliton Technologies
NI CLD, CTD
LabVIEW + TestStand + TestStand Semiconductor Module (2013 - 2020)
NI STS for Mixed signal and RF
0 Kudos
Message 4 of 4
(78 Views)