How to install Raspbian on an SD card and get started is described in detail at the homepage of the foundation. There is no need for the graphical mode, the installation of my software is done from the command line. What you need is an Internet connection, so link your Raspberry Pie with your router through a LAN cable. Only three commands turn your Raspberry Pi into an “Internet Of Things” device.
The first one downloads an installation script… …the second command turns this script into an executable file… …and the last one starts the script which does the rest of the installation work. Some questions have to be answered, mainly to set the installation directory and the password. That password is needed to access the Raspberry Pi through the browser interface. Since the password is also used to identify your Raspberry Pi, it should not be as easy as the one I have chosen for this video…
There is a step by step description available at the project page giving you a detailed insight in what the installation script does. The source code of my programs is of course also available. There is one tiny C program that enables software controlled pulse-width modulation for each GPIO… …and another C program that reads the status of the pins if a sensor or a switch is connected to that GPIO.
Both programs are called from a Perl script that connects your Raspberry Pie with two more scripts running on an Internet server. At the end of the installation process you can choose to start the Perl script on your Raspberry Pi automatically during the boot process. After shutdown, you can disconnect the keyboard… …mouse… …and display, by what you get a very compact Internet Of Things device. The hardware design around the GPIOs for this demonstration video is simple: There are four LEDs… …two servos… …an electric motor driven through an H bridge… …and finally two switches as the most simple type of sensor. After Reboot, the GPIOs can be switched through the browser interface – for example this cheap plastics laptop or a smartphone or a second Raspberry Pi can do the job.
For demonstration purposes I will use a larger laptop. To get connected, simply point to the script running on my Internet server and type the password you have entered during the installation process. As soon as the connection is established, you can set the variables by clicking on the control buttons. So let’s turn the colored LEDs fully on. As you can see, there is a delay of several seconds between clicking the control buttons and the accordant action of the GPIOs. In a secure shell session you can see that the Perl script running on the Raspberry Pi sends the current status of the GPIOs with a 10 second’s pause to the Internet server.
In turn the Raspberry Pi receives the next command set to be executed if you have clicked on a control button meanwhile. Some time passes by until the connection to the server is established and the control set is received, thus the total update interval is clearly larger than 10 seconds.
The second line of the status area turns green if the last instruction set has been received and executed by the Raspberry Pi. As demonstrated with the white LED, you can set the light intensity from 0 to 200, thus from OFF to fully ON. The motor connected to the H bridge can be controlled in the same way: The duty cycle of the pulse-width signal can be set from 0 to 100% according to a maximum value of 200. The direction of rotation is controlled by a second GPIO. That Pin can be set to either LOW or HIGH, thus fully OFF or fully ON.
Therewith the motor rotates either clockwise(?)… …or counterclockwise(?). Servos are also controlled by pulse-width signals, as demonstrated in my video about those devices. The pulses generated by the software are not very stable, thus you can see the servo levers oscillate around their setpoints. With the servos you can switch high voltage devices by simply actuating their power buttons. There is no need to open the housing in order to connect your Raspberry Pi to the high voltage cabling.
The poor precision of the servo pulses doesn’t matter. Two switches are used as the simplest kind of sensor. The state of those switches is displayed at the top of the browser interface – for this demonstration I have enlarged that area.
The status is updated each 15 seconds or with a click on a control button. There is also a delay of up to 30 seconds until a change in state is displayed. While creating this video I had the idea to add another control button: If there is a camera module installed, you can do snapshots that are automatically transmitted to your browser. Once more there is a delay of up to 30 seconds, but it gives you an overview of what is going on at home and shows if your remote controlled Raspberry Pi is operating as intended.
Since the keyboard and mouse are disconnected, you can shutdown your Raspberry Pi with the browser interface before unplugging the power supply. Two C programs and three perl scripts are working underneath the browser interface.
Try to understand how the source code works and create your own “Internet Of Things” with a Raspberry Pi. Learning text based programming languages is essential if you want to become a computer expert rather than staying on the level of “clicking on colored buttons”. So remote control your water boiler to turn it on 5 minutes before you arrive… …water your flowers while you are on a vacation trip… …see if a window or a door is open even if you are thousands of kilometers away… …drive my Curiosity Pi from any place with an Internet connection… …or turn the lights off! Thanks for watching and: “I’ll be back!”