Chapter 1 Introduction to “Basic Programming for Electronics”

28
Chapter 1 Introduction to “Basic Programming for Electronics” Dr. Minhhuy Le 606-A4, EEE, Phenikaa Uni. [email protected] 1

Transcript of Chapter 1 Introduction to “Basic Programming for Electronics”

Page 1: Chapter 1 Introduction to “Basic Programming for Electronics”

Chapter 1Introduction to

“Basic Programming for Electronics”

Dr. Minhhuy Le

606-A4, EEE, Phenikaa Uni.

[email protected]

1

Page 2: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.1 Course introduction and grades

1.2 Electrical and Electronic Signals

1.3 Introduction to LabVIEW

Outline

2

Page 3: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

• Credits: 3

• Prerequisite: “Basic informatics” course: C/C++

• Course summary: Học phần Lập trình căn bản – điện tử cung cấpnhững kiến thức cơ bản về lập trình thu thập vàxử lýdữ liệu điện/điệntử. Học phần sẽ cung cấp những kiến thức cần thiết về ngôn ngữ lậptrình LabVIEW. Sinh viên sẽ được trang bị kiến thức về cấu trúcchương trình, biến, hàm, đồ họa, thiết kế giao diện, đóng gói phầnmềm, kết nối cổng COM serial (RS232, USB...), thu thập vàđiềukhiển thông qua Arduino vàNI-DAQmx. Sinh viên sẽ được tham giathực hiện các project hoàn thiện một hệ thống xây dựng phần mềm từthu thập-phân tích-điều khiển hoặc thực hiện hóa các ý tưởng củamình.

1.1 Course introduction and grades

3

Page 4: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

Course outlines:

Chương 1: Tổng quan về lập trình cho kỹ sư điện/điện tử

Chương 2: Các kỹ thuật lập trình giao diện với LabVIEW

Programming environment, structures (if/while/for…), graph….

Chương 3: Lập trình với thiết bị NI-DAQmx

Collect electronic signal via DAQmx

Chương 4: Lập trình kết nối thiết bị ngoại vi

Communiation standards: RS232, RS485, USB, GPIB

Chương 5: Lập trình LabVIEW với Arduino

Receive/Control signal via Arduino

1.1 Course introduction and grades

4

Page 5: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.1 Course introduction and grades

5

• Output requirements:➢Lập trình và sử dụng thành thạo LabVIEW cơ bản như: đồ họa, cấu trúc

chương trình, lưu và đọc dữ liệu từ file

➢Có khả năng xây dựng chương trình và giao diện phần mềm LabVIEW, để thuthập, lưu trữ và xử lý dữ liệu qua thiết bị ngoại vi.

➢Vận dụng xây dựng chương trình phần mềm LabVIEW hoàn thiện từ giao diệnngười dùng, kết nối giao tiếp thiết bị, đo lường, phân tích dữ liệu, và điềukhiển thiết bị.

➢Có khả năng làm việc nhóm, phân chia công việc trong quá trình thực hiện dựán.

Page 6: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.1 Course introduction and grades

6

Grades:

• Must attend ≥ 80% total lectures

• Class attention + Exercises: 10%

• Midterm: 20%

• Final project: 70%

Page 7: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

Text Books:

• [1] John Essick (2018), Hands-On Introduction to LabVIEW for Scientists and Engineers,

Oxford University Press.

• [2] Nguyễn Tất Bảo Thiện, Phạm Quang Huy, Lập trình IoT với Arduino ESP8266 &

XBEE, NXB Thanh niên, 2018

References:

• [3] LabVIEW, “Training Course Details: LabVIEW Core 1, 2”,

http://www.ni.com/product-documentation/14437/en/

• [4] Rajesh Singh, Anita Gehlot, Bhupendra Singh, Sushabhan Choudhury, Arduino-Based

Embedded Systems: Interfacing, Simulation, and LabVIEW GUI, CRC Press; 1st edition

(November 22, 2017)

1.1 Course introduction and grades

7

Page 8: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.1 Course introduction and grades

8

Applications of LabVIEW

https://www.youtube.com/watch?v=Kf6rkwwc23w

Page 9: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.2 Electrical and Electronic Signals

9

Example: Karaoke system

How does the signal flow?

Voice -> Mic -> Signal process box-> Volume -> Voice

Page 10: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.2 Electrical and Electronic Signals

10

What are Electrical and Electronic signals?

Voice Transducer

Electronic processors

Transducer

Electrical signalI, V

Electronic signal

Signal

Electrical signal: Tín hiệu điệnElectronic signal: Tín hiệu điện tửTransducer: Bộ chuyển đổiProcessor: Bộ xử lý

Page 11: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.2 Electrical and Electronic Signals

11

What are Electrical and Electronic signals?

• Electrical signal is made by a transducer that converts the signal from its original form to a waveform expressed as a current (I) or voltage (V)

• Electronic signal is the signal available for further processing by electrical devices (e.g. amplifiers, filters...)

Page 12: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.2 Electrical and Electronic Signals

12

How does signal flow?

Sensors (transducers): Cảm biếnPhysical signal: Tín hiệu vật lýAnalog devices: Thiết bị xử lý tín hiệu tương tựADC = Analog-to-Digital Converter: Bộ chuyển đổi sốDSP = Digital Signal Processing: Bộ xử lý tín hiệu số

AVR, ARM, FPGA, Arduino...

Software

PC

SensorsPhysical signal

ADC

DSP

Output

Analog devices

Page 13: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW,

13

• LabVIEW: Laboratory Virtual Instrument Engineering Workbench• Graphical language: “G”; Software for Virtual Instrumentation (VI)

• Product of National Instruments (NI), US (by Jeff Kodowsky)• Initial release: 1986 for Apple Macintosh, newest version (LabVIEW

2019)

• Operating system: Windows, macOS, Linux...

• Written in C, C++, .Net

Page 14: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW,

14

Virtual Instruments (VIs)?

Appearance and operation imitates actual physical instruments

Actual Oscilloscope Oscilloscope in LabVIEW

Page 15: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW,

15

Features of LabVIEW:

Design:- Signal and Image processing- Embedded System Programming (PC, DSP, FPGA, Microcontroller)- Simulation and PrototypingControl:- Automatic Controls and Dynamic Systems- Mechatronics and RoboticsMeasurements:- Circuits and Electronics- Measurement and Instrumentation

Page 16: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW

16

Initialinterface

Page 17: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW

17

Text-Based Graphic-Based

LabVIEW

Front panel

Block diagram

Page 18: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW,

18

Flexible, Modular Hardware

Page 19: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW,

19

Flexible, Modular Hardware

PC-based systemsMeasurement & Test

CompactRIO(Distributed Measurement &

Control)

PXI(High-performance test)

LabVIEW

Page 20: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW

20

Easy to build applications

Sensors DAQ, AI, AODI, DO...

Analysis, Display, Control

Page 21: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW

21

Applications of LabVIEW: Controls & Maintenances

Page 22: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW

22

Applications of LabVIEW: Robotics

Page 23: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW

23

Applications of LabVIEW: Automation

https://www.youtube.com/watch?v=7Xf01eH1cXk

Page 24: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW

24

Applications of LabVIEW: Robotics

https://www.youtube.com/watch?v=P3VSwIA1ERg

Page 25: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW

25

Applications of LabVIEW: Robotics

https://www.youtube.com/watch?v=tdp-UZkBokA

Page 26: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW

26

Applications of LabVIEW: Nondestructive testing (NDT)

Page 27: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW

27

Basic LabVIEW programming

Signal control & Data acquisition

Practice withProteus & Arduino

Loopsfor, while, if, shift

DAQmxAI/AO/DI/DO

Graphsplots, multiplot

Filesread, write

RS232 RS485 GPIB

External devices:

1

2

3Simulation Project Real applications

Page 28: Chapter 1 Introduction to “Basic Programming for Electronics”

Minhhuy Le, EEE, Phenikaa Uni.

1.3 Introduction to LabVIEW

28

Summary:

• Electrical & Electronic Signal flows: Transducers, ADC, DSP,…

• Keywords

• Graphic-based vs. Text-based programming

• LabVIEW Features: Design, control & measurement

• LabVIEW Applications: Virtual devices, Laboratory, Industry