Reader small image

You're reading from  DIY Microcontroller Projects for Hobbyists

Product typeBook
Published inJul 2021
Reading LevelBeginner
PublisherPackt
ISBN-139781800564138
Edition1st Edition
Languages
Right arrow
Authors (2):
Miguel Angel Garcia-Ruiz
Miguel Angel Garcia-Ruiz
author image
Miguel Angel Garcia-Ruiz

Miguel Angel Garcia-Ruiz is an Associate Professor of Computer Science at the School of Computer Science and Technology, Algoma University, Canada. He has taught microcontroller programming and interfacing, human-computer interaction, and interaction design courses. Miguel has a PhD in Computer Science and Artificial Intelligence from Sussex University, England. He has published articles on tinkering with technology applying microcontroller boards. Miguel has conducted research projects funded by Canada's Northern Ontario Heritage Fund (NOHFC), Algoma University, and the Mexican Ministry of Education.
Read more about Miguel Angel Garcia-Ruiz

Pedro Cesar Santana Mancilla
Pedro Cesar Santana Mancilla
author image
Pedro Cesar Santana Mancilla

Pedro Cesar Santana Mancilla is a research professor at the School of Telematics at the University of Colima in Mexico. His research interests focus on human-computer interaction, ICT for elderly people, Internet of Things, and machine learning. He is currently serving as president of the Mexican Association on Human-Computer Interaction (AMexIHC). He is a Senior Member of the IEEE, and ACM and serves as Chair of the Mexican ACM SIGCHI Chapter (CHI-Mexico). Pedro is a member of the Mexican Academy of Computing (AMexComp) and the Mexican Society of Computer Science (SMCC).
Read more about Pedro Cesar Santana Mancilla

View More author details
Right arrow

Connecting an ultrasonic sensor to the microcontroller board

Before moving ahead, we need to learn about the functionality of the HC-SR04 ultrasonic sensor, how to interface it with the STM32 Blue Pill, and how to write a program to measure the distance between the sensor and another object.

This sensor emits an ultrasonic wave. When this wave collides with an object, the wave is reflected and received by the sensor. When the reflected signal is received, the sensor can calculate the time it took to be reflected, and thus the distance of the collision object can be measured.

The sensor can be seen in the following screenshot:

Figure 13.5 – Ultrasonic sensor

Figure 13.5 – Ultrasonic sensor

This sensor board connects to the STM32 Blue Pill microcontroller board with four pins, outlined as follows:

  • Trigger: This pin enables the ultrasonic wave.
  • Echo: This pin receives the reflected wave.
  • VCC: The pin to supply power to the sensor (5V).
  • GND: Ground connection...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
DIY Microcontroller Projects for Hobbyists
Published in: Jul 2021Publisher: PacktISBN-13: 9781800564138

Authors (2)

author image
Miguel Angel Garcia-Ruiz

Miguel Angel Garcia-Ruiz is an Associate Professor of Computer Science at the School of Computer Science and Technology, Algoma University, Canada. He has taught microcontroller programming and interfacing, human-computer interaction, and interaction design courses. Miguel has a PhD in Computer Science and Artificial Intelligence from Sussex University, England. He has published articles on tinkering with technology applying microcontroller boards. Miguel has conducted research projects funded by Canada's Northern Ontario Heritage Fund (NOHFC), Algoma University, and the Mexican Ministry of Education.
Read more about Miguel Angel Garcia-Ruiz

author image
Pedro Cesar Santana Mancilla

Pedro Cesar Santana Mancilla is a research professor at the School of Telematics at the University of Colima in Mexico. His research interests focus on human-computer interaction, ICT for elderly people, Internet of Things, and machine learning. He is currently serving as president of the Mexican Association on Human-Computer Interaction (AMexIHC). He is a Senior Member of the IEEE, and ACM and serves as Chair of the Mexican ACM SIGCHI Chapter (CHI-Mexico). Pedro is a member of the Mexican Academy of Computing (AMexComp) and the Mexican Society of Computer Science (SMCC).
Read more about Pedro Cesar Santana Mancilla