How to program a Raspberry Pi

You may have heard of the Raspberry Pi and how people have used it to create super cool and innovative projects - arcade machines, weather stations, autonomous robots, smart mirrors, and more.

At first glance, it may be difficult to understand how the Raspberry Pi is working behind the scenes. The first thing to understand is that the Raspberry Pi is actually a fully functioning computer. It features many components that may be familiar to you:

It is a "headless" computer, or a computer that operates without a monitor, keyboard, or mouse. (At QPi Kits, we actually streamline this Raspberry Pi setup and allow you to connect to it directly with your laptop through WiFi)

The most interesting feature of the Raspberry Pi is its set of 40 pins, which enables it to communicate with external components. That's why you can connect the Raspberry Pi to various other devices - motors, sensors, lights, etc. - and control them through code! 

These pins have different functions. While some pins provide electricity, others are grounds, and others connect to different kinds of interfaces.

For now, we're going to focus on the GPIO pins, which stands for General Purpose Input Output. GPIO pins are digital which means they can have two states: off or on. They can have a direction to receive or send current (input, output respectively) and we can control the state and direction of the pins using programming languages such as Python, JavaScript, node-RED etc. The operating voltage of the GPIO pins is 3.3v with a maximum current draw of 16mA.

In order to start using GPIO pins on the Raspberry Pi, you would need to importing a library of pre-written code. The most common library is RPi.GPIO and it has been used to create thousands of projects since the early days of the Raspberry Pi.

All of this may sound a bit confusing if you've never used any kind of machine or microcontroller to control hardware. If you're interested in learning more about how to program the pins but don't own a Raspberry Pi, you have the opportunity to explore and try programming the Raspberry Pi and its pins through a free simulator created by Peter Dring here:

Follow along with the tutorial below (note that basic knowledge in Python is required):

If you're interested in learning Python and using the Raspberry Pi to control electronics but not sure how to get started, check out QPi's beginner course How to Make a Robot!


1 comment

  • Link to Peter Dring simulator goes to the RPi.GPIO library …

    Jeff Beck

Leave a comment

Please note, comments must be approved before they are published