LabVIEW LINX and Raspberry Pi - Part2
LabVIEW LINX and Raspberry Pi - Part2
blog
Part 2: PWM and Push Buttons
LabVIEW LINX
and Raspberry Pi
LabVIEW + LabVIEW LINX Toolkit + Raspberry Pi
Hans-Petter Halvorsen
Table of Contents
• Raspberry Pi and LabVIEW LINX
• LabVIEW Raspberry Pi Project
• Digital Out and Digital In
• Push Buttons
• PWM
• Deployment
LabVIEW + LabVIEW LINX Toolkit
PC Raspberry Pi
LabVIEW GPIO
+ Ethernet
LabVIEW LINX Toolkit or Wi-Fi
Hardware
• Raspberry Pi
• Breadboard
• Wires (Jumper Wires)
• Resistors (𝑅 = 270Ω)
• LED, Push Button
https://www.halvorsen.blog
Raspberry Pi and
LabVIEW LINX
Hans-Petter Halvorsen Table of Contents
Raspberry Pi
GPIO Pins
Camera
Connector USB A x 4
My Configuration: On my
Windows PC I configured a
Wi-Fi Mobile hotspot. On the
Raspberry Pi I connected to
this Wi-Fi hotspot
Raspberry Pi LINX Configuration
You need to install
“LabVIEW Runtime Engine”
on the Raspberry Pi device.
LabVIEW Raspberry
Pi Project
Hans-Petter Halvorsen Table of Contents
Create your Raspberry Pi Project
Create your Raspberry Pi Project
Create your Raspberry Pi Project
LabVIEW Project Explorer
LED
𝑅 = 270Ω
GND (Pin34)
LED ON/OFF - LabVIEW Example
https://www.halvorsen.blog
Digital In (DI)
Push Buttons
Power Supply
-
Wiring (Pull-up Resistor)
5V (Pin2)
Using external Pull-up Resistor
𝑅 = 10𝑘Ω
GPIO23 (Pin16)
GND (Pin34)
Pull-down/Pull-up Resistor
Why do we need a pull-up or pull-down resistor in the
circuit?
• If you disconnect the digital I/O pin from everything, it
will behave in an irregular way.
• This is because the input is "floating" - that is, it will
randomly return either HIGH or LOW.
• That's why you need a pull-up or pull-down resistor in
the circuit.
Pull-up Resistor
+5V • When the pushbutton is open
(unpressed) there is a connection
Resistor between 5V and the DI pin.
DI • This means the default state is True
(High).
Switch
• When the button is closed
(pressed), the state goes to False
GND
(Low).
Pull-up Resistor
True/High False/Low
+5V +5V
Resistor Resistor
DI DI
GND GND
Push Button (Pull-up Resistor)
Button is NOT Pushed => True/High
Switch Switch
Open Closed
DI DI
GND GND
Wiring (Pull-down Resistor)
5V (Pin2)
Using external Pull-down Resistor
GPIO23 (Pin16)
𝑅 = 10𝑘Ω
GND (Pin34)
Push Button (Pull-down Resistor)
Button is NOT Pushed => False/Low
PWM
Not Working!
PWM as “Analog Out”
The Raspberry Pi has no
real Analog Out pins, but
we can use a PWM pin.
https://www.electronicwings.com/raspberry-pi/raspberry-pi-pwm-generation-using-python-and-c
PWM pins on Raspberry Pi
PWM LED Wiring
GPIO12 PWM0 (Pin32)
LED
𝑅 = 270Ω
GND (Pin34)
PWM Example
We will see the brightness of the LED
will increase.
Or you can use a Multimeter and see
the (average) voltage will increase
PWM Example
PWM Example
20% → 1V 1V
0-100% → 0-5V
https://www.halvorsen.blog
E-mail: hans.p.halvorsen@usn.no
Web: https://www.halvorsen.blog