Lesson 14 Controlling an LED Based on Web

Share for us


The reason why the Raspberry Pi is so powerful is its networking function and numerous open source web application support. We can easily use it to realize our own Internet of Things system. In this lesson, we will control an LED based on web with the Raspberry Pi. You can use your mobile phone, tablet pc or computer to control the LED too, as long as it is in the same Local Area Network (LAN) with your Raspberry Pi.


– 1*Raspberry Pi

– 1*Breadboard

– 1*Network cable (or USB wireless network adapter)

– 1*LED

– 1*Resistor (220Ω)

– Jumper wires

Experimental Principle

WebIOPi is a fully integrated Internet of Things framework for the Raspberry Pi. Webiopi is a lightweight web server program on Raspberry Pi platform. It provides users a solution that can access Raspberry Pi remotely. Based on this, you can remotely operate your Raspberry Pi and control the hardware connected to it by a browser or an APP.

Experimental Procedures

  • 1.  Build the circuit
  • 2.  InstallWebIOPi

             wget http://webiopi.googlecode.com/files/WebIOPi-0.5.3.tar.gz

             tar xvzf WebIOPi-0.5.3.tar.gz

            cd WebIOPi-0.5.3

            sudo ./setup.sh

  • 3.  Set or modify the password ofWebIOPi

            sudo webiopi-passwd

            Username: webiopi

    If you do not modify the password, the default password is: raspberry

  • 4.  StartWebIOPi

          sudo python -m webiopi 8000

 You can change the port by yourself, the default port is 8000

  • 5.  Run WebIOPi in background, or it will be killed when you press ctrl+c

           sudo /etc/init.d/webiopi start


            sudo /etc/init.d/webiopi stop

  • 6.  SetWebIOPi to start with the system

     sudo update-rc.d webiopi defaults

  • 7.  Open IP address access management interface with a browser

Control method:

1)    Click outside IN/OUT to switch between the input and output mode of GPIOs

2)    In output mode, click inside figures to switch output between high and low. After connecting the LED to GPIO17, when you click block 11, you will see the states of the LED changed

3)    In input mode, inside figures represent the input states of GPIO


In this lesson, we have learnt how to build Internet of Things for WebIOPi platform based on Raspberry Pi and learnt how to control our device remotely based on this platform. I hope you can learn WebIOPi in depth and use your brain to make many more fun things.


If you have any questions, please send an email to support@sunfounder.com. We will reply you as soon as possible!

For more tutorials, visit LEARN->Get Tutorial and WIKI on our website www.sunfounder.com.

And welcome to share with us and other hobbyists on our FORUM.

Thanks for your support!

For Safe Use

All parts and devices in this kit should be powered appropriately in compliance with relevant regulations and standards applicable in the country of intended use.

The connection of unapproved external devices to the modules/boards in this kit may affect compliance or result in damage to the unit, for which we will not be responsible.

To avoid malfunction or damage to your circuit boards, please observe the following:

DO NOT expose it to water/moisture or place it on a conductive surface whilst in operation.

DO NOT expose it to heat from any source; the product is designed for reliable operation at normal ambient room temperatures.

Take care whilst handling to avoid mechanical or electrical damage to the printed circuit board and connectors.

PLEASE perform the connection or wiring based on the instructions in the manual or our website if you are not clear of the results. 

Copyright Notice

All contents including but not limited to texts, images, and code in this manual are owned by the SunFounder Company. You should only use it for personal study, investigation, enjoyment, or other non-commercial or nonprofit purpose , under the related regulations and copyrights laws, without infringing the legal rights of the author and relevant right holder. For any individual or organization that uses these for commercial profit without permission, the Company reserves the right to take legal action.