Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Getting Started with Raspberry Pi Zero
  • Table Of Contents Toc
  • Feedback & Rating feedback
Getting Started with Raspberry Pi Zero

Getting Started with Raspberry Pi Zero

By : Richard Grimmett
4.7 (3)
close
close
Getting Started with Raspberry Pi Zero

Getting Started with Raspberry Pi Zero

4.7 (3)
By: Richard Grimmett

Overview of this book

Raspberry Pi Zero is half the size of Raspberry Pi A, only with twice the utility. At just three centimeters wide, it packs in every utility required for full-fledged computing tasks. This practical tutorial will help you quickly get up and running with Raspberry Pi Zero to control hardware and software and write simple programs and games. You will learn to build creative programs and exciting games with little or no programming experience. We cover all the features of Raspberry Pi Zero as you discover how to configure software and hardware, and control external devices. You will find out how to navigate your way in Raspbian, write simple Python scripts, and create simple DIY programs.
Table of Contents (11 chapters)
close
close
10
Index

Adding a sonar sensor

The basic circuit you just built is a wonderful start. Now you'll interface a more complex device, a sonar sensor, with Raspberry Pi Zero. Here is a picture of the sonar sensor that you'll add:

Adding a sonar sensor

The device is an HC-SR04 and they are available at most online electronics retailers. Now let's connect the device to Raspberry Pi Zero. In order to do this, first let's look at the layout of the GPIO pins on Raspberry Pi Zero:

Adding a sonar sensor

You'll need to connect to the 5 volt connection of the Raspberry Pi Zero, pin 2. You also need to connect to the GND, which is pin 6 on Raspberry Pi. Pin 16 (GPIO 23) is used as an output trigger pin and pin 18 (GPIO 24) as an input to time the echo from the sonar sensor.

Note

Don't connect 5 volts as an input to any of the GPIO pins as this might cause damage.

Now that you know the pins you have to connect to, you'll connect the sonar sensor. However, there is a problem, as you can't connect the 5-volt return from the...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY