Print Friendly, PDF & Email

Difficulty level: Beginner

Approx reading time:

Components Required:

1. Raspberry Pi 3 model B

2. MicroSD card 8 or 16 GB (Class 4 and above) with Raspbian

3. Windows PC / Linux PC (Tested on Windows 10, Ubuntu 14.04 LTS)

4. Ethernet cable (Category 5 – also called Cat 5)

5. Micro USB cable

6. Breadboard

7. MCP3008 Analog to Digital Converter – 1

8. LM35 Temperature Sensor – 1

9. Jumper Wires (Male to Female, Male to Male)

Way to go ->

1. Login to your Pi using PuTTy or your Ubuntu terminal.

2. Login to your Pi GUI using VNC server (Linux / Windows).

3. In Python 3 (IDLE), create a new file.

4. The name could be: LM35Read.py.

5. In the file LM35Read.py, write the following code with comments (line starting with “#”) for clear understanding and save (press Cntrl + S on your PC keyboard) the file.

Before running the python script do the following:

6. In the terminal type: sudo raspi-config and press Enter on your PC keyboard.

7. Go to Advanced Options.

7_AdvancedRaspi

8. Go to SPI.

8_SPI

9. Enable SPI Interface by clicking on <Yes>.

9_YesSPI

10. Reboot the Pi. In the terminal, type: sudo reboot

11. After it has rebooted, install Python 3 devlopment tools. In the terminal, type: 

12. Download this package. In the terminal type:

13. In the terminal type: ls to check that you have master.zip in your current working directory.

14. To unzip, in the terminal type: 

15. Remove master.zip: 

16. Navigate to py-spidev-master directory(folder): 

17. Type in the terminal: ls, to view the contents of the directory(folder).

18. In the terminal run the command: 

19. Finally, run the script by clicking on Run -> Run Module in the menu bar or by pressing F5 on your PC keyboard.

19_Output

Hardware Connections ->

1. Raspberry Pi 3 GPIO Header.

pi3_gpio

2. MCP3008 to Pi connections.

MCPToPi

3. LM35 to Pi / MCP3008 connections.

LM35Conn

LM35Read_schem

 LM35Read_bb

Read full tutorial at

Rating widget: