Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Student Projects & STEM Education

MicroPython for School Students: Beginner Coding on Pi Pico

MicroPython for School Students: Beginner Coding on Pi Pico

March 11, 2026 /Posted byJayesh Jain / 0

MicroPython for School Students: Beginner Coding on Pi Pico

MicroPython brings the simplicity of Python — India’s most popular programming language for beginners — directly onto a microcontroller. The Raspberry Pi Pico, at Rs. 400-500, is the perfect hardware for school students learning physical computing: it is USB-powered, has GPIO pins for connecting sensors and LEDs, and can be programmed using any computer with Thonny IDE (free download, works on Windows, Mac, and Linux).

This guide is specifically designed for class 8-11 students who know basic Python (variables, if-else, for loops) and want to start controlling real hardware. No electronics experience required — we start from the very first LED blink and build up to practical projects like a digital thermometer and an automatic plant watering system.

Table of Contents

  1. Why Raspberry Pi Pico for Students?
  2. Setting Up Thonny IDE
  3. Your First Program: Blink an LED
  4. Reading Sensors with MicroPython
  5. Project: Digital Thermometer
  6. PWM: Dimming and Servo Control
  7. Project: Automatic Plant Watering
  8. Frequently Asked Questions

Why Raspberry Pi Pico for Students?

Compared to Arduino (which uses a C-like language) and full Raspberry Pi (which runs Linux and is more complex), Pi Pico with MicroPython sits at the perfect learning level for school students:

  • Python syntax: Students learning Python in class already know the basics. MicroPython uses identical syntax — no new language to learn.
  • Immediate feedback: The Thonny REPL lets you type a command and see the result instantly — ideal for learning.
  • Low cost: Rs. 400-500 for Pico W (with WiFi). Much cheaper than Arduino Uno + WiFi shield combination.
  • No special programmer: Just a USB cable — no driver installation needed on most systems.
  • Built-in LED: Pin 25 controls an onboard LED — you can start coding without any external components.

Recommended Product

Waveshare 8-Channel Relay for Pi Pico
Once students are comfortable with MicroPython basics, the Waveshare relay expansion board for Pico enables real-world applications — controlling appliances, LEDs, or irrigation pumps. Designed specifically for Pi Pico GPIO layout.

Shop Pi Pico Accessories

Setting Up Thonny IDE

Thonny is the recommended IDE for MicroPython beginners — it handles firmware flashing automatically:

  1. Download Thonny from thonny.org (free, available for Windows/Mac/Linux)
  2. Connect Pi Pico to your computer via USB while holding the BOOTSEL button
  3. Pico mounts as a USB drive (RPI-RP2)
  4. In Thonny: Tools → Options → Interpreter → MicroPython (Raspberry Pi Pico)
  5. Thonny prompts to install MicroPython firmware. Click Install.
  6. After 30 seconds, the Pico restarts and shows a MicroPython REPL prompt in Thonny’s shell.

You are now ready to write Python code that runs on hardware. Type print("Hello from Pico!") in the REPL and press Enter — you should see the message immediately.

Your First Program: Blink an LED

The traditional first microcontroller program — making an LED blink:

from machine import Pin
from time import sleep

# Pin 25 is the built-in LED on Pico
led = Pin(25, Pin.OUT)

# Blink 10 times
for i in range(10):
    led.on()
    sleep(0.5)  # on for 0.5 seconds
    led.off()
    sleep(0.5)  # off for 0.5 seconds
    print(f"Blink number {i+1}")

print("Done!")

Save this as blink.py and click Run in Thonny. The onboard LED blinks while the loop counter prints in the Shell. Experiment: change the sleep values to make it blink faster or slower. Add more LEDs on other GPIO pins (GP0 through GP28) with Pin(0, Pin.OUT).

Reading Sensors with MicroPython

Connect a push button to GP15 and read its state:

from machine import Pin
from time import sleep

button = Pin(15, Pin.IN, Pin.PULL_DOWN)  # PULL_DOWN = reads 0 when not pressed
led = Pin(25, Pin.OUT)

while True:
    if button.value() == 1:  # Button pressed
        led.on()
        print("Button pressed!")
    else:
        led.off()
    sleep(0.01)  # Check 100 times per second

Read an analogue sensor (potentiometer or LDR) using the ADC:

from machine import ADC, Pin
from time import sleep

adc = ADC(Pin(26))  # ADC0 = GP26

while True:
    reading = adc.read_u16()  # 0 to 65535
    voltage = reading * 3.3 / 65535
    percentage = reading / 65535 * 100
    print(f"ADC: {reading} | Voltage: {voltage:.2f}V | {percentage:.1f}%")
    sleep(0.5)

Turn a knob (potentiometer) and watch the values change in real time in Thonny’s shell. This immediate visual feedback is what makes REPL-based learning so effective for beginners.

Project: Digital Thermometer with OLED

Connect a DS18B20 waterproof temperature sensor and an SSD1306 OLED display to build a digital thermometer. DS18B20 uses Dallas 1-Wire protocol — one data wire for all sensors:

from machine import Pin, I2C
from ds18x20 import DS18X20
from onewire import OneWire
from ssd1306 import SSD1306_I2C
from time import sleep

# DS18B20 on GP2
ow = OneWire(Pin(2))
ds = DS18X20(ow)
roms = ds.scan()

# OLED: SDA = GP4, SCL = GP5
i2c = I2C(0, sda=Pin(4), scl=Pin(5))
oled = SSD1306_I2C(128, 64, i2c)

print(f"Found {len(roms)} sensor(s)")

while True:
    ds.convert_temp()  # Start measurement
    sleep(0.75)         # Wait for conversion
    temp = ds.read_temp(roms[0])

    oled.fill(0)
    oled.text("Temperature:", 0, 0)
    oled.text(f"{temp:.1f} C", 20, 30)

    if temp > 38:
        oled.text("FEVER!", 30, 50)

    oled.show()
    print(f"Temperature: {temp:.1f}C")
    sleep(2)

This project teaches: sensor interfacing, I2C communication, data display, and conditional logic — all in Python code that students already understand from their computer science classes.

PWM: Dimming and Servo Control

PWM (pulse width modulation) controls LED brightness and servo position. Pi Pico has hardware PWM on all GPIO pins:

from machine import Pin, PWM
from time import sleep

led_pwm = PWM(Pin(15))
led_pwm.freq(1000)  # 1 kHz PWM frequency

# Gradually brighten from 0% to 100% and back
while True:
    for duty in range(0, 65536, 512):  # Fade in
        led_pwm.duty_u16(duty)
        sleep(0.01)
    for duty in range(65535, -1, -512):  # Fade out
        led_pwm.duty_u16(duty)
        sleep(0.01)

For servo control (SG90 works with 5V from VBUS pin):

servo = PWM(Pin(16))
servo.freq(50)  # 50 Hz for servo

def set_angle(angle):  # angle: 0 to 180 degrees
    # Map 0-180 degrees to 1000-9000 duty cycle
    duty = int(1000 + (angle / 180) * 8000)
    servo.duty_u16(duty)

for angle in [0, 45, 90, 135, 180, 90, 0]:
    set_angle(angle)
    print(f"Angle: {angle} degrees")
    sleep(1)

Recommended Product

Arduino and Robotics Kit with Sensors
While designed for Arduino, this kit’s sensors (DHT22, DS18B20, servo, ultrasonic) are all compatible with Raspberry Pi Pico + MicroPython. Works with both platforms — students can use Arduino C for some projects and MicroPython for others.

Shop Sensor Kits for Pico

Project: Automatic Plant Watering System

Combining soil moisture sensing with a pump relay, this project is perfect for class 9-10 students — it solves a real problem (forgetting to water plants) and demonstrates IoT concepts:

from machine import ADC, Pin
from time import sleep

soil_sensor = ADC(Pin(26))
relay_pin = Pin(15, Pin.OUT)

DRY_THRESHOLD = 30000   # ADC reading below this = dry soil
WET_THRESHOLD = 45000   # ADC reading above this = wet enough
WATER_DURATION = 5      # Seconds to run the pump

print("Plant Watering System Active")
print("Watering when soil ADC drops below", DRY_THRESHOLD)

while True:
    soil_reading = soil_sensor.read_u16()
    moisture_pct = (65535 - soil_reading) / 65535 * 100

    print(f"Soil moisture: {moisture_pct:.1f}%")

    if soil_reading < DRY_THRESHOLD:
        print("DRY! Starting pump...")
        relay_pin.on()           # Turn pump on
        sleep(WATER_DURATION)    # Run for 5 seconds
        relay_pin.off()          # Turn pump off
        print("Watering complete. Waiting 5 minutes...")
        sleep(300)               # Don't water again for 5 minutes
    else:
        print("Moisture OK")

    sleep(30)   # Check every 30 seconds

For the relay, use a 5V single-channel relay module. The pump can be a small submersible water pump (Rs. 80-150) running on USB 5V power. Mount the soil sensor in a potted plant and let the system run autonomously for a week — then present it at your school science fair with a graph of soil moisture vs watering events.

Frequently Asked Questions

Do I need a Raspberry Pi Pico W or the basic Pico?

The basic Pico (Rs. 400) is sufficient for all projects in this guide. The Pico W (Rs. 550) adds WiFi, enabling IoT features like posting sensor data to the internet or receiving remote commands. For beginners, start with the basic Pico and upgrade to Pico W once comfortable with MicroPython.

My teacher says we must use C++ for Arduino. Can I still learn MicroPython at home?

Absolutely. MicroPython on Pico and Arduino C++ are complementary skills — both involve GPIO, sensors, and actuators, just with different syntax. Understanding both makes you more versatile. Many professional embedded systems engineers know both languages.

Where do I find MicroPython libraries for sensors not covered here?

The MicroPython community maintains libraries at micropython-lib (GitHub). Search for your sensor name + “micropython”. Most popular sensors have ready-made MicroPython drivers. Copy the .py file to your Pico using Thonny (right-click → Upload to /) and import it in your code.

Can Pi Pico and Arduino work together in the same project?

Yes — they can communicate via UART (serial) or I2C. A common pattern is using Pi Pico (MicroPython) for the user interface (OLED, buttons) and an Arduino Nano for real-time sensor reading, with the two boards exchanging data at 9600 baud. This modular approach is used in professional embedded systems too.

Start Coding on Real Hardware Today

MicroPython on Pi Pico is the fastest way for Indian school students to go from Python code to controlling real-world devices. Sensors, relay modules, and accessories at Zbotic.

Shop Pi Pico Components

Tags: beginner coding, MicroPython, physical computing, Python for hardware, raspberry pi pico, school students, sensor projects, STEM India, Thonny IDE
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
Ferrite Bead: Noise Suppressio...
blog ferrite bead noise suppression on power and signal lines 599738
blog 360 degree camera stitching project with opencv and pi 599754
360-Degree Camera Stitching Pr...

Related posts

Svg%3E
Read more

CubeSat Kit: Satellite Building for Education

April 1, 2026 0
The cubesat kit is one of the most exciting STEM projects you can take on in India today. Whether you... Continue reading
Svg%3E
Read more

Weather Balloon: High-Altitude Data Collection

April 1, 2026 0
The weather balloon is one of the most exciting STEM projects you can take on in India today. Whether you... Continue reading
Svg%3E
Read more

Automatic Irrigation: Multi-Zone Watering Controller

April 1, 2026 0
The automatic irrigation is one of the most exciting STEM projects you can take on in India today. Whether you... Continue reading
Svg%3E
Read more

Smart Weighbridge: Load Cell Industrial Scale

April 1, 2026 0
The smart weighbridge is one of the most exciting STEM projects you can take on in India today. Whether you... Continue reading
Svg%3E
Read more

Vending Machine: Arduino Coin and Product Dispenser

April 1, 2026 0
The vending machine is one of the most exciting STEM projects you can take on in India today. Whether you... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now