Post on 19-Jan-2017
Hans-PetterHalvorsen
http://home.hit.no/~hansha/?equipment=myrio
2016.08.17
myRIOOverview
http://www.ni.com/myrio
http://home.hit.no/~hansha
myRIO Resources
http://home.hit.no/~hansha/?equipment=myrio
HardwareOverview
HardwareOverview• Wi-Fi• Three-axisAccelerometer• AudioIn/Out• USB• 4LEDs• 1PushButton• 3differentI/OConnectors(MXP:ConnectorA,B),MSP:ConnectorC)
• AnalogIn• AnalogOut• DigitalIn• DigitalOut• UART
HardwareOverview
2MXP34pinsConnectors(A,B)
Analog/DigitalI/OConnector(C)
QuickStart
1. InstallSoftware– LabVIEW– LabVIEWReal-TimeModule– LabVIEWmyRIOToolkit
2. ConnectyourmyRIOHardwaretotheUSBPortonyourPC3. Makesureyourdeviceisworkingproperly(followthewizard
thatpopsup)4. CreateasimpletestprograminLabVIEW
SoftwareInstallation
ThefollowingSoftwareareneeded:1. LabVIEW2. LabVIEWReal-TimeModule3. LabVIEWmyRIOToolkit
www.ni.com/academic/download
www.ni.com/download
Youmaydownloadthesoftwarehere:
GettingStartedWhenplugginginthemyRIOdevice,thefollowingwindowshouldpopup:
GettingStarted– TesttheDevice
9
WebConfiguringmyRIOdefaultIPAddress:172.22.11.2
JusttypetheIPAddress(172.22.11.2)inastandardWebBrowser
MAXMAX– Measurement&AutomationExplorer
Accessories
MXPBreadboard
IncludedwithmyRIOStarterKitorbuyseparately
AccessoriesmyRIOStarterKit
myRIOStarterKit• Barrelconnectorwithleads• Assortedcapacitors• Diodes• 7-segmentdisplay• Mechanicalrotaryencoder• Photointerruptor(lightsensorwithLED)
• Assortedop-amps• AssortedLEDs• SmallDCmotor(1VDCto3VDC,noloadspeed:6600rpm)
• Microphonewithaudiojack• MXPBreadboardAccessory
• Potentiometer(500kΩ)• Relay• Assortedresistors• Piezoelectricsensor• Photocell• 2Halleffectsensors(latchandswitch)
• Buzzer• Assortedswitches(DIP,slide,androtary)
• Thermistor(NTC:10kΩ,25degrees)
• Assortedtransistors• Forcesensingresistor• Wirekit
AccessoriesmyRIOMechatronicsKit
myRIOMechatronicsKitTheNImyRIOMechatronicsAccessoryKitincludesavarietyofcommonlyusedmotors,sensors,andcomponents.• Gearedmotor19:1(includesencoderforrotationandspeed,12V)
• Ultrasonicrangefinder(accuratereadingsof0in.to255in.or6.45m)
• Compass• Servomotor:standard(215degreesrotation)• Servomotor:continuousrotation• Accelerometer(3axis,digital- SPIandI2C)• H-bridgedriver(compatiblewithgearmotor)• Gyroscope(3axis,digital- SPIandI2C)• Infraredproximitysensor(10cmto80cm)• Ambientlightsensor(SPI)
LEDExampleThissimpleexamplelightsaLEDontheBreadboardwhenpushingthebutton(BUTTON0)inthemyRIOdevice
BUTTON0ElectriccircuitthatmakestheLEDlight
LEDExampleThissimpleexamplelightsaLEDontheBreadboardwhenpushingthebutton(BUTTON0)inthemyRIOdevice
LEDExample
LabVIEWApplication:
Add/RemoveSoftwareComponentsAdd/RemoveSoftwareusingMAX
Bydefault,onlyaminimumsetofSoftwarecomponentsareinstalled.Ifyoucreatemoreadvancedapplications,youmayneedtodownloadadditionalsoftwarecomponentsrunningonthedevice.
PublishingData
SincemyRIOincludesWiFi,thedeviceisidealforPublishingDataoveraNetworkExamples:• OPC• WebService
MakesuretoAdd/InstalltheproperSoftwareComponentsonthemyRIOdevice
OPC
YoucanusetheDataSocketfunctionsinordertocommunicatewithanOPCServer
WebService
• WebServicesisamoremodernapproachthanOPC
• LabVIEWhasbuilt-infeaturesforcreatingWebServicesandconsumingWebServices
CreatingandAccessingaLabVIEWWebService:http://zone.ni.com/reference/en-XX/help/371361K-01/lvhowto/build_web_service
DeployyourApplication
https://www.youtube.com/watch?v=JXoJECRS-eo&feature=youtu.be
• DuringdevelopmentyounormallyconnectNImyRIOtoyourcomputerwithaUSBcable.
• Afterdevelopmentiscompleteyoucaneasilydeployyourprojectasastand-aloneapplicationstoredonthemyRIOsolid-stateharddrivethatstartsautomaticallywhenyoupowerupthemyRIO
• NoUSBcablerequiredafterwards.
BuildaStand-AloneApplication
Step-by-stepprocedure:
CommunicationProtocolsavailableonmyRIO
• UART(UniversalAsynchronousReceiver/Transmitter,)• ...– http://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter
• SPI(SerialPeripheralInterface)– ...– http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus
• I2C(Inter-IntegratedCircuit)– ...– http://en.wikipedia.org/wiki/I2C
http://www.byteparadigm.com/applications/introduction-to-i2c-and-spi-protocols
myRIO – SPIBus• SerialPeripheralInterface(SPI)isasynchronousserialdataprotocolusedby
microcontrollersforcommunicatingwithoneormoreperipheraldevicesquicklyovershortdistances.
• WithanSPIconnectionthereisalwaysonemasterdevice(usuallyamicrocontroller)whichcontrolstheperipheraldevices.
• SPIdevicescommunicateinfullduplexmodeusingamaster-slavearchitecturewithasinglemaster.
• TheinterfacewasdevelopedbyMotorolaandhasbecomeadefactostandard.• Typicalapplicationsincludesensors,SecureDigitalcards,andliquidcrystaldisplays
(LCD).
http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus
SCLK:SerialClock(outputfrommaster)MOSI:MasterOutput,SlaveInput(outputfrommaster)MISO:MasterInput,SlaveOutput(outputfromslave)SS(orSC):SlaveSelect(activelow,outputfrommaster)
https://learn.sparkfun.com/tutorials/serial-peripheral-interface-spi
myRIO - I2CBus
http://en.wikipedia.org/wiki/I2C
• I²C(Inter-IntegratedCircuit),isamulti-master,multi-slave,single-ended,serialcomputerbus
• Itistypicallyusedforattachinglower-speedperipheralICstoprocessorsandmicrocontrollers.
• I²CistypicallyspelledI2C(pronouncedI-two-C)• TheI²Cbuswasdevelopedin1982byPhilipsSemiconductor.• TheI²Cprotocolrequiresonly2wiresforconnectingalltheperipheraltoamicrocontroller.
https://learn.sparkfun.com/tutorials/i2c
Hans-PetterHalvorsen,M.Sc.
UniversityCollegeofSoutheastNorwaywww.usn.no
E-mail:hans.p.halvorsen@hit.noBlog:http://home.hit.no/~hansha/