๐ Why I Chose Raspberry Pi Over Arduino (For Now)
Although Arduino is a great choice for microcontroller-based projects, I decided to start my IoT journey with the Raspberry Pi because of my background in Python programming from university. Since the Pi supports full Python scripting out of the box, it made sense for me to build on what I already know instead of starting from scratch with Arduino's C/C++ environment.
The Raspberry Pi also gives me access to a full Linux environment, GPIO pins, internet connectivity, and the flexibility to build full-stack IoT systems โ from hardware control to backend logic and eventually frontend dashboards.
๐ Section 1 โ Fundamentals & Python Libraries for GPIO and IoT
๐ Electronics Fundamentals
Before diving into coding and IoT, I studied core electronics principles which are essential to understand circuits and hardware behavior.
A push button is a simple switch that connects or disconnects a circuit when pressed.
Most breadboard push buttons have 4 pins:
Pins A & B are internally connected.
Pins C & D are internally connected.
Pressing the button connects AโC and BโD.
When connected to a Raspberry Pi GPIO pin:
One side of the button gets 3.3V.
The other side connects to a GPIO pin.
A pull-down resistor ensures the pin reads LOW (0) when not pressed.
Pressing the button sends HIGH (1) to the pin.
๐ Active Buzzer & GPIO Output
An active buzzer produces a tone when powered.
Unlike a passive buzzer, it does not need PWM signals to generate sound.
Connect VCC to 3.3V or 5V.
Connect GND to ground.
Control sound by sending HIGH/LOW signals to the GPIO pin.
๐ Python Libraries for GPIO and IoT
Before jumping into projects, I explored the different Python libraries available for controlling Raspberry Pi GPIO pins.
Each library has its own strengths, and learning them gives me flexibility for any IoT project.
1๏ธโฃ RPi.GPIO
Low-level control of GPIO pins.
Requires manual setup for input/output and cleanup.
Great for learning the fundamentals of GPIO control.
Comes with many ready-made libraries for OLEDs, temperature sensors, and more.
Useful for more complex IoT systems.
4๏ธโฃ Pigpio
Advanced library with hardware PWM and precise timing.
Great for servo motors and robotics applications.
Runs as a daemon and can even be controlled remotely.
Throughout my IoT journey:
- GPIOZero will be my go-to for quick LED and button projects โ simple, fast, and effective for hardware control.
- RPi.GPIO helps me dive deep into low-level GPIO concepts and fine-tune hardware interactions.
- CircuitPython is my choice for working with I2C/SPI devices like OLED displays and sensors โ perfect for complex sensor integrations.
- Pigpio comes in handy for precise motor control and robotics, especially when timing and PWM accuracy matter.
- And beyond controlling pins, Iโm also leveraging Pythonโs powerful backend capabilities โ from data handling, API integration, to automation โ to build complete, robust IoT systems.
๐ฆ My Journey into Full Stack IoT
My journey into Full Stack IoT started with a simple goal:
Master hardware and software integration before university resumed.
Since I already had a background in Python, I chose the Raspberry Pi over Arduino.
Arduino is excellent for microcontroller projects, but the Pi gave me the flexibility of a full Linux environment, Python support, and the ability to handle more complex IoT systems.
I ordered my Raspberry Pi B+ Model from
Direnc.net, a popular electronics store in Turkey.
My excitement turned into panic when the Pi wouldnโt turn on.
I had used a normal phone charger instead of the recommended Pi power supply.
The Pi requires 5.1V and 2.5A for stable operation,
but my phone charger was underpowered. I even bought a Raspberry Pi Pico thinking I had fried the board,
only to discover the issue was just insufficient current.
Lesson learned: always check power requirements first!
Once I got the proper power supply, the Pi booted perfectly.
I installed Raspberry Pi OS using the official imager and booted into Linux for the first time.
I began exploring the terminal with commands like cd, ls, sudo, pwd, and mkdir.
Soon, I was ready to start coding with Thonny IDE and controlling my first LED.
This early stage was full of small mistakes, but each taught me something new.
Now I feel more confident in handling hardware, software, and Linux basics.
My plan is to document everythingโnot only the successes but also the strugglesโ
so that I can look back on my growth and help beginners relate to the journey.
๐ Raspberry Pi B+ / 400 GPIO Pinout
Understanding the GPIO pins is essential for connecting LEDs, buttons, and sensors.
Here's the pinout diagram of my Raspberry Pi 3B+ (similar to the Pi 400):
๐ก Section 3 โ GPIO Projects
This section contains all my beginner GPIO projects using the Raspberry Pi.
Here, I experiment with controlling LEDs, buttons, and basic electronic components using Python libraries like
RPi.GPIO and GPIOZero.
๐น Project 1: Blinking Two LEDs โ My first hands-on GPIO project using Python.
๐น Project 2: 4 LEDs & 5 Buttons โ A small reaction-style game with multiple GPIO inputs and outputs.
๐น More Projects Coming Soon โ I will update this section as I explore motors, sensors, and interactive IoT systems.
Check the Projects Menu for detailed write-ups and demos of each GPIO project.
๐ฏ ๐ฎ GPIO Project 3: LED Roulette Game with Raspberry Pi
This project is a fun little game built using a Raspberry Pi, a set of LEDs, push buttons, and Python.
The goal is simple: spin the roulette of LEDs, press the stop button, and try to land on the โluckyโ LED
to score points! Your scores are saved between rounds, so you can keep improving over time.
๐ก Tip: This is a great beginner-friendly Raspberry Pi GPIO project that teaches
you about LED control, button inputs, random number generation, and persistent storage in Python.
๐ How It Works
When you start the game, the program randomly selects one LED to be the โluckyโ LED.
The LEDs then start lighting up in a fast sequence, like a spinning roulette.
When you press the stop button, the LEDs freeze on one position.
If you land on the lucky LED, you earn a point!
Your score is saved using a small local database, so it remembers you between plays.
๐ Components Needed
Raspberry Pi (any model with GPIO pins)
10 LEDs
10 suitable resistors (220ฮฉ recommended)
2 push buttons
Jumper wires & breadboard
Python 3 installed on your Raspberry Pi
๐ป The Code
The code below controls the LED roulette. It uses the gpiozero library for easy GPIO handling and shelve to store scores.
Install the gpiozero library if you havenโt already:
pip install gpiozero
Save the Python code to a file, for example led_roulette.py.
Wire up your LEDs and buttons according to the led_pins list in the code.
Run the program:
python3 led_roulette.py
Follow the instructions on the terminal, start the roulette, and try to stop on the lucky LED!
โ ๏ธ Safety Note: Always power off your Raspberry Pi when making changes to your wiring to avoid short circuits.
๐ฏ Final Thoughts
This project is a fun way to mix Python programming with hands-on electronics. Itโs also a perfect example
of how you can add a competitive twist to simple hardware projects by introducing scoring, randomness, and
persistent data storage.
My 5 Buttons & 4 LEDs Game Circuit on a Breadboard
๐ฎ GPIO Project 2: 5 Buttons & 4 LEDs Game
This project is an **interactive LED guessing game** built with a Raspberry Pi, 4 LEDs, 5 push buttons, and a passive buzzer.
It combines inputs (buttons) and outputs (LEDs & sound) to create a fun, hands-on GPIO challenge.
The goal is to guess which LED the Raspberry Pi randomly selects in each round.
๐น How the Game Works
1๏ธโฃ Press the **Start Button** to begin the game.
2๏ธโฃ Enter your **name** in the terminal to personalize the score.
3๏ธโฃ The Raspberry Pi **randomly chooses one of the 4 LEDs**, but keeps it secret.
4๏ธโฃ Use the 4 LED buttons to make your guess. When a button is pressed:
The corresponding LED lights up to show your selection.
If correct: โ +5 points and a **double beep** plays on the buzzer.
If wrong: โ -2 points and a **single low beep** plays.
5๏ธโฃ The game runs for **5 rounds**, tracking your score after each guess.
6๏ธโฃ At the end, your **total score** is displayed and stored in a Python Shelve database for future reference.
5ร Push Buttons (4 for guesses, 1 as the start button)
1ร Passive Buzzer (for audio feedback)
๐ Circuit Explanation
If you want to understand how push buttons and active buzzers are wired and work, check the Fundamentals Section โ Push Buttons & GPIO Input.
My 5 Buttons & 4 LEDs Game Circuit on a Breadboard
๐ง Game Logic in Python
- The game uses the random module to select a secret LED each round.
- Player input is captured via GPIO button presses.
- Scoring: +5 for correct guess, -2 for wrong guess.
- Sound Feedback:
Double short beeps = Correct
Single long beep = Wrong
-Storage: Player name and score are saved using shelve for local storage.
My first hands-on project was a blinking LED circuit using the RPi.GPIO library.
This simple project helped me understand GPIO outputs, resistors, and how to structure Python loops for hardware control.