Difference between revisions of "EGR 103/DAQ 1"
Jump to navigation
Jump to search
(41 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | This page contains pictures and graphs related to Data Acquisition Laboratory 1 (DAQ 1) of [[EGR | + | |
+ | == '''Note:''' For Fall 2019 and after, you will want the [[Python:DAQ_1]] page. == | ||
+ | <!-- | ||
+ | == Introduction == | ||
+ | This page contains pictures and graphs related to Data Acquisition Laboratory 1 (DAQ 1) of [[EGR 103]]. It has been updated for Spring, 2018. This page underwent a major revision in Fall of 2017 based on the DAQmx drivers and MATLAB's elimination of legacy toolbox codes. | ||
+ | |||
+ | == Supporting Pundit Pages == | ||
+ | *[[MATLAB:CB-68LP Pinout]] | ||
+ | *[[Resistor Color Codes]] | ||
+ | *[[Transferring_Files]] | ||
+ | |||
+ | == Typographical Errors / Clarifications == | ||
+ | * If the computer says your device is not found, try 'Dev2' instead of 'Dev1' in the | ||
+ | addDigitalChannel(s,'Dev1','Port0/Line0:2','OutputOnly') | ||
+ | : line. | ||
+ | * Before running the program, the person at the DAQ machine will need to install the pydaqmx module: | ||
+ | ** Go to the Start button, find the Anaconda3 folder, and click the Anaconda prompt | ||
+ | ** In the Anaconda terminal that just opened, type | ||
+ | pip install pydaqmx | ||
+ | ** One it is done installing (or confirms that it is installed), close the Anaconda terminal | ||
== Equipment Used == | == Equipment Used == | ||
Line 5: | Line 24: | ||
[[Image:NIPCI6014e.jpg|thumb|NI PCI 6014e]] | [[Image:NIPCI6014e.jpg|thumb|NI PCI 6014e]] | ||
[[Image:DAQ1Danger.jpg|thumb|Same card, after overheating]] | [[Image:DAQ1Danger.jpg|thumb|Same card, after overheating]] | ||
− | B209 has machines with two different data acquisition cards. Most of the machines have NI PCI 6014e cards, which will be what is discussed here. The others have a newer NI PCI | + | B209 has machines with two different data acquisition cards. Most of the machines have NI PCI 6014e cards, which will be what is discussed here. The others have a newer NI PCI 6221 cards. |
− | The NI PCI 6014e card can read up to 16 single-ended (8 differential) analog voltage measurements, has two analog outputs, and has 8 configurable digital input/output lines. The | + | The NI PCI 6014e card can read up to 16 single-ended (8 differential) analog voltage measurements, has two analog outputs, and has 8 configurable digital input/output lines. The 6221 cards are more powerful but, generally in EGR 103, we will limit ourselves to the features available on the 6014e cards. |
Be careful when making connections; improperly connecting wires can lead to catastrophic damage on the DAQ cards, as is shown on the second picture at right. | Be careful when making connections; improperly connecting wires can lead to catastrophic damage on the DAQ cards, as is shown on the second picture at right. | ||
Line 24: | Line 43: | ||
For the main part of the board, half-columns are connected together. For example, rows (ABCDE) in column 3 are all connected. Note, however, that ABCDE are not connected to FGHIJ. | For the main part of the board, half-columns are connected together. For example, rows (ABCDE) in column 3 are all connected. Note, however, that ABCDE are not connected to FGHIJ. | ||
− | Also, there are some helpful index numbers at the top and bottom to help determine which column you are in. For rows X and Y, some indices do not exist. For example, there | + | Also, there are some helpful index numbers at the top and bottom to help determine which column you are in. For rows X and Y, some indices do not exist. For example, there is no pin at X6, X12, X18, Y6, Y12, or Y18. |
<br clear=all /> | <br clear=all /> | ||
Line 35: | Line 54: | ||
[[Image:DAQ1LEDs.jpg|thumb|Several Light Emitting Diodes]] | [[Image:DAQ1LEDs.jpg|thumb|Several Light Emitting Diodes]] | ||
[[Image:DAQ1LEDsClose.jpg|thumb|Closeup of two round LEDs]] | [[Image:DAQ1LEDsClose.jpg|thumb|Closeup of two round LEDs]] | ||
− | [[File:LED, | + | [[File:LED,_5mm,_green_(en).svg|thumb|Drawing of LED from Wikipedia [http://en.wikipedia.org/wiki/Light-emitting_diode Light-emitting_diode] page]] |
A diode is an electrical element that generally only allows current to flow in one direction - and only after there is a sufficient voltage difference across the appropriate terminals. | A diode is an electrical element that generally only allows current to flow in one direction - and only after there is a sufficient voltage difference across the appropriate terminals. | ||
LEDs - Light Emitting Diodes - are a special form of diode that emit light when current flows through them. | LEDs - Light Emitting Diodes - are a special form of diode that emit light when current flows through them. | ||
Line 48: | Line 67: | ||
[[Image:DAQ1Circuit.jpg|thumb|Circuit built on breadboard]] | [[Image:DAQ1Circuit.jpg|thumb|Circuit built on breadboard]] | ||
[[Image:DAQ1Wiring.jpg|thumb|Connections to CB-68LP]] | [[Image:DAQ1Wiring.jpg|thumb|Connections to CB-68LP]] | ||
− | |||
− | |||
The pictures at right show both the breadboard and the CB-68LP once everything has been properly connected. Note especially on the CB-68LP where the wires are - there will be no connections in the first two columns and there is only one connection - the black wire for digital ground - in the fifth column. | The pictures at right show both the breadboard and the CB-68LP once everything has been properly connected. Note especially on the CB-68LP where the wires are - there will be no connections in the first two columns and there is only one connection - the black wire for digital ground - in the fifth column. | ||
<br clear=all /> | <br clear=all /> | ||
+ | |||
+ | == Code == | ||
+ | The following code listing is for <code>ThreeBits.m</code> | ||
+ | <source lang="matlab"> | ||
+ | % Clear out workspace | ||
+ | clear | ||
+ | |||
+ | % Create a session | ||
+ | s = daq.createSession('ni') | ||
+ | |||
+ | % Add output lines to session | ||
+ | addDigitalChannel(s,'Dev1','Port0/Line0:2','OutputOnly') | ||
+ | |||
+ | % Writing values to output lines using binary | ||
+ | outputSingleScan(s, [1 1 1]); | ||
+ | fprintf('Press return to continue\n'); | ||
+ | pause | ||
+ | outputSingleScan(s, [0 0 0]); | ||
+ | |||
+ | % Writing values to output lines using base 10 | ||
+ | MyVal = 0 | ||
+ | while 0<=MyVal & MyVal<=7 | ||
+ | MyBinVal = decimalToBinaryVector(MyVal, 3, 'LSBFirst'); | ||
+ | outputSingleScan(s, MyBinVal); | ||
+ | fprintf('Displaying %d as %d %d %d\n', ... | ||
+ | MyVal, MyBinVal(end:-1:1)) | ||
+ | MyVal = floor(input('Enter a number between 0 and 7: ')); | ||
+ | end | ||
+ | |||
+ | % Turn all outputs off | ||
+ | outputSingleScan(s, [0 0 0]); | ||
+ | </source> | ||
+ | |||
+ | == Other Resources == | ||
+ | * Landing Lights Animation: | ||
+ | [[File:LLGifSmall.gif]] | ||
== Questions == | == Questions == | ||
Line 57: | Line 110: | ||
== External Links == | == External Links == | ||
+ | *[http://sine.ni.com/nips/cds/view/p/lang/en/nid/11442 NI 6014 Page] | ||
+ | *[http://sine.ni.com/nips/cds/view/p/lang/en/nid/14132 NI 6221 Page] | ||
== References == | == References == | ||
<references /> | <references /> | ||
− | [[Category:EGR | + | [[Category:EGR 103]] |
+ | --> |