Controlling Devices with Raspberry Pi using Python

You can download the code from below link. It is written by Henry Cheung. You open and copy this file in your raspberry pi. After creating this file, run it using below command. Provide a file name while saving the python file and use it while executing the python script.

python3 filename.py

Building & Testing

Finally after making the connection, its time to test the code. Power on the Raspberry Pi.

Controlling Devices with Raspberry Pi using Python

Login to raspberry pi using SSH or using terminal. Now execute the below command

python3 rpi_webserver.py

The webserver will start and you have to use raspberry pi IP address along with port 8000 to access the web dashboard as shown below.

http://<your_raspberry_pi_ip>:8000

Now you can access the led or any device connected with the relay module.

Summary

There are many ways to control devices with your Raspberry Pi. In this article, we have shown you controlling devices with Raspberry Pi using Python. First, we will need to connect the relay module with pi and install the Python software if it is not present. Once the setup is ready, we can begin to control devices using Python dashboard easily. If you like this tutorial then please don’t forget to share it with others.

Related Projects:

Leave a Comment