06-06-2017 04:54 AM
Hello,
I want to do a project using the NI 6001 USB as a DIO device.
Details about the project:
- 4 sensors activated by a voltage input of 12V (anything under that will not activate the sensor)
- 2 actuators ( switch actuators )
- 3 LED (Red , Green, Yellow)
We have the following cases:
Case 1: If sensors 1 and 2 are activated, actuator 1 is activated and the Green LED is turned on (for 5 seconds) .
Case 2: If sensors 2 and 3 are activated, actuator 2 is activated and the Yellow LED is turned on for a period of time (10 seconds).
Case 3: If sensor 4 is activated, all actuators will stop and the Red LED is turned on.
For any other combination of sensors activated (for example sensor 1 and 4, the Red LED is turned on).
Other details:
- LabVIEW 15 SP1
06-06-2017 05:51 AM
Sounds great. Given the way that you have described the project in your post and the seeming interdependence of one sensor on another to determine output, I would suggest a State Machine.
Was there something you needed help with?
06-08-2017 05:37 AM
Hi, thank you for the suggestion.
I was thinking about the actuators, how can i make them work.
Each of the 2 actuators will start one DC motor depending on how the sensors are activated. (3V-6V motor, 2200 rpm)
And for the sensors, i was thinking to use push buttons for activation.
06-09-2017 09:25 AM
A good place to start might be to look at the USB 6001 datasheet:
http://www.ni.com/pdf/manuals/374369a.pdf
Depending on the voltage rating of your actuators, you have a variety of different digital output ports on the device that you can connect to the switch actuators to start your DC motors.
You can also use the digital input ports on the device to interface with your software.
Does this help with your problem?
06-13-2017 02:39 PM
I want to use 4 physical push buttons to activate 4 different physical LED's.
Push buttons and LED's are connected on a breadboard.
But i am having difficulties on how to make the VI to do that.
Can anyone help me with this ?
06-14-2017 09:21 AM
The best way to learn how to use a LabVIEW VI for this would be to look at the LabVIEW Examples that come with the software. You can find these at Help->Find Examples... which should pull up the NI Example Finder.
Once you're there, you can find some helpful examples on using the DAQmx API to control digital input and output, which is what your application is doing. In the Example Finder, if you navigate to Hardware Input and Output>DAQmx, you'll be able to see the Digital Input and Digital Output folders. In each of those folders, Digital - Finite Input.vi and Digital - Finite Output.vi show how to go about taking samples of digital input and output. You can use these, in addition to the State Machine architecture shown above, to model your VI off of.
06-14-2017 11:31 AM
Can anyone help me with this state machine ?
I am having a hard time understanding how to include signal generation from my DAQ device in one of the states and how to pass to the next state after i generated the signal.
In the first state i want to press a virtual button from VI to send 5V to power an LED, and then to move in the next state, in which i need to generate signal to power a DC motor (just to turn it on, i dont need to control it)
06-14-2017 12:54 PM
Something else that might help is this: https://forums.ni.com/t5/Example-Programs/Flexible-DAQmx-State-Machine-for-Automated-Tests/ta-p/3499...
Someone kindly made a State Machine VI that uses the DAQmx API. Just to explain some things on the block diagram that will answer your questions:
06-15-2017 05:40 PM
Ok i managed to get my state machine logic going on.
The only problem i have now is still the signal generation thing to power my DC Motor.
Its a basic motor, that starts spinning from 3V up to 6V .
I selected the channels on my device that i want to write, and i connected the motor accordingly, but it seems like it hasn't got enough power to turn it on. Or maybe there is something else wrong with my logic in that state.
I will attach my "running motor" state.
06-19-2017 10:05 AM
If you look on the datasheet, it shows that the maximum current output of the AO channels is limited to 5mA. If your DC motor requires more current than that to run, you'll have to use your output as an input to a switch, whether that be with a FET or an optocoupler. There are some resources online for this kind of thing, but in short those components would offer isolation from your USB device, so you wouldn't have to draw as much current from it, and instead from an external power supply, or the +5V power source on the device.