My Favorite Projects with Raspberry Pi Zero W

Updated on January 30, 2018

Introduction:

The main goal of this tutorial is to show a series of projects made with the Raspberry Pi Zero W board, which can serve us as a basis to develop more complex projects and to understand how the "One Wire" and "12C" protocols work " The program used is Python version 2.7.13.

1) Testing the analog ports of the ADS1115 Digital Analog Converter

The ADS1115 is a four-channel digital analog converter, uses the 12C protocol and has a resolution of 16 bits. The library of this device you can download it at the following link:

To install the library simply write the following command line:

>> sudo python setup.py install

This example comes in the library and is called "simpletest.py". Anyway I give you the code of this example at the end of this tutorial. In this example we are going to vary the analog voltage using a 10K potentiometer. The ADS1115 converts these analog values into data as shown in the following video.

2) Measure the differential data between channels 0 and 1 of the ADS1115 device

In this example we are going to measure the difference between channels 0 and 1 of the ADS1115 digital analog converter. We can also configure the ports to be monitored; we simply change the following code instruction which defaults to zero:

Where the assigned value can be:

0 = Channel 0 minus channel 1

1 = Channel 0 minus channel 3

2 = Channel 1 minus channel 3

3 = Channel 2 minus channel 3

This example is called "differential.py" and it also comes in the library, however I give you the code at the end of this tutorial. Below is a demonstration of this project.

3) Testing the barometric pressure sensor BMP085

The barometric pressure sensor BMP085 is used to measure the atmospheric pressure between 300 and 1100hPa. It can also measure between -500 and 9000 meters above sea level making the corresponding calculations. Additionally it measures the temperature from 0 to 65 degrees Celsius. We have to activate the 12C interface on the "Raspberry Pi Configuration" screen and reboot the system to work correctly. You can download the library from the following download link:

To install the library simply write the following command line:

>>sudo python setup.py install

This example comes in the library and is called "simpletest.py". Anyway I give you the code of this example at the end of this tutorial. In this example we will observe the following monitored values: Temperature, Pressure and Altitude as shown in the following video.

4) Testing digital temperature sensor DS18B20

The DS18B20 temperature sensor uses the 1-Wire protocol and can measure temperatures from -55 to 125 degrees Celsius or from -67 to 257 degrees Fahrenheit. We have to activate the 1-Wire interface in the "Raspberry Pi Configuration" screen and reboot the system so that it works correctly.

This example is "thermometer.py" and I give you the code at the end of this tutorial. In this example we will observe the temperature in degrees Celsius and degrees Fahrenheit as shown in the following video.

5) USB Communication With Arduino UNO And Raspberry Pi Zero W

In this project we are going to establish a serial communication between the Raspberry Pi board and the Arduino UNO board. The PIR motion detection sensor when activated sends a signal to pin 3 of the Arduino board, then two connected LEDs turn on pins 5 and 6, in my case I use a RGB LED. Immediately afterwards the Arduino board sends the following message to the Raspberry Pi Zero W board: "Motion detected". The download code for the Arduino and Raspberry Pi boards I gave you at the end of this tutorial and they are called "SerialArduino.ino" and "SerialRaspbery.py". The operation of the device is shown below:

0

0

18

11