DIY Microcontroller Projects for Hobbyists
eBook - ePub

DIY Microcontroller Projects for Hobbyists

Miguel Angel Garcia-Ruiz, Pedro Cesar Santana Mancilla

Condividi libro
  1. 320 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

DIY Microcontroller Projects for Hobbyists

Miguel Angel Garcia-Ruiz, Pedro Cesar Santana Mancilla

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

A practical guide to building PIC and STM32 microcontroller board applications with C and C++ programmingKey Features• Discover how to apply microcontroller boards in real life to create interesting IoT projects• Create innovative solutions to help improve the lives of people affected by the COVID-19 pandemic• Design, build, program, and test microcontroller-based projects with the C and C++ programming languageBook DescriptionWe live in a world surrounded by electronic devices, and microcontrollers are the brains of these devices. Microcontroller programming is an essential skill in the era of the Internet of Things (IoT), and this book helps you to get up to speed with it by working through projects for designing and developing embedded apps with microcontroller boards. DIY Microcontroller Projects for Hobbyists are filled with microcontroller programming C and C++ language constructs. You'll discover how to use the Blue Pill (containing a type of STM32 microcontroller) and Curiosity Nano (containing a type of PIC microcontroller) boards for executing your projects as PIC is a beginner-level board and STM-32 is an ARM Cortex-based board. Later, you'll explore the fundamentals of digital electronics and microcontroller board programming. The book uses examples such as measuring humidity and temperature in an environment to help you gain hands-on project experience. You'll build on your knowledge as you create IoT projects by applying more complex sensors. Finally, you'll find out how to plan for a microcontroller-based project and troubleshoot it. By the end of this book, you'll have developed a firm foundation in electronics and practical PIC and STM32 microcontroller programming and interfacing, adding valuable skills to your professional portfolio.What you will learn• Get to grips with the basics of digital and analog electronics• Design, build, program, and test a microcontroller-based system• Understand the importance and applications of STM32 and PIC microcontrollers• Discover how to connect sensors to microcontroller boards• Find out how to obtain sensor data via coding• Use microcontroller boards in real life and practical projects Who this book is forThis STM32 PIC microcontroller book is for students, hobbyists, and engineers who want to explore the world of embedded systems and microcontroller programming. Beginners, as well as more experienced users of digital electronics and microcontrollers, will also find this book useful. Basic knowledge of digital circuits and C and C++ programming will be helpful but not necessary.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
DIY Microcontroller Projects for Hobbyists è disponibile online in formato PDF/ePub?
Sì, puoi accedere a DIY Microcontroller Projects for Hobbyists di Miguel Angel Garcia-Ruiz, Pedro Cesar Santana Mancilla in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Computer Science e Hardware. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2021
ISBN
9781800569522
Edizione
1
Categoria
Hardware

Chapter 1: Introduction to Microcontrollers and Microcontroller Boards

In this chapter, you will learn how to set up fundamental software tools for programming microcontrollers, as well as how to use basic electronic components as a starting point for programming examples for beginners. We will begin with a general introduction to microcontrollers and their definitions, as well as their importance and applications in our everyday lives. We will then go on to give a simplified explanation of the digital and analog electronics necessary for the microcontroller projects carried out in the rest of the chapters. Here, we will also explain the basic equipment that may be used in this book's projects. Finally, we will look at a concise description of the Blue Pill and Curiosity Nano microcontroller boards to be used throughout this book.
Specifically, we will cover the following main topics:
  • Introduction to microcontrollers
  • An overview of analog and digital electronics necessary for carrying out the book's projects
  • Description of the Blue Pill and Curiosity Nano microcontroller boards
We will also cover how to install the necessary software drivers and the integrated development environments (IDEs) for programming the Blue Pill and Curiosity Nano. After completing this introductory chapter, you will be able to apply what you have learned regarding the installation of integrated development environments (a type of software tool) to programming the obligatory Hello World programs used to make an LED blink. This will run on the Blue Pill and Curiosity Nano using C. Don't worry if you don't know a lot about C programming yet; we have you covered; Chapter 2, Software Setup and C Programming for Microcontroller Boards, includes a gentle but concise C programming tutorial.

Technical requirements

The two microcontroller boards described in this book (Blue Pill and Curiosity Nano) can be programmed using different IDEs. An IDE is a programming and debugging software tool that includes a code editor, a compiling environment, debugging options, and so on. Many of the IDEs are also used to upload your compiled program to a microcontroller board via a USB port connection.
These are the IDEs that you will need to install on your computer:
  • Arduino IDE: This free IDE was originally created for programming Arduino microcontroller boards, but you can also use it for programming the Blue Pill microcontroller board if you install a library for it.
  • MPLAB ® X IDE: Made by Microchip, the Curiosity Nano manufacturer. This is a free IDE necessary for programming the Curiosity Nano.
We will explain how to install and use those IDEs in this chapter.
The code used in this chapter can be found at the book's GitHub repository here:
https://github.com/PacktPublishing/DIY-Microcontroller-Projects-for-Hobbyists/tree/master/Chapter01
The Code in Action video for this chapter can be found here: https://bit.ly/3zSOg8O
For hardware, you will need the following materials:
  • A regular LED light – any color will do.
  • A 220-ohm resistor; 0.25 watts.
  • A solderless breadboard for connecting an LED and a resistor and some male-to-male jumper wires to make the electrical connections between the components and the microcontroller boards.
  • A micro USB cable for connecting your microcontroller boards to a computer.
  • The Blue Pill and Curiosity Nano boards, of course! There are several vendors and manufacturers of the Blue Pill board, which uses the STM32F103C8T6 microcontroller. In the case of the Curiosity Nano, we use a version called the PIC16F15376 Curiosity Nano PIC® MCU 8-Bit Embedded Evaluation Board, part number DM164148, manufactured by Microchip.
  • A programming adapter such as the ST-Link/V2 is also needed. This electronic interface will allow you to upload the compiled code to the Blue Pill, establishing communication from your computer to the Blue Pill microcontroller board. The ST-Link/V2 needs four female-to-female DuPont wires.
Some of the sensors used in this book can be found in a sensor kit in the form of practical modules, such as the Kumantech 37-in-1 sensor kit:
http://www.kumantech.com/kuman-new-version-37-sensor-module-robot-project-starter-kit-for-arduino-r3-mega2560-mega328-nano-uno-raspberry-pi-rpi-3-2-model-b-b-k5_p0017.html.
This kit can be used with many types of microcontroller boards, including the Blue Pill and the Curiosity Nano. Sometimes, it is convenient to buy a sensor kit like this one for experimenting with its sensor modules. Some other kits include components such as resistors and code examples.

Introduction to microcontrollers

In this section, we will focus on what a microcontroller is and what its main parts are. It is important to understand what the microcontrollers are capable of and how they are used as a fundamental part of many embedded systems, so they can be used in real-world projects. An embedded system is a computer subsystem that usually works as part of a larger computer system, for example, a wireless router containing a microcontroller. Let's start with a definition of microcontrollers.
A microcontroller (also known as a microcontroller unit, or MCU) is a very small computer system self-contained in an integrated circuit (IC). It encases all the necessary computing components to execute tasks, computes numeric calculations, reads data from sensors, keeps data and a program in memory, and send data to actuators, among other actions. Most of the microcontrollers perform analog-to-digital conversion (ADC), obtaining analog data from sensors and converting it to digital values. More on ADC is explained in Chapter 4, Measuring the Amount of Light with a Photoresistor. Digital values are defined by binary values (1 or 0). The next section explains more about those values.
Microcontrollers have an internal clock signal that is like a heartbeat that coordinates how tasks and other actions are performed in the microcontroller. This clock signal is not as fast as microprocessors (used by desktop computers and laptops), but it is enough for doing basic operations such as reading a sensor or controlling a motor. Their internal memory is limited, but enough for storing a program capable of running a particular task. In general, microcontrollers do not use an external data storage device such as a hard drive. Everything they need to run is encased in their IC.
An IC is an electronic circuit densely packaged in a small and flat piece of plastic. It contains many microscopic electronic components and electrically connected pins. ICs are manufactured in different packaging. Dual in-line packaging (DIL) houses two rows of electrically connecting pins. Quad flat packaging (QFP) includes 8–70 pins per side, useful for surface mounting soldering. Microcontrollers are encased in ICs, as well as other electronic parts.
The pins of some microcontrollers are organized into two rows using DIL packaging. Other ICs, such as the STM32 microcontroller, have four rows of pins, which is known as QFP.
Microcontrollers are also called a computer in a chip. They generally have low-power consumption, and, of course, are reduced in size. Some of them ar...

Indice dei contenuti