Contents - PID-based Practical Digital Control
Contents - PID-based Practical Digital Control
PID-based Practical
PID-based Practical
Dogan Ibrahim
PID-based Practical Digital Control With Raspberry Pi and Arduino Uno 220802 UK.indd 3 15-08-2022 15:32
● This is an Elektor Publication. Elektor is the media brand of
Elektor International Media B.V.
PO Box 11, NL-6114-ZG Susteren, The Netherlands
Phone: +31 46 4389444
● All rights reserved. No part of this book may be reproduced in any material form, including photocopying, or
storing in any medium by electronic means and whether or not transiently or incidentally to some other use of this
publication, without the written permission of the copyright holder except in accordance with the provisions of the
Copyright Designs and Patents Act 1988 or under the terms of a licence issued by the Copyright Licencing Agency
Ltd., 90 Tottenham Court Road, London, England W1P 9HE. Applications for the copyright holder's permission to
reproduce any part of the publication should be addressed to the publishers.
● Declaration
The Author and Publisher have used their best efforts in ensuring the correctness of the information contained in
this book. They do not assume, and hereby disclaim, any liability to any party for any loss or damage caused by
errors or omissions in this book, whether such errors or omissions result from negligence, accident, or any other
cause.
All the programs given in the book are Copyright of the Author and Elektor International Media. These programs
may only be used for educational purposes. Written permission from the Author or Elektor must be obtained before
any of these programs can be used for commercial purposes.
Elektor is part of EIM, the world's leading source of essential technical information and electronics products for pro
engineers, electronics designers, and the companies seeking to engage them. Each day, our international team develops
and delivers high-quality content - via a variety of media channels (including magazines, video, digital media, and social
media) in several languages - relating to electronics design and DIY electronics. www.elektormagazine.com
●4
PID-based Practical Digital Control With Raspberry Pi and Arduino Uno 220802 UK.indd 4 15-08-2022 15:32
Contents
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Chapter 2 • Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
●5
PID-based Practical Digital Control With Raspberry Pi and Arduino Uno 220802 UK.indd 5 15-08-2022 15:32
PID-based Practical Digital Control
5.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
7.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
●6
PID-based Practical Digital Control With Raspberry Pi and Arduino Uno 220802 UK.indd 6 15-08-2022 15:32
Contents
7.4 Project 2: ON-OFF Temperature Control with Hysteresis and Arduino Uno . . . . . . . 98
7.5 Project 3: ON-OFF Temperature Control with Button Control – Arduino Uno . . . . . 100
7.6 Project 4: ON-OFF Temperature Control with Rotary Encoder and Arduino Uno . . 103
9.4 Project 3: PID Temperature Control with Arduino Uno and Timer Interrupts . . . . . 151
9.5 Project 4: PID Temperature Control using the Arduino Uno PID Library . . . . . . . . 154
●7
PID-based Practical Digital Control With Raspberry Pi and Arduino Uno 220802 UK.indd 7 15-08-2022 15:32
PID-based Practical Digital Control
10.8 Project 1: Motor Speed and Direction Control Using an H-Bridge Integrated Circuit . 169
10.9 Project 2: Displaying the Motor Speed with Arduino Uno . . . . . . . . . . . . . . . . . 176
10.10 Project 3: Displaying Motor Speed on LCD with Arduino Uno . . . . . . . . . . . . . 180
10.15 Project 8: PID Motor Speed Control with Arduino Uno . . . . . . . . . . . . . . . . . . 194
11.3 Project 1: Measuring Distance using the HC-SR04 Ultrasonic Module with
Arduino Uno . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
11.4 Project 2: Measuring Distance using the HC-SR04 Ultrasonic Module with
Raspberry Pi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
11.5 Project 3: Step Input Response of the System with Raspberry Pi . . . . . . . . . . . 205
11.7 Project 5: PID-based Water Level Control with Arduino Uno . . . . . . . . . . . . . . . 214
12.2 Project 1: Step Time Response of LED Brightness Control using the Raspberry Pi 218
12.3 Project 2: PID-Based LED Brightness Control using the Raspberry Pi . . . . . . . . . 222
12.4 Project 3: PID-based LED Brightness Control using the Arduino Uno . . . . . . . . . 227
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
●8
PID-based Practical Digital Control With Raspberry Pi and Arduino Uno 220802 UK.indd 8 15-08-2022 15:32