Home
NI myRIO Project Essentials Guide
Contents
1. 56 Digital Bubble Level Bubble levels are familiar to carpenters and to anyone who has hung picture frames When level the bubble of a bubble level is centered in its liquid tube otherwise the bubble drifts one way or the other Any of the accelerometer axes can be used to determine the degree to which the axis points directly at the ground i e a unit magnitude tells you that the axis is perfectly aligned with a plumb line Combine the accelerometer with an array of discrete LEDs a row of the LED matrix or the LCD display to emulate the bubble position Add a numerical display to show the percent of slope e Measurement display LCD Display e Onboard accelerometer Accelerometer 220 56 DIGITAL BUBBLE LEVEL 5 Weather Station A weather station commonly includes sensors for temperature humidity wind speed anemometer wind direction barometric pressure and rainfall Form an Internet search based on the sensor name with LC SPL or UART and you will find a wide selection of available sensors to create your own weather station Create a front panel display that includes waveform charts to show the weather conditions over the past hour or longer interval of time The NI myRIO kits provide a few of the needed sensors to get you started Temperature Sensor 33 Photocell 9 Ambient Light Senso 222 57 WEATHER STATION 58 EEPROM Programmer Create an EEPROM programmer applica
2. frequencies Remember to change the speed of both 12C Express VIS Try disconnecting either I C bus line from the LCD character display What LabVIEW error message do you see Change the slave address to some other value What LabVIEW error message do you see Integrated Project Ideas EEPROM Programmen 58 28 5 For More Information PmodCLS Reference Manual by Digilent Reference manual for the LCD character display PmodCLs Schematics by Digilent Schematic diagram of the LCD character display UM10204 FC bus Specification and User Manual by NXP Semiconductors A complete treatment of the I C bus standard including timing diagrams and multi master systems http www nxp com documents user_manual UM10204 pdf 29 LED Matrix The LED matrix pictured in Figure is an 8x8 grid with one green LED and one red LED behind each circular dot The LED matrix uses the same row column wiring scheme as the keypad of Chapter 25 with two column lines one for each LED and a shared row line Figure 29 1 NI myRIO Embedded Systems Kit LED matrix Learning Objectives After completing the activities in this chapter you will be able to 1 Describe the LED matrix wiring diagram 2 Explain the raster display technique to display arbitrary patterns 3 Describe the need to alternately activate the ereen and red LEDs and 4 Design an animation sequence 29 1 Component Demonstration Follow these
3. NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the ambi ent temperature in degrees Celsius as measured by the Microchip TCN75A temperature sensor with an accuracy of 1 C expect to see a temperature reading that matches your room temperature Double click the maximum and minimum values of the thermometer indicator to change its display range Try heating the sensor by a finger touch or by usinging a drinking straw or hair dryer to blow warm air on the thermistor What is the highest temperature that you observe Use a plastic sandwich bag filled with an ice cube or crushed ice Surround the temperature sensor with ice and you should observe the measured temperature going down What is the lowest temperature that you observe The alert LED indicator displays the state of the TCN75A ALERT output You should observe that the alert indicator asserts when the temperature exceeds 26 C and then de asserts when the temperature falls below 24 5 1 C The VI displays the contents of the four TCN75A registers ambient temperature primary measure ment configuration temperature limit to activate the ALERT output and temperature hysteresis lower limit stop the VI edit the block diagram save and re run to change the values in these last three registers Click the Stop button or press the escape key to stop the VI and to res
4. e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that you are using Connector B and possibly Connector C and that you have the correct pin connections and e Use the B AIO pin 3 jumper wire as probe to check the following signal points ADMP504 output 0 8 volt DC offset with signal at up to 0 25 volts Negative terminal of 1 F capacitor same as ADMP504 output but with zero DC offset for OP37 or 2 5 V offset AD8541 Noninverting op amp terminal zero for OP37 or 2 5 V offset AD8541 Inverting op amp terminal zero for OP37 or 2 5 V offset AD8541 if some other level double check all of your op amp connections or try another op amp 34 2 Interface Theory Interface circuit The ADMP504 produces a maxi mum voltage of 0 25 volts with a DC offset of 0 8 V Study the video ADMP504 Microphone Interfacing youtu be 991p37yUmuY 6 36 to learn about the microphone characteristics the need for a power supply bypass capacitor the DC blocking capacitor and the inverting amplifier that boosts microphone output to level matched to the 2 5 V input range of the audio input and analog input 34 3 Basic Modifications Study the video MEMS Mic Demo Walk Through youtu be 2ZpI_uDw0g4 2 31 to learn the design principles of MEMS Microphone demo and then try making these modifi
5. link at the bottom of the page ttp www magneticsensors com hree axis digital compass php i 3 je n WN 7 A 2 5 E 3 a E by Honeywell Converting the three axis compass measurements to a heading angle click the Literature link and then select AN203 from the Application Notes menu ttp www magneticsensors com hree axis digital compass php Reference Desing Low Cost Compass by Hon eywell More details on the design of a practical compass click the Literature link and then select AN214 from the Application Notes menu ttp www magneticsensors com i hree axis digital compass php Applications of Magnetic Sensors for Low Cost Compass Systems by Honeywell Detailed discussion of compass design including compen sation of error effects click the Literature link and then select this article from the Technical Articles menu Magnetic Declination by NOAA National Geophysical Data Center Magnetic declination angle maps for the US and world Estimated Values of Magnetic Field Properties by NOAA National Geophysical Data Center Look up your declination angle difference between magnetic north and true north and inclination angle angle of Earth s magnetic field based on your US zip code or your city and country Select either Declination or Inclination in the Magnetic component menu UM10204 C bus Specificatio
6. modTMP3 rm revA_l pdf PmodTMP3 Schematics by Digilent Schematic FU e D eje y Dd 5 O Fh er y FO O Pai D 3 D do O 7 O 53 ttp digilentinc com Products Detail cfm 3 TCN75A Datasheet by Microchip Datasheet for the TCN75A 2 Wire Serial Temperature Sensor UM10204 FC bus Specification and User Manual by NXP Semiconductors A complete treatment of the I C bus standard including timing diagrams and multi master systems UM10204 pdf Z w lt FU w an N H gt oO ke N oO N Q FU H O O FU iS O U H iS FJ DI DI 155 156 33 TEMPERATURE SENSOR A microphone serves as an acoustic sensor to record audio signals and monitor acoustic level The Analog Devices ADMP504 microphone pictured in Figure a MEMS micro electro mechanical sensor device with an on board amplifier finds application in smartphones The device is packaged on a DIP carrier for use on a breadboard cm Figure 34 1 NI myRIO Starter Kit MEMS micro phone The photo on the right shows the micro phone mounted to the underside of the DIP carrier Learning Objectives After completing the activities in this chapter you will be able to 1 Describe the output characteristics of the 34 MEMS Microphone ADMP504 MEMS microphone 2 Block the DC component of the microphone output 3 Amplify the microphone signal with an op amp and 4 Read the microphone signal
7. 24 23 22 21 20 19 18 17 16 15 14 1 8x8 R1 8 rows C1 8g columns green C1 8r columns red 6 LED Matrix top view ae IR1 R2 R3 R4 C1g C2g C3g C4g C5g C6g C7g C8g A DIOO 11 A DIO1 13 A DIO2 15 A DIO3 17 B DIO7 25 B DIO6 23 B DIOS 21 B DIO4 19 B DIO3 17 B DIO2 15 B DIO1 13 B DIOO 11 Figure 29 2 Demonstration circuit for LED matrix pin diagram and connection to 24 digital I O terminals on NI myRIO MXP Connectors A and B 29 2 Interface Theory Interface circuit Each circular dot of the 8x8 LED matrix contains a green LED and a red LED The cathode of each diode pair connects to the same horizontal row wire The anode of all the green LEDs in the same column connects to the same vertical column wire the anodes of the red LEDs are similarly connected thereby providing individual control of the two LEDs at each dot Activating both LEDs can color mix to yellow Study the video LED Matrix Interfacing Theory youtu be vsBjZBLdeNc 9 51 to learn more about the LED matrix wiring diagram and pin connections electrical interfacing especially the substantial voltage current mismatch between the red and green LEDs and the raster display technique that 131 132 29 LED MATRIX Figure 29 3 Demonstration circuit for LED matrix recommended breadboard layout 29 LED MATRIX permits an arbitrary pattern of dots to be selected NOTE The interf
8. DI E D er yo Q yo O D 2 Hall Applications Guide 3715 aspx e A Strange Attraction Various Hall Effect Sensors by bildrorg Video demonstration of latch switch and linear mode behavior ttp bildr org 2011 04 ey lt w 5 H O an un I w 0 hh hh D Q ct un 0 D un O K un 15 HALL EFFECT SENSOR 1 6 Piezoelectric Effect Sensor A piezoelectric sensor sandwiches a piezoelectric material between two plate electrodes Deforming the sensor causes a charge displacement that appears as a measurable voltage between the plates much like a parallel plate capacitor Combining the piezoelectric sensor with a charge to voltage converter provides a useful sensor to detect shock and vibration Figure 16 1 pictures the NI myRIO Starter Kit piezo sensor MEAS EN MEAS SPEC COM Figure 16 1 NI myRIO Starter Kit piezo sensor Learning Objectives After completing the activities in this chapter you will be able to 1 Describe the piezoelectric effect 2 Design a charge to voltage converter as an interface circuit to the analog input and 3 Set the gain of the charge to voltage converter for different applications including a deflection sen sor and a highly sensitive vibration shock sensor 16 1 Component Demonstration Follow these steps to demonstrate correct operation of the piezo sensor Select these parts from the NI myRIO Starter Kit e Piezo film sensor DT ser
9. NATIONAL _ INSTRUMENTS n _ _ _ agi p po _ gt _ LL a os y a x sa e P o e a 7 ei NI myRIO Project Essentials Guide Ed Doering Electrical and Computer Engineering Department Rose Hulman Institute of Technology IV Printed April 23 2014 Download the latest version atihttp www ni com myrio project guide 2013 National Technology and Science Press All rights reserved Neither this book nor any portion of it may be copied or reproduced in any form or by any means without written permission of the publisher NTS Press respects the intellectual property of others and we ask our readers to do the same This book is protected by copyright and other intellectual property laws Where the software referred to in this book may be used to reproduce software or other materials belonging to others you should use such software only to reproduce materials that you may reproduce in accordance with the terms of any applicable license or other legal restriction LabVIEW and National Instruments are trademarks of National Instruments All other trademarks or product names are the property of their respective owners Additional Disclaimers The reader assumes all risk of use of this book and of all information theories and programs contained or described in it This book may contain technical inaccuracies typographical errors other errors
10. lt i J 5 op es i vi 4 mi ui h 3 3 J I i x i 1 3 gt _ y o t i se eae Figure 38 3 Demonstration setup for RFID reader connected to NI myRIO MXP Connector B Note that the compact layout requires several breadboard jumper connections under the RFID reader 180 RFID reader to scan the tag Does waving the card or moving the card quickly make any difference Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Figure 38 4 RFID card transponders Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections Correct RFID reader terminals double check your connections and ensure that have connected the NI myRIO UART receive input to the RFID reader DO output also check that you have not accidently crossed the power supply connections and Hidden jumpers be certain that you have added the hidden jumper wires as shown in Figure 38 3 on the previous page 38 RFID READER 38 2 Interface Theory Interface circuit The RFID reader uses an electro magnetic field to supply power to the RFID tag and to receive a transmitted digital signal from the tag This noncontact method is popular for ID bad
11. 16 2 Interface Theory Interface circuit The piezo sensor acts like a charge pump current source when flexed The interface circuit is a charge to voltage converter based on an op amp Study the video Piezo Sensor Interfacing Theory youtu be dHaPUJ7n UI 5 13 to learn about the piezoelectric effect charge to voltage converters and choice of feedback capacitor to control the sensitivity of the sensor 16 3 Basic Modifications Study the video Piezoelectric Effect Sensor Demo Walk Through youtu be bime4f 31i0E 2 54 to learn the design principles of Piezoelectric Effect Sensor demo and then try making these modifications to the block diagram of Malin vL 1 Add the onboard LED Express VI myRIO Onboard subpalette as a bump indicator use the Programming Comparison In Range and Coerce VI as the upper limit and lower limit range test for the analog input Read VI Confirm that the LED flashes briefly when you bump the sensor Try one or more of the following methods to increase the sensitivity of your bump sensor e Increase the charge to voltage converter gain by 10x by changing the feedback capacitance to 100 pF 65 66 Right click on the waveform chart Y axis select autoscaling mode and observe the minimum and maximum values of the sensor waveform when the sensor is at rest Use this information to more precisely set the threshold values for the In Range and Coerce VI e Add mass to the senso
12. 205 207 209 211 213 215 Vil Vili CONTENTS 217 56 Digital Bubble Level 219 221 223 225 227 229 251 233 1 Introduction Welcome to the NI myRIO Project Essentials Guide and welcome to the exciting world of NI myRIO This book serves as your guide to interfacing your NI myRIO to the wide variety of sensors actuators and displays that you will need for your projects Each chapter concentrates on a specific component or device using a mixture of text and video to guide you through the learning process necessary to successfully integrate the component or device into your system For example consider the photocell of Chapter one of the many parts included with the NI myRIO Starter Kit You ll get immediate hands on experience with the photocell as you build a simple demonstration circuit connect it to one of the NI myRIO expansion ports and run a provided Lab VIEW program to confirm that the photocell works properly After that study a video tutorial that ex plains photocell operating principles and learn how to design a suitable interface circuit Next try your hand with the suggested modifications to the demon stration LabVIEW code to deepen your understand ing of the photocell behavior and LabVIEW program ming techniques At last you will be ready to tackle the suggested systems integration project in which you combine the photocell with other devices This book is intended for students at the junior or s
13. 3 Create an instruction tester Make two string controls one for the instruction and a second for the display use Boolean controls to disable sending either one 26 4 Integrated Project Ideas Now that you know how to use the LCD character display consider integrating it with other devices to create a complete system for example Data Loggen 41 2 LCD Character Display SPI Interface An LCD character display provides an excellent means for your LabVIEW block diagram code to display measurements status and conditions with ASCII character strings The LCD character display also provides visual feedback for a user interface Figure pictures the NI myRIO Embedded Systems Kit LCD character display which supports three different serial communications standards This chapter focuses on the SPI interface to the display while the previous chapter covers the UART interface and the next chapter covers the I C bus interface Figure 27 1 NI myRIO Embedded Systems Kit LCD Character display Learning Objectives After completing the activities in this chapter you will be able to 1 Configure the display for SPI serial communi cations at a desired clock frequency 2 Send characters directly to appear on display and 3 Send escape sequences to adjust the display modes 27 1 Component Demonstration Follow these steps to demonstrate correct operation of the LCD character display Select these parts fr
14. Refer to the schematic diagram and recommended breadboard layout shown in Figure 8 2 on page 33 The interface circuit requires four connections to NI myRIO MXP Connector B see Figure A 1 on page 227 1 5 volt power supply B 5V pin 1 2 Ground B GND pin 6 32 3 Temperature measurement B AIO pin 3 4 Supply voltage measurement B Al1 pin 5 Measure the resistance of the 10 k 2 resistor with an ohmmeter as this value is required for the LabVIEW VI Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location Open the project Thermistor demo lvproj contained in the subfolder Thermistor demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Enter the measured resistance of the 10 kQ resistor as R ohms Expected results The demo VI displays the measured resistance of your thermistor expect to see a value close to 10 k at room temperature Try heating the thermistor
15. The open drain ALERT output provides a setpoint limit to indicate when the temperature exceeds a user defined limit Study the video Temperature Sensor Interfacing youtu be HwzTgYp5nF0 10 03 to learn how to read the measured ambient temperature how to configure the device to adjust the resolution and ALERT output behavior including polarity temperature limit setpoint hysteresis and fault queue the number of consecutive conversion cycles for which a fault condition must be true before asserting the ALERT output and how to put the de vice into shutdown mode power saving idle with one shot measurement on demand Study youtu be 7CgNF78pYOM 8 47 to understand how the I2C Express VI con figuration options relate to the signaling waveforms between I C bus transmitters and receivers 33 3 Basic Modifications Study the video Temperature Sensor Demo Walk youtu be 10ib10sojds 6 25 to learn the design principles of Temperature Sensor demo and then try making these modifications to the block diagram of Main vi 1 Change the device address to some other value What LabVIEW error message do you see 2 Add the necessary computation to display the temperature in degrees Fahrenheit 3 Move the configuration register code inside the while loop and convert the Boolean array 33 TEMPERATURE SENSOR constant to a front panel control in this way you can more easily experiment with the configuration options
16. available temperature sensors to measure the room temperature Include a front panel control for the hysteresis band value 210 51 ON OFF CONTROL SYSTEM 52 security Camera Combine a webcam and a USB flash drive to create a security camera that monitors a room and saves time stamped images when motion is detected Consider using a pair of IMAQdx Grab instances to collect adjacent webcam frames IMAQ Absolute Dif ference to determine the difference image between the two frames IMAQ Cast Image to convert to a grayscale image and IMAQ Quantify 2 to determine the average value of the difference image a differ ence higher than a suitable threshold indicates a sig nificant difference between the frames i e motion As an alternative compare the current webcam image to a reference image taken by pressing the onboard button or when the VI starts up With this approach even a stationary intruder will be detected Use IMAQ Write File 2 to save image frames to the USB flash drive Refer to the project Data Logger Light Temperature to learn how to access the NI myRIO system time for the time stamping purpose 36 212 52 SECURITY CAMERA 53 Compass with Tilt Correction The compass described in Chapter page 101 senses a 3 D magnetic field and the tutorial video Compass Interfacing Theory youtu be 3WkJ7ssZmEc 12 47 presents a basic method to calibrate the compass to indicate true north for the purpose of
17. for example NIP Clock E 3 5 For More Information 7 Segment Display LED Blue by SparkFun Need more display digits This is the same or 3 SEVEN SEGMENT LED DISPLAY very similar product World s Simplest Font by Twyman Enterprises TrueType font for seven segment displays use this font and your favorite wordprocessor to quickly translate your text phrases into suitable segment patterns Nixie Tubes and Projects by Neonixie Before seven segment displays you would have used nixie tubes see http en m wikipedia org wiki Nixie_tube for the origin of nixie You can buy nixie tubes and related projects here http neonixie com 4 Pushbutton Switch Pushbutton switches also called momentary Learning Objectives After completing the activities contact switches serve as basic user interface in this chapter you will be able to devices as well as simple sensors e g bump sensors 1 Discuss the essential concepts associated with Figure 4 1 pictures the pushbutton integrated with a pushbutton switch the rotary encoder covered in a later chapter a Pushbutton switch appears as a short circuit when pressed otherwise as an open circuit b Interface circuit to the digital input relies on the DIO internal pull resistors to eliminate the need for additional components pull up on MXP Connectors A and B pull down on MSP Connector C Block diagram views the switch as a Boolean two lev
18. indicators for A DIO state Is the switch open or closed in the up position Click the Stop button or press the escape key to stop the VI and to reset NI myRIO a myRIO reset causes all of the digital I O pins to revert to input mode Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that you are using both Connectors A and B and that you have the correct pin connections and e Connecting wires link all eight of the lower pins of the DIP switch to ground 5 2 Interface Theory Interface circuit Each SPST switch in the standard DIP switch appears either as an open circuit or as a short circuit depending on the switch position up 5 DIP SWITCHES i Corner cutout 7 A DIOO 11 7 AIDIO1 13 7 AIDIO2 15 7 A DIO3 17 A GND 20 B GND 8 u A A aeee ee e nern a eta n re RR e n E AN EI ETTI ATEI TI he 008 TIA SAR A x r re t j a yey i Yes Pi ria ao Figure 5 2 Demonstration circuit for DIP switches schematic diagram recommended breadboard layout and connection to NI myRIO MXP Connectors A and B B DIO7 25 B DIO6 23 B DIOS 21 B DIO4 19 B DIO3 17 B DIO2 15 B DIO1 13 B DIOO 11 19 20 or down The 16 position rotary switch opens all four SPST sw
19. input wired to True to count the total number of photointerrupter pulses since the previous call No pulses are missed even at high pulse rates because the LabVIEW myRIO Encoder implements its counter in the FPGA fabric Embed the encoder VI in a timed loop for highest precision and show the measured RPM on the LCD display e Local display LCD Display e Motor 12 e Photointerrupter 12 206 49 TACHOMETER 50 scanning Sensor Use the servo as a turret style scanning platform for a 180 degree sensor sweep Select the largest available circular servo horn see Figure to create a large platform and then attach the desired sensor Set up a for loop structure to command the servo angle over a range of angles while collecting sensor measurements to an array For example with the sonic rangefinder as the sensor the array of measurements will indicate the distance to objects as a function of angle thereby providing useful information for a higher level robot navigation system 208 50 SCANNING SENSOR A room thermostat and air conditioner unit serves as a familiar example of an on off controller also known as a bang bang controller The thermostat continually monitors the room temperature with a sensor and compares the measured temperature to the desired room temperature setting When the measured room temperature rises above the desired temperature the thermostat closes a relay to activate the air condit
20. 18 J1 SB sensor B A ENCB pin 22 J1 DIR direction A DIOO pin 11 CON D I SWAN Use a small straight bladed screwdriver to loosen and tighten the screws on the motor supply voltage connector 2 Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project H Bridge amp Geared Mo tor demo lvproj contained in the subfolder H Bridge Geared Motor demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically 18 H BRIDGE AND GEARED MOTOR Expected results Click the Enable button and increase the PWM duty duty cycle slider until the motor begins to turn You should see the motor turn the Counter Value indicator value increment in the positive direction and the Counter Direction in dicator display Counting Up Continue increasing the PWM duty slider to speed up the motor Bring the slider back down towards zero and then continue downwards to a negative value You should
21. 5 red 16 B DIO12 pin 22 Column 6 red 15 B DIO13 pin 26 Column 7 red 14 B DIO14 pin 32 Column 8 red 13 B DIO15 pin 34 TIP Short on jumper wires You can connect a subset of the array e g rows 1 to 4 and columns 1 to 4 for a green only display that requires only eight jumper wires Run the demonstration VI http www ni com academic myrio Download if you have not done so previously and unpack the contents to a convenient location Open the project LED Matrix demo lvproj contained in the subfolder LED Matrix demo Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running 29 LED MATRIX NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The VI begins in automatic pattern mode and the display should show a converging square animation in which the display changes every half second Move the pattern loop time pointer slide to adjust the animation speed Do you notice anything unusual for loop times below 100 ms Click the auto pattern switch and then try clicking buttons on the gr
22. B AIO Also double click the upper and lower limits of the waveform chart and set to 2 5 and 2 5 for Audioln Left and to 0 and 5 for B AIO Try whistling speaking singing or make any other sound and you should see the corresponding waveform Note that the waveform is centered about zero when using the audio input and centered about approximately 2 5 volts when using the analog input 34 MEMS MICROPHONE B 3 3V 33 VDD3 Cc 0 1pF VDD ADMP504 OUT ADMP504 Figure 34 3 Demonstration circuit for MEMS microphone with AUDIO IN schematic diagram 100kQ C 15V 1 AUDIO_IN R1 10kQ Vec Vout VEE 8I 71 6 5 C 15V 2 CIAGND 3 OP37 11 2 3 4 Vee recommended breadboard layout and connection to NI myRIO Connectors B and C 159 160 34 MEMS MICROPHONE R2 100kQ B 5V 1 B 3 3V 33 VDD VDD3 at B AIO 3 VDD C1 R1 z ADMP504 OUT z 5 7 AD8541 GND Auf 10kQ R4 10kQ B GND 30 B GND 6 ADMP504 rina su PET PONI TE III mi A AIIP m aa a ne a pnp ubte mas ent fe 4 i G A Ta 33 i f 5 33 a por Figure 34 4 Demonstration circuit for MEMS microphone with analog input AI schematic diagram recommended breadboard layout and connection to NI myRIO MXP Connector B 34 MEMS MICROPHONE Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points
23. DIO channels i e select the 6 RELAY 23 VDD B 5V 1 B DIOO 11 TT S LI S ZVP2110 D B GND 6 A A ALAN ARONA RAN e nt ek a pes i gt j ae 4 5 l i yl 4 4 eer f y i 33 Figure 6 2 Demonstration circuit for relay schematic diagram recommended breadboard layout and connection to NI myRIO MXP Connector B 24 DIO channel directly on the front panel rather than editing the VI itself 6 3 Basic Modifications Study the video Relay Demo Walk Through youtu be W2iukd8WVIA 3 30 to learn the design principles of Relay demo 1vproj3 and then try making these modifications 1 Add a front panel control to adjust the cycle frequency specified in Hertz at what frequency is the relay unable to keep up 2 Blink two LEDs to simulate a railroad crossing signal use the three relay contacts normally open NO normally closed NC and common COM as shown in Figure 3 Build and test the interface circuit for a relay controlled from the MSP connector see Figure 6 3 Select C DIO7 pin 18 as the relay control line on the myRIO DIO channel front panel control Power the circuit from the MSP connector with C 5V pin 20 and the digital ground C DGND pin 19 6 4 Integrated Project Ideas Now that you know how to use the relay consider integrating it with other devices to create a complete system for example e On Off Control System e INTP Clock 42 6 5
24. EA x FMODMDOI y 2 e t gt gt E 94v 0 Ir A AA AA n i i a egy ES RRE aman eiA na en EEE IN b i i X x a i i i i to NI myRIO MXP Connectors A and B Figure 18 2 Demonstration circuit for H bridge and geared motor schematic diagram and connection A DIOO 11 E AIPWMO 27 amp A ENC A 18 E AIENC B 22 77 78 Black Run button on the toolbar signifying that the VI is in run mode Correct MXP connector terminals ensure that 18 H BRIDGE AND GEARED MOTOR 18 3 Basic Modifications Study the video H Bridge and Geared Motor Demo you are using Connector A for the H bridge Walk Through youtu be Q1UXVtVN 00 6 01 control and sensor signals and that you have the correct pin connections Correct PmodHB5 terminals double check your connections and ensure that you have not reversed the NI myRIO encoder inputs also check that you have not accidently crossed the power supply connections 18 2 Interface Theory Interface circuit The PmodHB5 H bridge motor driver provides motor enable and direction inputs and quadrature sensor outputs from the pair of Hall effect sensors affixed to the back of the motor a small circular magnet mounted to the motor shaft activates the sensors The Sha Yang Ye 1G22 geared motor connects directly to PmodHB5 via the JSI style connector The screw terminal block on the HB5 accepts 18 gauge wire to accommodate motors up to 12 volts and 2 a
25. For More Information e Using Relays lips amp Tricks by Jumper One Learn how to reduce relay switching time and minimize relay current for battery powered applications 6 RELAY 6 RELAY VDD C 5V 20 a Ce Ce 1N4001 com nc C DIO7 18 zu G N2110 S lin TE D L Gs C DGND 19 ewes eevee ee es we ee EEE ee eee ee eee EEE www n n a x a a a a uses e FI 4 e is ll lie O I Ss I ss 1 O O IA ow 0 O L Figure 6 3 Relay interface circuit suitable for internal pull down resistors on NI myRIO MSP Connector C 26 6 RELAY Potentiometer A potentiometer is a three terminal variable resistor When connected to a power supply to form a voltage divider a potentiometer acts as a proportional rotation sensor Figure 7 1 pictures the NI myRIO Starter Kit potentiometer Figure 7 1 NI myRIO Starter Kit potentiometer Learning Objectives After completing the activities in this chapter you will be able to 1 Discuss how the potentiometer can be used as ei ther one variable resistor or two series connected complementary variable resistors 2 Connect a potentiometer as a voltage divider to produce a voltage proportional to rotation angle and 3 Select the potentiometer resistance to minimize power consumption and to minimize loading effects 7 1 Component Demonstration Follow these steps to demonstrate correct operation of the
26. I C businterfaces to the display Py O Annnaspspsannannpana _ Figure 26 1 NI myRIO Embedded Systems Kit LCD Character display Learning Objectives After completing the activities in this chapter you will be able to 1 Configure the display for UART serial commu nications at a desired baud rate 2 Send characters directly to appear on display and 3 Send escape sequences to adjust the display modes 26 1 Component Demonstration Follow these steps to demonstrate correct operation of the LCD character display Select these parts from the NI myRIO Embedded Systems Kit e LCD character display with serial interface PmodCLS http digilentinc com Products e Jumper wires F F 3x Build the interface circuit Refer to the schematic diagram shown in Figure the LCD character display requires three connections to NI myRIO MXP Connector B see Figure A 1 on page 227 1 3 3 volt supply B 3 3V pin 33 2 Ground B GND pin 30 3 UART receiver gt B UART TX pin 14 118 26 LCD CHARACTER DISPLAY UART INTERFACE VDD B 3 3V 33 B UART TX 14 PmodCLS VEDA al 14 J2 G BIGND 30 A m a II A ne een rer A NA TL ALZI A IE A AE A IT LIT CEO genen F i t u A 3 ia S a re u o L Sih RR joer eee a3 ir i i E Set mode jumpers for UART 9600 baud Figure 26 2 Demonstration setup for LCD character display connected to NI myRIO MXP Connector B Remember to set the mode
27. Manual by NXP Semiconductors A complete treatment of the I C bus standard including timing diagrams and multi master systems ttp www nxp com documents user_manual UM10204 pdf A O of DI DI 94 21 ACCELEROMETER 22 Gyroscope A gyroscope measures the angular velocity rate of rotation about an axis The rate is reported in degrees per second and when integrated yields relative angular displacement A three axis gyroscope mounted to a robot platform yields 3 D attitude pitch roll and yaw and provides valuable information to maintain stability of the vehicle Figure pictures the NI myRIO Mechatronics Kit gyroscope based on the STMicroelectron ics L3G4200D triple axis digital output gyroscope with I C bus serial communications Figure 22 1 NI myRIO Mechatronics Kit gyroscope Learning Objectives After completing the activities in this chapter you will be able to 1 Configure the gyroscope for data rate and full scale range 2 Set up an interrupt output for onboard threshold limit detection 3 Read and display angular rate values and 4 Deal with non zero values of zero rate level output bias 22 1 Component Demonstration Follow these steps to demonstrate correct operation of the gyroscope Select these parts from the NI myRIO Mechatronics Kit e Gyroscope PmodGYRO e Jumper wires F F 6x Build the interface circuit Refer to the schematic diagram shown in Figure 22 2 on pa
28. Measurement youtu be PhZ2Q1CrwuQ 6 10 to learn how to measure the thermistor resistance with a voltage divider and also how to size the resistor R for best measurement sensitivity and range Also take a look at Measure Resistance with a Voltage youtu be 9KUVD7RkxNI 9 44 for a more complete treatment of voltage dividers as a measurement technique LabVIEW programming Study the video Input Express VI youtu be N6Mi VjBlmc 2 00 8 THERMISTOR VDD B 5V 1 B AI1 5 B AIO 3 c R 0 1pF 10kQ B GND 6 Lt Se Er er el yt tt rte hr arta sae A A tent sp romeno pe pen 33 y 1 Figure 8 2 Demonstration circuit for thermistor schematic diagram recommended breadboard layout and connection to NI myRIO MXP Connector B to learn how to use the Analog Input Express VI to measure the voltage divider s primary output as well as the voltage divider supply voltage 8 3 Basic Modifications Study the video Thermistor Demo Walk Through youtu be xi0VIpGpf4w 2 28 to learn the design principles of Thermistor demo and then try making these modifications to the block diagram Of Main vi A 33 1 Add the necessary computation to convert the measured resistance to temperature in degrees Celsius display the temperature on the large front panel dial indicator Use the built in VIs Mathematics Elementary Natural Logarithm and Mathematics Polynomial Polynomial Evaluation Use the polynomi
29. The buzzer speaker pictured in Figure 11 1 also called a magnetic transducer generates tones over much of the audible frequency spectrum The speaker coil is designed for on off operation 5 volts at 80 mA when on therefore cycling the speaker with a square wave created from a digital output is the most straightforward way to operate the speaker A transistor based interface circuit is required to drive the coil 1 cm Figure 11 1 NI myRIO Starter Kit buzzer speaker Learning Objectives After completing the activities in this chapter you will be able to 1 Describe the buzzer speaker principle of operation based on an electromagnetic coil that vibrates a small diaphragm 2 Select a transistor to drive the coil from a digital output 3 Protect the transistor from back emf voltage spikes when the transistor switches the coil current on and off and 4 Design the interface circuit to work with digital outputs that include either pull up or pull down resistors 11 1 Component Demonstration Follow these steps to demonstrate correct operation of the buzzer speaker Select these parts from the NI myRIO Starter Kit e Buzzer speaker Soberton GTI 0950RP3 http www soberton com product gt 0950rp3 e 1N3064 small signal diode fairchildsemi com ds 1N 1N3064 pdf 2N3904 npn transistor e Resistor 1 0 kQ e Breadboard e Jumper wires M F 3x Build the interface circuit Refer to the schematic diagram and r
30. a convenient location e Open the project Bluetooth demo lvproj contained in the subfolder Bluetooth demo Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results Older desktop computers equipped with a serial communications COM port could connect directly to the NI myRIO UART and exchange data The RN42 defaults to the Serial Port Profile SPP meaning that the RN42 appears to the desktop as a virtual COM port and appears to the myRIO as a physical COM port In other words the RN42 wirelessly extends the desktop COM port to the myRIO The demo VI displays data characters received by the RN42 from the Bluetooth capable laptop or desktop computer and transmits the NI myRIO system date and time when the characters d and 31 BLUETOOTH MODULE t are received The incoming character indicator uses the backslash codes display mode so that non printing characters such as carriage return appear as r and the ASCII hex code indicator show
31. again Hold the PmodGYRO board right side up and facing you with the word PmodGYRO in the lower right corner The X axis points to the right the Y axis point up and the Z axis points out of the board toward you Rotate the board about each of these three axes You should observe that counter clockwise rotation about the sensitive axis correspond to positive values in the angular rate 22 GYROSCOPE displays at the top of the VI front panel What do you observe as you vary the rotation rate The lower half of the VI front panel contains the angular displacement displays Hold the PmodGYRO board in an initial position and then click the reset integrator two times Rotate the board around a single axis and then rotate it back to the original position You should observe that the displacement value becomes a large positive or negative value away from zero displacement and then returns to the same value The L3G4200D gyroscope output contains a non ideal effect called zero rate level Set the PmodGYRO on a table undisturbed and then reset the integrator The rate values on top may be difficult to read due to the rapid data rate but you should expect to see the displacement values on the bottom begin a linear ramp away from zero Even when the gyroscope is perfectly stationary this is the zero rate input the output contains some residual non zero value zero rate level which causes the integrator output magnitude to
32. and omissions and out of date information Neither the author nor the publisher assumes any responsibility or liability for any errors or omissions of any kind to update any information or for any infringement of any patent or other intellectual property right Neither the author nor the publisher makes any warranties of any kind including without limitation any warranty as to the sufficiency of the book or of any information theories or programs contained or described in it and any warranty that use of any information theories or programs contained or described in the book will not infringe any patent or other intellectual property right THIS BOOK IS PROVIDED AS IS ALL WARRANTIES EITHER EXPRESS OR IMPLIED INCLUDING BUT NOT LIMITED TO ANY AND ALL IMPLIED WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED No right or license is granted by publisher or author under any patent or other intellectual property right expressly or by implication or estoppel IN NO EVENT SHALL THE PUBLISHER OR THE AUTHOR BE LIABLE FOR ANY DIRECT INDIRECT SPECIAL INCIDENTAL COVER ECONOMIC OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS BOOK OR ANY INFORMATION THEORIES OR PROGRAMS CONTAINED OR DESCRIBED IN IT EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND EVEN IF CAUSED OR CONTRIBUTED TO BY THE NEGLIGENCE OF THE PUBLISHER THE AUTHOR OR OTHERS Applicable law
33. and speed control gt gt Er Figure 18 1 NI myRIO Mechatronics Kit H bridge and geared motor Learning Objectives After completing the activities in this chapter you will be able to 1 Describe the H bridge principle of operation 2 Explain how to control the motor speed and direction of rotation 3 Sketch the quadrature encoded output wave forms of the shaft position sensor for clockwise and counterclockwise rotation 4 Understand how to protect the MOSFET transistors from momentary short circuit current when changing the motor direction 5 Apply the LabVIEW PWM Express VI to control the motor speed and 6 Apply the LabVIEW Encoder Express VI to measure the motor shaft position and speed 18 1 Component Demonstration Follow these steps to demonstrate correct operation of the H bridge and geared motor Select these parts from the NI myRIO Mechatronics Kit e H bridge PmodHB5 e Geared motor e Small screwdriver e Jumper wires F F 6x e Jumper wires M F 2x 76 Build the interface circuit Refer to the schematic di agram shown in Figure 18 2 on the next page the H bridge and geared motor requires six connections to NI myRIO MXP Connector A and two connections to MXP Connector B see Figure A 1 on page 227 J2 VM B 5V pin 1 J2 GND B GND pin 6 J1 VCC A 3 3V pin 33 JLGND A GND pin 30 J1 EN enable A PWMO pin 27 JLSA sensor A A ENCA pin
34. and the X and Y axes indicate zero The board is now normal to the Earth s magnetic field direction i e the Z axis is in parallel with the Earth s magnetic field lines The compass sensor yields a positive Z value when the field direction is out of the component side of the board therefore you will see a negative value if you are located in the northern hemisphere and a positive value if you are in the southern hemisphere The angle of the board indicates the magnetic field inclination angle which is 90 degrees at the north and south magnetic poles and a more acute smaller angle elsewhere Try holding the board near a magnet How does the magnet s field strength compare to that of the Earth s field If you like you can change the sen sitivity range to prevent the values from saturating Stop the VI open the block diagram press Ctrl E set all three gain configuration bits of Configuration Register B to one Boolean true go back to the front panel Ctrl E again and re run the VI Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that you are using Connector A and that you have the correct pin connections e Correct PmodCMPS connector te
35. and the range in centimeters to a reflective target Use a meter stick or yard stick to measure the distance from the back side of the sensor to a reflective target placed somewhere between 0 cm and 80 cm Compare the measured range to the known range how well do these values match Record the sensor voltage Vo when the target is placed at a known range R of between 10 cm and 40 cm calculate the calibration scale factor Kae R x Vo and then enter this value into the Kscale cm V front panel control Repeat your earlier range measurements do you observe improved measurement accuracy Try moving the target to ranges closer than 10 cm You should observe that the measured range begins to increase even though the target is obviously very close to the sensor You can mitigate this non ideal behavior by ensuring that the sensor is mounted at least 10 cm from the nearest target With a robot platform for example mount the sensor towards the interior of the platform rather than at the edge Use a smartphone camera or webcam to view the IR range sensor Infrared light appears blue on such a digital image sensor Which side of the sensor is the IR emitter Click the Stop button or press the escape key to stop the VI and to reset NI myRIO a myRIO reset causes all of the digital I O pins to revert to input mode Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI my
36. by double clicking e Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start 9 PHOTOCELL automatically Expected results The demo VI displays the measured resistance of your photocell expect to see a values in the range 1 KQ to 10 kQ at moderate illumination Try blocking the light with a cover or cylindrical shroud such as a black straw You should observe the resistance going up How high can you make the resistance Use a flashlight or bright LED as illumination you should observe the resistance going down How low can you make the resistance Click the Stop button or press the escape key to stop the VI and to reset NI myRIO a myRIO reset causes all of the digital I O pins to revert to input mode Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode and e Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections 9 2 Interface Theory Interface circuit Constructing a voltag
37. by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI includes three main indicators 1 tag detected lights anytime a valid RFID tag is within range of the RFID reader 2 RFID tag bytes displays the sixteen bytes transmitted by the RFID reader corresponding to a valid RFID tag and 3 data string extracts the data section of the message and displays it as a hexadecimal numerical value Hold one RFID tag card Figure 38 4 on page 180 near the RFID reader and you should see the tag detected indicator light when you hold the card sufficiently nearby The data string indicator should show a five digit hexadecimal number contains digits 0 to 9 and A to F and the RFID tag bytes indicator should a sequence beginning with 0x02 ASCII start of text character and end with 0x03 ASCII end of text character Try the other RFID tag card and confirm that you see a different value for the data string Also exper iment with the minimum required distance for the 38 RFID READER 179 VDD B 3 3V 33 B UART RX 10 E Beeper LED 10 ID 12LA B DIOO 11 Tag in Range 6 Leave remaining pins unconnected B GND 30 TE O SLATE TIRI a N N Te ng
38. collect measurements every 10 seconds and to collect 360 measurements one hour s worth of data Insert the USB flash drive in the NI myRIO USB port and then start the application The onboard LEDO will flash each time the sensors are polled and a data record is appended to the log file Press the NI myRIO onboard button to quit the data logging session early An error condition such as absence of the flash drive or problems communicating with the temperature sensor will cause all four onboard LEDs to light Once you have created a data log file reconnect the USB flash drive and then run the Read log file desktop application included in the project to plot the collected data It is important to note that LabVIEW data logging VIs allow you to read the measurements of all of your sensors exactly as they were recorded i e the data types are exactly the same This way you do not need to make decisions about how to format numerical values to text files and possibly lose available resolution You can easily adjust the system time of your NI myRIO With myRIO attached via USB point your web browser to 172 22 11 2 and select the Time Configuration tab NOTE NI myRIO does not include battery back up for the system clock therefore the sys tem clock suspends operation when power is removed Study the data logger application VI and then adapt it to your own needs with other available sensors consider using an LCD display to ser
39. correct pin connections Correct PmodGYRO connector terminals double check your connections and ensure that you have connected the NI myRIO I C bus SDA line to the PmoDACL SDA terminal on connector J2 and the SCL line to the SCL terminal also check that you have not accidentally crossed the power supply connections and Correct PmodGYRO interrupt terminals to the NI myRIO DIO lines the front panel only updates in response to the data ready interrupt NOTE Double check the SDA and SCL connections should you see the message Error 36011 occurred at myRIO Write 12C vi or similar this message indicates that NI myRIO did not receiving an expected acknowledgement from the PmodGYRO F C bus interface 22 2 Interface Theory Interface circuit The STMicroelectronics L3G4200D triple axis gyroscope at the heart of the the PmodGYRO supports the I C bus serial interface commonly denoted I2C the L3G4200D also supports the SPI serial interface however this chapter concentrates exclusively on the I C bus interface The L3G4200D includes two interrupt outputs designated INT1 and INT2 These pins provide access to various interrupt sources which may be enabled as needed Twenty six addressable registers provide access to the three angular rate measured values as well as a wide variety of configuration options 22 GYROSCOPE Study the video Gyroscope Interfacing The
40. current characteristic and 3 Recognize that blue LEDs may be direct connected to the NI myRIO DIO without 3 Seven Segment LED Display current limiting resistors 3 1 Component Demonstration Follow these steps to demonstrate correct operation of the seven segment LED component Select these parts e Seven segment LED display com datasheets Components LED YSD 160AB3C 8 pdf e Breadboard e Jumper wires M F 9x Build the interface circuit Refer to the pin diagram and recommended breadboard layout shown in Figure 3 2 on page 11 TIP Use the resistor color code for the DIO wire colors e g black 0 for B DIOO brown 1 for B DIOT and so on The interface circuit requires nine connections to NI myRIO MXP Connector B see Figure A 1 on page 227 Common anode CA B 3 3V pin 33 Segment a B DIOO pin 11 Segment b B DIO1 pin 13 Segment c gt B DIO2 pin 15 Segment d B DIO3 pin 17 Segment e B DIO4 pin 19 DOTA DNA 10 7 Segment f B DIOS pin 21 8 Segment g B DIO6 pin 23 9 Decimal point B DIO7 pin 25 Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project Seven Segment LED demo lvproj contained in the subfolder Seven Segment LED demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI my
41. demo VI will generate an error message 35 USB FLASH DRIVE if the USB flash drive is missing 35 2 Interface Theory NI myRIO file system The NI myRIO RT real time target runs the NI Linux Real Time OS operating system which manages the onboard solid state hard disk drive HDD with 387 MB capacity as well as the USB flash drive Inserting a USB flash drive automatically mounts the drive as the folder u Most of the folders on the HDD are read only however three folders provide read write access home lvuser home webserv and tmp this folder is automatically cleared after a reset Access to the file system includes web browser mapped network drive and interactive command line prompts with secure shell SSH A LabVIEW program can also directly read and write files as well as perform a wide variety of file management tasks Study the video youtu be BuREWnD6Eno 12 55 to learn about the NI myRIO file system including accessing and downloading files from the onboard hard disk drive HDD with a web browser mapping the onboard HDD as a network drive in Windows programmatically creating text files and spreadsheet files with LabVIEW and interactively navigating the NI myRIO file system through a secure shell SSH connection with the PuTTY SSH client 35 3 Basic Modifications Study the video USB Flash Drive Demo Walk youtu be Y1QukBt11WI 8 22 to learn the design principles of USB Flash Drive demo and then try
42. divider and analog input and 3 Size the voltage divider resistor for the best measurement sensitivity and range 9 1 Component Demonstration Follow these steps to demonstrate correct operation of the photocell Select these parts from the NI myRIO Starter Kit e Photocell API PDV P9203 pat e Resistor 10 kQ e Breadboard e Jumper wires M F 3x Build the interface circuit Refer to the schematic di agram and recommended breadboard layout shown in Figure 9 2 on the following page The interface circuit requires three connections to NI myRIO MXP Connector B see Figure A 1 on page 227 1 5 volt power supply B 5V pin 1 2 Ground B GND pin 6 3 Photocell measurement B AIO pin 3 Measure the resistance of the 10 k 2 resistor with an ohmmeter as this value is required for the LabVIEW VI 36 VDD B 5V 1 B AIO 3 ne ee rt 24 33 mu 9 PHOTOCELL Pa IAA TT IO LL ELL I DEL GOCE ANDA pese ed Dr oa ead y i 1 33 1 Figure 9 2 Demonstration circuit for photocell schematic diagram recommended breadboard layout and connection to NI myRIO MXP Connector B Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project Photocell demo lvproj contained in the subfolder Photocell demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi
43. higher current because effective resistance of the motor is less than 1 2 For these reasons the IRF510 n channel enhancement power MOSFET serves as a high current solid state switch to operate the motor Because the IRF510 gate to source threshold voltage Vasan ranges from 2 to 4 V the NI myRIO DIO output voltage of 3 3 V is not sufficient to turn on the IRF510 The two low power MOSFETS arranged as a standard CMOS logic inverter supplied by the 5 V supply act as a 3 3 to 5 V level shifter to ensure that the IRF510 gate voltage is either 0 V off or 5 V on Study the video youtu be C_22XZaL5TM 6 49 to learn more about the motor principles of operation and interface circuit design principles including sizing the power transistor for motor current under various load conditions importance of the rectifier to deal with back emf voltage spiking level shifting 12 MOTOR 49 B 5V 1 B 3 3V 33 VDD5 VDD3 S Q1 ZVP2110 D1 1N4001 M MOTOR G B DIO8 B PWMO 27 Note Same pinout fo 2VN 2VP tram sisters IRF SID Figure 12 2 Demonstration circuit for DC motor schematic diagram recommended breadboard layout and connection to NI myRIO MXP Connector B 50 12 MOTOR circuit for 3 3 to 5 V and required modification to 2 Insert additional code to deal with the fact that the connect the interface to the MSP connector with integral pull down resistors LabVIEW programming Study the vi
44. hole how does this affect the sound at different frequencies Click the Stop button or press the escape key to stop the VI and to reset NI myRIO a myRIO reset 11 BUZZER SPEAKER causes all of the digital I O pins to revert to input mode Troubleshooting tips Not hearing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct transistor orientation the transistor has a rounded shape on one side and e Correct diode orientation when the diode is backwards the buzzer speaker coil will never reach the voltage level necessary to turn on 11 2 Interface Theory Interface circuit The buzzer speaker contains an electromagnetic coil that vibrates a small diaphragm The coil current is approximately 80 mA well beyond the current drive limits of the NI myRIO digital output The interface circuit uses an NPN transistor as a switch to turn the coil current on and off and a diode to protect the transistor from large back emf voltage when the transistor abruptly shuts off the coil current Study the video Buzzer speaker Characteristics youtu be 8IbIWH9MpVO 5 14 to learn more about the buzzer speaker characteristics and interface circuit design principles including sizing the transistor for relay coil current importance of the diode to deal with back emf voltage spiking and circuit topologies for
45. in a staggered fashion as the knob turns The knob angle and rotation direction can be sensed with suitable decoding of the switching waveforms Figure 13 1 pictures the NI myRIO Starter Kit rotary encoder Figure 13 1 NI myRIO Starter Kit rotary encoder Learning Objectives After completing the activities in this chapter you will be able to 1 Discuss essential concepts related to rotary encoders a Quadrature waveforms A and B b NI myRIO built in encoder inputs and associated LabVIEW VI Encoder to indicate counts position and direction c Switch bounce that requires debouncing circuitry for reliable operation and 2 Connect the rotary encoder common terminal to work with digital inputs that include either internal pull up or pull down resistors 13 1 Component Demonstration Follow these steps to demonstrate correct operation of the rotary encoder Select these parts from the NI myRIO Starter Kit e Rotary encoder e Resistor 10 kQ 2x e 0 01 uF ceramic disk capacitor marking 103 2 x http www avx com docs Catalogs e Breadboard e Jumper wires M F 5x Build the interface circuit Refer to the schematic diagram and recommended breadboard layout shown in Figure 13 2 on page 53 52 TIP Flatten the two tabs on either side of the rotary encoder so that tt sits flush on the breadboard surface The rotary encoder interface circuit requires three connections to the NI my
46. increase indefinitely You can estimate the zero rate level as follows reset the integrator allow a relatively long time to elapse e g one minute 60 seconds stop the VI and then divide the measured displacement by 60 seconds Compare this value to the typical value you see for the rate indicator Note that you can adjust the limits of the angular rate plot by double clicking the upper and lower values on the amplitude axis Select a narrower range to better appreciate the output characteristics of the gyroscope including the zero rate level offset and high frequency noise level LEDO on the NI myRIO displays the Z axis HIGH limit threshold interrupt generated by the gyroscope Try a quick rotation about the Z axis to activate this LED Click the Stop button or press the escape key to stop the VI and to reset NI myRIO 22 GYROSCOPE 97 VDD A 3 3V 33 A I2C SDA 34 AII2C SCL 32 y PmodGYRO A DIOO 11 a A DIO1 13 i Tee ur EII A NDERT rt ne pro i i i o i Eie f 1 i A A 33 1 Figure 22 2 Demonstration setup for gyroscope connected to NI myRIO MXP Connector A 98 Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode Correct MXP connector terminals ensure that you are using Connector A and that you have the
47. jumpers as shown for UART serial communications 26 LCD CHARACTER DISPLAY UART INTERFACE Run the demonstration VI e Download http www ni com academic myrio iF you have not done so previously and unpack the contents to a convenient location e Open the project LCD UART demo lvproj contained in the subfolder LCD UART demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking e Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the state of the NI myRIO on board 3 axis accelerometer as three values X Y and Z directions and the state of the built in pushbutton on the bottom side of myRIO press the button to see the state change from 0 to 1 Change the orientation of myRIO to see the accelerometer values change and shake myRIO to see larger acceleration values You may wish to hold or tape the LCD character display to the top of myRIO too Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected resul
48. litswKgOmZA 1 53 16 4 3 Basic Modifications Study the video Pushbutton Demo Walk Through youtu be Xm1A4Cw2POU 3 16 to learn the design principles of Pushbutton demo and then try making these modifications to the block diagram of Main vi 1 Add the onboard LED Express VI myRIO Onboard subpalette as an indicator on the output of the edge detector the AND gate Confirm that the LED flashes briefly when you press the pushbutton 2 Experiment with different values of loop speed by adjusting the value of Wait ms you may find it more convenient to change the constant to a front panel control At what value does the VI introduce noticeable delay responding to the pushbutton press 3 Adjust the presses counter behavior to count pushbutton releases instead of presses 4 Adjust the presses counter behavior to count both pushbutton presses and releases HINT Try a single exclusive OR gate from the Programming Boolean subpalette 5 Modify the loop termination condition so that the VI runs only while the pushbutton is pressed NOTE The SPDT single pole single throw slide switch included with the NI myRIO Starter Kit see Figure 4 3 can connect to myRIO in the same way as the pushbutton switch Simply use the middle terminal and either end terminal in place of the push button terminals Use the slide switch anytime you need to maintain the DIO at a specific level for exam ple as a mode setting for your NI myRI
49. making these modifications to the block diagram of Main vi 1 Enable the accelerometer Y axis and X axis outputs and log these to the CSV spreadsheet file as two additional columns Read the spreadsheet 35 USB FLASH DRIVE file on a PC and confirm that the plotted data looks correct 2 Add a feature to create a text file that contains the time and date at which the logfile was created Use the Get Time Date VIs in the Programming Timing subpalette to create the character string 35 4 Integrated Project Ideas Now that you know how to use the USB flash drive consider integrating it with other devices to create a complete system for example Data Logger 41 2 EEPROM Programme 35 5 For More information e Using WebDAV to Transfer Files to Your Real Time Target by National Instruments Explains how to map the myRIO file system to a Windows drive JEBE45E8AS16B1938625786C0071D025 e Working with File Paths on Real Time Targets by National Instruments Best practices for specifying folder and file names file paths ttp www ni com tutorial 14669 en e What File Systems Can be Used With the NI Linux Real Time OS by National Instruments Recommended formatting of USB flash drives http digital ni com public nsf allkb 4819E4118F382D4586257C1A00592CF3 gt 167 168 35 USB FLASH DRIVE 36 Webcam NI myRIO includes support for USB webcams 4 Set a webcam attribute such as saturation and Figu
50. myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results Click the DIO state button to set the digital output to its low state and your motor should spin at high speed then click the button again to stop the motor Note that the motor driver interface circuit is active low Click the Stop button or press the escape key to stop the VI and to reset NI myRIO a myRIO reset causes all of the digital I O pins to revert to input mode 12 MOTOR Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct transistor orientation carefully follow the pin diagrams for each transistor especially note that the IRF510 has the gate pin on the side rather than in the middle as do the lower power MOSFETS and Correct rectifier orientation when the rectifier is backwards the motor will never reach the voltage level necessary to turn on 12 2 Interface Theory Interface circuit The motor requires approximately 180 mA at 3 3 V when unloaded and over 1000 mA when ruming at maximum efficiency three times higher than the maximum available current from all three NI myRIO connectors combined Stalling the motor due to excessive loading or blocking the rotor demands even
51. poo Ed i i I o PA siti AMB A AAN AA MR A A aa eae PE tanto ee On Figure 14 2 Demonstration circuit for photointerrupter schematic diagram recommended breadboard layout and connection to NI myRIO MXP Comnector B 14 PHOTOINTERRUPTER Run the demonstration VI e Download http www ni com academic myrio iF you have not done so previously and unpack the contents to a convenient location e Open the project Photointerrupter demo lvproj contained in the subfolder Photointerrupter demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking e Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the state of the photointerrupter output and an event count The state should normally be high Block the photointerrupter optical path with an opaque card your finger tip and a sheet of paper How much opacity does the photointerrupter require to trigger the event counter Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing th
52. programming Study the video SPI Express youtu be S7KkTeMfmc8 5 51 to learn how to use the SPI Express VI to read and write character strings including strings with special characters the video UART Express VI youtu be 0FMnkFDsGQs 5 29 provides additional useful string formatting techniques 27 3 Basic Modifications Study the video LCD SPI Demo Walk Through youtu be o0XYryu4Y c 4 23 to learn the design principles of LCD SPI demo and then try making these modifications to the block diagram of Main vi 1 Interchange the two display rows when the NI myRIO on board button is pressed revert to the original display when the button is released 2 Display the full character set Cycle through all possible 256 8 bit patterns and see if you can spot the ASCII code for the degrees symbol 3 Create an instruction tester Make two string controls one for the instruction and a second for the display use Boolean controls to disable sending either one 4 Experiment with the serial clock frequency what is the highest possible frequency that still provides reliable communication with the LCD What is the lowest frequency that still updates the LCD display without introducing noticeable lag Remember to change the speed of both SPI Express VIs NOTE You must power cycle the LCD display each time you change the serial clock frequency because while the display automatically adapts to the SPI clock frequency it does
53. range exceeds 80 cm 5 Add an enhanced proximity detection feature one of three onboard LEDs to indicate in range too close or too far 19 4 Integrated Project Ideas Now that you know how to use the rangefinderIR consider integrating it with other devices to create a complete system for example Data Loggen Steer By Wire 3 5 19 5 For More Information e IR Range Sensor Reference Manual by Digilent Reference manual for the IR range finder http ww digilentinc com Data Products ITR RANGE SENSOR IR 20Range 20Sensor 20rm pdf GP2Y0A21YKOF Datasheet by SHARP Micro electronics Datasheet for the GP2YOA21YKOF Distance Measuring Sensor Unit http sharp world com products device lineup data pdf datasheet gp2yla2lyk_e pdf 19 IRRANGE FINDER 20 sonic Range Finder A sonic range finder measures the round trip time of flight of short pulses of sound just beyond human hearing 42 kHz reflected back echoed from a target Multiplying the time of flight by the speed of sound in air yields the distance range to the target Applications of a sonic range finder include noncontact distance measurement object detection proximity sensing and robotic world mapping Figure 20 1 pictures the sonic range finder included with the NI Mechatronics Kit Figure 20 1 NI myRIO Mechatronics Kit sonic range finder Learning Objectives After completing the activities in this cha
54. resistor Now counter the effect of the internal pull down with a 4 7 kQ external pull up resistor connected between the motor control line and the 5 volt supply The motor should now remain off when the NI myRIO first powers on or after executing a myRIO reset 12 4 Integrated Project Ideas Now that you know how to use the DC motor consider integrating it with other devices to create a complete system for example e On Off Control System Scale and then Mapping and choose Log 12 5 For More Information arithmic Also double click the upper limit of your frequency control and enter 40000 and then similarly set the lower limit to 40 Experiment with both the duty cycle and frequency What frequency minimizes audible PWM noise and maximizes your ability to create very slow motor speeds What do you notice about restarting the motor after it stops If you have a DMM ammeter handy you may wish to observe the motor current under various conditions including mechanical loading free running and start up e Brushed DC Motor Fundamentals by Microchip Learn about DC motor principles of operation drive circuits direction control with an H bridge and speed control with Hall effect sensors as feedback http wwl microchip com downloads en AppNotes 00905B par 1 3 Rotary Encoder A rotary encoder also known as a quadrature encoder combines a rotary knob and two switches that open and close
55. rotation servo with similar appearance Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project Servo demo lvproj contained in the subfolder Servo demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI includes a pointer slide control to adjust the servo angle Move the slider and confirm that the servo shaft turns in response You may also use the Page Up and Page Down keys to move the slider Which slider values positive or negative correspond to clockwise motion 17 SERVO The servo includes a parts kit that includes a variety of servo arms also known as servo horns see Figure 17 3 on page 72 Attach the two arm servo horn to the servo spline the gear shaped rotating shaft of the servo so that you can more easily see the servo rotation angles The slider is calibrated in percent full scale FS Estimate the servo ang
56. so only one time 27 4 Integrated Project Ideas Now that you know how to use the LCD character display consider integrating it with other devices to create a complete system for example 27 5 For More Information PmodCLS Reference Manual by Digilent Reference manual for the LCD character display PmodCLs Schematics by Digilent Schematic diagram of the LCD character display M68HC11 Reference Manual by Freescale Semiconductor Refer to Section 8 for a complete treatment of the SPI serial bus standard including timing diagrams and multi master systems 28 LCD Character Display 1 C bus Interface An LCD character display provides an excellent means for your LabVIEW block diagram code to display measurements status and conditions with ASCII character strings The LCD character display also provides visual feedback for a user interface Figure pictures the NI myRIO Embedded Systems Kit LCD character display which supports three different serial communications standards This chapter focuses on the I C bus interface to the display while the previous two chapters cover the UART and SPI interfaces Figure 28 1 NI myRIO Embedded Systems Kit LCD character display Learning Objectives After completing the activities in this chapter you will be able to 1 Configure the display for I C bus serial communications 2 Send characters directly to appear on display and 3 Send escape sequences to adjust the display mod
57. the beam width at several different ranges Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that you are using Connector A and that you have the correct pin connections and e Correct MB1010 connector terminals double check your connections and ensure that you have connected the NI myRIO UART RX line to the MB1010 TX terminal also check that you have not accidentally crossed the power supply connections and NOTE Double check the RX and TX connections again should you see the message Timeout expired before operation completed or similar this message indicates that NI myRIO did not recetve the expected characters from the MB1010 TX output 20 2 Interface Theory Interface circuit The transducer of the MaxBotix MB1010 sonic range finder also known as the LV MaxSonar EZ1 generates short pulses of sound that 20 SONIC RANGE FINDER VDD A 3 3V 33 A UART RX 10 E MaxBotix MB1010 Digilent Pmod pinout k erat a A a and an a aE n Eanes deren E a a N a T A a RIP eene AIDA ere x r oh gt o a i r i x 33 ge r 1 177 3 Figure 20 2 Demonstration setup for sonic range
58. the counter clockwise direction and you should see a similar sequence but with switch B closing first The demo VI also maintains a counter of A B switch transitions and should increment by four counts for each click of the encoder in the clockwise direction and decrement by four counts for each click in the counter clockwise direction A front panel indicator also displays the counter direction Click the Reset Counter control to clear the counter to zero click again to continue counting Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode and e Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections 13 2 Interface Theory Interface circuit The rotary encoder translates shaft rotation into a pair of switch opening closing patterns known as quadrature encoding The pair of switches called A and B connect directly to one of four NI myRIO encoder inputs shared with the standard digital input output DIO terminals The Encoder Express VI decodes the switching patterns to produce a count value as well as the counter direction These outputs indicate the relative position of the rotary encoder shaft since the last time the counter was initia
59. the state of the keypad buttons as a 4x4 grid and as a 1 D Boolean array of scan results Iry a variety of single key combinations and confirm that only one LED indicator is active Also confirm that the position of the keypad button indicator exactly matches the position of the button you press Next try several two key combinations Do they all work properly Experiment with multi key combinations involv ing three or more keys You should find that some work as expected i e the front panel indicator properly corresponds to the actual keys pressed while other combinations produce an incorrect display Try to identify a pattern that explains when 25 KEYPAD a given multi key combination will or will not lead to an incorrect display Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections and e Correct keypad connector terminals double check your connections and ensure that you have not accidentally interchanged the row and column lines 25 2 Interface Theory Interface circuit Ihe keypad contains sixteen single pole single throw SPST pushbuttons arranged in 4x4 gr
60. then click the Save button Click Open to open the connection to the COM port Observe that the PmodBT2 green status LED 31 BLUETOOTH MODULE 143 VDD B 3 3V 33 J1 6 VCC3V3 J1 2 RX B UART TX 14 J1 3 TX B UART RX 10 y B DIO2 15 J1 4 CTS 15 J1 1 RTS aa 13 J1 7 STATUS iad 11 J1 8 RESET zn 17 J1 5 GND B GND 30 ek De AAA limitilic at tia E isa al ET Be See een eee yey i f Va es gt P a ar E a Ps i f 7 a 3 ie j d 5 f i Pi e z z A a A n e s d ADO RN 42 MIAE wirst rer BR CW 1m ana ne we RoHs FE CE Figure 31 2 Demonstration setup for Bluetooth module connected to NI myRIO MXP Connector B 144 goes dark and you should also expect to see the STATUS front panel indicator active these two indications show that the RN42 has established a data connection with another Bluetooth device Type characters into the PuTTY terminal emulator window and expect to see those same characters appear on the VI front panel Type t and d and confirm that you see the NI myRIO system time and date Click enable echo and type some more characters you should now see the characters as you type them in the PuTTY terminal emulator window Click the CTS Clear To Send button and type several characters When CTS is active the RN42 suspends transmitting from its UART and you should observe that no charact
61. to quickly create an application Study the video youtu be lizzs9rBmYA 7 50 to learn the basics of acquiring and processing a single image and then continue with Webcam Interfacing Theory Video Stream en E be L7tMeKsha38 10 59 to learn how to process a video stream in real ime Study Webcam Interfacing Theory Se Video Mode Mode youtu be IxsioDcCuwA 5 13 to learn how to adjust the video mode resolution and frame rate and then study Set Attribute youtu be wcM6X XOT61 4 49 to 36 WEBCAM learn how to adjust webcam attributes such as color saturation brightness and exposure 36 3 Basic Modifications Study three videos Webcam Demo Walk Through Single Image youtu be Fup ro7qwWxk 4 53 Webcam Demo Walk Through Video Stream Demo Walk Through Camera Information youtu be Pta6_REo41c 3 17 to learn the design principles of Webcam demo and then try making these modifications to the block diagram of Main video stream vl 1 Add additional processing functions by extend ing the enumerated front panel control and then adding new subdiagrams to the case structure The Vision and Motion VIs contain a rich set of processing functions for you to try 36 4 Integrated Project Ideas Now that you know how to use the webcam consider integrating it with other devices to create a complete system for example Data Logger al Steer By Wire t3 E 50 62 36 5 For M
62. when you power up the myRIO no USB cable required Study the tutorial Deploy a Stand Alone Application youtu be JXoJECRS eo 8 29 to learn the step by step procedure to create a build for the real time RI target deploy the build as the startup application and how to disable the startup application if necessary 230 APPENDIX B BUILD A STAND ALONE APPLICATION Every attempt has been made to ensure that the components shown in Chapters 1 through 35 match the components found in the NI myRIO component kits to which they are referenced Occasionally components may vary slightly Where these variations occur details about changes and links to updated data sheets can be found here http www ni com white paper 52319 en C NI myRIO Starter Kit Data Sheets Switches SPDT switch DIP switch Rotary DIP switch Rotary encoder Pushbutton switch integrated with rotary encoder TW 700198 pdf Sensors 0 Potentiometer 10 ko http www supertech com tw electronic resistors potentiometers PDF rotary3 23 RO904N pdf e US1881 Hall effect latch http www melexis com Hall Effect Sensor ICs Hall Effect Latches AD22151G linear output magnetic field sensor Piezo film sensor DT series http meas spec com product t_product aspx id 2478 Photointerrupter http sharpmicroelectronics com download gpla57hr epdf Chenyun CY 502 computer microphone Thermistor 10 kQ EPCOS B57164K103J http www epcos com inf 50 db ntc_09 Le
63. with an analog input 3 gt 1 Component Demonstration Follow these steps to demonstrate correct operation of the microphone Select these parts from the NI myRIO Starter Kit e ADMP504 ultra low noise ttp www analog com ADMP504 e OP37 low noise precision high speed op amp ttp www analog com OP37 AD8541 rail to rail single supply op amp ttp www analog com AD8541 e 0 1 uF ceramic disk capacitor marking 104 ttp www avx com docs Catalogs class3 sc pdf e 10 uF electrolytic capacitor industrial panasonic com www data pdf e Resistor 10 kQ 3x e Resistor 100 kQ e Breadboard O O microphone O DI gt gt Jumper wires M F 5x 3 5 mm stereo audio cable provided with NImyRIO 158 e Test clips 2x Build the interface circuit Refer to the schematic diagram and recommended breadboard layout shown in Figure The interface circuit requires four connections to NI myRIO Connectors B and C see Figures A 1 on page 27 ona A2 on page 22 15 volt power supply en 5V pin 1 15 volt power supply C 15V pin 2 3 3 volt power supply B 3 3V pin 33 Ground C AGND pin 3 5 Mic output AUDIO IN Connect the 3 5 mm stereo audio cable to the AUDIO IN Use test clips to connect the other plug tip left channel to the mic output and the plug sleeve to ground refer to Figure 34 2 Alternatively you may build the interface circuit designed for direct connec
64. 2bGU9EHU 12 56 youtu be 5JDkwG2rr1o 13 48 youtu be T9GP_cnz7rQ 9 48 youtu be W526ekpR8q4 11 26 youtu be ulFVfEvSdkg 4 59 youtu be oj2 CYSnyo0 13 10 youtu be m0Td7Kbhval 10 36 youtu be vsB jZBLdeNc 9 51 youtu be 9 R1IGPVgFWO 6 55 youtu be JW 19uXrWNU 15 06 youtu be 991p37yUnuY 636 youtu be C_22XZaL5TM 6 49 youtu be geNeoFU3M5O 4 45 youtu be dHaPUJ7n UI 5 13 youtu be 3gwwF 9rF_zU 7 51 youtu be e7UcL5Ycpho 4 24 youtu be Xwr j 2WT3k 9 59 youtu be UcpmrcJR_D8 9 26 234 APPENDIX D VIDEO TUTORIAL LINKS youtu be jLFL9_EWlwI 11 11 youtu be zlv0vCue83c 11 29 youtu be DOu5AvSDP2E 7 18 youtu be POEROVXv Sw 4 11 youtu be 8IbIWH9MpVO 5 14 youtu be GYBmRJ_gMrE 4 42 youtu be HwzTgYp5nF0 10 03 youtu be US406s jBUxY 4 54 youtu be PhZ201Crwuo 6 10 Tutorials youtu be 9KUVD7RKxNI 9 44 youtu be TqLXJroefTA 9 22 youtu be GYBmRJ_gMrE 4 42 youtu be odN66E85J5E 7 56 youtu be GaXtDamw5As 7 02 youtu be 7CgNF78pYOM 8 47 youtu be JXoJECRS eo 8 29 LabVIEW Techniques for myRIO youtu be N6Mi VjBlmc 2 00 youtu be litswKgOmZA 1 53 youtu be 4nzr7THqu8u 4 09 youtu be Y8mKdsMAgru 2 21 youtu be WvnInG3ffgY 4 53 youtu be mVN9jfwXleI 2 41 youtu be uJWICaL6L5c 1 54 youtu be S7KkTeMfmc8 5 51 youtu be OFMnkFDsGQs 5 29 LabVIEW Demo Project Walk
65. 4 Make front panel controls for the temperature limit setpoint and hysteresis values in degrees Celsius and then move the associated 12C Express VIs inside the while loop so that these values can adjusted while the VI is running Con firm that the alert indicator behaves as expected when you adjust these two temperature related controls What happens when the hysteresis value is higher than the limit setpoint value 5 Add a waveform chart indicator for measured temperature and then change the while loop time interval to a much larger value such as one minute Plot the long term temperature profile over a 24 hour period 6 Repeat the previous step and modify the block diagram code so that the temperature sensor operates in shutdown mode and performs a one shot measurement on demand Remember to wait for the necessary conversion time before reading the temperature register 30 ms for 9 bit resolution and double the time for each additional bit up to 240 ms for 12 bit resolution 7 Add a minimum and maximum recorded temperature display with reset buttons 33 4 Integrated Project Ideas Now that you know how to use the temperature sensor consider integrating it with other devices to create a complete system for example e Weather Station 57 33 TEMPERATURE SENSOR 33 5 For More Information PmodTMP3 Reference Manual by Digilent Reference manual for the temperature sensor ttp digilentinc com Data Products PMOD TMP3
66. 5 triple axis digital accelerometer with I C bus serial communications The ADXL345 provides a high degree of flexibility and includes on chip event detection including single tap and double tap activity and free fall Figure 21 1 NI myRIO Mechatronics Kit accelerom eter Learning Objectives After completing the activities in this chapter you will be able to 1 Configure the accelerometer for data rate resolution and range 2 Set up single tap detection and interrupt output pins and 3 Read and display acceleration values 21 1 Component Demonstration Follow these steps to demonstrate correct operation of the accelerometer Select these parts from the NI myRIO Mechatronics Kit e Accelerometer PmodACL com Data Products PMOD ACL PmodACL_rm pdf e Jumper wires F F 6x Build the interface circuit Refer to the schematic dia gram shown in Figure 21 2 on the following page the accelerometer requires six connections to NI myRIO MXP Connector A see Figure A 1 on page 227 3 3 volt supply A 3 3V pin 33 Ground A GND pin 30 Serial data SDA A 2C SDA pin 34 Serial clock SCL A 2C SCL pin 32 Interrupt 1 A DIOO pin 11 Interrupt 2 A DIOO pin 13 AJIA WN 90 21 ACCELEROMETER VDD A 3 3V 33 A 12C SDA 34 ial A I2C SCL 32 E PmodACL A DIOO 11 E A DIO1 13 Laa Figure 21 2 Demonstration setup for accelerometer connected to N
67. B see Figure page 227 1 VCC B 3 3V pin 33 2 GND gt B GND pin 30 3 SCL B SPI CLK pin 21 4 SDA gt B SPI MISO pin 23 5 CS B DIOO pin 11 Run the demonstration VI e Download http www ni com academic myrio iF you have not done 108 24 AMBIENT LIGHT SENSOR VDD B 3 3V 33 JINCC 6 J1 CS 1 7 B DIOO 11 PmodALS J1 SDA 3 7 B SPI MISO 23 J1 SCL 4 J B SPI CLK 21 J1 GND 5 B GND 30 Figure 24 2 Demonstration setup for ambient light sensor connected to NI myRIO MXP Connector B 24 AMBIENT LIGHT SENSOR so previously and unpack the contents to a convenient location e Open the project Ambient Light Sensor demo lvproj contained in the subfolder Ambient Light Sensor demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking e Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the ambient light sensor 8 bit value as a dial gauge Cover the light sensor the component immediately above the PmodALS logo and you shoul
68. Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections and e Correct orientation of the US1881 as you face the labeled side of the sensor you have Vpp on the left ground in the middle and the output on the right 15 2 Interface Theory Interface circuit The Hall effect relies on the fact that electrons moving across magnetic field lines expe rience a force A current source establishes a current in a small semiconductor known as a Hall plate and when subjected to a magnetic field the electrons tend to deflect to one side of the plate leaving behind positive charges on the other side of the plate The complete Hall effect sensor on the US1881 senses the charge displacement as a voltage applies amplifi cation and other signal conditioning operations and indicates the sensed magnetic pole type as the state of an open drain output suitable for digital inputs Study the video Hall Effect Sensor Interfacing youtu be T9GP_cnz7rQ 9 48 to learn more about the Hall effect the various types of Hall effect sensor output behaviors latch switch and linear and interface circuit techniques for both the MXP and MSP connectors LabVIEW programming Study the video Input Low Level VIs youtu be 4nzr7THQU8U 4 09 to learn how to use the low level Digital Input VIs to sense the state of the Hall effect sensor 15 HALL EFFECT SENSOR B rS vin Voo B pi
69. DIOs with internal pull up resistors MXP connector and internal pull down resistors MSP connector LabVIEW programming Study the video Express VI youtu be mVN9jfwXleI 2 41 to learn how to use the PWM Express VI PWM pulse width modulation to create a squarewave output on B PWMO pin 27 in the frequency range 40 Hz to 40 kHz with adjustable pulse width 11 BUZZER SPEAKER 45 VDD B 5V 1 D1 1N3064 Buzzer Speaker Han CE 2N3904 lego Top yee B PWMO 27 B GND 6 CA m os x x n a aaa 5 x aaa z 51 vw una NE eee wf nea uan x n x n x a ua una sss n x a aa un sss n xx mw wf x xa Y CE EAT aa Ee AS an gt i mar le Le MANN ANN aie aes oe PP SRT A I en en peer pes KR brs ro 17717 33 t TS i Pd 33 Figure 11 2 Demonstration circuit for buzzer speaker schematic diagram recommended breadboard layout and connection to NI myRIO MXP Connector B 46 11 3 Basic Modifications Study the video Buzzer speaker Demo Walk youtu be kW4v16GuAFE 2 06 to learn the design principles of Buzzer Speaker demo and then try making these modifications to the block diagram of Main vi 1 Add a front panel control to adjust the waveform pulse width called duty cycle between 0 and 100 How does a narrow pulse low duty cycle affect the tone quality at various frequencies 2 Create a two tone alar
70. DIP 8 A DIO8 pin 17 14 Rotary DIP C common A GND pin 20 LO COON DO OF WN HA Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project DIP Switches demo lvproj contained in the subfolder DIP Switches demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running 5 DIP SWITCHES NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the individual switch states of the two DIP switches An open switch appears as a high state because both MXP connectors A and B include pull up resistors on each DIO With the rotary DIP switch dial at Position 0 all A DIO state indicators should be active turn the dial counter clockwise one click to Position F and all indicator should be dark Try clicking through the re maining positions and observe the binary sequence remembering that the switches appear active low Try each of the eight switches on the DIP switch and confirm that you can individually activate the
71. Embedded Systems Kit e Digital potentiometer PmodDPOT e Jumper wires F F 5x e Jumper wires M F 3x e Small screwdriver Build the interface circuit Refer to the schematic diagram shown in Figure 32 2 on page 149 the digital potentiometer requires five connections to NI myRIO MXP Connector A and three connections to MXP Connector B see Figure A 1 on page 227 1 5 volt supply A 5V pin 1 148 Ground A GND pin 6 SPI receiver gt A SPI MOSI pin 25 SPI clock A SPI CLK pin 21 Chip select A DIOO pin 11 A B 5V pin 1 B gt B GND pin 6 W B AIO pin 3 ONDIN Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project Dpot demo lvproj con tained in the subfolder Dpot demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI provides a front panel slide control to set the virtual w
72. Follow these steps to demonstrate correct operation of the GPS receiver Select these parts GPS receiver PmodGPS com Data Products PMOD GPS PmodGPS_rm pdf e Jumper wires F F 5x Build the interface circuit Refer to the schematic dia gram shown in Figure 37 2 on the following page the GPS receiver requires five connections to NI myRIO MXP Connector A see Figure A 1 on page 227 1 3 3 volt supply VCC3V3 A 3 3V pin 33 2 Ground GND gt A GND pin 30 3 UART transmit data TXD A UART RX pin 10 4 UART receive data RXD A UART TX pin 14 5 One pulse per second 1PPS A DIOO pin 11 174 37 GPS RECEIVER VDD A 3 3V 33 AIUART TX 14 E AIUART RX 10 PmodGPS A DIOO 11 an CTPAORNI Figure 37 2 Demonstration setup for GPS receiver connected to NI myRIO MXP Connector A 37 GPS RECEIVER Run the demonstration VI e Download http www ni com academic myrio if you have not done so previously and unpack the contents to a convenient location e Open the project GPS Receiver demo lvproj contained in the subfolder GPS Receiver demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking e Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project com
73. G22 Geared Motor Datasheet by Sha Yang Ye Datasheet for the motor and planetary gearbox ttp www geared motor com english pdf G 22CM 01802 pdf e Iwo Channel Encoder Datasheet by Sha Yang Ye Datasheet for the two channel quadrature encoder ttp www geared motor com english pdf H Magnetic Encoders pdf 79 80 18 H BRIDGE AND GEARED MOTOR 1 9 IR Range Finder An IR range finder uses a beam of reflected infrared light to sense the distance between the sensor and a reflective target The range to an object is proportional to the reciprocal of the IR range finder s output voltage Applications of an IR range finder include ranging and object detection for robots proximity sensing and touchless switches Figure pictures the IR range finder included with the NI Mechatronics Kit Figure 19 1 NI myRIO Mechatronics Kit rangefind erIR Learning Objectives After completing the activities in this chapter you will be able to 1 Describe the features of the SHARP GP2YOA2TYKOF IR range finder 2 Discuss the principle of operation of IR range finders and 3 Apply calibration techniques using single or multiple measurements 19 1 Component Demonstration Follow these steps to demonstrate correct operation of the photocell Select these parts from the NI myRIO Mechatronics Kit e IR range finder http www digilentinc com Data Products IR RANGE SENSOR IR S20Range 20Sensor 20rm pdf e Jumper wire
74. I myRIO MXP Connector A 21 ACCELEROMETER Run the demonstration VI e Download http www ni com academic myrio if you have not done so previously and unpack the contents to a convenient location e Open the project Accelerometer demo lvproj contained in the subfolder Accelerometer demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking e Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the triple axis accelerometer values in three formats as the six bytes retrieved from the accelerometer DATA registers as three signed integers formed by combining the two bytes retrieved per axis and as a waveform chart You will soon learn how to convert these values to gees The VI also displays the contents of the INTERRUPT_SOURCE register Before running the main loop the VI configures the accelerometer registers for data rate resolution range and single tap detection on the X axis Run the VI and then observe the front panel dis play as you shake the accelerometer Loo
75. IO MXP Connector B see Figure A 1 on page 227 1 5 volt power supply B 5V pin 1 2 Ground B GND pin 6 3 Relay control B DIOO pin 11 Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project Relay demo lvproj contained in the subfolder Relay demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results Your relay should be clicking in synchronism with the front panel indicator DIO state Click the cycle front panel button to disable automatic mode and to enable the manual button click this button to manually set the digital output state either high or low The relay control signal is active low therefore the coil is energized when the DIO is low Click the Stop button or press the escape key to stop the VI and to reset NI myRIO a myRIO reset 6 RELAY causes all of the digital I O pins to revert to input mode Troubleshooting tips Not seeing the e
76. O program 44 For More Information e Mini Push Button Switch by SparkFun A handy switch for circuit boards http www sparkfun com products 97 4 PUSHBUTTON SWITCH Figure 4 3 SPDT single pole single throw switch included with the NI myRIO Starter Kit e Applications by Knitter Switch Learn about the myriad practical applications for switches as well as the wide variety of switch types http www knitter switch com p_ 5 DIP Switches DIP switches bundle multiple SPST switches together into a single component DIP stands for dual in line package the standard IC package style that is breadboard compatible and SPST means single pole single throw the simplest possible switch type Figure 5 1 pictures two popular DIP switch styles a standard DIP switch containing eight SPST switches and a 16 position rotary DIP switch that manipulates the open and closed states of four SPST switches in a binary sequence Figure 5 1 NI myRIO Starter Kit DIP switches DIP switch blue and 16 position rotary DIP switch Learning Objectives After completing the activities in this chapter you will be able to 1 Describe the following concepts related to switches and the NI myRIO interface a DIP switch bundles N SPST switches into a single component with each switch appearing as a short circuit in one position and as an open circuit in the other b 2 position rotary switch bundles N
77. PROM demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking e Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI provides an Action control to select among four different actions read entire memory array write to the array read the STATUS register and write to the STATUS register and three associated data panels data read from the memory array data to write and STATUS byte to write The VI performs the selected action only one time when the Action control value changes therefore an Idle action must be selected between two successive actions of the same type such as writing to the array Select the Read entire array action If your EEP ROM has not yet been programmed i e it is still fresh from the factory you should expect to see the EEPROM array indicator filled with 255 hexadeci mal FF and the associated graph plotting a constant of the same value as a function of address 512 total Select the Write to array action By default the VI performs a single byte write of value 0 to Addres
78. RIO e Black Run button on the toolbar signifying that the VI is in run mode and e Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections 19 2 Interface Theory Interface circuit The SHARP GP2Y0A21YKOF IR range finder creates an output voltage Vo that varies in inverse proportion with range to a reflective target Study the video IR Range Finder Interfacing youtu be Xwr j 2WT3k 9 59 to learn more about the IR range finder including features principle of operation calculating range from sensor voltage based on the geometric principle of similar triangles and calibrating the sensor with single or multi measurement techniques LabVIEW programming Study the video Input Express VI youtu be N6Mi VjBlmc 2 00 to learn how to use Analog Input Express VI to measure the voltage divider s primary output 83 84 19 3 Basic Modifications Study the video IR Range Finder Demo Walk youtu be BFgelROxJ_E 3 51 to learn the design principles of IR Range Finder demo and then try making these modifications to the block diagram of Main vi 1 Add a Boolean control to disable or enable the averaging function 2 Display the range in inches instead of centimeters 3 Add a proximity detection feature activate an onboard LED when the range is lower than a threshold value entered on the front panel 4 Add an out of range Boolean indicator when the
79. RIO MXP Connector B see Figure A T on page 227 1 Encoder A B ENC A pin 18 Encoder A B DIOO pin 11 Encoder B B ENC B pin 22 Encoder B gt B DIO1 pin 13 Encoder COM gt B GND pin 20 Ol A WN Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project Rotary Encoder demo lvpro3 contained in the subfolder Rotary Encoder demo Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the encoder A and B switch states as either open or closed Slowly turn the encoder shaft clockwise and you should observe the following sequence A switch state closed with B switch state open then both 13 ROTARY ENCODER closed then A open with B closed and finally both open again You should also observe that both switches are open when the encoder shaft is at rest in one of its twelve detente positions Rotate the shaft in
80. RIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results Toggle the eight front panel switches to activate and deactivate each segment a through g as well as the decimal point refer again to Figure 3 2 on the facing pagelto see the standard labeling scheme for the segments Activating the front panel switch should cause the corresponding segment to light Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO 3 SEVEN SEGMENT LED DISPLAY e Black Run button on the toolbar signifying that the VI is in run mode e Correct wiring ensure that your wiring order is correct and that you have started at B DIOO pin 11 and e Ensure that the seven segment LED common anode CA terminal connects to the power supply B 3 3V pin 33 3 2 Interface Theory Interface circuit Each of the seven line segments as well as the decimal point is an individual LED each with its own anode and cathode To conserve the number of electrica
81. SPST switches into a single component rotating the dial create a binary sequence of open closed switch states 2 Interface a switch on any of the NI myRIO connectors without using additional components by using the the DIO internal pull resistors pull up on MXP connectors pull down on MSP connector and 3 Interpret the combined switch open closed patterns as an integer numerical value binary array and individual bit fields 5 1 Component Demonstration Follow these steps to demonstrate correct operation of the DIP switches Select these parts from the NI myRIO Starter Kit DIP switch a htm Rotary DIP switch fran miri e Breadboard e Jumper wires M F 14x e Small screwdriver 18 Build the interface circuit Refer to the schematic di agram and recommended breadboard layout shown in Figure 5 2 on the facing page The interface circuit for the DIP switches requires five connections to NI myRIO MXP Connector A and nine connections to Connector B see Figure A 1 on page 227 DIP Switch 8 B DIOO pin 11 DIP Switch 7 B DIO1 pin 13 DIP Switch 7 B DIO2 pin 15 DIP Switch 5 B DIO3 pin 17 DIP Switch 4 gt B DIO4 pin 19 DIP Switch 3 B DIOS pin 21 DIP Switch 2 B DIO6 pin 23 DIP Switch 1 B DIO7 pin 25 DIP Switch common B GND pin 8 10 Rotary DIP 1 A DIOO pin 11 11 Rotary DIP 2 A DIO1 pin 13 12 Rotary DIP 4 A DIO2 pin 15 13 Rotary
82. Sensor 24 Webcam 86 e Temperature sensors 8 Temperature e Sound level sensors measure the RMS of the audio waveform 10 Ba e Range distance and position sensors 9 Boni Range Fide CIS 137 e Magnetic field sensors 15 e Motion and vibration sensors 16 onboard accelerometer Accelerometer 21 188 40 WIRELESS SENSOR 41 Data Logger A data logger monitors one or more sensors over an extended time period and saves the acquired data to a file for later review and analysis A data logger takes measurements at a regular interval and immediately appends the time stamped record to a file to ensure that data records are not lost in case of a power failure during the data logging session The sample project Data Logger Light Temperature uses the LabVIEW data logging and time stamping VIs to record measurements from the temperature sensor and ambient light sensor to a USB flash drive Use your desktop computer to create a configuration file on a USB flash drive called config txt that contains a string for the base name of the data log file an in teger to indicate the number of milliseconds to wait between measurements and and integer to indicate the total number of measurements for the session For example the line temp light 10000 360 will cause the program to create a data logging file log extension with a time stamp in the file name to show when the data logging session started to
83. Throughs youtu be _GWEsrfxU4 8 37 youta be cw 36703 3 02 youtu be LFCThGa681A 15 08 youtu be bWew4 fHWVKo 7 48 youtu be ZMyYRSsQCac 2 30 youtu be dtwX0j5vvy4 4 57 APPENDIX D VIDEO TUTORIAL LINKS 235 youtu be UNdVUnYHEAU 13 07 youtu be kZoFwORYz 98 2 52 Rotary Encoder Demo Walk Through youtu be nmG1RqhQ6Rw 3 15 youtu be SebcpkbYBd4 9 46 youtu be o_iuYOM3yDk 6 36 Hall Effect Sensor Demo Walk Through youtu be BCJLg WbIK4 2 36 youtu be Q1UXVEVN 00 6 01 youtu be yuzNb1ZDbv4 3 22 youtu be 7r_LwcDa2AM 4 58 youtu be qbD31Aeg0Mk 4 32 youtu be o0XYryu4Y c 4 23 youtu be JsEMMnIWg4k 3 44 youtu be Baq63sKwoKE 12 14 youtu be SHJ vu4jorU 2 03 youtu be 2ZpI_uDwOg4 2 31 youtu be UCgFck0CLpc 1 56 Photocell Demo Walk Through youtu be 3Z0gqsc5GmoY 3 07 youtu be blme4 340E 2 54 youtu be RYeKIuU6DX8 3 07 youtu be Xm1A4Cw2POU 3 16 youtu be BFgelROxJ_E 3 51 youtu be MVa9Hk1gKI 3 33 youtu be W2iukd8WVIA 3 30 youtu be Jovn0kPJOKs 5 18 youtu be QXHe0DFbUdc 4 23 youtu be ejyOo_k9K10 2 03 youtu be kW4v16GuAFE 2 06 youtu be 10ib10sojds 6 25 youtu be xi0VIpGpf4w 2 28 youtu be Y1QukBt11W1 8 22
84. VI illustrates a simple datalogging application Insert the USB flash drive into the USB connector on the top of NI myRIO as shown in Figure 35 1 on the previous page run the VI and then move the myRIO to cause some activity on the X axis acceleration indicator The VI continu ally monitors the activity of the NI myRIO onboard accelerometer and then saves these measurements to a spreadsheet file in CSV format comma separated values when you stop the VI click the Stop button or press the escape key Use the default base filename logfile or enter a new name Note that the VI overwrites the file each time that you run the VI Remove the USB flash drive and read the spreadsheet file with a spreadsheet application such as Excel The first column is time and the second column is acceleration plot these two columns as an X Y graph to confirm that the plot matches that of the Acquired data waveform graph The demo VI also displays the USB flash drive capacity and free space as well as the files and folder on the top level folder of the flash drive Run the VI repeatedly with different logfile names and you should see these newly created files appear in the far left indicator Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode and e USB flash drive inserted into the USB connector The
85. acing technique described in this chapter requires no additional parts and also helps you to understand how to set up a raster display also known as a multiplexed display However 24 DIOs uses more than half of the available 40 DIOs and also ties up shared resources such the SPI PC bus PWM and encoder Furthermore the raster scan code requires a significant amount of a CPU effort Consider instead using the MAX7219 LED Display Driver see For More Information section at the bottom of the page to completely offload the detailed control of the LED matrix you simply transfer the desired patterns via the SPI bus This technique becomes manda tory should your application need more LED matrices to build a larger display LabVIEW programming Study the video youtu be WvnInG3ffay 4 53 to learn how to use the low level VIs to connect Boolean arrays directly to the digital outputs i e as a bus 29 3 Basic Modifications Study the video LED Matrix Demo Walk Through youtu be Bgg63sKwQKE 12 14 to learn the design principles of LED Matrix demo and then try making these modifications to the block diagram of Main vi 1 Finish the Auto pattern generator loop and update the main loop to add a pattern codes array for the red LEDs 2 Create a set of 64 bit pattern codes to make your own animation and then update the 1 D array constant in the Auto pattern generator loop You may find it more convenient to change th
86. adedDisks__B57164 K164 pdf http www analog com AD22100 e AD22100 temperature sensor Photocell API PDV P9203 http www advancedphotonix com ap_products pdfs PDV P9203 pdf Indicators o Seven segment LED display http www sparkfun com datasheets Components LED YSD 160AB3C 8 pdf 232 APPENDIX C NI MYRIO STARTER KIT DATA SHEETS Actuators Oo Buzzer speaker Soberton GI 0950RPJ3 http www soberton com product gt 0950rp3 e DC motor http www mabuchi motor co jp cgi bin catalog e_catalog cgi CAT_ID ff_180phsh Oo Relay http www cndongya com pdf relayjzc 11f pdf Diodes Transistors and Active Devices 1N3064 small signal diode 1N4001 general purpose rectifier 2N3904 npn transistor 2N3906 pnp transistor AD8541 rail to rail single supply op amp IRF510 n channel enhancement mode power MOSFET OP37 low noise precision high speed op amp ZVN2110A n channel enhancement mode MOSFET ZVP2110A p channel enhancement mode MOSFET D Video Tutorial Links Component Principles of Operation and Interfacing Techniques Accelerometer Interfacing Theory youtu be uj76 JtT_xk 15 55 youtu be zKnn1SskgRQ 7 38 youtu be WidjSMNU1OM 15 34 youtu be 3WkJ7ssZmEc 12 47 youtu be KNzEyRwcPIg 7 16 youtu be C4iBQ jWn701 9 15 youtu be RxRwyDOCeRw 11 18 youtu be izJni 0PMO I 8 48 youtu be CpwGXZX 5Ug 10 08 youtu be BuREWnD6Eno 12 55 youtu be ptp
87. al coefficient values presented in the earlier video Modify your temperature display to display in degrees Fahrenheit Create a Boolean indicator to indicate when the measured temperature exceeds or falls below 33 8 THERMISTOR a preset threshold 8 4 Integrated Project Ideas Now that you know how to use the thermistor consider integrating it with other devices to create a complete system for example O O O O O O e Weather Station 57 8 5 For More Information e Thermistors by National Instruments ther mistor characteristics and the Steinhart Hart thermistor equation e NIC Thermistors by Vishay Learn about thermistor principles of operation selection criteria design equations and example circuits and applications http www vishay com docs 29053 ntcintro pdf 9 Photocell A photocell is a two terminal device fabricated from cadmium sulfide CdS and with resistance that varies with illumination in the visible spectrum of 400 to 700 nm The photocell pictured in Figuref9 1 has a resistance that varies over many orders of magnitude 10 kQ at moderate illumination less than 100 2 at high illumination and more than 10 MO in darkness I 1mm Figure 9 1 NI myRIO Starter Kit photocell Learning Objectives After completing the activities in this chapter you will be able to 1 Describe the photocell principles of operation 2 Measure the photocell resistance with a voltage
88. am interface to the keypad The LabVIEW demonstration project Keypad demo presented in Chapter 25 on page 113 shows how to scan the keypad to determine which buttons are pressed at any given moment This scanning operation forms the basis of the scan keypad VI included with the calculator project scan keypad scans the keypad one time and returns a scan code integer representing the button or buttons that are pressed The related VIs open keypad and close keypad simplify the process of opening DIO channels to the row and column driver lines for the keypad The read keypad VI further simplifies the interface to the keypad by combining two instances of scan keypad inside loops one to wait for all keys to be released and another to wait for a keypress The VI blocks further execution until either a keypress is detected or the timeout period has expired the timeout value can be selected with open keypad With this VI the main application merely waits for read keypad to return a valid scan code which in turn can be converted to a numerical value with scancode to number this latter VI also filters out multiple keypresses In summary these keypad API VIs greatly simplify the interface to the keypad to speed up development of any application that requires user input via the keypad Begin by adding the LCD display interface code to the idle state You have two display rows available consider displaying Stack 0 and Stack 1 or perhaps a text st
89. ance 3 Main camera info vi This demo VI displays information for all cameras that have ever been connected to your NI myRIO as well as available attributes and video modes for the selected webcam Select a specific webcam with the webcam control and then run the VI to up Set Attribute 36 WEBCAM date the display you need to run the VI again each time you select another webcam Click the up down arrows on the array index control of all cameras to see the details on each camera Identify one of the video modes resolution and frame rate besides the mode at the top of the list make note of its number and then enter this value into Main video stream vi you need to re run the VI to change the video mode Con firm that the resolution matches that reported in the camera information display underneath the source image display on the left hand side Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode and e Webcam inserted into the USB connector 36 2 Interface Theory NI myRIO file system The LabVIEW Vision and Motion VIs provide a comprehensive set of tools to acquire and process images as well as to extract useful numerical information from images Connect a single webcam to the NI myRIO USB port or multi ple webcams with a USB hub and then use the Vision and Motion VIs
90. and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the piezo sensor amplifier output much like an oscilloscope display You should observe that the voltage is a constant close to 2 5 volts Flex the piezo sensor and you should see a corresponding change in the voltage observe the difference as you flex the sensor one way and then the other Next try flicking the sensor and jostling the breadboard You should see a decaying sinusoid similar to an underdamped second order system Experiment to determine the sensitivity of the sensor i e what is the lightest disturbance that still registers on the display Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct op amp wiring be certain that you understand the pinout of the AD8541 and e Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections
91. ation information of which the GPS sentences form a rather small subset Each sentence begins with followed a two character talker ID GP for a GPS sentence and a three character sentence type The sentence body contains comma delimited fields and ends with a check sum By default the Gms u1LP emits ASCII characters at 9600 baud 8 bit 1 stop and generates a cluster of four sentences and occasionally more every second Study the video GPS Receiver Interfacing Theory youtu be ptp2bGU9EHU 12 56 to learn more about general GPS concepts including a 2 D trilater ation example that illustrates how an unknown posi tion is determined from satellite signals the Digilent GPS board and GlobalTop Gms u1LP GPS module features the five NMEA sentences generated by the Gms u1LP module and a detailed example of parsing the SGPRMC sentence to obtain latitude longitude time date and other information 37 3 Basic Modifications Study the video GPS Receiver Demo Walk Through youtu be SebcpkbYBd4 9 46 to learn the design principles of GPS Receiver demo and then try making these modifications to the block diagram of Main vi 1 Add an altitude front panel indicator refer to the SGPGGA sentence 2 Add a front panel indicator to show the number of satellites in view refer to the SGPGGA or SGPGSV sentence 3 Add a display to show the distance from a reference latitude longitude coordinate Refe
92. ay pin diagram recommended breadboard layout and connection to eight digital I O terminals on NI myRIO MXP Connector B 12 LED demo lvproj and then try making these modifications to Main vi 1 Maintain the same behavior but convert the Digital Output Express VI to its underlying code and then connect the array style front panel control directly to the Write VI from the NI myRIO Advanced I O Digital I O subpalette Also create a front panel control to make user selectable digital I O channels Display a numerical integer front panel control value as its corresponding pattern on the seven segment display a case structure with Boolean array constants works nicely here see http cnx org content m14766 latest collection col10440 Display the values 0 to 9 and a dash for values greater than 9 bonus points for a hexadecimal display to include values A to F Create a rotating chase sequence in which a single active segment appears to move around the periphery of the display Make the speed adjustable and also include a control to reverse the direction of rotation Consider a single Boolean array constant connected to Rotate 1D Array in the Programming Array subpalette TIP Use Quick Drop Ctrl Space to search for a programming element by name 3 4 Integrated Project Ideas Now that you know how to use the seven segment display consider integrating it with other devices to create a complete system
93. by gently pinching the thermistor body with your finger tips you may also use a drinking straw or hair dryer to blow warm air on the thermistor You should observe the resistance going down How low can you make the resistance Use a plastic sandwich bag filled with two ice cubes or crushed ice Surround the thermistor with 8 THERMISTOR ice and you should observe the resistance going up How high can you make the resistance Click the Stop button or press the escape key to stop the VI and to reset NI myRIO a myRIO reset causes all of the digital I O pins to revert to input mode Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode and e Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections 8 2 Interface Theory Interface circuit Constructing a voltage divider from a thermistor and a fixed value resistor offers an effective and easy to build interface circuit Placing the thermistor in the top branch of the divider makes the measured voltage increase with higher temperature Study the video youtu be US406s3BUXY 4 54 to learn more about thermistor characteristics and the Steinhart Hart thermistor equation that converts measured thermistor resistance to temperature in degrees Kelvin Study Thermistor Resistance
94. cations to the block diagram of Main vi 1 Add a real time amplitude spectrum display use the point by point version of the built in Amplitude and Phase Spectrum VI located on the Signal Processing Point by Point Spectral subpalette 2 Add a VU volume meter that displays signal intensity use the AC output of the built in AC amp DC Estimator PtByPt VI located on the Signal Pro cessing Point by Point Sig Operation subpalette 3 Create an anti aliasing filter by adding a parallel capacitor with the feedback resistance 34 4 Integrated Project Ideas Now that you know how to use the MEMS microphone consider integrating it with other devices to create a complete system for example Data Loggen 41 ta 54 34 5 For More information e Microphone Array Beamforming with the ADMP504 by Analog Devices Video demon stration of two ADMP504 microphones combined with DSP digital signal processing to create a virtual directional microphone 161 162 34 MEMS MICROPHONE e ADMP504 Flex Eval Board by Analog Devices The ADMP504 packaged with a bypass capacitor and extension wires Part IV Additional Devices 35 USB Flash Drive The NI myRIO includes a USB port with operating system support for USB flash drives to ereatly extend to ability of NI myRIO to work with a Web browser b Network mapped drive c Interactive secure shell SSH and large data sets and to perform data lo
95. configuration options relate to the signaling waveforms between SPI transmitters and receivers In particular see the discussion beginning at 4 29 to better understand the SPI Express VI Advanced Options for clock phase and polarity the ADC0815021 requires Trailing edge clock phase and High clock polarity LabVIEW programming Study the video SPI Express VI youtu be S7KkTeMfmc8 5 51 to learn how to use the SPI Express VI 24 3 Basic Modifications Study the video Ambient Light Sensor Demo Walk Through youtu be XcwEjM6TOig 3 02 to learn the design principles of Ambient Light Sensor demo and then try making these modifications to the block diagram of Main vi 1 Display the ambient light level as a normalized value between 0 and 1 109 110 24 AMBIENT LIGHT SENSOR 2 Add a front panel Boolean indicator or con e M68HC11 Reference Manual by Freescale nection to the NI myRIO on board LED that activates whenever the ambient light level exceeds a user defined threshold 3 Convert the Wait constant to a front panel control Experiment with different loop times 24 4 Integrated Project Ideas Now that you know how to use the ambient light sensor consider integrating it with other devices to create a complete system for example e Steer By Wirel 3 e Scanning Sensor e Music Maker 65 24 5 For More information PmodALS Reference Manual by Digilent Ref erence manual for t
96. ct the error cluster from the encoder VI b Place the PID controller located in the Real Time Function Blocks Control subpalette in this space c Reconnect the error cluster to ensure that the PID VI executes after the Encoder VI and before the PWM VI d Create front panel controls for the propor tional gain integral time and derivative time values e Right click on the PWM duty control and select Change to indicator f Connect the PID output to the PWM duty indicator g Create a control for the PID setpoint input and h Keep the Reset Counter switch active or change it to a true valued constant 18 H BRIDGE AND GEARED MOTOR Search the Internet with the phrase Ziegler Nichols PID tuning to look for tutorials that discuss how to choose appropriate values for the three PID controller constants and feel free to experiment on your own start with proportional gain 18 4 For More Information e PmodHB5 Reference Manual by Digilent Reference manual for the H bridge module ttp digilentinc com Data Products PMOD HB5 FU modHB5_RevD_rm pdf e PmodHB5 Schematics by Digilent Schematic diagram of the H bridge module ttp digilentinc com Data Products PMOD HB5 FU modHB5 D sch par e Motor Gearbox by Digilent Need more geared motors for your project The IG22 is supplied by Digilent ttp digilentinc com Products Detail cfm DI NavPath 2 403 625 amp Prod MT MOTOR e I
97. d LEDs POSION waren ler i 75 For More Information e Potentiometer by Resistorguide Describes a variety of potentiometer types and characteristics http www resistorguide com potentiometer 30 7 POTENTIOMETER 8 Thermistor The thermistor a contraction of thermal 1 and resistor is a two terminal semiconductor device whose resistance varies with temperature Most thermistors are of the negative temperature coefficient NIC type meaning their resistance varies inversely with temperature pictures the NI myRIO Starter Kit thermistor 1 cm Figure 8 1 NI myRIO Starter Kit thermistor Learning Objectives After completing the activities in this chapter you will be able to Figure 4 Explain the thermistor principles of operation 2 Measure the thermistor resistance a voltage divider and analog input 3 Convert the measured resistance to temperature with the Steinhart Hart thermistor equation and Size the voltage divider resistor for the best measurement sensitivity and range 8 1 Component Demonstration Follow these steps to demonstrate correct operation of the thermistor Select these parts from the NI myRIO Starter Kit e Thermistor 10 kQ EPCOS B57164K103 J LeadedDisks__B57164__K164 pdf e Resistor 10 kQ e 0 1 uF ceramic disk capacitor marking 104 http www avx com docs Catalogs class3 sc pdf e Breadboard e Jumper wires M F 4x Build the interface circuit
98. d see the value drop towards zero Shine a bright flashlight on the sensor to see the value increase towards the upper limit of 255 Expect to see a random variation of about 1 LSB least significant bit Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals and e Correct SPI connector terminals double check your connections and ensure that you have connected the NI myRIO SPI MISO input to the ambient light sensor SDA output and digital output DION to the chip select input 24 2 Interface Theory Interface circuit The Digilent PmodALS board combines the Vishay Semiconductors TEMT6000X01 phototransistor and the Texas Instruments ADC0815021 analog to digital converter ADC The ADC converts the phototransistor output voltage to an 8 bit value and transmits this measurement via SPI serial peripheral interface Study the video Ambient Light Sensor Interfacing youtu be zKnn1SskqRo 7 38 to learn more about the ambient light sensor theory of operation SPI bus and chip select timing and proper setup of the SPI Express VI to read sensor measurements Study Serial Communication SPI youtu be GaXtDamw5As 7 02 to understand how the SPI Express VI
99. d you should observe a corresponding change in the voltage sensed on the analog input Because the potentiometer acts as an ajustable voltage divider between ground and the 5 volt supply you should observe that a full rotation of the potentiometer dial from one extreme to the other causes the voltage to change from 0 to 5 volts Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points 7 POTENTIOMETER e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode and e Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections 7 2 Interface Theory Interface circuit The potentiometer provides a fixed resistance between the two outer terminals while the middle terminal connects to a movable contact point that effectively makes the potentiometer appear as two variable resistors As one resistor increases in value the other resistor decreases by the same amount Wiring the potentiometer between ground and the power supply produces a voltage divider with voltage output proportional to the position of the contact Connecting this variable voltage to the NI myRIO analog input provides a convenient sensing technique for angular position Study the video youtu be 3gwwF9rF_zU 7 51 to learn about the poten
100. deo youtu be mVN9jfwXleI 2 41 to learn how to use the PWM Express VI to create a pulse width modulated square wave to provide variable speed motor operation 12 3 Basic Modifications Study the video Motor Demo Walk Through youtu be UCgFck0CLpc 1 56 to learn the design principles of Motor demo and then try making these modifications to the block diagram of MATT VE 1 Create variable speed motor operation as follows e Replace the existing Digital Output Express VI with the PWM Express VI Choose the PWM channel as B PWMO the same connector pin as B DIO8 pin 27 Choose the remaining dialog box options so that both frequency and duty cycle are available as inputs e Create pointer slide front panel controls for each right click on each control and choose Visible items and the Digital display and e Right click on the frequency control select motor control interface is active low That is you want 0 duty cycle to turn the motor off rather than causing maximum speed as it does now 3 Add a Boolean front panel control as a motor enable Trying using a Select node under the Programming Comparison subpalette to set the duty cycle either to 0 or to the value of the front panel duty cycle control 4 Disconnect the motor control line and re connect to C PWMO pin 14 on MSP Connector C adjust your VI to refer to this channel too You should observe that the motor is on due to the internal pull down
101. e The PmodBT2 module serve as a wireless alternative to a UART style data cable Figure 31 1 Digilent PmodBT2 module based on the Roving Networks RN42 2 Pair the RN42 with a laptop or desktop computer to create a virtual COM port 3 Access the COM port interactively with a terminal emulator and with a LabVIEW VI 4 Establish a wireless data link and Configure the RN42 name pairing code and profile 31 1 Component Demonstration Follow these steps to demonstrate correct operation of the Bluetooth module Select these parts from the NI myRIO Embedded Systems Kit e Bluetooth module PmodBT2 e Jumper wires F F 8x You will also need a Bluetooth capable laptop or desktop computer Build the interface circuit Refer to the schematic diagram shown in Figure 31 2 on page 143 the Bluetooth module requires eight connections to NI myRIO MXP Connector B see Figure Learning Objectives After completing the activities page 227 in this chapter you will be able to 1 Describe the essential features and pinout of the RN42 Bluetooth module 1 3 3 volt supply VCC3V3 B 3 3V pin 33 2 Ground GND gt B GND pin 30 3 TX B UART RX pin 10 142 4 RX gt B UART TX pin 14 5 STATUS gt B DIOO pin 11 6 RTS gt B DIO1 pin 13 7 CTS B DIO2 pin 15 8 RESET gt B DIO3 pin 17 Run the demonstration VI e Download if you have not done so previously and unpack the contents to
102. e constant to a front panel control You may also want to use Array Size from the Programming Array subpalette instead of the constant 4 to make your code accommodate an arbitrary number of 64 bit patterns 3 Think of a way to map one or more measure ments such as the onboard accelerometer output or analog input voltages onto the display For example you could make eight bar graphs to show eight analog input voltages or you could map the X and Y outputs from the accelerometer onto a Cartesian grid Your mapping destination is the 2 D Boolean array global variables 4 Add a pointer slide to vary the loop time of the timed loop pull down on the Right Data Node on the upper right interior of the timed loop to expose the Next Loop Iteration Timing terminal appears at dt and then create a front panel control to interactively adjust the loop time Set the lower limit to 1 ms to avoid selecting 0 ms this hangs the application 5 Observe the effects of jitter on the display change the timed loop to a standard while loop right click on the loop frame and select Replace with While Loop and then add a 1 ms time delay You should notice that the display intensity has a slight random flicker because the real time processor now has more freedom to process background tasks The timed loop on the other hand guarantees a precise loop time 29 4 Integrated Project Ideas Now that you know how to u
103. e divider from a photocell and a fixed value resistor offers an effective and easy to build interface circuit Placing the photocell in the top branch of the divider makes the measured voltage increase with more illumination Study the video youtu be geNeoFuUjMjo 4 45 to learn about photocell characteristics and then study Measure Resistance with a Voltage Divider youtu be 9KUVD7RKxNI 9 44 to learn how to measure the photocell resistance with a voltage di vider and also how to properly choose the resistance R to maximize measurement sensitivity and range LabVIEW programming Study the video youtu be N6Mi VjBlmc 2 00 to learn how to use Analog Input Express VI to measure the voltage divider s primary output 9 3 Basic Modifications Study the video Photocell Demo Walk Through youtu be 3Z0qsc5GmoY 3 07 to learn the design principles of Photocell demo and then try making these modifications to the block diagram of Main vi 1 Adda Boolean front panel control to make the voltage divider configuration user selectable i e one state of the control corresponds to the photocell in the lower branch while the other state selects the upper branch Confirm that your modification works properly by swapping positions of the photocell and resistor 2 Create a room lights ON detector with a suit able node from the Programming Comparison subpalette and a Boolean front panel indicator Include a user selectable
104. e expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections and e Correct resistor value ensure that you have a 470 Q resistor yellow violet brown and not a 470 kQ resistor yellow violet yellow 14 2 Interface Theory Interface circuit The photointerrupter places an infrared LED as the photoemitter on one side of the gap and a photodetector with signal conditioning circuitry on the other The output is normally 5 volts and drops to zero volts when the optical path is blocked The photointerrupter output may be connected directly to any NI myRIO digital input MXP and MSP connectors Study the video Photointerrupter Characteristics youtu be ulFVfEvSdkg 4 59 to learn more about the photointerrupter characteristics including the voltage output details and requirements for sizing the current limiting resistor for the infrared LED emitter LabVIEW programming Study the video D Input Low Level Vis Input Low Level VIs youtu be 4nzr7THqUu8u 4 09 to learn how to use the low level Digital Input VIs to sense the state of the photointerrupter 143 Basic Modifications Study the video Photointerrupter Demo Walk youtu be yuzNb1ZDbv4 3 22 to learn the design principles of Photointerrupter dem
105. e servo motor with a rotary user input device to create your own steer by wire system with the servo motor controlling the position of steering wheels on a robotic platform Use the accelerometer or gyro scope as a hand held controller like the Waterloo Labs system see the LabVIEW application Steer By Wire as an example of controlling the servo position using the X axis of the NI myRIO onboard accelerometer You can also use a sensor to make the steering system automatically respond to physical measurements such as light and temperature e Steering wheel actuator Servo 17 e Steering wheel control ae Potentiometer 7 Rotary Encoder 13 e Light and vision sensors Photocell 9 Ambient Webcam 8 Temperature Li Tht Sensor Light Sensor 24 e Temperature sensors e Sound level sensors measure the RMS of the audio waveform Electret Microphone 10 MEMS Microphone 34 e Range sensors IR Range Finder 19 Sonic Range Finden 0 e ee DA sensors Hall Effect Sensor 15 onboard accelerometer e Com pass l celerometer 21 Gyrascope 2 194 43 STEER BY WIRE 44 Digital Thermometer Create a digital thermometer to measure the ambient temperature using either the thermistor or the I C bus temperature sensor and display the temperature on the LCD Include features to display in Fahrenheit or celsius use the NI myRIO onboard pushbutton to select between these options and also display the mi
106. eaking off a 5 pin section and a 6 pin section of the breakaway header Place the headers in a breadboard longer pin down to keep them properly aligned and then fit the breakaway board over the headers with the pin numbers facing down and the SparkFun logo 178 facing up Solder the short pins in place When cool remove the breakout board and then fit the RFID reader onto the breakout board Solder the RFID reader pins on the other side of the breakout board Figure 38 2 RFID reader breakout board and headers after soldering Refer to the schematic diagram and recom mended breadboard layout shown in Figure Note that the compact layout requires several breadboard jumper connections under the RFID reader The RFID reader requires four connections to NI myRIO MXP Connector B see Figure A T on page 227 1 3 3 volt supply B 3 3V pin 33 2 Ground B GND pin 30 3 UART output DO B UART RX pin 10 4 Tag in range B DIOO pin 11 Run the demonstration VI e Download http www ni com academic myrio if you have not done 38 RFID READER so previously and unpack the contents to a convenient location e Open the project RFID demo lvproj con tained in the subfolder RFID demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking e Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or
107. ecommended breadboard layout shown in Figure Note that the two buzzer speaker terminals do not sit on tenth inch centers however they fit just fine in two 44 diagonally adjacent breadboard holes The interface circuit requires three connections to NI myRIO MXP Connector B see Figure A 1 on page 227 1 5 volt power supply B 5V pin 1 2 Ground B GND pin 6 3 Buzzer speaker control B PWMO pin 27 Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project Buzzer Speaker demo lvproj contained in the subfolder Buzzer Speaker demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results Your buzzer speaker should be making a low frequency tone at 40 Hz Move the front panel control frequency Hz to increase the frequency At what frequency is the sound output level the highest What is the highest frequency that you can hear Try blocking the port rectangular
108. een 2 D array control You should see the corresponding green LED activate on the display Take a moment to try each of the rows and columns to ensure that your wiring is correct Repeat for the red 2 D array control The green pattern and red pattern indicators under the array controls show the state of the 8x8 2 D Boolean arrays as a single 64 bit hexadecimal value Select Edit Reinitialize Values to Default to clear all 64 array buttons and then click the lower right button Note how this corresponds to the least significant bit in the 64 bit value Click the upper left button this is the most significant bit Click more buttons to determine the ordering of the remaining bits These 64 bit pattern codes provide a convenient way for you to create individual display patterns to be used for animations Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode and e Correct wiring ensure that your wiring order is correct it is easy to make a mistake 29 LED MATRIX A DIO4 19 A DIOS 21 AIDIOG 23 A DIO7 25 J B DIO8 27 B DIO 29 O B DIO10 31 O B DIO11 18 J B DIO12 22 O B DIO13 26 O B DIO14 32 O B DIO15 34 R8 R7 R6 IRS Cfr G2r C3r ICdr C r C6r Cfr C8r
109. el signal that is either active high or active low depending on the type of pull resistor and a 2 Apply software based edge detection to convert bl a pushbutton press into a trigger event c N 4 1 Component Demonstration Follow these steps to demonstrate correct operation of the pushbutton switch Select these parts from the NI myRIO Starter Kit e Pushbutton switch integrated with rotary Figure 4 1 NI myRIO Starter Kit pushbutton switch ee ee Components TW 700198 pdf e Breadboard e Jumper wires M F 2x integrated with rotary encoder 14 Build the interface circuit Refer to the schematic diagram and recommended breadboard layout shown in Figure 4 2 on the facing page TIP Flatten the two tabs on either side of the rotary encoder so that it sits flush on the breadboard surface The pushbutton switch interface circuit requires two connections to NI myRIO MXP Connector B sce Figure A T on page 227 1 Pushbutton Terminal 1 B DIOO pin 11 2 Pushbutton Terminal 2 B GND pin 12 Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location Open the project Pushbutton demo lvproj contained in the subfolder Pushbutton demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run b
110. end this project in a number of ways Add the LCD display to show the date and time purchase additional seven segment display modules to make a traditional digital clock use the LED matrix to create a binary clock display each pair of rows displays a numerical value as a binary pattern or devise a creative arrangement of discrete LEDs to indicate the time of day You could also add an actuator or output device to make something happen at specific times As examples use the speaker to chime at fifteen minute intervals and on the hour like London s Big Ben use the relay as a clicker instead of a chime or move the servo motor horn as a pseudo minute hand the horn rotates over an angle of 180 degrees during 60 seconds and then rapidly resets e Time and date display LCD Display e Actuators and output devices Buzzer Speake 11 Servo 192 42 NTP CLOCK 43 Steer By Wire The phrase fly by wire applies to aircraft systems in which sensors control electronics and servo motors replace the mechanical linkages between the pilot s yoke and rudder pedals and the control surfaces including flaps ailerons and rudder Engineers at Waterloo Labs applied this idea to create a steer by wire actually wireless system using an iPhone as the controller and a Compact RIO to control the steering column accelerator and brakes see the fascinating video demo at youtu be _x5IziyOcAg Combine th
111. enior year especially those students engaged in capstone projects or research A background in electrical and computer engineering is ideal but students pursuing other disciplines will find the level of tutorial detail to be more than adequate This document is fully hyperlinked for section and figure references and all video links are live hyperlinks Open the PDF version of this document for the most efficient way to access all of the links click a video hyperlink to automatically launch the video in your browser Within the PDF use ALT leftarrow to navigate back to a starting point The book is organized into six major parts Parts I through II detail the components and devices included in the NI myRIO Starter Kit Mechatronics Kit and Embedded Systems Kit Part IV includes additional chapters USB flash drive webcam GPS receiver and RFID reader Part V provides numerous ideas for complete projects that integrate two or more devices and components and Part VI Appendices includes NI myRIO connector diagrams a tutorial on building a stand alone application power on your NI myRIO and the application runs immediately collected data sheet links and links to all video tutorials Every attempt has been made to ensure that the components shown in Chapters 1 through 35 match the components found in the NI myRIO component kits to which they are referenced Occasionally components may vary slightly Where these variations occu
112. ers are received by the NI myRIO Click the CTS button again and you should see the buffered characters appear in quick succession on the incoming character indicator Close the PuTTY window you will see the PmodBT2 green status LED blinking again and the STATUS front panel indicator inactive to show that the RN42 is waiting for a new data connection Open a PuTTY window again and type to enter command mode By now the default 60 second configuration time window has expired and nothing special will happen Observe the PmodBT2 green status LED as you click the RESET button two times do you notice how the blink rate is faster now This medium speed rate indicates that the RN42 can accept a request to enter command mode Type again and you will see the CMD prompt ap pear also observe that the status LED blinks at high speed while in command mode Type h to display help on all of the available commands In particular try d to display basic settings e to display extended settings and v to show the firmware version Type to exit command mode Click the Stop button or press the escape key to stop the VI and to reset NI myRIO 31 BLUETOOTH MODULE Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that yo
113. es 28 1 Component Demonstration Follow these steps to demonstrate correct operation of the LCD character display Select these parts from the NI myRIO Embedded Systems Kit e LCD character display with serial interface PmodCLS Detail cfm NavPath 2 401 473 amp Prod PMOD CLS e Jumper wires F F 4x Build the interface circuit Refer to the schematic diagram shown in Figure 28 2 on the following page the LCD character display requires four connections to NI myRIO MXP Connector B see Figure A 1 on page 227 1 3 3 volt supply B 3 3V pin 33 2 Ground B GND pin 30 3 Serial data SD B I2C SDA pin 34 4 Serial clock SC B I2C SCL pin 32 126 28 LCD CHARACTER DISPLAY I C BUS INTERFACE VDD B 3 3V 33 J2 V J2 SD B I2C SDA 34 Ed PmodCLS DISC B 12C SCL 32 E J2 G BIGND 30 address 0x48 SAASBGSASBFARAAAR ESA Figure 28 2 Demonstration setup for LCD character display connected to NI myRIO MXP Connector B Remember to set the mode jumpers as shown for I C bus serial communications 28 LCD CHARACTER DISPLAY 1 C BUS INTERFACE Run the demonstration VI e Download http www ni com academic myrio iF you have not done so previously and unpack the contents to a convenient location e Open the project LCD I2C demo lvproj contained in the subfolder LCD 12C demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by do
114. es After completing the activities in this chapter you will be able to 1 Discuss compassing principles including Earth s magnetic field inclination angle and declination angle location dependent difference between magnetic north and true north 2 Interpret the three axis compass output to find true north direction 3 Configure the compass for data rate range and continuous measurements and 4 Read and display compass direction 23 1 Component Demonstration Follow these steps to demonstrate correct operation of the compass Select these parts from the NI myRIO Mechatronics Kit e Compass PmodCMPS e Jumper wires F F 5x Build the interface circuit Refer to the schematic diagram shown in Figure the compass requires five connections to NI myRIO MXP Connector A see Figure A 1 on page 227 1 3 3 volt supply VDD A 3 3V pin 33 2 Ground GND gt A GND pin 30 3 Serial data SDA A I2C SDA pin 34 4 Serial clock SCL A I2C SCL pin 32 102 5 Data ready DRDY 1 A DIOO pin 11 NOTE Leave both jumpers JP1 and JP2 discon nected these jumpers enable 2 2 kQ pull up resistors that are already included on the NI myRIO SCA and SCL lines Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project Compass demo lvproj contained in the subfolder Compass demo e Expand the hierarchy button a plus sign f
115. et NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections e Correct PmodTMP3 connector terminals double check your connections and ensure that you have connected the NI myRIO I C bus SDA line to the PmoDTMP3 SDA terminal on connector J1 and the SCL line to the SCL terminal also check that you have not accidentally crossed the power supply connections and e Correct PmodTMP3 address jumper settings refer again to the circled region of Figure the facing pagelfor the proper settings NOTE Double check the SDA and SCL connections should you see the message Error 36011 occurred at myRIO Write 12C vi or similar this message indicates that NI myRIO did not receiving an expected acknowledgement from the PmodTMP3 I C bus interface 153 154 33 2 Interface Theory Interface circuit The Microchip TCN75A temper ature sensor packaged by the PmodIMP3 supports the I C bus serial interface commonly denoted T2C Two 8 bit registers provide the measured temperature in degrees Celsius every 30 ms for 9 bit resolution and every 240 ms for 12 bit resolution each additional bit doubles the conversion time
116. f the gyroscope Datasheet for the L3G4200D Digital Output ttp www st com st web ui static active en resource technical document datasheet CD00265057 pdf L3G4200D Datasheet by STMicroelectronics TA0343 Everything about STMicroelectronics 3 axis digital MEMS gyroscopes This technical article provides an excellent discussion of the gyroscope principles of operation as well as techniques to deal with zero rate level ttp www st com st web ui static active en I 0 pai O WN Q O jo resource technical document technical_article DM00034730 pdf UM10204 C bus Specification and User Manual by NXP Semiconductors A complete treatment of the I C bus standard including timing diagrams and multi master systems ttp www nxp com documents user_manual f Sl P iS O N O Hs jo O 99 100 22 GYROSCOPE 23 Compass The familar compass with its magnetic north seeking needle has a digital counterpart in the Hon eywell HMC5883L three axis compass at the heart of the Digilent PmodCMPS pictured in Figure 23 1 and included in the NI myRIO Mechatronics Kit The HMC5883L generates 12 bit measurements deliv ered by I C bus serial communications at rates of up to 160 Hz and offers multiple sensitivity ranges for compassing finding the Earth s magnetic north pole or to measure stronger magnetic fields up to 8 gauss Figure 23 1 NI myRIO Mechatronics Kit compass Learning Objectiv
117. finder connected to NImyRIO MXP Connector A 87 88 when echoed back from an object can be detected by the same transducer The time of flight of the pulse combined with the speed of sound yields the distance or range to the object The MB1010 provides range measurements in digital format via UART analog output and pulse width output Study the video Sonic Range Finder Interfacing youtu be UcpmrcJR_D8 9 26 to learn about the sonic range finder principle of operation applications MaxBotix MB1010 features signal connections temperature compensation technique and beam pattern Study Serial Communication UART youtu be odN66E85J5E 7 56 to better un derstand the signaling waveforms between UART transmitters and receivers 20 3 Basic Modifications Study the video Sonic Range Finder Demo Walk youtu be MVa9Hk1gKI 3 33 to learn the design principles of Sonic Range Finder demo and then try making these modifications to the block diagram of Main vi Update the front panel to display the range in centimeters Add a proximity detector Boolean indicator or onboard LED with an adjustable threshold level control on the front panel For example when the threshold is set to 20 inches any object ranging less than 20 inches would activate the proximity detector indicator Add an Analog Input Express VI to display the ana log output AN of the MB1010 Convert the volt age to range and then compare this value to
118. fset and enter this value into the time zone control For example Eastern Time Zone in the United States is 5 indicating five hours west of Coordinated Universal Time UTC centered on the Prime Meridian intersecting Greenwich England Compare the value in the Time indicator upper left corner to the official time maintained by the National Institute of Standards and Technology at Do you observe any difference Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that you are using Connector A and that you have the correct pin connections Correct GPS receiver terminals double check your connections and ensure that you have connected the NI myRIO UART receive input to the GPS receiver transmit output also check that you have not accidently crossed the power supply connections 37 2 Interface Theory Interface circuit The GlobalTech Gms ulLP is a self contained GPS module with integrated antenna 175 176 The GPS module generates NMEA sentences i e ASCI text strings terminated by a carriage return and line feed combination NMEA National Marine Electronics Association sentences accommodate a wide range of navig
119. g interfaces SparkFun Glowing multi color boxes as household art http www sparkfun com news 1210 e Use LEDs as photodiodes by EDN LEDs can detect light too making them an interesting type of photosensor Use LEDs as photodiodes e LED Lighting Applications by OSRAM Opto Semiconductors LEDs are everywhere these days including outdoor street lighting architec A N tural illumination downlights i e ceiling lights A 0 N o RED ce flashlights and greenhouses http ledlight osram os com applications BLUE GREEN Common CATHODE Figure 2 3 RGB LED pins and schematic diagram 2 4 Integrated Project Ideas Now that you know how to use the discrete LED consider integrating it with other devices to create a complete system for example e 3 D Color Controller 45 e Digital Bubble Level 56 e INTP Clock 42 Displays based on seven LED segments arranged in an 8 pattern provide a simple means to display numbers 0 to 9 and some letters of the alphabet Figure 3 1 shows the NI myRIO Starter Kit seven segment display si gt a Figure 3 1 NI myRIO Starter Kit seven segment display Learning Objectives After completing the activities in this chapter you will be able to 1 Describe the array of LEDs wired with a common anode connection 2 Design the interface circuit by applying knowl edge of the DIO output resistance source voltage LED voltage
120. ge 97 the gyroscope requires six connections to NI myRIO MXP Connector A see Figure A 1 on page 227 3 3 volt supply A 3 3V pin 33 Ground A GND pin 30 Serial data SDA A I2C SDA pin 34 Serial clock SCL A I2C SCL pin 32 Interrupt 2 A DIOO pin 11 OT A WN FR 96 6 Interrupt 1 A DIOO pin 13 Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location Open the project Gyroscope demo lvproj contained in the subfolder Gyroscope demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI shows the six byte rate output from the L3G4200D gyroscope format ted values as 16 bit signed integers and a waveform chart to show the time history of the three gyroscope rates The VI also shows the integrated rate values which yield relative angular displacement The integrators may be reset to zero by clicking reset integrator and then clicking
121. ges and inventory control The ID Innovations ID 12LA RFID reader reads RFID tags encoded with the EM4001 standard and formats the tag information into one of three formats one of which is compatible with the NI myRIO UART serial communications port Study the video RFID Reader Interfacing Theory youtu be zlv0vCue83c 11 29 to learn more about the RFID reader principles of operation including the EM4001 tag standard ID 12LA RFID reader configuration and UART data output format and checksum calculation 38 3 Basic Modifications Study the video RFID Demo Walk Through youtu be Jovn0kPJOKs 5 18 to learn the design principles of RFID demo and then try making these modifications to the block diagram of Marn vi 1 Calculate the checksum for the data segment and compare to the checksum field of the RFID tag message use a Boolean indicator to show whether or not a valid message was received from the RFID reader 38 4 Integrated Project Ideas Now that you know how to use the RFID reader consider integrating it with other devices to create a complete system for example e Hotel Room Safe Controlle 38 RFID READER 38 5 For More Information e EM4001 Protocol Description by Priority 1 Design Detailed tutorial on the EM4001 protocol used by RFID tag cards http www priorityldesign com au em4100_ protocol html e RFID Made Easy AppNote 411 by EM Micro electronic Everything you need to know about RFID
122. gging tasks 2 Read and write files with LabVIEW over long periods of time beyond the limitations of the onboard solid state hard disk drive Fig ure pictures a USB flash drive inserted into the NI myRIO USB connector Figure 35 1 NI myRIO USB connector with USB flash drive Learning Objectives in this chapter you will be able to 1 Access the NI myRIO file system onboard disk drive with any of these methods After completing the activities 39 1 Component Demonstration Follow these steps to demonstrate correct operation of the USB flash drive Select these parts USB flash drive formatted for Windows FAT16 or FAT32 Run the demonstration VI e Download http www ni com academic myrio if you have not done so previously and unpack the contents to a convenient location Open the project USB Flash Drive demo lvproj contained in the subfolder USB Flash Drive demo Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R 166 Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo
123. gth pattern of a magnet Figure shows a photo of a typical Hall effect sensor Figure 15 1 NI myRIO Starter Kit Hall effect sensor Learning Objectives After completing the activities in this chapter you will be able to 1 Discuss the Hall effect principle 2 Discuss the two types of Hall effect sensor behavior latching and switching and 3 Connect an open collector sensor output to digital inputs with either pull up resistors MXP con nector or pull down resistors MSP connector 15 1 Component Demonstration Follow these steps to demonstrate correct operation of the Hall effect sensor Select these parts from the NI myRIO Starter Kit e US1881 Hall effect latch e 0 1 uF ceramic disk capacitor marking 104 http www avx com docs Catalogs class3 sc pdf e Breadboard e Jumper wires M F 3x Build the interface circuit Refer to the schematic di agram and recommended breadboard layout shown in Figure 15 2 on page 61 The Hall effect sensor inter face circuit requires three connections to NI myRIO MXP Connector B see Figure A 1 on page 227 1 5 volt supply B 5V pin 1 2 Ground B GND pin 6 60 3 Hall effect sensor output B DIOO pin 11 Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project Hall Effect Sensor demo lvproj contained in the subfolder Hall Effect Sensor demo Expand t
124. he ambient light sensor board modALS rm RevA pdf PmodALS Schematics by Digilent Schematic diagram of the ambient light sensor board e ADC0815021 Data Sheet by Texas Instruments Complete information on the ADC081S021 analog to digital converter on the PmodALS board ttp www ti com product adc081s021 TEMT6000X01 Data Sheet by Vishay Semi conductors Complete information on the TEMT6000X01 ambient light sensor phototran sistor on the PmodALS board ttp www vishay com product docid 81579 O FU DO O SE DI Semiconductor Refer to Section 8 for a complete treatment of the SPI serial bus standard including timing diagrams and multi master systems Part Ill NI myRIO Embedded Systems Kit 25 Keypad A keypad provides an essential component for a human user interface Figure pictures the the NI myRIO Embedded Systems Kit keypad The keypad pushbutton switches wired in a 4x4 matrix can be scanned to determine single and multiple key presses APIOILENT stronzo THEORY x 00 A Figure 25 1 NI myRIO Embedded Systems Kit keypad Learning Objectives After completing the activities in this chapter you will be able to 1 Describe the matrix connection used by the keypad switch array 2 Use internal pull up and pull down resistors to eliminate additional components and 3 Determine which multi keypress patterns can be uniquely decoded 25 1 Component Demonstration Follow
125. he hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the state of the Hall effect sensor output and the most recent magnetic pole north or south applied to the marked side The US1881 behaves as a latch meaning that a magnetic field of the opposite pole must be applied to flip the latch to its opposite state Find as many magnets as you can refrigerator magnets work nicely and experiment with the sensitivity of the sensor how close does the magnet need to be to flip the state as well as the location of the north and south poles on the magnet How many distinct pole locations can you detect on the magnet The answer may surprise you Click the Stop button or press the escape key to stop the VI and to reset NI myRIO 15 HALL EFFECT SENSOR Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e
126. id refer to Chapter for a complete treatment of pushbutton interfacing to both the MXP and MSP connectors Because the key pad normally receives a sequence of single button presses and occasionally two or even three button combination presses the matrix connection based on shared row lines and column lines requires only eight connections to the NI myRIO DIO lines instead of the perhaps more expected sixteen connections that would be required to properly sense all 216 65536 possible switch open closed patterns Study the video youtu be oj2 CYSnyo0 13 10 to learn more about the matrix approach to keypad switch wiring the reasoning behind the pull up resistors on the row lines the keypad scanning process of driving column lines with a low level voltages and reading the row lines and the rule that explains when a multi key button combination will produce ghost 25 KEYPAD VDD B 3 3V 33 J1 6 B DIO4 19 B DIO5 21 gl B DIO7 25 A COL1 COL2 COL3 COL4 J1 4 J1 3 J1 2 J1 1 B DIO3 17 O B DIO2 15 ul B DIO1 13 5 B DIOO 11 colum a E 1 did _4 Azur ZX 1 2 fe 2 5 6 row 3 8 9 4 Fe 1009000 A ae J1 Connector ia Jt o O front view Figure 25 2 Demonstration setup for keypad connected to NI myRIO MXP Comnector B 115 116 keypresses false reads Look for the challenge offered in the video and see if you can determine the maximum possible multi key combination
127. ies e AD8541 rail to rail single supply op amp e 100 pF ceramic disk capacitor marking 101 e 0 001 uF ceramic disk capacitor marking 102 BEEp Twww Vishay con docs AS1T1 ksexies pal Resistor 10 MQ Resistor 10 kQ 2x Breadboard Jumper wires M F 3x Build the interface circuit Refer to the schematic diagram and recommended breadboard layout shown in Figure The piezo sensor interface circuit requires three connections to NI myRIO MXP Comnector B see Figure A 1 on page 227 1 5 volt supply B 5V pin 1 2 Ground B GND pin 6 3 Sensor output B AIO pin 3 64 16 PIEZOELECTRIC EFFECT SENSOR B 5V 1 VDD PIEZO B AIO 3 eat ATEO LIT AZIO IZ bn ie en bet Rt a ss ad FORT BE 5 or ST a ma N ely i r qm d i si i e Be n o i i i i i i K fo Figure 16 2 Demonstration circuit for piezo sensor schematic diagram recommended breadboard layout and connection to NI myRIO MXP Connector B 16 PIEZOELECTRIC EFFECT SENSOR Run the demonstration VI e Download http www ni com academic myrio if you have not done so previously and unpack the contents to a convenient location e Open the project Piezoelectric Effect Sensor demo lvproj contained in the sub folder Piezoelectric Effect Sensor demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking e Confirm that NI myRIO is connected to your computer
128. internal components of the servo controller motor drive gearbox and potentiometer the principle of operation of the servo s feedback control system and the technique used to make a continuous rotation servo LabVIEW programming Study the video Express VI youtu be mVN9jfwXleI 2 41 to learn how to use the PWM VIs to open a channel to a PWM output and to set the pulse width and pulse repetition rate 173 Basic Modifications Study the video Servo Demo Walk Through youtu be QXHe0DFbUdc 4 23 to learn the design principles of Servo demo and then try making these modifications to the block diagram of Main vi 1 Add the necessary computation to calibrate the pointer slide control in degrees of rotation Use the same technique as the null offset code but now with a multiplicative scale factor be sure to initialize the feedback node to 1 Test your code as follows e Null the offset e Set the servo angle to zero and note the position of the servo horn arm e Adjust the servo angle until the arm rotates 90 degrees e Click and then release your scale button and then e Enter 90 degrees into the point slide control direct entry box and confirm that the arm rotation is exactly 90 degrees from center 17 SERVO 2 Make the servo follow an angular position trajec tory 1 e a sequence of angles stored in an array e Replace the while loop with a for loop right click on the for loop and select the Condit
129. ional Terminal option e Create an array using the Sine Pattern generator found in the Signal Processing Sig Generation subpalette select an amplitude for the sine pattern that will move the servo horn arm throughout its possible range of travel e Change the pointer slide control to an indicator and e Connect the Sine Pattern output through the for loop frame to the position control wire 17 4 Integrated Project Ideas Now that you know how to use the servo consider integrating it with other devices to create a complete system for example Steer By Wire 43 Hotel Room Safe Controlle 17 5 For More Information e Actuators and Servos by Society of Robots Many practical details on servos e Servo Control by PC Control Learning Zone Another good tutorial on servos 73 74 17 SERVO 1 8 H Bridge and Geared Motor An H bridge motor drive uses four power MOSFETs to direct current through a DC motor in one direction or the other thereby allowing the motor controller to reverse the motor direction as needed The MOSFETs also switch fast enough that pulse width modulation PWM of the pair of active MOSFETs can adjust the motor speed The H bridge and geared motor included with the NI myRIO Mechatronics Kit Figure provides relatively high torque and is suitable for the drive train of a robotic platform Moreover the integrated shaft position quadrature encoder provides feedback suitable for motor position
130. ioner Adding cool air to the room causes the measured temperature to fall e and once the measured temperature falls below the desired temperature the relay opens and the air conditioner shuts off On off controllers represent an inexpensive form of closed loop feedback control system and perform satisfactorily for applications that can tolerate a certain degree of up and down behavior in the controlled variable On off controllers include a hysteresis band to prevent the controller from cycling the control effort on and off too frequently For example suppose the thermostat sensor resolution is 0 1 Cand the desired temperature is set to 20 5 C Without hysteresis the thermostat would start the air conditioner at a measured temperature of 20 6 C turn off a few moments later when the temperature returns to 20 5 C and then resume cooling shortly after that when the temperature rises again to 20 6 C With a 0 2 Chysteresis band centered about 20 5 Cthe measured temperature would need to exceed 20 6 Cbefore the air conditioner turns one and then fall below 20 4 Cto cause the air conditioner to turn 51 On Off Control System off The width of the hysteresis band defines a trade off between the amount of acceptable temperature variation and the cycle time of the air conditioner Create your own version of an on off control system Make or buy a fan to attach to the DC motor to serve as the air conditioner and use one of the
131. iper position as an 8 bit value The five volt power supply con nected across the end terminals of the potentiometer creates a proportional variable voltage at the wiper terminal W which is read by an analog input and displayed on the indicator dial Move the slide and you should see a corresponding change on the dial position Press the page up and page down keys to make single bit changes to the digital value 32 DIGITAL POTENTIOMETER If you have an ohmmeter handy disconnect all three potentiometer terminals from NI myRIO and then measure the resistance between the W and B terminals as you vary the digital wiper position repeat for the W and A terminals If the measurement does not seem sufficiently stable try connecting either A or B to one of the NI myRIO ground terminals Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that you are using Connector A to power the digital potentiometer board and Connector B to establish the potentiometer variable voltage and e Correct SPI connector terminals double check your connections and ensure that you have connected the NI myRIO SPI MOSI output to the digi
132. is designed to connect directly to laptop computer soundcard inputs and can also connect directly to the NI myRIO AUDIO IN jack Figure 10 1 microphone NI myRIO Starter Kit electret Learning Objectives After completing the activities in this chapter you will be able to 1 Discuss the electret microphone operating principle based on parallel plate capacitance 2 Apply the phantom power provided by the NI myRIO AUDIO IN jack to power the electret microphone JFET impedance level shifter and 3 Increase the microphone gain with a simple inline preamplifier circuit powered by the NI myRIO AUDIO IN jack 10 1 Component Demonstration Follow these steps to demonstrate correct operation of the microphone Select these parts from the NI myRIO Starter Kit e Chenyun CY 502 computer microphone www chenyun cc product_en asp Product ID 859 Build the interface circuit This microphone inte erates a standard 3 5 mm audio jack that can plug directly into the NI myRIO AUDIO IN jack consequently no special circuit is required Refer to the diagram in Figure 10 2 on the next page Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project Electret Microphone demo lvproj contained in the subfolder Electret Microphone demo 40 10 ELECTRET MICROPHONE Figure 10 2 Demonstration circuit for electret microphone connected directly
133. isplay to create your own hotel room safe controller Use the high level keypad API VIs included with the RPN Calculator project to ensure that your state machine sees only single button presses and the timeout feature of open keypad and read keypad comes in handy to deal with partially entered codes i e if someone enters three digits gets distracted and then walks away the partially entered code should be cleared You could use an LED to indicate the bolt position open or locked or use the servo motor as a more realistic model of the bolt Also consider adding a master key option based on an RFID tag to open the safe in the event of a forgotten four digit code 48 Hotel Room Safe Controller e Local display LCD Display 25 e Sera 204 48 HOTEL ROOM SAFE CONTROLLER 49 Tachometer A tachometer measures the speed of rotating machinery in revolutions per minute RPM Measure the speed of the DC motor like this attach a circular cardboard disk about 3 inch diameter with a single notch cut into the disk edge to the motor shaft and then place the disk edge in the light path of the photointerrupter the photointerrupter detector will generate one pulse per revolution Take the reciprocal of the measured time between pulses useful for low RPM or measure the number of pulses during a given time interval useful for high RPM Use the Step and Direction Signal mode of the LabVIEW myRIO Encoder with the Reset
134. itches at Position 0 and then applies an ascending binary sequence to switch closings as the dial rotates clockwise The DIP switches may connect directly to the digital input without any additional components because of the internal pull resistors on the NI myRIO DIO lines Each DIP switch can be interpreted by software in a number of different ways including single integer numerical value single Boolean array pattern and groups of binary patterns or numerical values called bitfields Study the video Pushbutton Interfacing Theory youtu be e7UcL5Ycpho 4 24 to learn about the DIO pull resistors and how to properly connect a single SPST switch for pull up resistors MXP Connectors A and B and for pull down resistors MSP Connector C Each of the SPST switches on the standard DIP switch must have one terminal tied either low to ground for pull up resistors or high to the power supply for pull down resistors it is customary to tie all of the terminals on a given side but you could use any pattern that you like Study the video youtu be KNzEyRwcP Ig 7 16 to learn more about the DIP switch and the rotary DIP switch especially various ways that you can interpret the switch patterns as meaningful information in software LabVIEW programming Study the video Run Time Selectable I O Channels youtu be uJW7CaL6L5c 1 54 to learn how to use the low level Digital Input VIs to select the DIP switch connector pins from the front pane
135. k carefully at the PmodACL board to see the X and Y co ordinate system axes Try shaking the accelerometer along a particular axis and then correlate this motion with what you see on the front panel The coordinate system follows the right hand rule therefore the Z axis point up from the top of the board Next try some static constant acceleration measurements that form the basis of level and tilt sensing applications For example place the edge of the board marked X on a level surface and then rock the board back and forth as you observe the front panel What do you observe about the sign of the measured X axis acceleration Note the position of the board when the X axis acceleration reaches its maximum deviation from zero Can you form an idea of how a static acceleration measurement could be converted into a tilt sensor reporting its results in degrees off center Lastly try tapping the edge of the board on the table or tap the edge with your finger The NI myRIO onboard LEDO will flash to indicate that a single tap event was detected by the accelerometer Single tap detection is only enabled along the X axis Try tapping on the three different axes as you observe the LED Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run butt
136. l dial indicator see the built in Re Im To Polar VI Assuming that you have already added the offset corrections code previous modification com pare the accuracy of your compass measurement to that of another instrument You can find many compass apps for your smartphone for example 5 Add code to read the three HMC5883L device ID registers addresses 0x0A through 0x0C and to generate an error condition if the ID does not match the expected value in this way your VI can detect that the correct I C bus device is attached to the NI myRIO PC terminals Study the HMC5883L datasheet register map Tables 18 through 20 to determine the expected values Select one of the pop up dialog box VIs from the Programming Dialog amp User Interface subpalette to display your error message 23 COMPASS 23 4 Integrated Project Ideas Now that you know how to use the compass consider integrating it with other devices to create a complete system for example Data Loggentti Steer By Wire EE 23 5 For More Information PmodCMPS Reference Manual by Digilent Reference manual for the compass ttp digilentinc com Data Products PMOD CMPS PmodCMPS rm revAl pdf PmodCMPS Schematics by Digilent Schematic diagram of the compass ttp digilentinc com Data Products PMOD CMPS DI FU modCMPS_A1_ sch pdf HMC5883L Datasheet by Honeywell Datasheet for the HMC5883L Three Axis Compass click the HMC5883L Brochure
137. l connections on the display all of the eight anodes are tied together an brought out as the common anode pin Study the video Seven Segment LED Interfacing Theory youtu be POEROVXv Sw 4 11 to learn about the voltage current characteristics of the individual LED segment why the segment controls are active low and why no current limiting resistors are required for this particular device LabVIEW programming Study the video Digital Out put Express VI youtu be Y8mKdsMAqrU 2 21 to learn how to access all of the available digital outputs with the NI myRIO Digital Output Express VI in cluding single output multiple outputs and choice of connector In addition study the video youtu be WvnInG3ffgY 4 53 to learn how to access and use the lower level code created by the Express VI to connect Boolean arrays directly to the digital outputs i e as a bus 3 3 Basic Modifications Study the video Seven Segment LED Demo Walk Through youtu be ejy0o_k9K10 2 03 to learn the design principles of 7 segment 3 SEVEN SEGMENT LED DISPLAY e deg CA common anode dp Pin MXP Termine h 0 B DID II i b B DID1 13 e B DIDZ IS d B DI03 17 e B DID4 9 f B DIDS 2 4 B DID6 23 dp B DID7 25 CA B 43 3V 33 EN a na ee ga Pars 33 i 33 jee if E 34 11 de ie um ee spe bed The ny Vd Ze A REPT i I Figure 3 2 Demonstration circuit for seven segment displ
138. l instead of editing the VI itself 5 3 Basic Modifications Study the video DIP Switch Demo Walk Through youtu be ZMyYRSsOCac 2 30 to learn the design principles of DIP Switches demo and then try 5 DIP SWITCHES making these modifications to the block diagram of Main vi 1 Display the DIP switch pattern as an 8 bit unsigned integer UINT8 data type using the right most switch as the least significant bit LSB and the down position as logical 0 2 Display the DIP switch pattern as three distinct fields as follows Field 1 bits 2 0 3 bit integer Field 2 bits 6 3 4 bit integer and Field 3 single bit Boolean 3 Display the 16 position rotary DIP switch pattern as a 4 bit integer displayed in both decimal and in hexadecimal 4 Move either or both of the DIP switches to the MSP Connector C remember these have pull down resistors and repeat some of the previous exercises Use a single strategically placed NOT gate to avoid changing other parts of the block diagram Also remember to connect the DIP switch common terminal to C 5V pin 20 5 4 For More Information e 2 Wire Controlled Digital DIP Switch by Maxim Integrated An electronic replacement for mechanical DIP switches the DS3904 contains microcontroller controlled nonvolatile variable resistors that offer smaller footprint higher reliability and lower cost 6 Relay Low power digital outputs lack the necessary current drive to o
139. lay Inter facing Theory youtu be m0Td7Kbhvdl 10 36 to learn more about the LCD character display operation with UART interface including setting the baud rate sending display information and escape sequences and available configuration instructions Study Serial Communication UART youtu be odN66E85J5E 7 56 to understand how the UART Express VI configuration options relate to the signaling waveforms between UART transmitters and receivers 120 26 LCD CHARACTER DISPLAY UART INTERFACE LabVIEW programming Study the video e Digital Bubble Level 56 Express VI youtu be OFMnkFDsGos 5 29 to learn e EEPROM Programmer 58 how to use the UART Express VI to read and write Character strings including strings with special barca 26 5 For More Information e PmodCLS Reference Manual by Digilent 26 3 Basic Modifications Reference manual for the LCD character display Study the video LCD UART Demo Walk Through youtu be JsEMMnIWgAk 3 44 to learn the design P modCLs Schematics by Digilent Schematic principles of LCD UART demo and then try diagram of the LCD character display making these modifications to the block diagram dii 1 Interchange the two display rows when the NI myRIO on board button is pressed revert to the original display when the button is released 2 Display the full character set Cycle through all possible 256 8 bit patterns and see if you can spot the ASCII code for the degrees symbol
140. lbar signifying that the VI is in run mode and e Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections 4 2 Interface Theory Interface circuit The pushbutton switch normally appears as an open circuit and becomes a short circuit when pressed The pushbutton may be connected directly to the digital input without any additional components because of the internal pull resistors on the NI myRIO DIO lines Study the video Pushbutton Interfacing Theory youtu be e7UcL5Ycpho 4 24 to learn about the DIO pull resistors and how to properly connect the pushbutton switch for pull up resistors MXP Connectors A and B and pull down resistors MSP Connector C Study Detect a Switch Signal down resistor Press the pushbutton and you should Transition youtu be GYBmRJ_gMrE 4 42 to learn 4 PUSHBUTTON SWITCH 15 8 Dlog 1 Ignore side with three terminales B GND 12 AAA a frre ae ee ia ay in RS RS ET E pe rear siege Ew a A pe N a les 1 1 i lt 4 Pra i y 1 Figure 4 2 Demonstration circuit for pushbutton switch schematic diagram recommended breadboard layout and connection to NI myRIO MXP Connector B how to detect a switching signal transition inside to learn how to use Digital Input Express VI to sense a software while loop structure the state of the pushbutton LabVIEW programming Study the video Input Express VI youtu be
141. le at 100 FS and then at 100 FS Use the direct entry box at the top of the slider to apply step changes e g 100 FS to 100 FS how quickly does the servo rotate between these two angles The default limits on the slider allow a 2x over travel factor At what FS values does the servo reach its rotation limits The servo command input is a variable width pulse with 1 0 ms at 100 FS and doubling to 2 0ms at 100 FS the midpoint pulse width 1 5 ms called the neutral position pulse width corresponds to 0 FS The pulse must be repeated at a sufficiently fast rate and yet not too fast Try adjusting the freq HZ control to a lower frequency say 10 Hz and to a higher frequency say 200 Hz each time moving the position slider to command different angles Note the two indicators under this control that indicate the pulse width and duty cycle percent of time that the pulse is active of the signal sent to the servo command input What happens to the servo angle at these frequency extremes Experiment to determine a range of frequencies that yields satisfactory control of the servo angle Disconnect the servo and replace it with the continuous rotation servo GWS GWS S535 XF this servo uses a slightly different connector red 5 V brown ground and yellow command input Investigate the behavior of this servo and compare it to your earlier results Click the Stop button or press the escape key to s
142. les with data retention over 200 years The array may be read in any fashion from a single byte up to the entire array in a single read operation Data may be written to the array either as individual bytes or up to a single page of 16 bytes provided that the starting address is a page boundary Study the video youtu be RxRwyDOCeRw 11 18 to learn more about the 25LC040A features applications pinout for the 8 pin DIP package instruction set and necessary configuration settings for the NI myRIO SPI VIs The video continues by detailing the timing of the chip select CS necessary to read from and write to the array and STATUS register including considerations for writing to the entire array and 30 SERIAL EEPROM concludes by describing how to use the HOLD pin to suspend an SPI bus transaction momentarily Study Serial Communication SPI youtu be GaXtDamw5As 7 02 to better un derstand the signaling waveforms between SPI transmitters and receivers LabVIEW programming Study the video SPI Express VI youtu be S7KkTeMfmc8 5 51 to learn how to use the SPI VIs to read and write data 30 3 Basic Modifications Study the video EEPROM Demo Walk Through youtu be UNdVUnYHE4U 13 07 to learn the design principles of EEPROM demo and then try making these modifications to the block diagram Of Main vi 1 Add an action Write entire array that will fill the memory array e Add the item Write entire array to the Action contr
143. lized NOTE The additional connections to B DIOO and B DIO1 simply provide another way to observe 13 ROTARY ENCODER B DIOO 11 J B ENC A 18 B ENC B 22 B DIO1 13 0 01uF 0 01pF B GND 20 rotary encoder Q B ComM A a h u a a A es eee ss lt Y s a ya sn 30 qu gt s e serc seas s sees 28 Eu eee oiie n A push button Switch Figure 13 2 Demonstration circuit for rotary encoder schematic diagram recommended breadboard layout and connection to NI myRIO MXP Connector B 53 54 the switching activity they are not required for decoding Study the video Rotary Encoder Interfacing youtu be CpwGXZX 5Ug 10 08 to learn about the rotary encoder principles of operation the quadrature waveforms produced by Switches A and B interfacing techniques for the NI myRIO MXP and MSP connectors and dealing with switch bounce that when ignored causes erroneous decoding of the switching waveforms 13 3 Basic Modifications Study the video Rotary Encoder Demo Walk youtu be nmGlRqhQ6Rw 3 15 to learn the design principles of Rotary Encoder demo and then try making these modifications to the block diagram of Main vi 1 Temporarily disconnect the two capacitors from the circuit thereby removing the switch de bouncing circuit Experiment with various shaft rotation speeds and see if you can observe any relationship between rotation speed and counting err
144. luding single output multiple outputs and connector type 2 3 Basic Modifications Study the video LED Demo Walk Through youtu be SHJ vu4jorU 2 03 to learn the design principles of Discrete LED demo and then try making these modifications to the interface circuit and to Main vi 1 Add a front panel control to adjust the blink frequency specified in Hertz at what frequency does the blinking become imperceptible 2 Blink two adjacent LEDs to simulate a railroad crossing signal 3 Blink the green and blue LEDs of the RGB LED using the same LabVIEW code as the railroad crossing signal refer to Figure following page for the RGB LED pinout diagram Use the current sourcing interface circuit 2 DISCRETE LED 4 Create an LED variable intensity dimmer with 2 5 For More Information the PWM Express VI to create a pulse width modulated digital output Set the Frequency to e LED Mixed Bag 5mm by SparkFun Need the default constant value of 1000 Hz and create more LEDs The LED Mixed Bag from SparkFun a pointer slide control to adjust the duty cycle Offers the same type as those in the NI myRIO select the logarithmic mapping option for the Starter Kit also search SparkFun for many other control too Add some code to account for the sizes and types of LEDs active low current sinking LED interface bonus points with a Boolean control to select between e Engineering Thursday LED Light Boxes by current sinking and current sourcin
145. m signal with a Boolean front panel control as an enable Review Dis crete LED demo lvproj from Section to learn how to make a two state oscillator 11 4 Integrated Project Ideas Now that you know how to use the buzzer speaker consider integrating it with other devices to create a complete system for example e 55 e INTP Clock 42 11 5 For More Information e Products by Soberton Inc Discover related products to the buzzer speaker in the NI myRIO Starter Kit http www soberton com products 11 BUZZER SPEAKER 1 2 Motor The low voltage DC motor pictured in Figure 3 Protect the transistor from back emf voltage provides sufficient mechanical power to drive small fans or to spin lightweight objects While the voltage is relatively low at 1 5 to 4 5 volts the current can get as high as several hundred milliamps or even several amps in stall blocked rotor conditions For this rea son a power MOSFET is used as a motor driver Fig ure 12 1 shows the NI myRIO Starter Kit DC motor Figure 12 1 NI myRIO Starter Kit DC motor Learning Objectives After completing the activities in this chapter you will be able to 1 Describe the DC motor principle of operation 2 Size the power transistor to drive the motor under various load conditions spikes when the transistor switches the motor current on and off 4 Design a voltage level shifting circuit from 3 3 volts to 5 volts and 5 Design the interface circ
146. matic diagram shown in Figure 3 2 on the following page the temperature sensor requires five connections to NImyRIO MXP Connector B see Figure A 1 on page 27 1 3 3 volt supply B 3 3V pin 33 2 Ground B GND pin 30 3 Serial data SDA B I2C SDA pin 34 4 Serial clock SCL B I2C SCL pin 32 152 33 TEMPERATURE SENSOR VDD B 3 3V 33 B I2C SDA 34 Li B I2C SCL 32 PmodTMP3 B DIOO 11 El Disable all pull up resistors MXP inputs Set address jumpers to are already pulled up 000 to obtain device address 0x48 Figure 33 2 Demonstration setup for temperature sensor connected to NI myRIO MXP Connector B Set all jumpers exactly as shown 33 TEMPERATURE SENSOR Ensure that all PmodTMP3 jumpers are set exactly as shown Run the demonstration VI e Download http www ni com academic myrio iF you have not done so previously and unpack the contents to a convenient location e Open the project Temperature Sensor demo lvproj contained in the subfolder Temperature Sensor demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking e Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running
147. may not allow the exclusion or limitation of incidental or consequential damages so the above limitation or exclusion may not apply to you Introduction NI myRIO Starter Kit Discrete LED Seven Segment LED Displa Pushbutton Switch DIP Switches Rela al al al Jl O QO NI eN Ol Ha DI N al O lt O a s D _ pp Y Potentiomete Thermistor p lt p Photoce 0 Electret Microphone 1 Buzzer Speaker 3 Rotary Encoder 4 Photointerrupter 5 Hall Effect Sensor 4 13 17 21 27 31 35 39 43 47 51 55 59 vi CONTENTS 63 67 17 Servo 69 75 81 85 89 95 101 24 Ambient Light Sensor 107 II NI myRIO Embedded Systems Kit 111 25 Keypad 113 117 121 125 129 135 141 147 33 Temperature Sensor 151 34 MEMS Microphone 157 CONTENTS V Additional Devices 5 USB Flash Driv O 6 Webcam 7 GPS Receive 8 RFID Reader QI lt Bo WwW Ww m p er ge bi DI n O ou Po ai IS O A pesi p Qi O DI YN 9 Handheld Mete Ha 0 Wireless Sensor 1 Data Logger 2 NTP Clock 3 Steer By Wire 4 Digital Thermometer QI 5 3 D Color Controller 6 OR Code Scanner 7_RPN Calculator 8 Hotel Room Safe Controller 9 Tachometer 0 Scanning Sensor 1 On Off Control System 2 Security Camera 3 Compass with Tilt Correction 4 Guitar Tuner 163 165 169 173 177 183 185 187 189 191 193 195 197 199 201 203
148. mode a voltage divider providing an adjustable voltage Study youtu be GaXtDamw5As 7 02 to understand how the SPI Express VI configuration options relate to the signaling waveforms between SPI transmitters and receivers LabVIEW programming Study the video SPI Express VI youtu be S7KkTeMfmc8 5 51 to learn how to use the SPI Express VI 32 3 Basic Modifications Study the video Dpot Demo Walk Through youtu be dtwx0j5vvy4 4 57 to learn the design principles of Dpot demo and then try making these modifications to the block diagram of Main vi 1 Interchange the A and B connections and confirm that the analog voltage decreases as you increase the digital value 2 Evaluate the linearity of the digital potentiometer Change the while loop structure to a for loop create an array of the analog voltage at each digital value and then plot the analog voltage as a function of digital voltage 3 Continue the linearity evaluation of the previous step by plotting the difference of the measured analog voltage and the ideal analog voltage This difference plot makes it much easier to identify any trends of nonlinearity e PmodDPOT Reference Manual by Digilent Ref erence manual for the digital potentiometer board PmodDPOT_rm pdf e PmodDPOT Schematics by Digilent Schematic diagram of the digital potentiometer board PmodDPOT_sch pd e AD5160 Data Sheet by Analog Devices Complete information on the AD5160
149. mps Study the video H Bridge and Geared Moto Interfacing Theory youtu be W526ekpR8q4 11 26 to learn more about the H bridge principles of operation PmodHB5 and IG22 features speed control with pulse width modulation PWM Hall effect sensors and quadrature encoded sensor signals and an overview of closed loop control of the motor position and speed by using the sensor signals as feedback LabVIEW programming Study the video youtu be mVN9jfwXleI 2 41 to learn how to use the PWM Express VI to create a pulse width modulated square wave to provide variable speed motor operation to learn the design principles of H Bridge amp Geared Motor demo and then try making these modifications to the block diagram of Main vi 1 Determine the number of shaft encoder counts for one revolution of the gearbox shaft output hint you need to know the gearbox ratio and the number of encoder counts for one revolution of the sensor magnet and then add block diagram code to display the gearbox output shaft angle in degrees 2 Add a display to show the gearbox output shaft RPS revolutions per second 3 The block diagram has been intentionally designed to make it easy for you to add a PID proportional integral derivative controller to implement a closed loop speed control system a Open up some vertical space immediately to the right of the Encoder Express VI press Ctrl and left mouse click and drag and then disconne
150. n and User Manual by NXP Semiconductors A complete treatment of the I C bus standard including timing diagrams and multi master systems 105 106 23 COMPASS 24 Ambient Light Sensor An ambient light sensor ALS provides a rudi mentary eye that enables a robot to sense general lighting conditions to track and follow a light source and to follow a painted line pathway The PmodALS pictured in Figure 24 1 integrates a phototransistor sensor with an 8 bit analog to digital converter ADC that communicates via the SPI serial bus Figure 24 1 NI myRIO Mechatronics Kit ambient light sensor Learning Objectives After completing the activities in this chapter you will be able to 1 Describe the principles of operation of the phototransistor and analog to digital converter ADS combined on the PmodALS board 2 State the timing requirements for the chip select and SPI clock and 3 Interpret the format of the SPI data word output 24 1 Component Demonstration Follow these steps to demonstrate correct operation of the ambient light sensor Select these parts from the NI myRIO Mechatronics Kit e Ambient light sensor PmodALS http digilentinc com Products Detail cfm NavPath 2 401 1190 amp Prod PMOD ALS e Jumper wires F F 5x Build the interface circuit Refer to the schematic diagram shown in Figure 24 2 on the next page the ambient light sensor requires five connections to NI myRIO MXP Connector
151. navigation This basic method requires that the compass be held parallel to the ground however this may not always be convenient or even possible A compass tilt correction procedure exists provided that an accelerometer is available to indicate the angle of the compass with respect to ground Study the article Applications of Magnetic Sensors for Low Cost Compass Systems linked in the For More Information section at the end of Chapter 23 to learn how to mathematically correct for compass tilt and then create your own tilt compensated compass Include an option to disengage tilt compensation so that you can make a study of the improved performance e Measurement display LCD Display e Onboard accelerometer Accelerometer 214 53 COMPASS WITH TILT CORRECTION 54 Guitar Tuner A microphone provides your NI myRIO the op portunity to listen to you as you tune your guitar The built in VI Extract Single Tone Information an alyzes the microphone audio signal and returns the frequency of the tone with the highest amplitude i e the fundamental frequency of a single guitar string A six string guitar tuned according to equal temperament has the following string frequencies see Perception of Sound for a description of equal temperament and cnx org content m15440 for an interactive piano keyboard that displays pitch frequencies String 1 EA 440 x 279 12 329 6 Hz String 2 B3 440 x 2710 12 246 9 Hz Stri
152. nd source Study the video ircuit youtu be izJni0PMObI 8 48 to learn about the electret microphone principle of operation and the NI myRIO equivalent circuit for the AUDIO IN that provides power to the electret microphone as well as AC signal coupling the video also describes a simple three component audio preamplifier circuit Figure that applies a gain factor of over 100x to greatly improve the sensitivity of the microphone 10 3 Basic Modifications Study the video Electret Mic Demo Walk Through youtu be kZoFwORYz 98 2 52 to learn the design principles of Electret Microphone demo and then try making these modifications to the block diagram of Main vi 1 Add a real time amplitude spectrum display use the point by point version of the built in Amplitude and Phase Spectrum VI located on the Signal Processing Point by Point Spectral subpalette 2 Add a VU volume meter that displays signal intensity use the AC output of the built in AC amp DC Estimator PtByPt VI located on the Signal Pro cessing Point by Point Sig Operation subpalette 3 Try building the simple three component audio preamplifier circuit of Figure pagelif you find that the electret microphone pro vides insufficient sensitivity for your application You may wish to build this circuit on a small perf board perforated plastic board with holes drilled on 0 1 centers with a jack on one side for the CY 502 and a plug on the other side
153. ner has a QR code label that can be conveniently scanned by a webcam As another example each robot in a road race could be tagged with a QR code and the scanner could automatically identify each robot by name as it passes by a checkpoint Combine the webcam and the LCD display to create your own QR code scanner The example LabVIEW project QR Code Scanner gets you started e Local display LCD Display 200 46 OR CODE SCANNER 47 RPN Calculator Combine the keypad and LCD display to create your own version of the familiar pocket calculator The LabVIEW project RPN Calculator gets you started with the basic framework of an RPN reverse Polish notation stack based calculator This project illustrates the Simple State Machine design pattern the calculator waits for a button to be pressed on the keypad idle state moves to one of several calculation states depending on the button that was pressed and then returns to the idle state to wait for the next key press An RPN calculator requires you to enter two values and then select the operation For example add two values by first pressing the numerical keys for the first value press E to enter the value onto the stack press the numerical keys for the second value and then press A to add the values See the block diagram of Main vi for the keypad layout The RPN Calculator project includes sev eral VIs to serve as a high level API application progr
154. nfirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the state of the NI myRIO on board 3 axis accelerometer as three values X Y and Z directions and the state of the built in pushbutton on the bottom side of myRIO press the button to see the state change from 0 to 1 Change the orientation of myRIO to see the accelerometer values change and shake myRIO to see larger acceleration values You may wish to hold or tape the LCD character display to the top of myRIO too Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections Correct LCD character display connector ter minals double check your connections and ensure that you have connected the NI myRIO SPI MOSI output to the LCD character di
155. ng 3 G3 440 x 2711 12 196 0 Hz String 4 D3 440 x 2719 12 146 8 Hz String 5 A2 440 x 2721 12 110 0 Hz String 6 E2 440 x 2729 12 82 41 Hz Create a display that at a minimum shows the frequency in Hz of the detected tone Add more sophistication by detecting and displaying the nearest string name with an indication of the number of cents sharp or flat one cent is one hundredth of a semitone For example suppose the detected frequency is 333 5 Hz This is frequency is nearest String 1 but is too high sharp by 3 9 Hz At the target frequency 440 x 277 12 an error e in cents causes the frequency to shift to 440 x 26 5 100 12 Solving this equation for e yields an error of 20 2 cents or about 20 of a semitone sharp Make the display even more user friendly by displaying a bar graph under the detected frequency that indicates the direction of the tuning error bar to the right for sharp bar to the left for flat with the bar length indicating the amount of error e Measurement display LCD Display e Electret Microphone 10 e MEMS Microphone 34 216 54 GUITAR TUNER 95 Music Maker Drive the speaker from a tone generator whose frequency and amplitude is controlled by sensors For example you could light level detected by a pho tosensor to control the frequency and the orientation of the accelerometer to control the amplitude Photocell e Onboard accelerometer 218 55 MUSIC MAKER
156. nimum and maximum observed temperatures e Time and date display LCD Display 26 27 28 e Temperature sensors Thermistor 8 196 44 DIGITAL THERMOMETER 45 3 D Color Controller The gyroscope and accelerometer both provide three axis measurements related to orientation of the sensor The RGB LED mixes the primary light colors to produce any arbitrary color Use one of the these 3 D sensors to control the RGB LED color by mapping the X axis to red Y axis to green and Z axis to blue Use three PWM outputs to provide intensity control of each LED Provide the option to calibrate the sensor values so that a given value on each axis produces the same intensity on each LED Also investigate nonlinear mapping functions that will make the LED intensity appear to vary proportionally with the sensor variable RGB LED e 3 D sensors Onboard accelerometer Accelerom en 198 45 3 D COLOR CONTROLLER 46 QR Code Scanner OR codes are a popular type of 2 D bar code that encodes a website s URL The LabVIEW Vision library includes the VI IMAQ Read QR Code to extract the URL as a string A quick Internet search reveals many free OR code generating services i e Because you can enter arbitrary text the generated QR code pattern is not restricted to URLs but may be used to represent any type of information that you wish For example you could create unique QR codes for an inventory control system in which each object or contai
157. o 128 learn how to send display information escape se 28 4 28 LCD CHARACTER DISPLAY 1 C BUS INTERFACE quences and configuration instructions to the LCD character display Study Now that you know how to use the LCD character RC youtu be 7CgNF78pYOM 8 47 to understand display consider integrating it with other devices how the I2C Express VI configuration options to create a complete system for example relate to the signaling waveforms between I C bus transmitters and receivers LabVIEW programming Study the video Express VI youtu be OFMnkFDsGos 5 29 to learn useful string formatting techniques 28 3 Basic Modifications Study the video LCD 12C Demo Walk Through youtu be qbD31AeqOMk 4 32 to learn the design principles of LCD 12C demo and then try making these modifications to the block diagram of Main vi 1 Interchange the two display rows when the NI myRIO on board button is pressed revert to the original display when the button is released Display the full character set Cycle through all possible 256 8 bit patterns and see if you can spot the ASCII code for the degrees symbol Create an instruction tester Make two string controls one for the instruction and a second for the display use Boolean controls to disable sending either one Experiment with the serial clock frequency does the LCD character display appear to support both Standard mode and Fast mode
158. o and then try making these modifications to the block diagram of Main vi 1 Add the onboard LED Express VI myRIO Onboard subpalette as an indicator on the output of the edge detector the AND gate Confirm that the LED flashes briefly when you block the photointerrupter optical path 2 Measure and display the elapsed time between photointerrupter events use the Elapsed Time 57 58 Express VI Programming Timing subpalette inside a case structure with the selector terminal connected to the edge detector output 14 4 Integrated Project Ideas Now that you know how to use the photointerrupter consider integrating it with other devices to create a complete system for example e Tachometer 9 14 5 For More Information e How do I set up photogates for data collection by Vernier Review of various ways to use a photointerrupter to take time based measure ments such as elapsed time and speed e Switch Tips Photointerrupter switches by Ma chine Design Replace mechanical pushbuttons with a photointerrupter based pushbutton to improve reliability and maximize equipment life 14 PHOTOINTERRUPTER 1 5 Hall Effect Sensor The Hall effect provides an elegant way to sense magnetic fields as a change in voltage Hall effect sensors provide either digital or analog outputs with the former finding numerous applications in detecting proximity and sensing position and speed while the latter can map the field stren
159. o make the VI start automatically Expected results This project contains three distinct Main vi top level applications 1 Main single image vi Ihis demo VI captures a single image and detects the edges in the image Select your webcam with the web cam front panel control and then run the VI You should see the webcam image on the left side and its edge detected version on the right side Adjust the high threshold HThresh control to change the sensitivity of the edge detector 2 Main video stream vi This demo VI captures a video stream and processes the stream in real time Select your webcam with the we bcam front panel control and then run the VI You should see the webcam image on the left hand side and its processed version on the right hand side the VI begins with no processing pass through mode Select the type of video process ing with the processing front panel control Ad just the high threhold HThresh control to change the sensitivity of the edge detector Try the hue processing mode to to display a gray level image where each gray level represents a different color can you relate the color in the image to its gray tone Also try the luma processing mode to display the gray level equivalent of the source image Click adjust saturation to enable adjust ment of the webcam Saturation property and then move the horizontal pointer control What level seems to provide the most pleasing color bal
160. o the LCD character display SD terminal on connector J2 and the SCL line to the SC terminal also check that you have not accidentally crossed the power supply connections and Correct mode jumper settings refer again to the circled region of Figure 28 2 on the facing page for the proper settings NOTE Double check the SDA and SCL connections should you see the message Error 36011 occurred at myRIO Write 12C vi or similar this message indicates that NI myRIO did not receiving an expected acknowledge ment from the LCD character display I C bus interface 28 2 Interface Theory Interface circuit The LCD character display sup ports three serial communication standards UART univeral asynchronous receiver transmitter SPI se rial peripheral interface and I C bus inter IC This chapter concentrates on the I C bus interface com monly denoted I2C while the previous two chap ters cover the other interfaces the functionality of the LCD character display itself remains independent of the selected communication standard Simply send ASCII characters to the display s I C bus receive line to make them appear on the display screen Use escape sequences to configure other aspects of the display such as homing the cursor displaying and blinking the cursor scrolling the display and so on Study the video LCD Character Display Inter facing Theory youtu be m0TA7KbhvdI 10 36 t
161. og N ER LN a a a Aaaa A A a at A DIA A pre r pes jari i i i 35 o 5 I i 3 USI88 EUA Von GND Vour Figure 15 2 Demonstration circuit for Hall effect sensor schematic diagram recommended breadboard layout and connection to NI myRIO MXP Connector B 61 62 15 3 Basic Modifications Study the video Hall Effect Sensor Demo Walk youtu be BCJLg WbIKA4 2 36 to learn the design principles of Hall Effect Sensor demo and then try making these modifications to the block diagram of Main vi 1 Add the onboard LED Express VI myRIO Onboard subpalette to indicate the Hall effect sensor Output state 15 4 Integrated Project Ideas Now that you know how to use the Hall effect sensor consider integrating it with other devices to create a complete system for example Handheld Mete e Data Logger 41 e Steer By Wire 43 15 5 For More Information What is the Hall Effect by Melexis com Includes an excellent animation of the charge dis placement phenomenon due to a magnetic field ttp www melexis com Assets o DI DE a E E na Hh Hh J N x Hall Applications Guide by Melexis com Slide by switch proximity sensor rotary interrupt switch pushbutton flowmeter liquid level sensing brushless DC motor commutation and many more includes detailed discussion of w E H u ct D w D Q W o w u je ttp www melexis com Assets
162. ol Create an array of 512 values that will produce a recognizable pattern on the graph display e g Sine Pattern from the Signal Processing Sig Generation subpalette Use Reshape Array from the Programming Array subpalette to form a 32x16 2 D array 32 pages of 16 bytes each e Duplicate the Write to array subdiagram of the case structure and e Wrap the operation in a for loop structure Note that the 5 ms delay must be used between page writes 30 4 Integrated Project Ideas Now that you know how to use the serial EEPROM consider integrating it with other devices to create a complete system for example 30 SERIAL EEPROM 139 e EEPROM Programmer 58 30 5 For More Information e 25LC040A Data Sheet by Microchip Data sheet for the Microchip 25LC040A serial EEPROM http www microchip com 25LC040A e M68HC11 Reference Manual by Freescale Semiconductor Refer to Section 8 for a complete treatment of the SPI serial bus standard including timing diagrams and multi master systems 140 30 SERIAL EEPROM 31 Bluetooth Module Bluetooth radios provide short range up to 20 m data communication between mobile appliances such as smartphones laptop computers headsets and audio systems The Roving Networks now Microchip RN42 Bluetooth module at the heart of the Digilent PmodBT2 pictured in Figure 5 provides a simple to use interface between an embedded controller and another Bluetooth capable devic
163. om the NI myRIO Embedded Systems Kit e LCD character display with serial interface PmodCLS Detail cfm NavPath 2 401 473 amp Prod PMOD CLS e Jumper wires F F 4x Build the interface circuit Refer to the schematic diagram shown in Figure 27 2 on the following page the LCD character display requires four connections to NI myRIO MXP Connector B see Figure A 1 on page 27 1 3 3 volt supply B 3 3V pin 33 2 Ground gt B GND pin 30 3 SPI receiver gt B SPI MOSI pin 25 4 SPI clock B SPI CLK pin 21 122 27 LCD CHARACTER DISPLAY SPI INTERFACE VDD B 3 3V 33 J1 SI B SPI MOSI 25 PmodCLS J1 CK B SPI CLK 21 n BIGND 30 tizi do a hh ee tees em E AA E ee NOE Tn SONS A OLE RE GO E IT PIET AM TIPO Te em e 2 pe 4 EN e gr n 3 i r 3 o 2 n O i z 1 1 A Set mode jumpers for SPI f Figure 27 2 Demonstration setup for LCD character display connected to NI myRIO MXP Connector B Remember to set the mode jumpers as shown for SPI serial communications 27 LCD CHARACTER DISPLAY SPI INTERFACE Run the demonstration VI e Download http www ni com academic myrio iF you have not done so previously and unpack the contents to a convenient location e Open the project LCD SPI demo lvproj contained in the subfolder LCD SPI demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking e Co
164. on offers a non contact scanning method for access control and inventory management An RFID reader queries an RFID tag to determine the unique bit pattern encoded in the tag Passive RFID tags power their on board electronics from the magnetic field generated by the reader Figure shows the ID Innovations ID 12LA RFID reader along with the breakout board that converts the 2 mm pin spacing to standard 0 1 inch pin spacing for breadboards 1012 Breakout P Seeeee0 p gt LIDO A 18527 S DO ANT a _ A e e Figure 38 1 D Innovations ID 12LA RFID reader with breakout board Learning Objectives After completing the activities in this chapter you will be able to 1 Describe the EM4001 RFID tag standard 2 Interpret the ID 12LA UART output format and 3 Implement the checksum calculation 38 1 Component Demonstration Follow these steps to demonstrate correct operation of the RFID reader Select these parts e ID Innovations ID 12LA RFID reader e Breakout board for ID 12LA RFID reader reakaway header straight pin www sparkfun com products 116 ID tag 125 kHz EM4001 format 2x e LED needs info e Jumper wires M F 4x You will also need access to a soldering station DI 23 uy AS J Build the interface circuit The RFID reader breakout board requires soldering Refer to Figure 38 2 on the to see how the reader and breakout board should look when finished Begin by br
165. on on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that you are using Connector A and that you have the correct pin connections Correct PmodACL connector terminals double check your connections and ensure that you have connected the NI myRIO I C bus SDA line to the PmodACL SDA terminal on connector J2 and the SCL line to the SCL terminal also check that you have not accidentally crossed the power supply connections and Correct PmodACL interrupt terminals to the NI myRIO DIO lines the front panel only updates in response to the data ready interrupt 91 92 NOTE Double check the SDA and SCL connections should you see the message Error 36011 occurred at myRIO Write 12C vi or similar this message indicates that NI myRIO did not receive an expected acknowledgement from the PmodACL I C bus interface 21 2 Interface Theory Interface circuit The Analog Devices ADXL345 triple axis accelerometer at the heart of the PmodACL supports the I C bus serial interface commonly denoted I2C the ADXL345 also supports the SPI serial interface however this chapter concentrates exclusively on the I C bus interface The ADXL345 includes two interrupt outputs designated INT1 and INT2 These pins provide access to eight different interrupt sources which may be enabled as needed Thirty addressable registers
166. onstrate correct operation of the serial EEPROM Select these parts from the NI myRIO Embedded Systems Kit e Microchip 25LC040A serial http www microchip com 25LC040A e Jumper wires M F 7x EEPROM Build the interface circuit Refer to the schematic diagram shown in Figure the serial EEPROM requires six connections to NI myRIO MXP Connector B see Figure A 1 on page 27 VCC B 3 3V pin 33 VSS gt B GND pin 30 ST B SPI MOSI pin 25 SO gt B SPI MISO pin 23 SCK B SPI SCLK pin 21 CS B DIOO pin 11 WP gt B DIOO pin 13 ND OTE 0 NH 136 30 SERIAL EEPROM VDD B 3 3V 33 B SPI MOSI 25 Bi SO B SPI MISO 23 Microchip 25LC040A B DIO1 13 B SPI SCLK 21 B DIOO 11 E B GND 30 a otte rito tra oe _ no PINAR ANY APIS iI DS AAA NS AAN POETA NAAA Ea era On pr er e i mets a er 7 i 2 i i i 3 a de a 5 o o f G i er 7 39 Use Jumper wire to keep HOLD pin tied to high level Figure 30 2 Demonstration setup for serial EEPROM connected to NI myRIO MXP Connector B 30 SERIAL EEPROM Be sure to include a short jumper wire to connect the HOLD input to the NI myRIO 3 3 volt supply Run the demonstration VI e Download http www ni com academic myrio if you have not done so previously and unpack the contents to a convenient location e Open the project EEPROM demo lvproj contained in the subfolder EE
167. or the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the three axis compass values in three formats as the six bytes retrieved from the compass DATA registers as three signed integers formed by combining the two bytes retrieved per axis and as a waveform chart You will soon learn how to convert these values to magnetic field strength in gauss Before entering the main loop the VI configures the compass registers for averaging mode data rate range and continuous measurement mode Run the VI and then observe the front panel display as you move and rotate the compass Hold the board component side up and level with the 23 COMPASS ground and then rotate the board while observing the X value when X reaches its maximum positive value with the board still level the right side of the board points to magnetic north Hold the PmodCMPS board component side up and level with the ground Gradually tilt the board until the Z axis reaches either a positive or negative extreme value
168. or Replace the capacitors and see if you can cause any count errors to occur remember that each detente click corresponds to four counts 2 Create a front panel indicator to display the number of full encoder shaft revolutions 3 Add the onboard button myRIO Onboard Button Express VI as another way to reset the counter value 4 Add two wires to use the pushbutton on the decoder 13 4 Integrated Project Ideas Now that you know how to use the rotary encoder consider integrating it with other devices to create a complete system for example e Steer By Wird 23 13 ROTARY ENCODER 13 5 For More Information e Quadrature Encoder Velocity and Acceleration Estimation with CompactRIO and LabVIEW FPGA by National Instruments A good review of quadrature encoders e Quadrature Encoding in a Rotary Encoder by Robot Room Look at the insides of a rotary encoder to better understand how it works see the adjacent pages in this article too e Rotary Encoder H W S W or No Debounce by HiFiDUINO A nice discussion of the rotary encoder switch bounce problem with hardware and software solutions http hifiduino wordpress com 2010 10 20 rotaryencoder hw sw no debounce 1 4 Photointerrupter A photointerrupter also called a photogate com Learning Objectives After completing the activities bines an infrared LED emitter to produce an optical in this chapter you will be able to light path and an infrared detec
169. ore Information e Machine Vision Concepts by National Instru ments Click the Table of Contents link to learn more about vision basics image processing and analysis and machine vision 372916P 01 nivisionconcepts machine_vision 171 172 36 WEBCAM 3 GPS Receiver All modern navigation relies on the Global Posi tioning System GPS satellite network to provide the 3 D coordinates latitude longitude and altitude of a GPS receiver anywhere on the planet with high pre cision and accuracy While the entirety of the global positioning system represents a sophisticated and complex system the PmodGPS Figure 37 1 based on the GlobalTech Gms u1LP GPS module provides a surprisingly simple way to access a wealth of information in addition to coordinates including precise time date heading speed and other useful information related to the specific satellites in view Figure 37 1 Digilent PmodGPS receiver based on the GlobalTech Gms u1LP Learning Objectives After completing the activities in this chapter you will be able to 1 Discuss GPS concepts including trilateration to measure 3 D coordinates 2 Capture the NMEA sentences ASCII text strings generated by the Gms ulLP as an array of strings in LabVIEW 3 Parse the sentence to extract individual data fields and 4 Extract information from the data fields using LabVIEW Scan From String and Format Into String VIs 37 1 Component Demonstration
170. ory youtu be 5JDkwG2rrlo 13 48 to learn about gyroscope principles of operation applications STMicroelectronics L3G4200D features and Digilent PmodGYRO connections and sensor axis orientation Continue studying the video to learn the necessary details to configure the L3G4200D registers read angular rate data and integrate the rate measure ments to obtain relative angular displacement The L3G4200D is a relatively complex device offering a wide range of options the video tutorial therefore concentrates on the subset of features that will quickly get you up and running The detailed example shows you how to do the following e Set the data rate and full scale range e Set up a high level threshold to generate a comparator style interrupt on the INT1 output pin e Generate a data ready interrupt on the INT2 output pin e Read the three sets of data registers and convert these rate values into measured acceleration in dps degrees per second units e Integrate the rate values to obtain relative angular displacement and e Estimate the zero rate level offset to reduce integrator ramp up Study Serial Communication RC youtu be 7CgNF78pYOM 8 47 to better un derstand the signaling waveforms between I C bus transmitters and receivers 22 3 Basic Modifications Study the video Gyroscope Demo Walk Through youtu be o_iuY0M3yDk 6 36 to learn the design principles of Gyroscope demo and then try making
171. ou see 2 Add the necessary computation to display the acceleration in g units 3 Add code to read the ADXL345 device ID register address 0x00 and to generate an error condition if the ID does not match the expected value in this way your VI can detect that the correct I C bus device is attached to the NI myRIO DC terminals Study the ADXL345 datasheet register map Table 19 to determine the expected value Select one of the pop up dialog box VIs from the Programming Dialog amp User Interface subpalette to display your error message 4 Compare the accelerometer performance to that of the NI myRIO onboard accelerometer by set ting up an additional set of front panel indicators see the Accelerometer Express VI located in the myRIO Onboard subpalette Use a piece of tape to affix the PmodACL to the myRIO case 21 4 Integrated Project Ideas Now that you know how to use the accelerometer consider integrating it with other devices to create a complete system for example 40 Data Logger 41 Digital Bubble Level 21 ACCELEROMETER 21 5 For More Information e PmodACL Reference Manual by Digilent Reference manual for the accelerometer modACL_rm pdf e PmodACL Schematics by Digilent Schematic diagram of the accelerometer modACL_sch pdf e ADXL345 Datasheet by Analog Devices Datasheet for the ADXL345 Digital Accelerometer ttp www analog com ADXL345 e UM10204 FC bus Specification and User
172. perate motors lights and other high current appliances Relays bridge the power gap using a relatively low power magnetic coil to control a switch designed to carry large currents Fig ure 6 1 shows the NI myRIO Starter Kit SPDT relay Figure 6 1 NI myRIO Starter Kit relay Learning Objectives After completing the activities in this chapter you will be able to 1 Discuss the relay principles of operation 2 Size the interface transistor to accommodate the relay coil current 3 Explain why the rectifier is necessary to suppress back emf voltage spiking when the transistor turns on and off 4 Design the interface circuit to work with DIOs that have internal pull resistors and 5 Ensure that the relay remains off during NI myRIO power on and reset 6 1 Component Demonstration Follow these steps to demonstrate correct operation of the relay Select these parts from the NI myRIO Starter Kit Oo Relay http ww cndongya com pdf relay3jzc 11f pdf rectifier e 1N4001 general purpose e ZVP2110A p channel enhancement mode MOS FET pdf e Breadboard e Jumper wires M F 3x Build the interface circuit Refer to the schematic diagram and recommended breadboard layout shown in Figure 6 2 on page 23 Note that the three relay switch contacts do not sit on tenth inch centers 22 therefore this side of the relay must hang off the side of the breadboard The interface circuit requires three connections to NI myR
173. piles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI includes three main front panel indicator zones 1 NMEA sentences on the bottom left displays the sentences ASCII text strings as received from the Gms ulLP GPS module the most recent sentence appears at the bottom of the indicator 2 Time Latitude deg and Longitude deg at the top of the front panel show examples of formatted data extracted from the NMEA sentences and 3 NMEA data fields right side from the SGPRMC Recommended Minimum Naviga tion Information sentence Run the demo VI and you should see a new cluster of NMEA sentences appear once every second On a cold start the Gms ulLP GPS receiver requires about one minute to begin generating valid informa tion at this time the 1PPS indicator on both the front panel and on the NI myRIO LEDO will begin to flash Note that overcast conditions and building obstructions may increase the time for the receiver to gain a fix on a sufficient number of satellites If you have a battery pack for your NI myRIO and a mobile computer you may want to observe the display as you move to other locations How well does the Speed over ground value match your speed Can you see the latitude and longitude indicators change value Find your time zone of
174. potentiometer Select these parts from the NI myRIO Starter Kit e Potentiometer 10 kQ e Breadboard e Jumper wires M F 3x Build the interface circuit Refer to the schematic diagram and recommended breadboard layout shown in Figure 7 2 on page 29 TIP Flatten the two tabs on either side of the potentiometer so that it sits flush on the breadboard surface The potentiometer interface circuit requires three connections to NI myRIO MXP Connector B see Figure A 1 on page 227 28 1 Pot Terminal 1 B GND pin 16 2 Pot Terminal 2 B AIO pin 3 3 Pot Terminal 3 B 5V pin 1 Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project Potentiometer demo lvproj contained in the subfolder Potentiometer demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the voltage on the analog input B AIO Turn the potentiometer dial an
175. provide access to the three acceleration measured values as well as a wide variety of configuration options Study the video Accelerometer Interfacing Theory youtu be uj76 JtT_xk 15 55 to learn about accelerometer principle of operation applications Analog Devices ADXL345 features and Digilent PmodACL connections and sensor axis orientation Continue studying the video to learn the necessary details to configure the ADXL345 registers and read accelerometer data The ADXL345 is a relatively complex device offering a wide range of options the video tutorial therefore concentrates on the subset of features that will quickly get you up and running The detailed example shows you how to set the data rate resolution and range how set up single tap threshold and duration values and direct the single tap interrupt to an output pin and how to read the three sets of data registers and convert these accelerometer values into measured acceleration in g units Study Serial Communication RC 21 ACCELEROMETER youtu be 7CgNF78pYoM 8 47 to better un derstand the signaling waveforms between I C bus transmitters and receivers 21 3 Basic Modifications Study the video Accelerometer Demo Walk youtu be _GWEsrfxU4 8 37 to learn the design principles of Accelerometer demo and then try making these modifications to the block diagram of Main vi 1 Change the device address to some other value What LabVIEW error message do y
176. pter you will be able to 1 Describe the features of the MaxBotix MB1010 sonic range finder 2 Determine the measured range from the UART and analog outputs 3 Discuss the principle of operation of sonic range finders 4 Compensate the measurement for air tempera ture and 5 Understand the beam characteristics presented in the datasheet 20 1 Component Demonstration Follow these steps to demonstrate correct operation of the sonic range finder Select these parts from the NI myRIO Mechatronics Kit e Sonic range finder e Jumper wires F F 3x Build the interface circuit Refer to the schematic diagram shown in Figure 20 2 on the next page the sonic range finder requires three connections to NI myRIO MXP Connector A see Figure A 1 on page 227 1 VCC gt A 3 3V pin 33 2 GND gt A GND pin 30 86 3 TX A UART RX pin 10 Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project Sonic Range Finder demo lvproj contained in the subfolder Sonic Range Finder demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys do
177. r details about changes and links to updated data sheets can be found here http www ni com white paper 52319 en 1 1 Acknowledgements This book represents the contributions of many and I gratefully acknowledge the support of these individuals at National Instruments Gretchen Edel mon for her technical support and encouragement regarding the book s content and organization Margaret Barrett for inviting me to participate inthe NI myRIO Beta Program Sam Kristoff for timely advice regarding LabVIEW programming techniques Charles Yarbrough for discussions of myRIO hardware design and Andrew Watchorn for his ongoing support of university academic programs I am also grateful to Tom Robbins at NTS Press for his editorial support on this project Ed Doering Department of Electrical and Computer Engineering Rose Hulman Institute of Technology Terre Haute IN 47803 doering rose hulman edu 1 INTRODUCTION Part NI myRIO Starter Kit 2 Discrete LED LEDs or light emitting diodes provide simple yet essential visual indicators for system status and error conditions Figure 2 1 shows some typical LEDs the clear LEDs on the right are included in the NI myRIO Starter Kit Figure 2 1 Typical LEDs including standard red and green high efficiency in various colors and RGB Learning Objectives After completing the activities in this chapter you will be able to b The LED forward bias voltage drop varies wi
178. r to the article Great Circle Distance referenced below to learn how to calculate the distance along the surface of a sphere between two points 37 GPS RECEIVER 37 4 Integrated Project Ideas Now that you know how to use the GPS receiver consider integrating it with other devices to create a complete system for example y 40 e Data Logger 41 37 5 For More Information e PmodGPS Reference Manual by Digilent Reference manual for the GPS receiver PmodGPS_rm pdf PmodGPS Schematics by Digilent Schematic diagram of the GPS receiver Gms ulLP Datasheet by GlobalTop Datasheet for Gms ulLP GPS module based on the Medialek GPS MT3329 chip set this document contains detailed information on the NMEA sentences produced by the module Try a general web search on the phrase Gms u1LP PDF if your search at GlobalTop is unsuccessful Untangling the GPS Data String by Institute of Agriculture and Natural Resources A good arti cle detailing the NMEA sentences related to GPS build ec157 pdf e Great Circle Distance by Wolfram The Great Circle distance between any two points on a sphere may be used to approximate the distance between any two GPS latitude longitude coordi nates this relatively simple technique ignores the fact that the Earth is an oblate spheroid slightly flattened at the poles ttp mathworld wolfram com GreatCircle html O D ej 37 38 RFID Reader RFID radio frequency identificati
179. r tab modeling clay works well Try to make the bump indicator flash at the slightest disturbance such as tapping on the table 16 4 Integrated Project Ideas Now that you know how to use the piezo sensor consider integrating it with other devices to create a complete system for example 10 Data Logger 41 16 5 For More Information Fundamentals of Piezoelectric Shock and Vibra tion Sensors by Digi Key TechZone Detect excessive shock and vibration that could damage equipment echzone sensors resources articles Bicycle Anti Theft Alarm Circuit Diagram by Electronic Circuit Diagrams amp Schematics Alarm circuit based on the same piezo sensor in the NI myRIO Starter Kit Signal Conditioning Piezoelectric Sensors by Texas Instruments Piezoelectric sensor principle of operation and circuit model voltage mode amplifier and charge mode amplifier circuits ttp www ti com lit an sloa033a sloa033a pdf ej Di 16 PIEZOELECTRIC EFFECT SENSOR Part Il NI myRIO Mechatronics Kit 1 l Servo A servo motor usually called a servo for short combines a DC motor gearbox potentiometer and controller electronics to provide relatively precise angular position control of a rotating shaft Servos provide motion control for robot arms rotating sen sor scanners and other actuators Servos have been used for many years in remote controlled airplanes cars and boats to manipulate control surfaces aile
180. rces by Bluetooth Developer Por tal Comprehensive site devoted to designing with Bluetooth http developer bluetooth org 145 146 31 BLUETOOTH MODULE A digital potentiometer is a three terminal variable resistor that behaves just like its mechanical analog potentiometer counterpart see Chapter but with a digital numerical value to set the virtual knob position The digital potentiometer provides a convenient replacement for mechanical potentiometers offers computer adjustable gain control for amplifiers and software adjustment of trim potentiometers used to null resistive sensor circuit offsets Figure 32 1 pictures the NI myRIO Embedded Systems Kit digital potentiometer with 10 kQ end to end resistance and 8 bit resolution SPI serial bus conveys the digital wiper position Figure 32 1 NI myRIO Embedded Systems Kit digital potentiometer 32 Digital Potentiometer Learning Objectives After completing the activities in this chapter you will be able to 1 Adjust the digital potentiometer wiper position with SPI serial communications 2 Properly connect and operate the digital poten tiometer as either a rheostat or as a potentiometer voltage divider and 3 Discuss the principles of the virtual wiper as implemented by an array of solid state switches 32 1 Component Demonstration Follow these steps to demonstrate correct operation of the digital potentiometer Select these parts from the NI myRIO
181. re 36 1 and can work with multiple webcams attached via a USB hub With the Vision Acquisition and Development modules installed you can acquire and process still images and video streams with a wide variety of image processing and machine vision tools Figure 36 1 webcam connected to NI myRIO USB port Learning Objectives After completing the activities in this chapter you will be able to 1 Acquire and process a single image 2 Acquire and process a video stream 3 Set the webcam s video mode resolution and frame rate 5 Use NI MAX to determine available video modes and attributes for your webcam 36 1 Component Demonstration Follow these steps to demonstrate correct operation of the webcam Select these parts e USB webcam Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project Webcam demo lvproj contained in the subfolder Webcam demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking e Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running 170 NOTE You may wish to select the Close on successful completion option t
182. resistors as on the 25 KEYPAD MXP connectors You can either rely on the 10 kQ pull up resistors on the PmodKYPD to override the approximately 40 kQ MSP pull downs use the MSP 5 volt supply for the PmodKYPD or you can connect the PmodKYPD V terminal to ground thereby converting the 10 kQ resistors to pull down resistors this latter connection requires that you also change the column drives to high level with a Boolean T instead of the current F value 25 4 Integrated Project Ideas Now that you know how to use the keypad consider integrating it with other devices to create a complete system for example e Hotel Room Safe Controlle e RPN Calculator 47 25 5 For More Information e PmodKYPD Reference Manual by Digilent Reference manual for the 4x4 keypad scroll to the bottom of the page e PmodKYPD Schematics by Digilent Schematic diagram of the 4x4 keypad scroll to the bottom of the page 26 LCD Character Display UART Interface An LCD character display provides an excellent means for your LabVIEW block diagram code to display measurements status and conditions with ASCII character strings The LCD character display also provides visual feedback for a user interface Figure pictures the NI myRIO Embedded Systems Kit LCD character display which supports three different serial communications standards this chapter focuses on the UART interface and the next two chapters cover the SPI and
183. ring to indicate the most recent operation Next add more operations to the calculator at the moment the calculator only supports addition change sign multiplication squaring and square root because of the limited number of keys additional functions need to be added as function keys For example the square root operation is invoked by first pressing F to select a function key and then pressing 2 applies the square root operation You may also want to change the stack data type from integer to double and then add more code to handle decimal points 202 47 RPN CALCULATOR e Local display LCD Display Some hotel rooms provide a small safe to protect your valuables The digital controller for the hotel room safe works like this place your belongings in the safe close the door type in a four digit code which you need to remember to lock the safe and then type in the same code to open the safe again The Simple State Machine design pattern illustrated in the LabVIEW project RPN Calculator applies quite well to the digital controller for this project The states include open safe is open and waiting for a four digit code locking save four digit code to memory move the bolt to the locked position locked safe is locked and waiting for the same four digit code and opening correct four digit code entered move the bolt to the open position Combine the keypad and LCD d
184. rminals double check your connections and ensure that you have connected the NI myRIO I C bus 23 COMPASS 103 VDD A 3 3V 33 A I2C SDA 34 fe A I2C SCL 32 PmodCMPS A DIOO 11 le Figure 23 2 Demonstration setup for compass connected to NI myRIO MXP Connector A 104 SDA line to the PmodCMPS SDA terminal on connector J1 and the SCL line to the SCL terminal also check that you have not accidentally crossed the power supply connections and e Correct PmodCMPS data ready DRDY terminal to the NI myRIO DIO line the front panel only updates in response to the data ready interrupt NOTE Double check the SDA and SCL connections should you see the message Error 36011 occurred at myRIO Write 12C vi or similar this message indicates that NI myRIO did not receiving an expected acknowledgement from the PmodCMPS I C bus interface 23 2 Interface Theory Interface circuit The Honeywell HMC5883L three axis compass at the heart of the PmodCMPS board supports the I C bus serial interface commonly de noted 12C The HMC5883L includes a data ready output designated DRDY Twelve addressable reg isters provide access to the three compass measured values as well as a variety of configuration options Study the video youtu be 3WkJ7ssZmEc 12 47 to learn about compass applications Honeywell HMC5883L features Digilent PmodCMPS connection
185. ron elevator rudder and steering Figure 17 1 pictures the GWS SO3N STD servo included in the NI myRIO Mechatronics Kit the kit also includes the GWS 535 XF continuous rotation sensor that can serve as the basis of a robot drive train Learning Objectives After completing the activities in this chapter you will be able to 1 Discuss the main components of a servo feedback control system pulse style command input controller DC motor gearbox and potentiometer as an angular position sensor 2 Create a pulse width modulated PWM signal to command the servo spline to a desired angle 3 Null any nonideal offsets in the angular position and 4 Explain the fundamental difference between a standard servo and a servo intended for continuous operation Figure 17 1 NI myRIO Mechatronics Kit servo 17 1 Component Demonstration Follow these steps to demonstrate correct operation of the servo Select these parts from the NI myRIO Mechatronics Kit e Servo GWS S03N STD e Jumper wires M F 3x 70 Build the interface circuit Refer to the schematic diagram shown in Figure 17 2 on the next page the servo requires three connections to NI myRIO MXP Connector B see Figure A 1 on page 227 1 Vcc red B 5V pin 1 2 Ground black B GND pin 6 3 Command signal white B PWMO pin 27 Make certain that you are using the correct servo GWS SO3N STD the NI myRIO Mechatronics Kit includes a continuous
186. s M F 3x Build the interface circuit Refer to the schematic di agram and recommended breadboard layout shown in Figure 19 2 on the following page The interface circuit requires three connections to NI myRIO MXP Connector B see Figure A 1 on page 227 1 5 volt power supply B 5V pin 1 2 Ground B GND pin 6 3 Output signal B AIO pin 3 82 19 IR RANGE FINDER VCC B 5V 1 SHARP Vout yellow B AIO 3 GP2Y0A21YKOF Jal GND black B GND 6 Figure 19 2 Demonstration setup for rangefinderIR connected to NImyRIOMXP Connector B 19 IR RANGE FINDER Run the demonstration VI e Download http www ni com academic myrio iF you have not done so previously and unpack the contents to a convenient location e Open the project IR Range Finder demo lvproj contained in the subfolder IR Range Finder demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking e Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays both the IR range finder output voltage
187. s 0 Observe that the EEPROM array and graph are both empty now therefore you need to select Read entire array to update these two displays Because the Write protect control is initially set this holds the WP pin low you should observe that the array is still entirely filled with value 255 Click the Write protect button to enable writing select Write to array and then select Read entire array You should now see that Address 0 contains the value zero Try writing some single byte values to other addresses and confirm that the plotted values appear where you expect Type a new value into the EEPROM array index control to view other regions of the array indicator e g type 511 to see the last array value Click on the Bytes to write control to enter more values for a multi byte write You can write up to sixteen bytes one page in a given write operation provided that the address begins on a page boundary lower four bits of the address are zero Right click on the Bytes to write select Data Op erations followed by Delete Element to remove values from the array control You may also reini tialize the entire front panel to the original settings by selecting Edit Reinitialize Values to Default Select Read STATUS register to view the contents of the EEPROM s STATUS register expect to the see a zero value Enter the hexadecimal value 0x08 into the STATUS to write control and then select Write STATUS regi
188. s and sensor axis orientation and compassing principles magnetic north vs true north declination angle inclination angle and compass output corrections to read true north Continue studying the video to learn the necessary details to configure the HMC5883L registers and read compass data The detailed example shows you how to set the data rate averaging mode sensitivity range and continuous measurement mode and also how to read the three sets of data registers and convert these compass values into measured compass in gauss units Study Serial Communication RC youtu be 7CgNF78pYoM 8 47 to better un 23 COMPASS derstand the signaling waveforms between I C bus transmitters and receivers 23 3 Basic Modifications Study the video Compass Demo Walk Through youtu be bWew4 fHWVKo 7 48 to learn the design principles of Compass demo and then try making these modifications to the block diagram of Main vi 1 Change the device address to some other value What LabVIEW error message do you see 2 Add the necessary computation to display the compass measurements in gauss units Note that the scale factor depends on the gain setting in Configuration Register B 3 Add the X axis and Y axis offset corrections de scribed in the theory video tutorial these are nec essary to improve the accuracy of the compass 4 Add calculations to convert the X and Y value to polar form and display the angle on a front pane
189. s is an active low LED interface circuit Click the Stop button or press the escape key to stop the VI and to reset NI myRIO a myRIO reset causes all of the digital I O pins to revert to input mode Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct LED orientation the diode conducts current in one direction only remove the LED and reinsert it in the opposite direction and e Correct resistor value use an ohmmeter to verify that the resistance is near 220 ohms 2 2 Interface Theory Interface circuit Study the video Interfacing Theory youtu be 9 R1GPVgFWO 6 55 to learn the basics of LEDs and the two types of interface circuits current sinking and current sourcing Also study LED Current Management youtu be JW 19uXrwNu 15 06 to learn about the voltage current characteristics of the various types of diodes included in the NI myRIO Starter Kit standard superbright and RGB to learn principles of operation of the LED interface circuit including the current sinking and current sourcing forms and to learn how to choose the size of the current limiting resistor LabVIEW programming Study the video Output Express VI youtu be Y8mKdsMAgrU 2 21 to learn how to access all of the available digital outputs with the NI myRIO Digital Output Express VI inc
190. s the associated hexadecimal code of the character The VI also displays the lower four bits of the received character on the myRIO onboard LEDs The RN42 STATUS and RTS outputs are displayed as LED indicators and its RESET and CTS inputs are controlled with the pushbuttons Press RESET to reset the module you should see that the green status LED on the PmodBT 2 is off Release the RESET button and you should see the status LED blinking at medium speed to indicate that the RN42 is discoverable and waiting for a connection Pair the RN42 with your Bluetooth capable laptop or desktop computer using the default RN42 pairing code 1234 View the video tutorial Demo Walk Through youtu be LFCThGa681A 15 08 through 2 30 to see the step by step Bluetooth pairing procedure for the Windows 7 operating system the pairing process is similar for Mac OS Make note of the COM port that was created for the RN42 SPP service Download and run the PuTTY terminal emulator from Make the following settings this is demonstrated in the same video tutorial beginning at 2 52 1 Connection type Serial 2 Serial line the COM port created from pairing the RN42 3 Speed 115200 baud click the Serial category on the bottom left 4 Data bits 8 5 Stop bits 1 and 6 Flow control None You may wish to save this configuration so that you can load it later on type a name for Saved Sessions and
191. se the LED matrix consider integrating it with other devices to create a complete system for example e Digital Bubble Level 56 e NTP Clock 42 133 BA LED MATRIX 29 5 For More Information e 8x8 LED Matrix Datasheet by SparkFun Datasheet for the 8x8 LED matrix SanYoung Medium RG pdf e MAX7219 LED Display Driver with SPI Interface by Maxim Integrated Includes power transis tors and raster display controller to completely offload the detailed control of each LED Simply send the patterns via the SPI serials bus http www maximintegrated com MAX7219 30 Serial EEPROM An EEPROM Electrically Erasable Programmable Read Only Memory provides nonvolatile data storage that persists even when power is absent EEPROMs find application as sensor calibration tables digital keys and adaptive devices The Microchip 25LC040A serial EEPROM Figure 30 1 offers 4 kilobits of storage organized as an array of 512 8 bit bytes accessible via the SPI serial bus Figure 30 1 NI myRIO Embedded Systems Kit serial EEPROM Learning Objectives After completing the activities in this chapter you will be able to 1 Describe the Microchip 25LC040A features and device pinout 2 Apply the 25LC040A instruction set to read and write data to the memory array and status register and 3 Use the LabVIEW low level SPI interface VIs to communicate with the 25LC040A 30 1 Component Demonstration Follow these steps to dem
192. see the direction indicator change to Count ing Down and the counter value decrementing Click the Reset Counter button and then exper iment with the motor speed Note that the counter now serves as a speed indicator reporting the number of counts measured in a 100 millisecond interval Try varying the PWM freq slide control to adjust the rate at which pulses are applied to the H bridge enable input Look for relationships between the PWM frequency and duty cycle especially in terms of these points 1 What PWM frequency range makes it easiest to start the stopped motor when increasing the PWM duty cycle from zero 2 What PWM frequency range causes audible tones 3 What PWM frequency range is best for very slow rotation Bring the motor speed back to zero and then reset the counter leaving the Reset Counter switch in its ott state Manually rotate the magnet on the back of the motor and observe the Counter Value display How many counts do you see for one complete revolution of the magnet Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO 18 H BRIDGE AND GEARED MOTOR VM B 5V 1 VDD A 3 3V 33 J2NM J1 DIR J2 GND PmodHB5 amp Geared Motor B GND 6 e DO Cl Gilerntinc com de mired
193. splay MOSI input also check that you have not ac cidentally crossed the power supply connections and Correct mode jumper settings refer again to the circled region of Figure 27 2 on the facing page for the proper settings 27 2 Interface Theory Interface circuit The LCD character display sup ports three serial communication standards UART univeral asynchronous receiver transmitter SPI serial peripheral interface and I C bus inter IC This chapter concentrates on the SPI interface while the adjacent chapters cover the other interfaces the functionality of the LCD character display itself remains independent of the selected communication standard Simply send ASCII characters to the display s SPI receive line to make them appear on the display screen Use escape sequences to configure other aspects of the display such as homing the cursor displaying and blinking the cursor scrolling the display and so on Study the video LCD Character Display Inter facing Theory youtu be m0Td7Kbhvdl 10 36 to learn more about the LCD character display operation including setting the baud rate sending display information and escape sequences and available configuration instructions Study youtu be GaXtDamw5As 7 02 to understand how the SPI Express VI con figuration options relate to the signaling waveforms between SPI transmitters and receivers 124 27 LCD CHARACTER DISPLAY SPI INTERFACE LabVIEW
194. steps to demonstrate correct operation of the LED matrix Select these parts e LED matrix http www sparkfun com datasheets Components SanYoung Medium RG pdf e Breadboard 2x e Jumper wires M F 24x Build the interface circuit Refer to the pin diagram shown in Figure 29 2 on page 131 and recommended breadboard layout shown in Figure 29 3 on page 132 TIP Use the resistor color code for the DIO wire colors e g black 0 for B DIOO brown 1 for B DIOT and so on The interface circuit requires eight connections to NI myRIO MXP Connector A and sixteen connec tions to Connector B see Figure A 1 on page 227 Row 1 1 gt A DIOO pin 11 Row 2 2 A DIO1 pin 13 Row 3 3 gt A DIO2 pin 15 Row 4 4 A DIOS pin 17 Row 5 21 gt A DIO4 pin 19 Row 6 22 gt A DIOS pin 21 O OTF QQ MER 130 Row 7 23 gt A DIO6 pin 23 Row 8 24 A DIO7 pin 25 Column 1 green 5 B DIOO pin 11 10 11 Column 4 green 8 B DIO8 pin 17 13 14 15 16 17 18 19 20 21 22 23 24 Column 2 green 6 B DIO1 pin 13 Column 3 green 7 B DIO2 pin 15 Column 5 green 9 B DIO4 pin 19 Column 6 green 10 B DIO5 pin 21 Column 7 green 11 gt B DIO6 pin 23 Column 8 green 12 gt B DIO7 pin 25 Column 1 red 20 B DIO8 pin 27 Column 2 red 19 B DIO9 pin 29 Column 3 red 18 B DIO10 pin 31 Column 4 red 17 B DIO11 pin 18 Column
195. ster followed by Read STATUS register to confirm that the STATUS register has been updated With this setting the upper half of the memory is write protect regardless of the state of the WP pin Try to write data to a low address 0 to 127 and then to a high address 128 to 511 remember to deselect the Write protect switch Confirm that the value at the lower address changes while the value at the higher address does not Write a 0x00 137 138 value to the STATUS register when you are finished to return the register to its as shipped default value the two block protect bits are nonvolatile Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections and Correct 25LC040A pins connections double check your connections and ensure that you have not reversed the NI myRIO B SPI MOSI and B SPI MISO lines also check that you have not ac cidentally crossed the power supply connections 30 2 Interface Theory Interface circuit The Microchip 25LC040A offers 4 kilobits of nonvolatile storage organized as 512 8 bit bytes The memory array is rated for one million erase write cyc
196. system principles electromagnetic theory antenna design and data coding techniques 181 182 38 RFID READER Part V Integrated Project Ideas 39 Handheld Meter Handheld meters such as a digital multimeter DMM provide a convenient way to make mea surements of voltage current and resistance You can extend the idea of a handheld meter to measure a wide range of other physical parameters too Combine the LCD display with one or more sensors to create your own handheld meter e Measurement display LCD Display 26 27 28 e Light sensors Photocell 9 Ambient Light Sensor 24 erature sensors Thermistor 8 Temperature e Sound level sensors measure the RMS of the audio waveform 10 Z e Range distance sensors 19 e Magnetic field sensors 15 Refer to the example LabVIEW application Digital Tape Measure that combines the sonic range finder with the LCD display 186 39 HANDHELD METER 40 Wireless Sensor Wireless sensors provide useful information at a distance from the data acquisition system often in areas that do not have power readily available or are otherwise inaccessible Attach a battery pack to your myRIO and then combine the Bluetooth module with one or more sensors you may also wish to include a local display to confirm that your wireless sensor is properly transmitting information e Wireless data link e Local display LCD Display e Light and vision sensors Light
197. tal potentiometer SDI input and digital output DION to the chip select input 32 2 Interface Theory Interface circuit The Digilent PmodDPOT board provides a convenient set of interface connectors for the Analog Devices AD5160 digital potentiometer The digital potentiometer provides the conventional trio of terminals like a mechanical potentiometer and an 8 bit value between 0 and 255 transmitted via SPI serial peripheral interface sets the virtual wiper position by closing exactly one of 256 solid state switches that establish the connection point to a string of 256 equal valued resistors between terminals A and B Study the video Digital Potentiometer Interfacing youtu be C4iBOjWn701 9 15 to learn 32 DIGITAL POTENTIOMETER 149 VDD A 5V 1 JINCC 6 A SPI MOSI 25 C J1 SDI 2 J B 5V 1 PmodDPOT A SPI CLK 21 E J1 SCLK 4 7 B AIO 3 A DIOO 11 J1 CS 1 4 B GND 6 J1 GND 5 AIGND 6 Figure 32 2 Demonstration setup for digital potentiometer connected to NI myRIO MXP Connector B Use the M F jumper wires and a screwdriver for the three potentiometer terminals 150 32 DIGITAL POTENTIOMETER more about the digital potentiometer theory of 32 4 For More Information operation including SPI bus and chip select timing internal switch array circuit and design equations for using the digital potentiometer in rheostat mode a single variable resistance and in potentiometer
198. th color wavelength c The interface circuit design depends on knowledge of the DIO output resistance and source voltage d LEDs may be direct connected to the DIO under some circumstances and 2 Select a suitable current limiting resistor or no resistor based on the LED type 2 1 Component Demonstration Follow these steps to demonstrate correct operation of the discrete LED component Select these parts from the NI myRIO Starter Kit e Two 100 2 resistors connected in series or two 470 Q resistors connected in parallel e Two terminal LED e Breadboard e Jumper wires M F 2x Build the interface circuit Refer to the schematic di agram and recommended breadboard layout shown in Figure 2 2 on the following page The discrete LED interface circuit requires two connections to NI myRIO MXP Connector B see Figure 1 Describe the essential concepts related to LEDs Pa8 227 a AnLED is a diode that permits only one way current 1 Anode B 3 3V pin 33 2 LED control B DIOO pin 11 2 DISCRETE LED DICO pin 11 B 3 3V pin 33 B Ding N Figure 2 2 Demonstration circuit for discrete LED schematic diagram recommended breadboard layout and connection to NI myRIO MXP Connector B Run the demonstration VI e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by Download http www ni com academic myrio double clicking J project guide vis
199. th the COM port review Bluetooth Interfacing Theory youtu be WidjSMNU1OM 15 34 for ideas Add additional cases to return other internal states of the NI myRIO For example return the value of the onboard accelerometer X axis when the x character is received Add a data streaming feature when the a character is received begin transmitting the three onboard accelerometer values once every 100 ms three space delimited values followed by a carriage return and linefeed combination continue streaming out data until the a character is received again Integrated Project Ideas Now that you know how to use the Bluetooth module consider integrating it with other devices to create a complete system for example e Wireless Sensor 40 31 5 For More Information PmodBT2 Reference Manual by Digilent Reference manual for the Bluetooth module PmodBT2 Schematics by Digilent Schematic diagram of the Bluetooth module RN42 Datasheet by Microchip Datasheet for RN42 Bluetooth module select the RN42 PDF document at the bottom of the page Bluetooth Data Module Command Reference and Advanced Information User s Guide by Microchip Complete information on config uring the RN42 while in command mode select the Bluetooth Advanced User Manual PDF document at the bottom of the page Bluetooth Basics by SparkFun Excellent tutorial on Bluetooth and wireless mobile devices Bluetooth Resou
200. that does not produce ghosting LabVIEW programming Study the video Output Low Level VIs youtu be WvnInG3ffqy 4 53 to learn how to use the low level Digital Output VIs set the DIOs to either high impedance or to a defined voltage level 25 3 Basic Modifications Study the video Keypad Demo Walk Through youtu be 7r_LwcDa2AM 4 58 to learn the design principles of Keypad demo and then try making these modifications to the block diagram of Main vi 1 Temporarily remove the Transpose 2D Array node and observe the new behavior of the Keypad buttons front panel indicator Thinking about the Scan display can you explain how the transpose operation corrects the Keypad buttons information display 2 Add the Boolean Array to Number node just before the Scan indicator connection and then create a numerical indicator Try various single button and multi button keypress combinations until you understand the relationship between the keypress and the indicated numerical value 3 Create a numerical indicator whose value matches the value printed on each button of the keypad with the letters corresponding to hexadecimal values the indicator should display 1 when no key is pressed Consider using the Boolean Array to Number node and a case structure 4 Re connect the display to the MSP connector and updated the DIO values accordingly Note that the MSP connector includes internal pull down resistors instead of pull up
201. that serves as the heart of the digital potentiometer board e M68HC11 Reference Manual by Freescale Semiconductor Refer to Section 8 for a complete treatment of the SPI serial bus standard including timing diagrams and multi master systems A temperature sensor provides a useful indication of environmental conditions Figure 33 1 pictures the NI myRIO Embedded Systems Kit temperature sensor based on the Microchip TCN75A tempera ture sensor with IC bus serial communications The sensor offers 1 C accuracy over the range 40 C to 125 C nine to twelve bits resolution and con version times from 30 to 240 ms The sensor also pro vides an alert output that triggers when the mea sured temperature exceeds a user adjustable limit Figure 33 1 NI myRIO Embedded Systems Kit temperature sensor 30 Temperature Sensor Learning Objectives After completing the activities in this chapter you will be able to 1 Describe the continuous conversion one shot and shutdown operating modes 2 Configure the ALERT output polarity compara tor and interrupt modes and 3 Read and interpret the ambient temperature 33 1 Component Demonstration Follow these steps to demonstrate correct operation of the temperature sensor Select these parts from the NI myRIO Embedded Systems Kit e Temperature sensor PmodTMP3 PmodTMP3 rm revA_l pdf e Jumper wires F F 5x Build the interface circuit Refer to the sche
202. the UART value Do you find any difference between using the analog output and the digital output Create an on demand version of the VI add two Digital Output Express VIs to hold the MB1010 RX normally low with a short high level pulse to trigger a single measurement 20 SONIC RANGE FINDER 20 4 Integrated Project Ideas Now that you know how to use the sonic range finder consider integrating it with other devices to create a complete system for example Data Logger al Steer By Wire t3 20 5 For More Information e MB1010 Datasheet by MaxBotix Datasheet for the MB1010 Sonic Range Finder pdf Temperature Compensation for Sonic Range Finders by MaxBotix The speed of sound varies significantly with temperature This page presents an equation for calculating speed of sound for any given temperature that can be used as the basis of temperature compensation e Sonic Range Finder Tutorials by MaxBotix Tutorials on all aspects of sonic range finders 21 Accelerometer An accelerometer measures the position of an on chip suspended proof mass and reports motion of the proof mass as acceleration in gees i e 1g 9 81m s Accelerometers measure both static acceleration for leveling tilt and drop sensor ap plications as well as dynamic acceleration for shock and vibration data acquisition Figure 21 1 pictures the NI myRIO Mechatronics Kit accelerometer based on the Analog Devices ADXL34
203. these modifications to the block diagram of Main vi 1 Change the device address to some other value What LabVIEW error message do you see 22 GYROSCOPE 2 Add the necessary computation to display the e L3G4200D Datasheet by STMicroelectronics angular rate in dps units degrees per second refer to the theory video or the datasheet to obtain the necessary sensitivity scale factor to convert LSB least significant bit units to dps units 3 Add code to read the WHO_AM_I devide ID register 4 Add code to read the L3G4200D device ID register address 0x0F and to generate an error condition if the ID does not match the expected value in this way your VI can detect that the cor rect I C bus device is attached to the NI myRIO DC terminals Study the L3G4200D datasheet register map Table 18 to determine the expected value Select one of the pop up dialog box VIs from the Programming Dialog amp User Interface subpalette to display your error message 5 Add the necessary computation to subtract the zero rate level 22 4 Integrated Project Ideas Now that you know how to use the gyroscope consider integrating it with other devices to create a complete system for example 20 Data Logger 41 Steer By Wire 22 5 For More Information e PmodGYRO Reference Manual by Digilent Reference manual for the gyroscope PmodGYRO_rm_RevA pdf e PmodGYRO Schematics by Digilent Schematic diagram o
204. these steps to demonstrate correct operation of the keypad Select these parts from the NI myRIO Embedded Systems Kit e 4x4 matrix keypad PmodKYPD e Jumper wires F F 9x Build the interface circuit Refer to the schematic diagram shown in Figure 25 2 on page 115 the keypad requires three connections to NI myRIO MXP Connector B see Figure A 1 on page 227 3 3 volt supply B 3 3V pin 33 Column line 1 B DIOO pin 11 Column line 2 gt B DIO1 pin 13 Column line 3 B DIO2 pin 15 Column line 4 B DIO3 pin 17 OT Hb WN FR 114 6 Row line 1 gt B DIO4 pin 19 7 Row line 2 B DIO4 pin 21 8 Row line 3 B DIO4 pin 23 9 Row line 4 B DIO4 pin 25 Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location Open the project Keypad demo lvproj contained in the subfolder Keypad demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI shows
205. threshold resistance as a front panel numerical control 3 Because analog inputs are not as plentiful as digital inputs create the same room lights ON detector behavior but do the comparison directly at a digital input study Threshold Detector youtu be TqLXJroefTA 9 22 to learn the design procedure 9 4 Integrated Project Ideas Now that you know how to use the photocell consider integrating it with other devices to create a complete system for example 37 38 Data Loggen Steer By Wirej 43 5 Music Maker 57 9 5 For More Information Photocell Tutorial by Digital DIY An excellent tutorial with many types of interface circuits for analog and digital inputs 269 photocell tutorial html Photocells by Adafruit A good overview of CdS photocells with interesting applications such as light based motor control line following robots and laser pointer breakbeam sensor http learn adafruit com photocells overview Photocell Tutorial by Digital DIY Several different light detector circuits including a dual photocell version that acts as a bistable latch http digital diy com general electronics 269 photocell tutorial html 9 PHOTOCELL 1 0 Electret Microphone A microphone serves as an acoustic sensor to record audio signals and to monitor acoustic level Electret microphones provide good performance at low cost The Chenyun CY 502 electret microphone pictured in Figure 10 1
206. tiometer as a variable voltage source and also to learn about proper sizing of the potentiometer to minimize power required and also to minimize loading effects that could distort the measurement LabVIEW programming Study the video Input Express VI youtu be N6Mi V3B1mc 2 00 to learn how to use Analog Input Express VI to measure the voltage divider output voltage 7 3 Basic Modifications Study the video Potentiometer Demo Walk Through youtu be RYeKIuU6DX8 3 07 to learn the design principles of Potentiometer demo and then try making these modifications to the block diagram of Main vi 7 POTENTIOMETER 29 VDD B 5V 1 quei B AIOO 3 B GND 16 _ ee Ratei at birre frate apre bp A RN FO ee u Gr Tae ANA cara a Wr oF DIR Jr 33 i 4 f i Pe j 1 i H i i v 3 5 i a i fej t i i 7 Figure 7 2 Demonstration circuit for potentiometer schematic diagram recommended breadboard layout and connection to NI myRIO MXP Connector B 1 Make the front panel control selectable 7 4 Integrated Project Ideas 2 Replace dial indicator with another type of indicator Now that you know how to use the potentiometer 3 Connect to a DIO input and monitor it s state consider integrating it with other devices to create inside a loop adjust the pot voltage to locate the acomplete system for example hysteresis edges of the digital input and o 4 Make a bargraph indicator of the pot wiper ition with onboar
207. tion that reads a programming file from a USB flash drive copies the data to the EEPROM and then reads back the EEPROM data to confirm that it exactly matches the data from the USB flash drive file Include an LCD display to show the status of the programming erial EEPROM 30 e LCD Display 26 224 58 EEPROM PROGRAMMER Part VI Appendices A MXP and MSP Connector Diagrams AS a oov olv o LOY Liy o ans ziy an9 Xy LUYN AND XL LYWN AND VON3 LLOIO AND 9 DN3 ZLOIO AND Aolle AND AND 198921 v LOIG vas ozl SLOIO 341 pe ga g ag a ga g 2 Ban l ll l alal el e dal A 19 1dS SOIC OSIW IdS 9010 ISOW IdS ZOIG OWMd 8010 HAMd 6010 GINMd O LOIO AEET 341 pe gpegrpe pepegpee a en SIGNALS Figure A 1 MXP myRIO eXpansion Port connector diagram APPENDIX A MXP AND MSP CONNECTOR DIAGRAMS 228 AS ANDO zolid 9010 SOIC rolad gold cold LOIO 0010 IV FLV OIV FOI ONDV LOV DOV GNOV Asi ASI PRIMARY SIGNALS HAMd LONI WY LONA ONMd d 09Na YOONA SECONDARY SIGNALS Figure A 2 MSP miniSystem Port connector diagram B Build a Stand Alone Application During development you normally connect NI myRIO to your computer with a USB cable After development is complete you can easily deploy your project as a stand alone application stored on the myRIO solid state hard drive that starts automatically
208. tion to the MXP analog input refer to Figure 34 4 on page 160 This version requires five connections to NI myRIO MXP Connector B see Figure A 1 on page 227 1 5 volt power supply B 5V pin 1 Ground B GND pin 6 3 3 volt power supply B 3 3V pin 33 Ground B GND pin 30 Mic amplifier output B AIO pin 3 HS GO N DI A WN Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location Open the project MEMS Microphone demo lvproj contained in the subfolder MEMS Microphone demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and 34 MEMS MICROPHONE Left Right Ground Figure 34 2 3 5 mm stereo audio cable plug connec tions for ground left channel and right channel e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the audio signal detected by the microphone as an oscilloscope display Select the appropriate mic input depending on the interface circuit you built Audioln Left or
209. to AUDIO IN e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking e Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the audio signal detected by the microphone as an oscilloscope display Try whistling speaking singing or any other sound and you should see the corresponding waveform You will need to position the microphone quite close to the sound source Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode and e Microphone plugged into the AUDIO IN jack instead of the adjacent AUDIO OUT jack 10 2 Interface Theory Interface circuit The Chenyun CY 502 electret microphone produces a monophonic single 10 ELECTRET MICROPHONE channel audio signal of fractions of a volt up to more than a volt depending on the proximity and intensity of the sou
210. top the VI and to reset NI myRIO 17 SERVO VCC B 5V 1 white BIPWMO 27 R B GND 6 LE n aa et ig e DESIO Rag tt u A E Pe i re Oe et pr t y 7 STI nie 33 E u p f 4 L Figure 17 2 Demonstration setup for the GWS S03N STD servo connected to NI myRIO MXP Connector B 71 72 Figure 17 3 Servo control horns included with the GWS SO3N STD Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections and Correct servo connections double check your connections and ensure that you have connected the red line to the 5 volt supply the black line to ground and the white line to the PWMO output 17 2 Interface Theory Interface circuit The servo adjusts its shaft angle according to the command input a periodic pulse that varies in width between 1 0 and 2 0 ms A pulse width centered between these two limits 1 5 ms commands the servo to its neutral center position 17 SERVO The servo requires the 5 volt power supply and a sin gle connection to one of the pulse width modulation PWM outputs available on the NI myRIO Study the video youtu be DOu5AvSDP2E 7 18 to learn about servo applications the
211. tor to sense when the light path is broken A photointerrupter serves 1 Size the current limiting resistor for the infrared emitter and as the basis for position and speed measurement 2 Apply software based edge detection to count when combined with timers and suitable targets of alternating opacity and transparency Figure pictures the NI myRIO Starter Kit photointerrupter Figure 14 1 NI myRIO Starter Kit photointerrupter photointerrupter events 14 1 Component Demonstration Follow these steps to demonstrate correct operation of the photointerrupter Select these parts from the NI myRIO Starter Kit Photointerrupter e Resistor 470 Q e Breadboard e Jumper wires M F 3x Build the interface circuit Refer to the schematic diagram and recommended breadboard layout shown in Figure The photointerrupter interface circuit requires three connections to NI myRIO MXP Connector B see Figure A T on page 227 1 5 volt supply B 5V pin 1 2 Ground B GND pin 6 3 Photointerrupter output B DIOO pin 11 56 14 PHOTOINTERRUPTER VDD B 5V 1 1 Anode 2 Cathode 3 Vcc 4 Vout 5 GND J B DIOO 11 NOTE Simplified detector symbol omits on board signal processing BIGND 6 Top View rara iazzone Cathode SS cid een O 1 un A LASTHR e 2 detector Vee k r GAD Vour Sharp N emitter a ee A NE NL A FIT eT ht Ee N peye na i ha 4 ao
212. ts Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections e Correct LCD character display connector ter minals double check your connections and ensure that you have connected the NI myRIO UART transmit output to the LCD character display receive input also check that you have not accidentally crossed the power supply connections and e Correct mode jumper settings refer again to the circled region of Figure 26 2 on the facing page for the proper settings 26 2 Interface Theory Interface circuit The LCD character display supports three serial communication standards UART univeral asynchronous receiver transmitter SPI serial peripheral interface and I C bus inter IC This chapter concentrates on the UART interface while the next two chapters cover the other interfaces the functionality of the LCD character display itself remains independent of the selected communication standard Simply send ASCII characters to the display s UART receive line to make them appear on the display screen Use escape sequences to configure other aspects of the display such as homing the cursor displaying and blinking the cursor scrolling the display and so on Study the video LCD Character Disp
213. u are using Connector B and that you have the correct pin connections e Correct PmodBT2 terminals double check your connections and ensure that you have connected the NI myRIO UART receive input to the RN42 transmit output also check that you have not accidently crossed the power supply connections 31 2 Interface Theory Interface circuit The Roving Networks RN42 is a self contained full qualified Bluetooth Class 2 module with integrated antenna By default the RNA2 operates in slave mode may be paired with the code 1234 and offers the Serial Port Profile SPP service By connecting the NI myRIO UART directly to the RN42 UART the RN42 appears as a virtual COM port on a Bluetooth capable laptop or desktop computer Study the video youtu be WiajSMNU19M 15 34 to learn more about the RN42 as the basis of a wireless serial cable replacement application including essential RN42 features and PmodBT2 pinout pairing the RN42 with a computer accessing the virtual COM port with a terminal emulator and with a LabVIEW desktop application and accessing the RN42 UART with the NI myRIO low level UART VIs 31 3 Basic Modifications Study the video Bluetooth Demo Walk Through youtu be LFCThGa681A 15 08 to learn the design principles of Bluetooth demo and then 31 BLUETOOTH MODULE try making these modifications to the block diagram of Main vi 1 31 4 Create a desktop LabVIEW VI to interact wi
214. uble clicking e Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the state of the NI myRIO on board 3 axis accelerometer as three values X Y and Z directions and the state of the built in pushbutton on the bottom side of myRIO press the button to see the state change from 0 to 1 Change the orientation of myRIO to see the accelerometer values change and shake myRIO to see larger acceleration values You may wish to hold or tape the LCD character display to the top of myRIO too Click the Stop button or press the escape key to stop the VI and to reset NI myRIO Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct MXP connector terminals ensure that you are using Connector B and that you have the correct pin connections Correct LCD character display connector ter minals double check your connections and ensure that you have connected the NI myRIO I C bus SDA line t
215. uit to work with digital outputs that include either pull up or pull down resistors 12 1 Component Demonstration Follow these steps to demonstrate correct operation of the motor Select these parts from the NI myRIO Starter Kit e DC motor e 1N4001 general purpose rectifier e ZVN2110A n channel enhancement mode MOSFET e ZVP2110A p channel enhancement mode MOS FET pdf e IRF510 n channel enhancement mode power MOSFET e Breadboard e Jumper wires M F 4x 48 Build the interface circuit Refer to the schematic di agram and recommended breadboard layout shown in Figure 12 2 on the facing page The interface circuit requires four connections to NI myRIO MXP Connector B see Figure A 1 on page 227 1 5 volt power supply B 5V pin 1 2 3 3 volt power supply B 3 3V pin 33 3 Ground B GND pin 30 4 Motor control B DIO8 pin 27 Run the demonstration VI e Download if you have not done so previously and unpack the contents to a convenient location e Open the project Motor demo lvproj contained in the subfolder Motor demo e Expand the hierarchy button a plus sign for the myRIO item and then open Main vi by double clicking Confirm that NI myRIO is connected to your computer and e Run the VI either by clicking the Run button on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI
216. use a jack on the output side to use the audio cable included with your NI myRIO The optional 2 2 kQ resistor connected to the NI myRIO five volt supply doubles the signal headroom to 2 volts and maximizes the signal available to the AUDIO IN analog to digital converter 10 4 Integrated Project Ideas Now that you know how to use the electret microphone consider integrating it with other devices to create a complete system for example O O O O 10 5 For More Information e Computer Microphones by Hobby Hour com Describes the tip ring sleeve jack wiring and power supply connections for electret microphones and computer soundcards e Electret Microphones by Open Music Labs An excellent detailed teardown and explanation of electret microphone operating principles e Preamp to Electret Mic by Instructables A simple and effective preamplifier to raise the electret mic voltage level to line level ttp www instructables com id re amp to electret mic 41 42 10 ELECTRET MICROPHONE Electret PREAMPLIFIER NI myRIO Microphone AUDIO IN 5V RIGHT unamplified LEFT amplified Figure 10 3 Preamplifier circuit to connect between the electret microphone and AUDIO IN The NI myRIO AUDIO IN jack provides power to both the electret microphone and the preamplifier circuit The optional 2 2 KQ resistor connected to the NI myRIO five volt supply doubles the signal headroom to 2 volts 1 1 Buzzer Speaker
217. utton on the toolbar or by pressing Ctrl R Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the input state of three DIOs one on each connector The states of the Connector A and B DIOs should be high due to the internal pull up resistors and the Connector C DIO should be low because of the internal pull 4 PUSHBUTTON SWITCH see the B DIOO state indicator change to low release the pushbutton and the state should go high again The demo VI also counts pushbutton presses detected on B DIOO Stop and restart the VI to clear the counter value Disconnect Pushbutton Terminal 1 and reconnect to A DIOO pin 11 Confirm that the A DIOO state indicator changes in response to pushbutton presses Disconnect Pushbutton Terminal 1 and reconnect to C DIOO pin 11 Does the C DIOO state indicator change in response to a pushbutton press Can you explain the behavior you observe Click the Stop button or press the escape key to stop the VI and to reset NI myRIO a myRIO reset causes all of the digital I O pins to revert to input mode Troubleshooting tips Not seeing the expected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the too
218. ve as a local display of the current measurement e Data log file storage e Local display LCD Display 26 27 e Light and vision sensors ight Sonor 2 Webcam e Temperature sensors 8 Temperature Sensor 33 190 41 DATA LOGGER e Sound level sensors measure the RMS of the audio waveform 10 e e Range distance and position sensors P Bonie Range Finde job 37 e Magnetic field sensors 15 e Motion and vibration sensors 16 onboard accelerometer Accelerometer al 42 NTP Clock Network Time Protocal NTP servers provide precise time and date information to any Internet connected device See http nist time gov for a web style interface The LabVIEW project NTP Clock illustrates how to use the LabVIEW TCP IP VIs to query an NTP time server for the current date and time For example opening a TCP IP connection to nist time gov returns the string 56742 14 03 26 22 10 29 50 0 0 172 1 UTC NIST x which can then be parsed to obtain the date March 26 2014 and the time 22 10 29 Coordinated Universal Time NOTE Enable Wi Fi networking on your NI myRIO to allow NTP Clock to work properly With myRIO connected via USB browse to select the Net work Configuration tab select Connect to wireless network and then complete the re maining entries in the form Your myRIO is ready to connect to the NTP server when you see a valid entry for IPv4 Address You can ext
219. wnloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The demo VI displays the measured range in inches as a horizontal fill slide and digital display The output characters generated by the MB1010 appear in the lower left corner Allow at least 14 inches of clearance when you power on the range finder to allow its power on calibration to work properly and then try holding an object at known distances from the range finder You should find that the range finder accurately displays the distance to the object Try holding the object very close to the transducer i e closer than six inches Note how the range finder reports a minimum range of six inches Double click the upper limit of the horizontal fill slide and change its value to 254 this is the max imum range of the MB1010 Position the sonic range 20 SONIC RANGE FINDER finder in an open area of at least 22 feet Are you able to see the maximum possible range measurement Try objects of various thicknesses such as a pen or pencil The range finder cannot see small diameter objects unless they are sufficiently close Can you determine the maximum detectable range Try placing an object off to the side The range finder beam pattern looks a bit like a flashlight beam narrow near the transducer and fanning out farther away Can you determine
220. xpected results Confirm the following points e Glowing power indicator LED on NI myRIO e Black Run button on the toolbar signifying that the VI is in run mode e Correct transistor orientation the transistor has a rounded shape on one side and e Correct rectifier orientation when the rectifier is backwards the relay coil will never reach the voltage level necessary to turn on 6 2 Interface Theory Interface circuit The relay contains an electromag net coil that operates a spring loaded switch The coil current is approximately 100 mA well beyond the current drive limits of the NI myRIO digital output The interface circuit uses a p channel enhancement FET as a switch to turn the coil current on and off and a rectifier to protect the transistor from large back emf voltage when the transistor shuts off the coil current Study the video youtu be jLFL9_EWlwI 11 11 to learn more about the relay principles of operation and interface circuit design principles including sizing the transistor for relay coil current importance of the rectifier to deal with back emf voltage spiking and circuit topologies for DIOs with internal pull up resistors MXP connector and internal pull down resistors MSP connector LabVIEW programming Study the video Run Time Selectable I O Channels youtu be uJW7CaL6L5c 1 54 to learn how to use the low level Digital I O VIs Open Write and Close to create a VI with run time selectable
221. zip if you have not done Confirm that NI myRIO is connected to your so previously and unpack the contents toa _ omputer and convenient location e Run the VI either by clicking the Run button on e pen the project Discrete LED te toolbar or by pressing Ctrl R demo lvproj contained in the subfolder Discrete LED demo 2 DISCRETE LED Expect to see a Deployment Process window showing how the project compiles and deploys downloads to NI myRIO before the VI starts running NOTE You may wish to select the Close on successful completion option to make the VI start automatically Expected results The schematic diagram indicates a single 220 Q current limiting resistor you may instead use two series connected 100 2 resistors or two parallel connected 470 Q resistors from the NI myRIO Starter Kit Also all of the LEDs in the Starter Kit have clear plastic lenses with a wide variety of colors You may wish to try multiple LEDs to investigate your color options Your discrete LED should be blinking on and off in synchronism with the front panel indicator digital output state Click the enable blinker front panel button to disable blinking and to enable the digital level button click this button to manually set the digital output state either high or low Because this interface circuit is the sinking current form explained in the next section the LED is active when the digital output is in the low state i e thi
Download Pdf Manuals
Related Search
Related Contents
TOMAHAWK 1025 & 1538 Sun™ ONE Portal Server 3.0 Rewriter Configuration and - DESY MOCAP, TRUCKS AND VISUALIZATION TOOL USER`S MANUAL Teledyne BDS-3960 Oxygen Equipment User Manual User Manual Enviroglow General Warranty and T&Cs 2014 Samsung 460TSn Dynacord DRP 10 User's Manual Copyright © All rights reserved.
Failed to retrieve file