https://www.halvorsen.blogLabVIEW LINXand ArduinoLabVIEW LabVIEW LINX Toolkit ArduinoHans-Petter Halvorsen
Contents This Tutorial shows how we can use Arduino incombination with the LabVIEW Programming environment “LabVIEW LINX Toolkit” is an add-on for LabVIEW whichmakes it possible to program the Arduino device usingLabVIEW In that way we can create Data Logging Applications, etc.without the need of an expensive DAQ device If you don’t have “LabVIEW Professional” Software, youmay use the “LabVIEW Community Edition” (free for noncommercial use). You then get a very low-costDAQ/Datalogging System!
Table of Contents Introduction to LabVIEW LINX DAQ System Input/Output Channels– Digital I/O Digital Out/Write Digital In/Read– Analog I/O Analog Out/Write - PWM (Pulse Width Modulation) Analog In/Read Sensors– TMP36 Temperature Sensor– Thermistor Temperature Sensor
LabVIEW LabVIEW LINX ToolkitPCArduino UNOLabVIEW SensorsLabVIEW LINX ToolkitUSB cable Type A-BTMP36TemperatureSensor
Hardware ArduinoBreadboardWires (Jumper Wires)Resistors (𝑅 270Ω, 𝑅 10𝑘Ω)LED, Push ButtonTMP36 Temperature SensorThermistor
Arduino UNO Arduino is a Microcontroller Arduino is an open-source platformwith Input/Output Pins (DigitalIn/Out, Analog In and PWM) Price about 20 Arduino Starter Kit 40-80with Cables, Wires, Resistors, Sensors, etc.
Arduino I/O ChannelsDigital Inputs and Digital OutputsYou can choose from thecode if they are to beinputs or outputsThose marked with can alsobe used as "Analog Outputs",so-called PWM outputsAnalog Inputs
LabVIEW LabVIEW is Graphical Software LabVIEW has powerful features forsimulation, control and DAQapplicationsBasic LabVIEW Example:
LabVIEW LINX Toolkit The LabVIEW LINX Toolkit addssupport for Arduino, Raspberry Pi,and BeagleBone embeddedplatforms We will use Arduino Uno in thisTutorial
Installing LabVIEW LINX ToolkitUse VI Package MangerNote: Do not install this package if you are running LabVIEW 2020 Community Edition or later,as the Community Edition already includes the LabVIEW LINX Toolkit
LabVIEW LINX
LINX Firmware Wizard
LabVIEW Palette
https://www.halvorsen.blogDAQ SystemHans-Petter HalvorsenTable of Contents
DAQ SystemDAQ – Data AcquisitionInput/Output SignalsAnalog SignalsSoftwareAnalog IOApplicationDigital SignalsHardware DriverUSB, etc.Sensors(Analog/DigitalInterface)Digital IOData AcquisitionHardwarePCWe will use an Arduino Uno as the DAQ Hardware
I/O ModuleAnalog SignalsAnalog SensorsAnalog IOAnalog Input (AI)Analog Output (AO)Digital IODigital Signals0 5𝑉I/O ModuleDigital Input (DI)Digital Output (DO)TrueFalseSensors with Digital Interface (e.g., SPI, I2C)
https://www.halvorsen.blogLabVIEW LINXArduino DAQ SystemHans-Petter HalvorsenTable of Contents
-Petter HalvorsenTable of Contents
Arduino I/O ChannelsDigital Inputs and Digital OutputsYou can choose from thecode if they are to beinputs or outputsThose marked with can alsobe used as "Analog Outputs",so-called PWM outputsAnalog Inputs
Input/Output Channels Digital–Digital Out–Digital In Analog–Analog Out–Analog In
https://www.halvorsen.blogDigital I/OHans-Petter HalvorsenTable of Contents
LabVIEW Palette – Digital I/O
Digital I/ODigital Inputs and Digital OutputsYou can choose from thecode if they are to beinputs or outputsThose marked with can alsobe used as "Analog Outputs",so-called PWM outputs
https://www.halvorsen.blogDigital Out (DO)Hans-Petter HalvorsenTable of Contents
Digital Out (DO) We will use the Digital Out pins toturn on/off a LED
Breadboard WiringMake sure not to short-circuitthe components that youwire on the breadboardThe Breadboard is used to connect components and electrical circuits
LED WiringLED𝑅 270Ω
LabVIEW Example
Multiple Digital Out Channels
https://www.halvorsen.blogDigital In (DI)Hans-Petter HalvorsenTable of Contents
LabVIEW - Digital InWe can test the Digital In (Read) by wiring to 5V (True/High) or GND (False/Low)False/LowTrue/High
LabVIEW - Digital In
LabVIEW Digital Write - ReadWe can test the Digital In (Read) by wiring a DigitalOut (Read) Channel to the Digital In (Read) Channel
LabVIEW Digital Write - Read
Push Button/Switch Pushbuttons or switches connect twopoints in a circuit when you press them. You can use it to turn on a Light whenholding down the button, etc.Light Switch (On/Off)Power Supply-
Wiring (Pull-up Resistor)Another Digital Channelcan of course be usedUsing external Pull-up Resistor𝑅 10𝑘Ω
Pull-down/Pull-up ResistorWhy do we need a pull-up or pull-down resistor in thecircuit? If you disconnect the digital I/O pin from everything, itwill behave in an irregular way. This is because the input is "floating" - that is, it willrandomly return either HIGH or LOW. That's why you need a pull-up or pull-down resistor inthe circuit.
Pull-up Resistor 5VResistorDISwitchGND When the pushbutton is open(unpressed) there is a connectionbetween 5V and the DI pin. This means the default state is True(High). When the button is closed(pressed), the state goes to False(Low).
Pull-up ResistorTrue/HighFalse/Low 5VResistor 5VResistorDISwitchOpenDIWe Push the ButtonGNDSwitchClosedGND
Push Button (Pull-up Resistor)Button is NOT Pushed True/HighButton is Pushed False/Low
Adding a “NOT” blockButton is NOT Pushed False/LowButton is Pushed True/High
Pull-down ResistorWe could also have wired according to a “Pull-down“ ResistorFalse/LowTrue/High 5V 5VSwitchOpenSwitchClosedDIDIWe Push the ButtonResistorGNDResistorGND
Wiring (Pull-down Resistor)Another Digital Channelcan of course be usedUsing external Pull-down Resistor𝑅 10𝑘Ω
Push Button (Pull-down Resistor)Button is NOT Pushed False/LowButton is Pushed True/High
https://www.halvorsen.blogAnalog I/OHans-Petter HalvorsenTable of Contents
Analog I/OThose marked with can alsobe used as "Analog Outputs",so-called PWM outputs
LabVIEW Palette – Analog I/O
https://www.halvorsen.blogAnalog Out (AO)Hans-Petter HalvorsenTable of Contents
Analog Out Arduino UNO has no real Analog Out We need to use Pulse Width Modulation(PWM)Not Working!
PWM as “Analog Out”The Arduino UNO has noreal Analog Out pins, butwe can use a PWM pin.PWM can be used tocontrol brightness of aLED, control the speed ofa Fan, control a DC Motor,etc.
PWMPWM is a digital (i.e., square wave) signal that oscillates according to a given frequency andduty cycle.The frequency (expressed in Hz) describes how often the output pulse repeats.The period is the time each cycle takes and is the inverse of frequency.The duty cycle (expressed as a percentage) describes the width of the pulse within thatfrequency window.You can adjust the duty cycleto increase or decrease theaverage "on" time of thesignal. The following diagramshows pulse trains at 0%,25%, and 100% duty:
PWMThe Digital Pins marked with can be used as "AnalogOutputs", so-called PWMoutputs
Control Brightness of a LED We've seen how to turn an LED on and off, but how dowe control its brightness levels? An LED's brightness is determined by controlling theamount of current flowing through it, but that requires alot more hardware components. A simple trick we can do is to flash the LED faster thanthe eye can see! By controlling the amount of time the LED is on versusoff, we can change its perceived brightness. This is known as Pulse Width Modulation (PWM).
Control Brightness of a LEDBelow we see how we can use PWM to control the brightness of a spberry-pi-pwm-generation-using-python-and-c
WiringLED𝑅 270Ω
PWM ExampleWe will see the brightness of the LEDwill increase.Or you can use a Multimeter and seethe (average) voltage will increase
PWM Example
PWM Example20% 1V0-100% 0-5V1V
https://www.halvorsen.blogAnalog In (AI)Hans-Petter HalvorsenTable of Contents
Analog Input
Analog In
Analog In
https://www.halvorsen.blogLabVIEW LINXArduinoTemperature SensorsHans-Petter HalvorsenTable of Contents
https://www.halvorsen.blogSensorsHans-Petter HalvorsenTable of Contents
SensorsWe will use 2 different types of TemperatureSensors: TMP36 Temperature Sensor Thermistor Temperature Sensor
SensorsSome Examples ofpremade Sensor VIsYou can use these, or youcan also easily make yourown VIs for interfacingSensors from scratch
https://www.halvorsen.blogTMP36 TemperatureSensorHans-Petter HalvorsenTable of Contents
Hardware ArduinoBreadboardTMP36 Temperature SensorWires (Jumper Wires)
TMP36 Temperature Sensor A Temperature sensor like TM36 usea solid-state technique to determinethe temperature. They use the fact as temperatureincreases, the voltage across a diodeincreases at a known rate. It costs only about or
TMP36TMP is a small, low-cost temperature sensor and cost about 1 (you can buy it “everywhere”)
Wiring
LabVIEWLabVIEW LINX has a built-in SubVI for TMP3x Sensors
LabVIEW
Do it from Scratch LabVIEW LINX has a built-in SubVI forTMP3x Sensors (TMP3x.vi) Let's see how we can do it from“Scratch” We use the Datasheet and theordinary “Analog Read.vi”
Output Voltage vs. TemperatureDatasheet
Linear ScalingConvert form Voltage (V) to degrees CelsiusFrom the Datasheet we have:(𝑥! , 𝑦! ) (0.75𝑉, 25 𝐶)(𝑥" , 𝑦" ) (1𝑉, 50 𝐶)There is a linear relationship betweenVoltage and degrees Celsius:𝑦 𝑎𝑥 𝑏This gives:𝑦 25 50 25(𝑥 0.75)1 0.75Then we get the following formula:𝑦 100𝑥 50We can find a and b using the followingknown formula:𝑦 𝑦! 𝑦" 𝑦!(𝑥 𝑥! )𝑥" 𝑥!
LabVIEW Example𝑦 100𝑥 50
https://www.halvorsen.blogThermistorTemperature SensorHans-Petter HalvorsenTable of Contents
ThermistorA thermistor is an electronic component that changesresistance to temperature - so-called ResistanceTemperature Detectors (RTD). It is often used as atemperature sensor.Our Thermistor is a so-called NTC (Negative Temperature Coefficient).In a NTC Thermistor, resistance decreases as the temperature rises.There is a non-linear relationship between resistance and excitement. To find thetemperature we can use the following equation (Steinhart-Hart equation):1 𝐴 𝐵 ln(𝑅) 𝐶 ln(𝑅)𝑇7where 𝐴, 𝐵, 𝐶 are constants given below[Wikipedia]𝐴 0.001129148, 𝐵 0.000234125 𝑎𝑛𝑑 𝐶 8.76741𝐸 08
Hardware ArduinoBreadboardThermistor 10K (Temperature Sensor)Wires (Jumper Wires)Resistor 10 kΩ
Wiring𝑅 10 𝑘ΩThermistor
Voltage Divider 5VThe wiring is called a “Voltage divider”:10𝑘 ThermistorAnalog In (AI)𝑅 10𝑘ΩGND[https://en.wikipedia.org/wiki/Voltage divider]
General Voltage DividerWe want to find 𝑉9:; Formula:𝑅!𝑉&' -𝑅"𝑉# %-𝑉!"#𝑅& 𝑉 %𝑅' dividers/all
Voltage Divider for our SystemVoltage Divider Equation:𝑉9:;𝑅; 𝑉 𝑅 𝑅;We want to find 𝑅% :𝑅! "!"# # "%& "!"# 5𝑉 𝑉&'-𝑅( 10𝑘Ω𝑅% 𝑉# %-𝑅% - 10k Thermistor. This varies withtemperature. From Datasheet weknow that 𝑅% 10𝑘Ω @25 Steps:1. We wire the circuit on the Breadboard and connect it to the DAQ device2. We measure 𝑉# % using the DAQ device3. We calculate 𝑅% using the Voltage Divider equation4. Finally, we use Steinhart-Hart equation for finding the Temperature
Steinhart-Hart EquationTo find the Temperature we can use Steinhart-Hart Equation:1 𝐴 𝐵 ln(𝑅) 𝐶 ln(𝑅) *𝑇)This gives:1𝑇F 𝐴 𝐵 ln 𝑅 𝐶 ln 𝑅Where the Temperature 𝑇) is in Kelvin𝐴, 𝐵 𝑎𝑛𝑑 𝐶 are constantsThe Temperature in degrees Celsius will then be:𝑇I 𝑇F 273.157𝐴 0.001129148𝐵 0.000234125𝐶 0.0000000876741
Pseudo Code1. Get 𝑉9:; from the DAQ device (Arduino UNO)O!"# P 2. Calculate 𝑅; O%& QO!"#3. Calculate 𝑇F STU V RP# TI V P# '4. Calculate 𝑇I 𝑇F 273.155. Present 𝑇I in the User Interface
Pseudo Codefloat Vin 5;float Ro 10000;float Rt (Vout*Ro)/(Vin-Vout);//Steinhart constantsfloat A 0.001129148;float B 0.000234125;float C 0.0000000876741;//Steinhart-Hart Equationfloat TempK 1 / (A (B * ln(Rt)) (C * ln(Rt)**3));//Convert from Kelvin to Celsiusfloat TempC TempK - 273.15;
LabVIEW
LabVIEW - Steinhart-Hart EquationAlternative 1: Formula NodeSomething may be easier to do in atext-based programming language
LabVIEW - Steinhart-Hart EquationAlternative 2: Pure LabVIEW Code
Summary This Tutorial has shown how we can use Arduino incombination with the LabVIEW Programming environment “LabVIEW LINX Toolkit” is an add-on for LabVIEW whichmakes it possible to program the Arduino device usingLabVIEW In that way we can create Data Logging Applications, etc.without the need of an expensive DAQ device If you in addition use the “LabVIEW Community Edition”(free for non-commercial use) you get a very low-costDAQ/Datalogging System! You can also easily add features for logging data to Files or aDatabase System like SQL Server, or an OPC Server
Hans-Petter HalvorsenUniversity of South-Eastern Norwaywww.usn.noE-mail: hans.p.halvorsen@usn.noWeb: https://www.halvorsen.blog
This Tutorial shows how we can use Arduino in combination with the LabVIEW Programming environment “LabVIEW LINX Toolkit” is an add-on for LabVIEW which makes it possible to program the Arduino device using LabVIEW In that way we can create Data Logging Appli
of the LabVIEW Arduino interface. What this book covers Chapter 1, Welcome to LabVIEW and Arduino, introduces you to the Arduino platform and the LabVIEW software. Chapter 2, Getting Started with the LabVIEW Interface for Arduino, shows you how to install and use the LabVIEW interface for Arduino via the LINX module.
Certified LabVIEW Architect Exam LabVIEW Core 1 LabVIEW Core 3 LabVIEW Core 2 Managing Software Engineering in LabVIEW Advanced Architectures in LabVIEW LabVIEW Connectivity Object-Oriented Design and Programming in LabVIEW LabVIEW Performance LabVIEW Real-Time 1
examples. So launch LabVIEW and explore the LabVIEW environment as you read this section. 1.3.1 Starting LabVIEW . If your version of LabVIEW was installed using the default installation procedure, launch LabVIEW by selecting All Programs National Instruments LabVIEW 2013 (or LabVIEW 2014) LabVIEW 2013 (or LabVIEW 2014) from the Start menu .
DAQ device/hardware 3. Driver software 4. Your software application (Application software) NI DAQmx Driver Your App created with LabVIEW NI TC-01 Thermocouple Device or NI USB 6008 DAQ Device Sensors, etc. Using TC-01 in LabVIEW Hans-Petter Halvorsen, M.Sc. TC-01 Hans-Petter Halvorsen, M.Sc. How-To use TC -01 with LabVIEW USB
Labview Exercises for Labview 7.0 Installation of Labview: 1. Install the Labview 7.0 software and drivers onto your computer. These files can be found by mapping a network drive to \\poohbah\labview, and by running the ‗autorun‘ file in the ‗Labview 7‘ folder. The serial num
The LabVIEW GUI for Arduino is a device extension that allows you to link your Arduino to LabVIEW and run LabVIEW code on your Arduino. The object control device is used in the artificial intelligence area, such . design is compulsory to understand the human emotions. Moreover in this work acrostic commands are used to controlling robotic .
Arduino compatible components. Personal computer running Arduino software Arduino software is free to download and use from: www.arduino.cc Arduino board Such as: Arduino Uno Freetronics Eleven Genuino Uno or any Arduino compatible board that has a standard Arduino UNO header l
Grade 2 Home Learning Packet The contents of this packet contains 10 days of activities in paper copy. Students should be completing this packet, along with completing lessons on their math/reading online programs daily. If we surpass the 10 days without school, students should continue using their online math and reading programs for 45 minutes per day per program unless otherwise specified .