RED PITAYA Dogan Ibrahim
FOR TEST & MEASUREMENT
The Red Pitaya is a credit card-sized, open-source test and measurement board that can be used to replace most measurement instruments used in electronics laboratories. With a single click, the board can transform into a webbased oscilloscope, spectrum analyser, signal generator, LCR meter, Bode plotter, and microcontroller. Prof Dr Dogan Ibrahim is a Fellow of the Institution of Electrical Engineers.
ISBN 978-1-907920-53-0
This book is written for college level and first year university students studying electrical or electronic engineering.
RED PITAYA
FOR TEST & MEASUREMENT
DOGAN IBRAHIM
In addition, he is the author of over 250 technical papers, published in journals, and presented in seminars and conferences.
This book is an introduction to electronics. It aims to teach the principles and applications of basic electronics by carrying out real experiments using the Red Pitaya. The book includes many chapters on basic electronics and teaches the theory and use of electronic components including resistors, capacitors, inductors, diodes, transistors, and operational amplifiers in electronic circuits. Many fun and interesting Red Pitaya experiments are included in the book. The book makes an introduction to visual programming environment.
EXPLORE, EXPERIMENT, PROGRAM
●
He is the author of over 60 technical books, published by international famous publishers, such as Wiley, Butterworth, and Newnes.
The Red Pitaya can replace the many pieces of expensive measurement equipment found at professional research organisations and teaching laboratories. The device, that based on Linux, includes an FPGA, digital signal processing (DSP), dual core ARM Cortex processor, signal acquisition and generation circuitry, micro USB socket, microSD card slot, RJ45 socket for Ethernet connection, and USB socket all powered from an external mains adaptor.
RED PITAYA FOR TEST & MEASUREMENT
EXPLORE, EXPERIMENT, PROGRAM
LEARN
www.elektor.com
DESIGN
Elektor International Media BV
Dogan Ibrahim LEARN
DESIGN
SHARE
SHARE
LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● RN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE SIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● RN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE
Red Pitaya for Test & Measurement.indd All Pages
14-07-16 09:11
Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Chapter 1 • Red Pitaya – Quick Startup Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.1 What is Red Pitaya ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.2 What’s in the Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.3 The Diagnostic Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.4 Impedance Analyzer Extension Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.5 Sensor Extension Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 1.6 Red Pitaya Casing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 1.7 Red Pitaya Board Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 1.8 Brief Specifications of the Red Pitaya Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 1.9 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 1.9.1 Connecting Red Pitaya Board Through an Ethernet Cable . . . . . . . . . . . . . . . . . 25 1.9.2 IP Address of the Red Pitaya Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 1.9.3 Changing the IP Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 1.9.4 Accessing the Red Pitaya Operating System . . . . . . . . . . . . . . . . . . . . . . . . . . 28 1.9.5 Wireless Connection Without a Router . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 1.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Chapter 2 • Resistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 2.1 What is a Resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 2.2 Series and Parallel Resistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.2.1 Series Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.2.2 Parallel Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 2.2.3 Hybrid Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 2.3 Ohm’s Law . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 2.3.1 Division of Current . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 2.3.2 Division of Voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 2.4 Kirchoff’s Laws . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 2.4.1 Kirchhoff’s Current Law . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 2.4.2 Kirchoff’s Voltage Law . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 2.5 Power in Resistor Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 2.6 Using Red Pitaya To Measure Voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 2.7 Thermistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
●5
Red Piyata UK 160606.indd 5
07-07-16 16:20
Red Pitaya for Test & Measurement 2.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 2.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Chapter 3 • Capacitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 3.1 What is a Capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 3.1.1 Parallel Plate Capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 3.1.2 Capacitors in Parallel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 3.1.3 Capacitors in Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 3.1.4 Marking of Capacitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 3.2 Current Through a Capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 3.3 Resistor - Capacitor Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 3.4 Energy Stored in a capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 3.5 Red Pitaya Experiment with Resistor – Capacitor Circuit . . . . . . . . . . . . . . . . . . . 78 3.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 3.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Chapter 4 • Inductors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 4.1 What is an Inductor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 4.2 Resistor – Inductor Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 4.3 Energy Stored in an Inductor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 4.4 Red Pitaya LCR Meter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 4.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 4.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Chapter 5 • Alternating Current and Voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 5.1 What is Alternating Current . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 5.1.1 Root Mean Square Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 5.1.2 Average Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 5.2 Phase and Phase Difference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 5.3 Other Waveforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 5.3.1 Square Wave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 5.3.2 Triangular Wave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 5.4 Red Pitaya Experiments With Waveforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 5.4.1 Experiment 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 5.4.2 Experiment 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
●6
Red Piyata UK 160606.indd 6
07-07-16 16:20
Inhalt 5.4.3 Experiment 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 5.4.4 Experiment 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 5.4.5 Experiment 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 5.5 Transformers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 5.6 Resistors, Capacitors, and Inductors in AC Circuits and Resonance . . . . . . . . . . . 111 5.6.1 Inductive Reactance and Capacitive Reactance . . . . . . . . . . . . . . . . . . . . . . . 111 5.6.2 Resonance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 5.6.3 Experiment 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 5.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 5.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Chapter 6 • Semiconductor Diodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 6.1 The Semiconductor Diode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 6.2 Types of Diodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 6.2.1 Power Supply Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 6.2.2 Light Emitting Diodes (LED) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 6.2.3 Zener Diodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 6.2.4 Varactor Diodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 6.3 Red Pitaya Experiment - Half Wave Rectifier Circuit . . . . . . . . . . . . . . . . . . . . . 125 6.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 6.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Chapter 7 • Bipolar Transistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 7.1 How a Transistor Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 7.2 The NPN Transistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 7.2.1 DC Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 7.2.2 AC Analysis – Transistor Amplifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 7.3 Red Pitaya Experiment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 7.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 7.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Chapter 8 • Operational Amplifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 8.1 What is an Operational Amplifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 8.2 Operational Amplifier Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 8.2.1 Inverting Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
●7
Red Piyata UK 160606.indd 7
07-07-16 16:20
Red Pitaya for Test & Measurement 8.2.2 Non-Inverting Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 8.2.3 The Voltage Follower . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 8.2.4 Summing Amplifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 8.2.5 The Difference Amplifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 8.2.6 The Differentiator Amplifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 8.2.7 The Integrator Amplifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 8.3 Operational Amplifiers With Single Power Supply . . . . . . . . . . . . . . . . . . . . . . . 153 8.4 Red Pitaya Experiments – Operational Amplifiers . . . . . . . . . . . . . . . . . . . . . . . 153 8.4.1 Experiment 1 – Inverting Amplifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 8.4.2 Experiment 2 – Integrating Amplifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 8.5 Operational Amplifier Function Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 8.5.1 Generating Square Wave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 8.5.2 Generating Sine Wave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 8.5.3 Triangle Wave Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 8.6 Red Pitaya Experiment – Phase Shift Oscillator . . . . . . . . . . . . . . . . . . . . . . . . . 160 8.7 FILTERS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 8.7.1 Low-Pass Butterworth Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 8.7.2 High-Pass Butterworth Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 8.7.3 Band-Pass Butterworth Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 8.8 Red Pitaya Experiments – Filters and Bode Plotter . . . . . . . . . . . . . . . . . . . . . . 174 8.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 8.10 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 Chapter 9 • Modulation and Radio Communication Circuits . . . . . . . . . . . . . . . . . . . 180 9.1 What is Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 9.1.1 Amplitude Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 9.1.2 Frequency Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 9.2 Wavebands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 9.3 Red Pitaya - Software Defined Radio (SDR) . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 9.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 9.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Chapter 10 • Visual Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 10.1 What is Visual Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
●8
Red Piyata UK 160606.indd 8
07-07-16 16:20
Chapter Number ● Chapter Name 10.2 PROJECT 1 - Flashing an LED on Red Pitaya Board . . . . . . . . . . . . . . . . . . . . . 188 10.3 PROJECT 2 - Flashing Two LEDs Alternately . . . . . . . . . . . . . . . . . . . . . . . . . . 191 10.4 PROJECT 3 – Chasing LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 10.5 PROJECT 4 – FLASHING LEDs A NUMBER OF TIMES . . . . . . . . . . . . . . . . . . . . 193 10.6 PROJECT 5 – INTERRUPTING THE PROGRAM FROM THE KEYBOARD . . . . . . . . . 194 10.7 Using the Extension Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 10.8 PROJECT 6 – The Buzzer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 10.9 PROJECT 7 – Buzzer with a Push-Button Switch . . . . . . . . . . . . . . . . . . . . . . . 199 10.10 PROJECT 8 – Generating the SOS Morse Code . . . . . . . . . . . . . . . . . . . . . . . 201 10.11 PROJECT 9 – Relay and DC Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 10.12 PROJECT 10 – Generating Sound with a Known Frequency . . . . . . . . . . . . . . . 205 10.13 PROJECT 11 – Sound Effect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 10.14 PROJECT 12 – Light Activated Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 10.15 PROJECT 13 – Sound Activated Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 10.16 PROJECT 14 – Sending e-Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 10.17 PROJECT 15 – Temperature Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 10.18 PROJECT 16 – Temperature Activated Alarm . . . . . . . . . . . . . . . . . . . . . . . . . 215 10.19 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Chapter 11 • Controlling Red Pitaya from Matlab . . . . . . . . . . . . . . . . . . . . . . . . . . 218 11.1 Matlab Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 11.2 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Chapter 12 • Microcontrollers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 12.1 Microcontroller Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 12.1.1 RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 12.1.2 ROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 12.1.3 PROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 12.1.4 EPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 12.1.5 EEPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 12.1.6 Flash EEPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 12.2 Microcontroller Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 12.2.1 Supply Voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 12.2.2 The Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
●9
Red Piyata UK 160606.indd 9
07-07-16 16:20
Red Pitaya for Test & Measurement 12.2.3 Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 12.2.4 Watchdog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 12.2.5 Reset Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 12.2.6 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 12.2.7 Brown-out Detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 12.2.8 Analogue-to-digital Converter (ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 12.2.9 Serial Input-Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 12.2.10 EEPROM Data Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 12.2.11 LCD Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 12.2.12 Analog Comparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 12.2.13 Real-time Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 12.2.14 Sleep Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 12.2.15 Power-on Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 12.2.16 Low Power Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 12.2.17 Current Sink/Source Capability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 12.2.18 USB interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 12.2.19 CAN Bus interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 12.2.20 Ethernet interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 12.2.21 ZigBee interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 12.2.22 Multiply and divide hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 12.2.23 Operating temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 12.2.24 Pulse Width Modulated (PWM) Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 12.2.25 Package size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 12.2.26 DMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 12.3 Microcontroller Architectures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 12.3.1 RISC and CISC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 12.4. 8, 16, or 32 Bits ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 APPENDIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 A.1 Starting Python on Red Pitaya . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 A.2 Variable Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 A.3 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 A.4 Indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
â—? 10
Red Piyata UK 160606.indd 10
07-07-16 16:20
Chapter Number ● Chapter Name A.5 Line Continuation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 A.7 Python Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 A.8 Python Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 A.9 Control of Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 A.10 Trigonometric Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 A.11 Mathematical Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 A.12 Print Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 A.13 String Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 A.14 Date & Time Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 A.15 User Defined Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 A.16 Keyboard Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 A.17 Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 A.18 Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 A.19 Python Input-Output Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 A.20 Example Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
● 11
Red Piyata UK 160606.indd 11
07-07-16 16:20
Preface
Preface The Red Pitaya is a credit card-sized, open-source test and measurement board that can be used to replace most measurement instruments used in electronics laboratories. With a single click, the board can transform into a web-based oscilloscope, spectrum analyser, signal generator, LCR meter, Bode plotter, and microcontroller. The Red Pitaya can replace the many pieces of expensive measurement equipment found at professional research organisations and teaching laboratories. The Red Pitaya is a network attached device based on Linux. The device includes an FPGA, digital signal processing (DSP), dual core ARM Cortex processor, signal acquisition and generation circuitry, micro USB socket, microSD card slot, RJ45 socket for Ethernet connection, and USB socket - all powered from an external mains adaptor. The Red Pitaya can be controlled using Matlab, labView, Python, Scilib, and Visual Programming Language. Even the new comers to the field of electronics and computing can start creating applications and programs using the visual programming language. With the addition of an extension module, the Red Pitaya turns into a powerful microcontroller that can be programmed and used in complex automation and robotics applications. Red Pitaya offers two analog inputs and two analog outputs, as well as four lower-speed I/O ports. This book is an introduction to electronics. It aims to teach the principles and applications of basic electronics by carrying out real experiments using the Red Pitaya. The book includes many chapters on basic electronics and teaches the theory and use of electronic components including resistors, capacitors, inductors, diodes, transistors, and operational amplifiers in electronic circuits. Many fun and interesting Red Pitaya experiments are included in the book. The book makes an introduction to visual programming environment and shows how simple to complex Red Pitaya applications can be developed using the visual programming language. The use of various sensors such as temperature, humidity, pressure and so on are discussed and full visual programming listings are given in the book with complete details of how they operate. This book is written for college level and first year university students studying electrical or electronic engineering. Although the book is aimed at beginners, readers with some basic knowledge of electronics should also find the book useful. Additionally, the book should be a useful source of reference to anyone interested in building electronic projects or anyone wishing to measure or test electronic circuits. I hope that you will find the book useful and enjoyable and that it will help you learn about and experiment with basic electronic circuits. Dogan Ibrahim London, 2016
â—? 13
Red Piyata UK 160606.indd 13
07-07-16 16:20
Chapter 1 • Red Pitaya – Quick Startup Guide
Chapter 1 • Red Pitaya – Quick Startup Guide 1.1 What is Red Pitaya ?
There are many Test and Measurement (T&M) instruments used in electrical and electronic engineering. These T&M instruments are very important parts of electrical and electronic projects and are used in all kinds of engineering laboratories. Some of the frequently used T&M instruments found in nearly all electronic laboratories are (see Figure 1.1): digital multimeters (DMM), oscilloscopes, signal generators, spectrum analysers, logic analysers, frequency analysers, frequency counters, LCR meters, and many more.
Figure 1.1 Some commonly used Test and Measurement instruments Digital multimeters are used to measure voltage, current, resistance, and continuity in electronic circuits. The cost of a standard typical DMM is around $200. More expensive DMMs can also be used to measure various working parameters and the health of semiconductor devices such as diodes and transistors. Some can even measure ambient temperature. Oscilloscopes are one of the fundamental devices found in almost all electronics laboratories. An oscilloscope is used to display the waveform of a signal in real-time. The cost of an oscilloscope depends on the type of signals it can display, its performance, screen size, and quality. Basic mid-level oscilloscopes cost around $500, while top of the range professional oscilloscopes can easily cost over $1M. Signal generators are used to generate signals with different waveforms, such as sine waves, square waves, triangular waves etc. The cost of a signal generator depends on the types of signals it can generate, the maximum frequency that can be generated, and its performance. The cost of a basic signal generator is around $500. Spectrum analysers are other important T&M instruments found in most electronics laboratories. Signals in real-time are complex and are usually made up of many frequencies
● 15
Red Piyata UK 160606.indd 15
07-07-16 16:20
Red Pitaya for Test & Measurement
such as harmonics. A spectrum generator is used to display frequency components and magnitudes of all frequencies contributing to a given signal. The cost of a basic spectrum analyser is in the range of $1000 to $5000. Logic analysers are commonly used in most modern digital electronics and computer laboratories. These instruments can for example be used to capture and analyse digital logic signals. A professional logic analyser costs approx. $1500. A frequency counter is basically a digital instrument that is used to measure the frequency of a signal generator or transmitter. The cost of a basic frequency counter is around $500. LCR meters are portable instruments with displays used to measure inductance (of a coil), capacitance (of a capacitor), or resistance (of a resistor). The cost of an LCR meter depends upon its measurement range, accuracy, and performance. The basic unit costs around $800. As can be seen from Figure 1.1, all T&M instruments have common properties, such as buttons, switches, knobs, displays etc. and they are usually independent and standalone instruments. Red Pitaya is a low-cost, credit card sized board combining most of the T&M instruments described above. As is shown in Figure 1.2, the Red Pitaya board has no buttons, switches, knobs, or displays. In order to use the Red Pitaya board as a T&M instrument you need to connect it to a network and access it via your web browser. The user can then choose the required instrument from the web browser as a virtual instrument and then control the chosen instrument via the provided graphical user interface type virtual buttons, knobs, and displays. The Red Pitaya is thus a multi-instrument T&M board built on a small card, just like a smart phone which is not just a smart phone but also a camera, compass, accelerometer, alarm device, calendar, GPS, and many more.
â—? 16
Red Piyata UK 160606.indd 16
07-07-16 16:20
Red Pitaya for Test & Measurement
Chapter 2 • Resistors In last chapter we briefly looked at the specifications of the Red Pitaya board. We have also seen how its software can be installed and accessed. This chapter is about resistors which are one of the fundamental components of every electronic circuit. In this chapter, in addition to some of the important equations and physical laws, we shall be seeing and analysing the resistor network circuits used in electrical and electronic applications. 2.1 What is a Resistor
A resistor is a passive, two-terminal electrical component used to reduce current flow in electrical or electronic circuits. Resistors can be constructed out of a variety of materials. The most common, modern resistors are made out of either carbon, metal, or metal-oxide film. Some resistors are used in low-power electronic circuits and these are cylindrical in shape with a wire protruding from each end (see Figure 2.1). High-power resistors are used in high current electrical circuits. They are typically large in size, and can be in various shapes as shown in Figure 2.2.
Figure 2.1 Low-power resistors
Figure 2.2 High-power resistors
â—? 36
Red Piyata UK 160606.indd 36
07-07-16 16:21
Chapter 2 • Resistors
Resistors can be fixed or variable. Fixed resistors have resistances that only change slightly with ageing and temperature. The value (resistance) of variable resistors on the other hand can be changed by moving their wiper arms. Variable resistors have 2 legs and are also called presets or rheostats. Potentiometers are variable resistors with 3 legs where the resistance between two outer legs is fixed and the resistance between the centre leg and outer leg can be varied by moving the wiper arm (see Figure 2.3).
Figure 2.3 A typical variable resistor The symbols of resistors and variable resistors in electrical circuits are shown in Figure 2.4.
Figure 2.4 Symbols of various types of resistors Resistors are also available in packs as arrays of 5 or 7, together having a common pin as shown in Figure 2.5. In highly populated printed circuit boards, it is common to use surface-mount type resistors, also called SMD. These are made of thick or thin films. As shown in Figure 2.6, SMD resistors are tiny components having only 0.8mm lengths and 0.5mm widths. Soldering SMD resistors requires special tools because of their very small size.
â—? 37
Red Piyata UK 160606.indd 37
07-07-16 16:21
Red Pitaya for Test & Measurement
Chapter 3 • Capacitors In last chapter we briefly looked at resistors, their properties, and how they can be used in electrical and electronic circuits. We have seen how Ohm’s and Kirchoff’s current and voltage laws can be used to find current and voltage at any part of a circuit. In this chapter, we shall be looking at the basic properties of capacitors and how they can be used in electrical and electronic circuits. Circuits made up of resistors and capacitors will be investigated and the Red Pitaya board will be used in oscilloscope mode to display the waveform of resistor-capacitor transient waveforms. 3.1 What is a Capacitor
A capacitor (also known as condenser) is a passive, two-terminal electrical component that can be used to store energy temporarily in an electrical circuit. There are several types of capacitors depending upon the way they are constructed and used in circuits. Figure 3.1 shows some popular capacitors, such as parallel plate, electrolytic, and so on..
Figure 3.1 Capacitors Perhaps the parallel plate capacitor is the most commonly known and used capacitor. This type of capacitor has two parallel conducting plates with a non-conducting material (also called a dielectric) between plates. Some of the non-conducting materials used are paper, mica, plastic film, ceramic, glass, and even air. Unlike resistors, ideal capacitors do not dissipate energy. When a capacitor is connected across a battery, a positive charge (+Q) is collected on one side and a negative charge (-Q) is collected on the other side. The charge Q on each plate is measured in Coulomb (C). The ratio of charge to voltage across a capacitor is called capacitance. i.e.
C=
Q V
(3.1)
Where, C is capacitance in Farads (F), Q is charge in Coulombs (C), and V is voltage in Volts (V).
● 66
Red Piyata UK 160606.indd 66
07-07-16 16:21
Chapter 3 • Capacitors
One Farad is a big unit and in most electronic circuits smaller units of capacitance such as microfarads, nanofarads, or even picofarads are used. The conversion between these units is as follows: also,
1 Farad (F) = 106 microfarad (µF) or, 1 Farad (F) = 109 nanofarad (nF) or, 1 Farad (F) = 1012 picofarad (pF) or, 1 µF = 10-6 F or, 1 nF = 10-9 F or, 1 pF = 10-12 F or,
1,000,000 µF 1,000,000,000 nF 1,000,000,000,000 pF
0.000001 F 0.000000001 F 0.000000000001 F
Capacitors can be fixed or variable. Fixed capacitors have a fixed value as set during the manufacturing process. Variable capacitors (see Figure 3.2) are usually used in communication circuits and their values can be changed by rotating an arm.
Figure 3.2 Variable capacitors Figure 3.3 shows the circuit symbols of capacitors. The one on the left is a fixed capacitor, while the one on the right is an electrolytic capacitor.
Figure 3.3 Capacitor symbols Ceramic capacitors (see Figure 3.4) are the most commonly used capacitors where dielectric is made up of ceramic. Electrolytic capacitors (see Figure 3.5) are used when high capacitance values are needed. These capacitors have polarities and the correct polarity must be observed when connected in circuits.
● 67
Red Piyata UK 160606.indd 67
07-07-16 16:21
Red Pitaya for Test & Measurement
Chapter 4 • Inductors In last chapter we briefly looked at capacitors, their properties, and how they can be used in electrical and electronic circuits. We have seen how voltage across a capacitor can be calculated in a circuit consisting of resistors and capacitors. In this chapter, we shall be looking at the basic properties of inductors and how they can be used in electrical and electronic circuits. 4.1 What is an Inductor
An inductor is a passive two-terminal electrical component that can be used to store energy temporarily in an electrical circuit. An inductor is basically a coil where wire is wound on some kind of former. Inductors are mainly used in motors, transformer circuits, communications circuits such as oscillators, receivers, and transmitters. A simple inductor can be made by winding single or multilayer wire onto a former such as a cardboard or PVC. Factory-made inductors come in many different shapes, sizes, and values. Figure 4.1 shows some factory-made inductors.
Figure 4.1 Factory-made inductors Inductors have inductances (like the resistors which have resistances, or capacitors which have capacitances). The unit of inductance is Henry (H), but because this is a very large inductor in practice, millihenry (mH) or microhenry (µH) are used. 1H = 1000mH and 1mH=1000µH. An inductor is represented by letter L and is shown in an electrical circuit as in Figure 4.1. The inductance of a coil depends upon several factors such as the number of turns, size of the former, and the properties of any material used inside the former.
● 84
Red Piyata UK 160606.indd 84
07-07-16 16:21
Chapter 4 • Inductors
Figure 4.2 An inductor The formula used to calculate the inductance of a single layer coil (also called a solenoid) wound on a cylindrical former is given by:
L=
µ 0µ r N 2 A l
(4.1)
Where, µ is known as the permeability of the material used inside the former, N is the number of turns, A is the cross sectional area of the former, and l is the length of the coil. The permeability µ 0 of free space is 1.257x10-6 H/m. µ r is the permeability of the material used inside the coil (if any). Example 4.1 An inductor is constructed with the following parameters. Calculate the inductance of this coil: Number of turns = 100 Coil radius = 1cm Length of winding = 5cm Relative permeability = 200 Solution 4.1 The cross sectional area is given by:
A = π r 2 = π ×12 = 3.1415cm2
Using equation 4.1,
µ0µr N 2 A 1.257×10−6 ×200×1002 ×3.14159×10−4 L= = l 5×10−3
Red Piyata UK 160606.indd 85
● 85
07-07-16 16:21
Red Pitaya for Test & Measurement
which gives, L = 0.01579H, or L = 15.79mH The voltage the formula:
v
v =L
across an inductor
di dt
L
with current
i
flowing through the coil is given by
(4.2)
4.2 Resistor – Inductor Circuits
It is important to understand the behaviour of resistor-inductor circuits when such circuits are connected to DC voltage like a battery. We will derive equations in this section to calculate the change of voltage across the inductor in resistor-inductor circuits. CASE I – Rising Current Figure 4.3 shows a simple resistor-inductor circuit connected to a battery through a switch S. At time t = 0 the switch is set to position A, and the current starts to flow in the circuit.
Figure 4.3 Resistor-inductor circuit From Kirchoff’s law and using equation (4.2),
Vbat = Ri + L Vbat
R
−i =
If we let,
I=
Vbat R
di dt
L di R dt
, which is the final steady state value of the current in the circuit.
● 86
Red Piyata UK 160606.indd 86
07-07-16 16:21
Chapter 5 • Alternating Current and Voltage
Chapter 5 • Alternating Current and Voltage In last chapter looked briefly at inductors, their properties, and how they can be used in electrical and electronic circuits. We have seen how the current through an inductor can be calculated in a circuit consisting of a resistor and inductor . In this chapter, we will be looking at alternating current (AC) and voltage circuits and see how we can display voltage, current, or frequency using the Red Pitaya board as an oscilloscope. 5.1 What is Alternating Current
A battery provides a direct current (DC) power supply where current only flows in one direction. In an alternating current (AC) power supply, current periodically varies in magnitude and direction. As a familiar example, the mains voltage we use at home is AC, and has a voltage of 110V or 220V, with a frequency of 50 or 60Hz. AC voltage is expressed as a sine wave and its instantaneous value is given by:
V = Vp sin ωt (5.1)
where, Vp is the peak (or maximum) value (or the amplitude) of the voltage, and given by:
ω = 2π f
or
ω=
2π T
is
(5.2)
where, f is the frequency of the waveform, and Similarly, current is given by:
ω
T
is the period ( (T
= 1 / f ) ).
I = I p sin ωt (5.3)
Figure 5.1 shows a sine wave voltage.
Figure 5.1 Sine wave voltage
● 93
Red Piyata UK 160606.indd 93
07-07-16 16:21
Red Pitaya for Test & Measurement
Example 5.1 Mains voltage at home is specified as 220V at 50Hz. Calculate the period of this voltage. Solution 5.1 The period is given by:
T=
1 1 = = 0.02 f 50
second, or 20ms. Therefore, the durations of the positive
and negative parts of the waveform are 10ms each. 5.1.1 Root Mean Square Value
As you can see in Figure 5.1, the value of alternating voltage or current varies with time. Its peak value is rarely used. The root mean square (or rms) value of alternating current or voltage is more commonly used in practice since it is the effective value of alternating quantity. The rms is the value as if direct current with the same value is applied to a heater and produces the same heating effect in the same time. The rms value of a sine wave alternating current is given by:
where
Irms = Ip
Ip
2
= 0.707I p (5.4)
is the peak (or maximum) value.
5.1.2 Average Value
The average value of a complete one cycle of sine wave is zero since the waveform is symmetrical about the time axis. However, the average value of a sine wave alternating current or voltage is quoted over a half cycle of the wave and it is given by:
Iave = 0.637I p (5.5)
Example 5.2 It is measured that the peak voltage of a sinusoidal alternating current is 100A. Calculate its rms and average values. Solution 5.2 From equations (5.4) and (5.5): and
Irms = 0.707I p = 0.707 100 = 70.7A Iave = 0.637I p = 0.637 100 = 63.7A
â—? 94
Red Piyata UK 160606.indd 94
07-07-16 16:21
Red Pitaya for Test & Measurement
Chapter 6 • Semiconductor Diodes In last chapter we briefly looked at alternating currents and their use in electronic circuits. We have seen that sinusoidal is the most commonly used form of alternating current in electronic circuits. We have seen how to calculate various parameters of alternating currents, such as frequency, period, peak value, rms value, and average value. In addition, we have looked at resonance in series circuits constructed using a resistor, inductor, and capacitor. A number of Red Pitaya based experiments have been given to show how the oscilloscope and function generator applications of Red Pitaya can be used in real, practical alternating circuits. In this chapter we shall learn about semiconductor diodes and see where and how they are used in electronic circuits. 6.1 The Semiconductor Diode
A semiconductor is a kind of material which exhibits electrical characteristics between conductors and insulators. A typical conductor is metal, while a typical insulator is glass. The two most commonly used semiconductors in electronic components are silicon and germanium. The electrical behaviour of a pure semiconductor material can be changed by adding a small amount of impurity to it, also known as doping the semiconductor. Depending upon the type of impurities added, we have two types of semiconductors: N-type and P-type. In a N-type semiconductor, impurities such as arsenic and phosphorus are added in very small amounts to pure silicon. Such impurities create free electrons which allow electric current to flow through the silicon. Because electrons have negative charges, this type of semiconductor is called N-type. In a P-type semiconductor, impurities such as boron or gallium are added in very small amounts to pure silicon. Such impurities create “holes” in the crystal which are in effect an absence of electrons, thus creating positive charge. This is the reason this type of semiconductor is called P-type. A semiconductor diode (also called a diode) allows current to flow in one direction only. Diodes are made by combining N-type and P-type semiconductors together. The point where the two semiconductors are bonded is called the PN junction. The circuit symbol of a diode is shown in Figure 6.1. A diode has two pins: anode (or positive) and cathode (or negative). It can be connected in a circuit in two ways: in forward biased mode, or in reverse biased mode. In a forward biased mode, the anode is made more positive than the cathode and this makes current flow from the anode to the cathode. In a reverse biased diode, the cathode is more positive than the anode and as a result no current flows in the circuit. Figure 6.2 shows a forward biased and a reverse biased diode in a simple light circuit.
● 118
Red Piyata UK 160606.indd 118
07-07-16 16:21
Chapter 6 • Semiconductor Diodes
Figure 6.1 Circuit symbol of a diode
Figure 6.2 Forward and reverse biased diode The current-voltage (or I/V) curve of a typical diode is shown in Figure 6.3. The forward junction potential is typically 0.7V for silicon and 0.3V for a germanium diode. The leakage current is the current that flows in a reverse biased diode. This current is very small and is in the region of several nanoamperes. Reverse breakdown voltage is the point where large voltage is applied in reverse biased mode that causes large reverse current to pass through the diode and this may damage the diode.
Figure 6.3 Diode I/V curve Figure 6.4 shows the actual I/V curve of a 1N4001 type silicon diode when operated in the forward biased mode. Notice in this figure that the I/V curve depends upon the diode junction temperature. Also, the forward junction potential increases as more current is passed through the diode.
â—? 119
Red Piyata UK 160606.indd 119
07-07-16 16:21
Chapter 7 • Bipolar Transistors
Chapter 7 • Bipolar Transistors In last chapter we briefly looked at different types of semiconductor diodes and where and how they are used in electronic circuits. We have seen how half wave and full wave rectifier circuits can be built using diodes. In addition, the use of Zener diodes is described with an example. In this chapter we will learn about bipolar transistors and see where and how they are used in electronic circuits as amplifiers. There are essentially two types of transistors: bipolar junction (BJT), and metal-oxide field-effect (MOSFET). In this chapter we will focus on BJTs as they are used in most small signal amplifier circuits. 7.1 How a Transistor Works
There are two types of BJTs: NPN and PNP. Transistors are 3-terminal devices, with the pins labelled as emitter (E), base (B), and collector (C). The circuit symbol for each type is shown in Figure 7.1. Figure 7.2 shows some typical transistors.
Figure 7.1 Transistor circuit symbols
Figure 7.2 Typical transistors Transistors are constructed by using three different layers of semiconductor material together. All the layers are doped with impurities. In an NPN transistor two N-type and one
● 129
Red Piyata UK 160606.indd 129
07-07-16 16:21
Red Pitaya for Test & Measurement
P-type semiconductor is used. Similarly, in an PNP transistor to P-type and one N-type semiconductor is used. Transistors work as current controlled devices. In an NPN transistor, current flows from collector to emitter and also from base to emitter. The base controls the number of electrons emitted by the emitter. Most of the emitted electrons are collected by the collector. A PNP transistor works similarly where the base controls current flow. Figure 7.3 shows the analogy between an NPN transistor and a valve controlling water flow.
Figure 7.3 Analogy of NPN transistor operation 7.2 The NPN Transistor
In this section we shall be looking at the formula governing the operation of NPN transistors. Similar analysis can be carried out for PNP transistors. Transistor analysis is carried out in two sections: DC and AC. DC analysis refers to using resistors to bias the transistor correctly for its operation. AC analysis is about choosing component values for a required amplification. 7.2.1 DC Analysis
Some of the important transistor formula in DC analysis are:
IE = IB + IC (7.1)
IC = β IB (7.2)
IC = α IE (7.3)
β=
α 1− α
(7.4)
● 130
Red Piyata UK 160606.indd 130
07-07-16 16:21
Red Pitaya for Test & Measurement
Chapter 8 • Operational Amplifiers In last chapter we had a brief look at BJT transistors, their theory and use in electronic circuits as amplifiers. We have seen how the DC operating point can be set using external resistors. We have also seen the AC model of a transistor and have derived equations for voltage gain, input and output resistance. In this chapter we shall learn about operational amplifiers and see how they can be used in DC and AC circuits as amplifiers, buffers, function generators, and filters. 8.1 What is an Operational Amplifier
An operational amplifier (or just an op amp) is a differential input integrated circuit amplifier with single output, whose circuit symbol is shown in Figure 8.1. Figure 8.2 shows some typical operational amplifiers.
Figure 8.1 Circuit symbol of an operational amplifier
Figure 8.2 Some operational amplifiers
â—? 146
Red Piyata UK 160606.indd 146
07-07-16 16:21
Chapter 8 • Operational Amplifiers
A typical operational amplifier has two supply inputs: (+V) and (–V), and two inputs (+) and (-), and one output. An operational amplifier can be used both in DC and AC circuits as amplifiers, buffers, or function generators to generate various waveforms. In addition, they can be used as filters in AC circuits. An ideal operational amplifier takes two inputs, finds their difference, amplifies the difference and presents the result to the output. Ideal operational amplifiers are assumed to have infinite voltage gains (called open-loop gain), infinite input resistance, zero output resistance, zero bias current, and zero voltage gain for common signals. In practice however, operational amplifiers have very large voltage gains, large input resistances, very small output resistances, and very small bias currents. As we shall be seeing later, operational amplifiers are operated with feedbacks such that part of the output signal is fed back to the input. Feedback stabilizes operational amplifiers and also fixes their operational characteristics, such as voltage gain. When feedback is applied, the operational amplifier is said to be operating in closed-loop. Most operational amplifiers operate with dual supplies. Figure 8.3 shows the connection of an operational amplifier to a dual supply.
Figure 8.3 Dual power supply connection The ideal model of an operational amplifier is shown in Figure 8.4a. The practical model is shown in Figure 8.4b with finite input and output resistances. A is very large and it is the open-loop gain (with no feedback) of the operational amplifier.
Figure 8.4 a) Ideal model b) practical model 8.2 Operational Amplifier Circuits
The voltage gain of an operational amplifier is so large (e.g. around 100,000) that its use without feedback is not practical. For example, without feedback, even a very small input voltage may force the output to go over its maximum value, i.e. saturate.
â—? 147
Red Piyata UK 160606.indd 147
07-07-16 16:21
Red Pitaya for Test & Measurement
Chapter 9 • Modulation and Radio Communication Circuits In last chapter looked at operational amplifiers and their use in electronic circuits as amplifiers, function generators, and as electronic filters. The design of inverting and non-inverting amplifier circuits was described with examples. The important topic of function generators using operational amplifiers has been described by giving the basic theory and also by giving practical examples. Red Pitaya experiments are given in the chapter to show how frequency response of electronic filters can be plotted in real-time using the Bode Plotter application of Red Pitaya. In this chapter we will briefly look at the theory of modulation circuits, namely amplitude modulation and frequency modulation. In addition the Software Defined Radio (SDR) of the Red Pitaya will be described. 9.1 What is Modulation
In radio communication circuits, a carrier signal is generated using an oscillator circuit. Intelligence is then transmitted via this carrier signal by varying one or more properties of the signal. This process is called modulation. At the receiving side, the transmitted intelligence is recovered by removing this intelligence from the carrier signal by means of demodulation. The process of data communication can either be analog or digital. In this section we shall be looking at traditional analog communication and modulation/demodulation techniques. Figure 9.1 shows the principle of voice communication where the output from a microphone is modulated and transmitted via the carrier signal. At the receiving side, the voice is recovered from the carrier signal and sent to a loudspeaker.
Figure 9.1 Radio communication Two types of analog modulation are commonly used: amplitude modulation (or AM) and frequency modulation (or FM). Both methods are briefly described in this chapter. 9.1.1 Amplitude Modulation
Figure 9.2 shows the block diagram of a typical amplitude modulated transmitter. Here, the fixed high frequency oscillator generates a sinusoidal carrier signal which is then am-
â—? 180
Red Piyata UK 160606.indd 180
07-07-16 16:22
Chapter 9 • Modulation and Radio Communication Circuits
plified by the high frequency amplifier. The signal to be transmitted (e.g. voice) is fed to a modulator circuit together with the carrier signal. The modulator changes the amplitude of the carrier signal proportional to the amplitude of the input signal. The net result is that a waveform is obtained with a fixed frequency whose amplitude is variable. This signal is then amplified using a power amplifier and is transmitted through an antenna.
Figure 9.2 Amplitude modulated transmitter Figure 9.3a shows a fixed frequency carrier signal having fixed amplitude. In Figure 9.3b, a low frequency signal (e.g. voice) is used to modulate the carrier signal. Figure 9.3c shows the amplitude modulated signal. As you can see, the frequency of the carrier signal is the same but its amplitude varies in relation to the applied signal.
Figure 9.3 The process of amplitude modulation At the receiving side, a demodulator circuit (e.g. a simple diode) is used to extract the carrier from the modulated signal and thus to obtain the transmitted signal. Figure 9.4 shows the block diagram of a simple amplitude modulated receiver. The demodulation process is shown in Figure 9.5.
â—? 181
Red Piyata UK 160606.indd 181
07-07-16 16:22
Chapter 10 • Visual Programming
Chapter 10 • Visual Programming In last chapter we looked at the modulation and demodulation techniques used in radio communication. In addition, we have seen how to use the software defined radio application of the Red Pitaya. In this chapter we will be learning how to program the Red Pitaya using the visual Programming Language. This will allow us to interface various sensors to our Red Pitaya and measure quantities such as temperature, humidity, pressure and so on. 10.1 What is Visual Programming
Programming in general is a complex process and is best learned through long experience. Complex programs are usually created through team work and are written by professional software engineers. Visual programming provides a simplified way of writing application programs for your Red Pitaya. Visual programming requires no previous experience and even those new to programming can develop applications. Visual programming is based on blocks. You can join the blocks like in a Lego or jigsaw puzzle to create an application. Using the visual programming environment you can create simple applications to turn lights ON and OFF or flash the lights on the Red Pitaya board. In more complex applications you can interface various sensors to your Red Pitaya board using an Extension Module together with sensors to measure temperature, humidity, pressure, to sound a buzzer, to control a relay and many more applications. Visual programming offers the following features: • Remote programming of the Red Pitaya via a web based interface using blocks or other programming language (Python, C/C++, Java Script, etc.) • Ability to create your own dashboards with real time graphs, dials, meters, sliders and buttons • Ability to control the program flow from a PC, smartphone or tablet • Ability to share measurements or send notifications to email or even social networks like Facebook and Twitter • Measure temperature, moisture, alcohol, water level, vibrations, UV light, sound, pressure, air quality, detect motion, and more. These applications require the extension module and suitable sensors. • Controls actuators and indicators like external LEDs, displays, motors or relays in order to control high load devices. These applications require the extension module and suitable sensors or actuators. In this chapter, we shall initially be developing simple visual programming applications to control the LEDs (e.g. to flash an LED) mounted on the Red Pitaya board. In later sections of this chapter we shall learn how to use the extension module and how to connect sensors to this module and also how to develop simple visual programming applications.
● 187
Red Piyata UK 160606.indd 187
07-07-16 16:22
Red Pitaya for Test & Measurement
Before using the visual programming environment you will need to purchase an activation key for visual programming and then load it on to your Red Pitaya. Then, start the visual programming environment. You should see the visual programming start up screen as shown in Figure 10.1.
Figure 10.1 Visual programming startup screen Now we are ready to use the visual programming environment to develop Red Pitaya based applications and programs. 10.2 PROJECT 1 - Flashing an LED on Red Pitaya Board
There are 8 LEDs available to the user on the Red Pitaya board, namely LED0 to LED7. In this project we will develop an application to flash LED0 every second. The steps are given below: • Start the Red Pitaya by entering its IP address • Select the Visual programming application and click RUN • You should see a form asking for a board name. Enter a new board name with at least two characters. In this example the name DIPitaya is chosen. • Click the settings icon next to the board name at the top of the screen, and download file: Wyliodrin.json into a folder on your PC. • Remove the SD card from your Red Pitaya and insert it into your PC using an SD card adaptor if necessary. • Copy file Wyliodrin.json to the top directory on your SD card. • Insert the SD card back into your Red Pitaya and re-start it • Log in to the Red Pitaya and select Visual Programming. You should see the word Online highlighted in green at the top of the screen • Notice that the steps up to here should only be performed once. They need not be repeated when you want to create new projects. • Click Create new application • Give a name and briefly describe your project (see Figure 10.2), and click Submit
● 188
Red Piyata UK 160606.indd 188
07-07-16 16:22
Red Pitaya for Test & Measurement
Chapter 11 • Controlling Red Pitaya from Matlab In last chapter we looked at the visual programming language and have developed projects using visual programming and the extension module. In this chapter we shall be looking at how to control the Red Pitaya from Matlab. Matlab is a software package used in engineering calculations and applications. We can develop Matlab code to control LEDs on the Red Pitaya or control the function generator and other features of the board. 11.1 Matlab Interface
The Standard Commands for Programmable Instrumentation (SCPI) commands are used to control the Red Pitaya from Matlab. The SCPI is an organization whose members share the common interest to develop interface language between computers and test instruments. The SCPI syntax is in ASCII text format and therefore can be used with any programming language such as BASIC, C, C++, Python, Matlab, and so on. Before controlling Red Pitaya using SCPI commands, users must first start their SCPI server on Red Pitaya. Log in to the Red Pitaya remotely as described in Chapter 1 and enter the following command to start the SCPI server: redpitaya> systemctl start redpitaya_scpi &
We can now start Matlab on our PC and write the required code. But before doing that, let’s look at the Red Pitaya SCPI commands. The SCPI commands cover the following features of the Red Pitaya: • Commands to control digital LEDs and general purpose digital I/O (GPIO) • Commands for analog I/O • Commands to control the signal generator • Commands to control data acquisition • Commands to trigger the oscilloscope • Data pointer commands • Data read commands In this chapter will look at an example to control one of the LEDs on the Red Pitaya board, and also an example to generate a sine wave with a given frequency and amplitude. Tables 11.1 to 11.3 give a list of the SCPI commands that can be used with Red Pitaya.
● 218
Red Piyata UK 160606.indd 218
07-07-16 16:22
Red Pitaya for Test & Measurement
Chapter 12 • Microcontrollers The term microcontroller is used to describe a system that includes a minimum of a microprocessor, program memory, data memory, and input-output (I/O). Most microcontroller systems also include additional components such as timers, counters, analogue-to-digital converters, and so on. Thus, a microcontroller system can be anything from a large computer having hard disks, floppy disks, and printers, to a single chip embedded controller. Microcontrollers are used in many household goods such as microwave ovens, TVs, remote control units, cookers, hi-fi equipment, CD players, personal computers, fridges, etc. There are a large number of microcontrollers available in the market manufactured by different companies. Most popular microcontrollers are 8-bits wide and are used in many domestic and commercial applications. More professional microcontrollers are 16 or 32 bits wide and are used in specialized signal processing applications requiring higher processing powers. 12.1 Microcontroller Systems
A microcontroller is a single chip computer. Micro suggests that the device is small, and controller suggests that the device can be used in control applications. Another term used for microcontrollers is embedded controller, since most of the microcontrollers are built in to (or embedded in) the devices they control. A microprocessor differs from a microcontroller in many ways. The main difference is that a microprocessor requires several other components for its operation, such as program memory and data memory, input-output devices, and external clock circuit. A microcontroller on the other hand has all the support chips incorporated inside the same chip. All microcontrollers operate on a set of instructions (or the user program) stored in their memory. A microcontroller fetches the instructions from its program memory one-by-one, decodes these instructions, and then carries out the required operations. Microcontrollers have traditionally been programmed using the assembly language of the target device. Although assembly language is fast, it has several disadvantages. An assembly program consists of mnemonics and it is difficult to learn and maintain a program written using assembly language. Also, microcontrollers manufactured by different firms have different assembly languages and the user is required to learn a new language every time a new microcontroller is to be used. Microcontrollers can also be programmed using a high-level language, such as BASIC, PASCAL, and C. High-level languages have the advantage that it is much easier to learn a high-level language than an assembler. Also, very large and complex programs can easily be developed using a high-level language. In general, a single chip is all that is required to have a running microcontroller system. In practical applications, additional components may be required to allow a microcomputer to interface to its environment. With the advent of the microcontrollers, the development time of an electronics project has reduced from several weeks to several hours. Basically, a microcontroller executes a user program which is loaded in its program memory. Under the control of this program, data is received from external devices (inputs), ma-
â—? 224
Red Piyata UK 160606.indd 224
07-07-16 16:22
Chapter 12 • Microcontrollers
nipulated and then sent to external devices (outputs). For example, in a microcontroller based fluid level control system, the fluid level is read by the microcomputer via a level sensor device and the microcontroller attempts to control the fluid level at the required value. If the fluid level is low, the microcomputer operates a pump to draw more fluid from the reservoir in order to keep the fluid at the required level. Figure 12.1 shows the block diagram of our simple fluid level control system.
Figure 12.1 Microcontroller based fluid level control system The system shown in Figure 12.1 is a very simplified fluid level control system. In a more sophisticated system we may have a keypad to set the required fluid level, and an LCD to display the current level in the tank. Figure 12.2 shows the block diagram of this more sophisticated fluid level control system.
â—? 225
Red Piyata UK 160606.indd 225
07-07-16 16:22
Red Pitaya for Test & Measurement
APPENDIX PYTHON PROGRAMMING LANGUAGE ON RED PITAYA Python is an interpreted, interactive and object oriented programming language. It was developed by Guido van Rossum in the 1980’s at the National Research Institute for Mathematics and Computer Science in the Netherlands. Python is interactive which means that you can issue a command and see the results immediately without having to compile the command. It is interpreted, thus requiring no pre-compilation before it is run. Python supports object oriented technique of programming. Python is a beginner language which is easy to learn and easy to maintain. Beginners can easily learn programming in a relatively short period of time. Python supports a large library of functions which makes it very powerful. The language is portable, meaning that it can run on several different platforms, such as Red Pitaya, Raspberry Pi etc. In this Appendix we shall briefly look at the details of Python programming language and discover how we can write programs using this language on the Red Pitaya. A.1 Starting Python on Red Pitaya
The Python interpreter is started from the Visual Programming application of Red Pitaya. To start Python, click Create new application and choose Python as the Programming language. You should see a program template as shown in Figure A1.
Figure A1 Python program template You can also start Python from the command line. Log in to Red Pitaya using username root and password root, and type python: redpitaya > python python 2.7.9 (default , Mar 1 2015, 13:48:22) [GCC 4.9.2] on linux2 Type “help” , “copyright”, “credits”, or “license” for more information. >>>
● 236
Red Piyata UK 160606.indd 236
07-07-16 16:22
APPENDIX
A.2 Variable Names
Python variable names are case sensitive and can start with a letter A to Z or a to z or an underscore character “_”, followed by more letters or numbers 0 to 9. Some valid and invalid example variable names are given below: Total - valid TOTAL - valid _sum - valid Count9 - valid 9cnt - invalid @loop - invalid %tot - invalid My_Account - valid
Note that variables total, Total, TOtal, and TOTAL are all different. A.3 Comments
Comment lines in Python start with a hash sign “#”. All characters after the # sign are ignored by the Python interpreter. An example comment line is shown below: # This is a comment line
Comments can also be inserted after a statement: Sum = 0; # another comment
A.4 Indentation
In most programming languages, blocks of code are identified by using braces at the beginning and end of the block, or by identifying the end of the block using a suitable statement. e.g. END, WEND, or ENDIF. In the Python language, there are no braces or statements to indicate the start and end of a block. Instead, blocks of code are identified by line indentation. All statements within a block must be indented by the same amount. The actual number of spaces used to indent a block is not important as long as all the statements in the block use the same number of spaces. A valid block of code is given below: if i == 5: a = a + 4 b = a + 1 else: a = 0; b = 0;
● 237
Red Piyata UK 160606.indd 237
07-07-16 16:22
Red Pitaya for Test & Measurement
Index E
A alternating current (AC)
93
Edimax EW7811Un
33
amplitude 181
EEPROM 228
analog comparator
231
Electrically Erasable Programmable
analogue-to-digital converter (ADC)
230
Read Only Memory
228
e-mail 213 B
embedded controller
Band-Pass 162
emitter 129
224
base 129
energy stored in a capacitor
bipolar junction (BJT)
EPROM 228
bipolar square bipolar transistors Bode Plotter
129 97
77
Erasable Programmable Read
129
Only Memory
174
Ethernet 232
breadboard 78
Ethernet cable
Brown-out detectors
230
Extension Module
Butterworth filter
164
buzzer 197
228 25 187
F Farad 67 Filters 162
C CAN bus capacitor capacitor colouring schemes carrier signal central processing unit (CPU)
232 66, 112 71
Flash EEPROM
228
forward biased mode
118
FPGA (Field Programmable Gate Array
181
frequency counter
227
frequency modulation
CISC 233
FTD driver
clock 229
full wave rectifier circuit
20 16 182 28 122
collector 129 condenser 66
G
control unit (CU)
227
GL5528 209
Coulomb 66
GrovePi+ 196
D
H half wave circuit
121
demodulation 180
Harvard architecture
233
demodulator circuit
Henry (H)
decibel (dB)
163 181
DHCP protocol
26
Diagnostic Kit
18
dielectric 66
I
difference amplifier
152
Impedance Analyzer Extension Board
152
inductor
differentiator amplifier
84
High-Pass 162
18 84, 112
diode 118
integrator amplifier
direct current (DC)
interrupt 230
93
DMA 233
152
Interrupt Service Routine (ISR)
230
interrupt vector address
230
inverting circuit
148
â—? 266
Red Piyata UK 160606.indd 266
07-07-16 16:22
Index J
P
joules 54
package size
233
parallel plate capacitors K
68
Phase shift oscillators
159
Kirchoff’s current law
49
PIC32 232
Kirchoff’s laws
49
PNP transistor
Kirchoff’s voltage law
50
power equation
53
power-on reset
231
L
PowerSDR mRX PS
185
LCD 231
power supply circuits
120
LCR meter
90
programmable Read Only Memory
228
LCR Meter Extension Board
90
PROM 228
LCR meters
16
PTC (Positive Temperature Coefficient)
130
62
LED 123
P-type 118
light sensor
push-button switch
208
199
Linux 28
PuTTy 32
Linux commands
PWM 233
30
LM35DZ 214 LM35DZ temperature sensor
Python
190, 236
215
LM358N 160
R
Local access
28
radio communication circuits
Logic analysers
16
RAM 228
Low-Pass 162 M MAC address
60
180
Random Access Memory
228
Read Only Memory
228
real-time clock
231
Red Pitaya board
17
Matlab 218
Red Pitaya Board Layout
20
memory 227
Red Pitaya board main features
21
metal-oxide field-effect (MOSFET)
Red Pitaya Casing
19
microcontroller 224
Red Pitaya LCR meter
90
microhenry (µH)
relay 204
129 84
microprocessor 224
reset input
millihenry (mH)
resistor
84
modulation 180
resistor-capacitor 78 resistor colour coding
N
230 36, 112 39
resonance 112
non-inverting circuit
149
resonant frequency
112
NPN transistor
130
reverse biased mode
118
NTC (Negative Temperature Coefficient)
62
RISC 233
N-type 118
ROM 228 root mean square
94
O Ohm’s law
43
S
op amp
146
SDR transceiver
184
operational amplifier
146
second order filter
166
oscilloscope
55, 99
semiconductor 118 semiconductor diodes
118
● 267
Red Piyata UK 160606.indd 267
07-07-16 16:22
Red Pitaya for Test & Measurement Sensor Extension Module Signal generators
19 15
sleep modes
231
Software Defined Radio (SDR)
184
sound sensor
211
spectrum generator
16
Standard Commands for Programmable Instrumentation (SCPI)
218
summing amplifier
151
T temperature sensor Test and Measurement
214 15
thermistor 62 timer 229 transformer 109 transistor 129 triangular wave
98
U UART 231 USB 232 V varactor diodes
125
visual programming
187
voltage divider biasing
134
voltage follower circuit
150
Von Neumann architecture
233
W Watchdog 229 waveform 99 wavelength 183 Wien Bridge Oscillator
158
WiFi 33 Z Zener diode
124
ZigBee 232
â—? 268
Red Piyata UK 160606.indd 268
07-07-16 16:22
RED PITAYA Dogan Ibrahim
FOR TEST & MEASUREMENT
The Red Pitaya is a credit card-sized, open-source test and measurement board that can be used to replace most measurement instruments used in electronics laboratories. With a single click, the board can transform into a webbased oscilloscope, spectrum analyser, signal generator, LCR meter, Bode plotter, and microcontroller. Prof Dr Dogan Ibrahim is a Fellow of the Institution of Electrical Engineers.
ISBN 978-1-907920-53-0
This book is written for college level and first year university students studying electrical or electronic engineering.
RED PITAYA
FOR TEST & MEASUREMENT
DOGAN IBRAHIM
In addition, he is the author of over 250 technical papers, published in journals, and presented in seminars and conferences.
This book is an introduction to electronics. It aims to teach the principles and applications of basic electronics by carrying out real experiments using the Red Pitaya. The book includes many chapters on basic electronics and teaches the theory and use of electronic components including resistors, capacitors, inductors, diodes, transistors, and operational amplifiers in electronic circuits. Many fun and interesting Red Pitaya experiments are included in the book. The book makes an introduction to visual programming environment.
EXPLORE, EXPERIMENT, PROGRAM
●
He is the author of over 60 technical books, published by international famous publishers, such as Wiley, Butterworth, and Newnes.
The Red Pitaya can replace the many pieces of expensive measurement equipment found at professional research organisations and teaching laboratories. The device, that based on Linux, includes an FPGA, digital signal processing (DSP), dual core ARM Cortex processor, signal acquisition and generation circuitry, micro USB socket, microSD card slot, RJ45 socket for Ethernet connection, and USB socket all powered from an external mains adaptor.
RED PITAYA FOR TEST & MEASUREMENT
EXPLORE, EXPERIMENT, PROGRAM
LEARN
www.elektor.com
DESIGN
Elektor International Media BV
Dogan Ibrahim LEARN
DESIGN
SHARE
SHARE
LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● RN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE SIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● RN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE ● LEARN ● DESIGN ● SHARE
Red Pitaya for Test & Measurement.indd All Pages
14-07-16 09:11