Skip to main content

Installing the NewPing library

What is a library, anyway?

When you want to attach sensors or other new parts (or ‘hardware’) to your Arduino board, it is often necessary to install a ‘library’ so that the board knows how to communicate with this new hardware. This is very much like when you plug a new printer into your computer: you have to install the required drivers or programs for it to work properly.

The following instructions will guide you through installing the library that will allow you to control an ultrasonic sensor with your Arduino board.

Download NewPing
Play Video
Watch Mac Tutorial

Windows installation guide

 

Step 1: Download the NewPing library

You can download the ‘NewPing’ library by clicking the ‘Download NewPing’ button which can be found on any of the project pages which use an ultrasonic sensor. You can also press the button below which will begin downloading a zip file automatically.

Step 2: Copy the library into the Arduino software

If you are using ‘Microsoft Edge’ or ‘Internet Explorer’, you may need to confirm that you want to save the zip file to your computer. Otherwise, the file will now be saved in your ‘Downloads’ folder. You now need to copy the file – it should be called something like ‘NewPing_v1.8.zip’ – and paste it into the folder in Documents > Arduino > Libraries.

The following screenshots will show you the process. Note that for this demonstration, we used the Google Chrome browser installed on Microsoft Windows. The process will be relatively similar when using other browsers or the Mac operating system.

ViewDownloadOptions

A zip file should begin downloading. Once it has finished, click the ‘up’ arrow. A tooltip should pop up with the download options.

 

ShowInFolder

Select the option that says ‘Show in folder’. This will open your downloads folder where the file will be highlighted in blue.

 

RightClickAndCopy

Now, right click on the zip file that should now be selected. This will show the options for this file. Click on the one that says ‘Copy’.

 

GoToArduinoFolder

Double click on the ‘Documents’ folder in the sidebar of Explorer, and then open the ‘Arduino’ folder that should be inside.

Step 3: Add the library in the Arduino software

You now need to tell the Arduino software that a new library called ‘NewPing’ is available. this is done by opening the Arduino software and then selecting Sketch > Include Library > Add ZIP library.

Again, we’ve included screenshots to help along the way.

Adding arduino zipped library

Select the option to ‘Add .ZIP Library’ from within the Arduino software

Open documents

Open arduino folder

Open libraries folder

Open newping folder

Receive library success message

Check newping install