Arduino Pedometer: Step Counter with MPU6050 and OLED Display
Arduino pedometer: acceleration magnitude, peak detection and threshold, steps, distance and calories on an OLED, MPU6050 vs ADXL345, ESP32 and Pico code.
An Arduino pedometer is a fun and instructive project that turns motion data from an accelerometer into a number. The step counters in phones and smartwatches work on the same idea: an acceleration sensor picks up the short up-and-down jolt your body makes with every step, and the peaks of those jolts are counted. In this article you will build a pedometer with an MPU6050, a 0.96 inch OLED display and an Arduino Uno that shows steps, distance and calories.
First you will learn about the magnitude of the acceleration vector and the peak detection logic that separates steps from noise, then you will turn the step length and calorie formulas into code. You will also find how to choose between the MPU6050 and the ADXL345, a battery-powered version you can wear on your wrist, ESP32 code that saves the step count to persistent memory and a Raspberry Pi Pico version in MicroPython.

How does a pedometer work? The acceleration magnitude
An accelerometer measures acceleration on three axes (x, y, z) and reports it in g; even at rest it sees about 1 g in total because of gravity. Since the sensor keeps turning on your wrist or in your pocket, looking at a single axis doesn't work: one moment the z axis points up, the next moment the x axis does. The solution is the vector magnitude, which combines the three axes: |a| = √(ax² + ay² + az²). This value doesn't depend on the sensor's orientation. At rest it stays around 1.0 g; when you walk it rises to 1.2–1.5 g each time your heel hits the ground and then drops below 0.8 g. The pedometer's job is to count the peaks in this wave. You can find the sensor basics in the MPU6050 accelerometer and gyroscope guide.
| Situation | |a| value (approx.) | Step frequency |
|---|---|---|
| Lying on a table | 1.00 g, ±0.02 g noise | - |
| Slow walk | 0,9–1,2 g | 1.2–1.6 steps/s |
| Normal walk | 0,8–1,4 g | 1.6–2.0 steps/s |
| Running | 0,5–2,5 g | 2.5–3.2 steps/s |
| In a car or bus | Irregular bumps | No rhythm, should not count |
Peak detection and a dynamic threshold
The raw |a| value is jittery and noisy; if you compare it directly with a fixed threshold, you'll count a single step two or three times. So the code applies four steps. First it takes 50 samples per second and smooths the jitter with a simple low-pass filter (an exponential moving average). Second, it keeps a slow average of about one second; this baseline follows the middle of the wave even if the sensor is tilted or its calibration drifts. Third, a peak starts when the filtered signal rises 0.12 g above the baseline and ends when it falls back to 0.06 g above it; this two-level structure (hysteresis) prevents flickering in the noise. Finally, there must be at least 300 ms between two steps, because people can't take more than about 3.3 steps per second. For the logic behind filters, see the sensor data filtering guide.
Step length, distance and calorie formulas
| Quantity | Formula | Example (175 cm, 70 kg) |
|---|---|---|
| Step length, walking (men) | height × 0.415 | 72,6 cm |
| Step length, walking (women) | height × 0.413 | 72,3 cm |
| Measured step length | Distance covered in 20 steps ÷ 20 | 14.5 m ÷ 20 = 72.5 cm |
| Distance | steps × step length | 10,000 steps ≈ 7.26 km |
| Calories (MET method) | MET × kg × hours | 3.5 × 70 × 1.5 = 368 kcal |
| Calories, walking shortcut | 0.7 × kg × km | 0.7 × 70 × 7.26 ≈ 356 kcal |
| Calories, running shortcut | 1.0 × kg × km | 5 km run ≈ 350 kcal |
MET (metabolic equivalent) shows how many times more energy an activity uses than resting: rest is 1 MET. A slow walk at 3.2 km/h is about 2.8 MET, a normal walk at 4.8 km/h 3.5 MET, a brisk walk at 6.4 km/h 5.0 MET and an easy run at 8 km/h about 8.3 MET. The 7.26 km walk in the example takes about 1.5 hours at 4.8 km/h, and the MET method gives 368 kcal; the shortcut formula lands close to that at 356 kcal. These are gross calories that include resting energy use and carry a margin of error of ±20%; a pedometer is meant to show a trend, not to take a medical measurement. Replace the BOY_CM (height) and KILO_KG (weight) constants in the code with your own values.
MPU6050 or ADXL345?
| Feature | MPU6050 (GY-521) | ADXL345 (GY-291) |
|---|---|---|
| Sensors | 3-axis accel + 3-axis gyro | 3-axis accel only |
| Range | ±2 / 4 / 8 / 16 g | ±2 / 4 / 8 / 16 g |
| Resolution | 16-bit (16384 LSB/g at ±2 g) | 13-bit, 3.9 mg/LSB in full resolution |
| Interface and address | I2C, 0x68 (AD0 = GND) / 0x69 | I2C or SPI, 0x53 (SDO = GND) / 0x1D |
| Current | About 3.5–4 mA (gyro on) | About 0.05–0.15 mA |
| Extras | Orientation and tilt from the gyro | 32-sample FIFO, tap and inactivity interrupts |
| Best for | Desk experiments, USB powered | Battery-powered wrist device |
You don't need the gyroscope to count steps; acceleration alone is enough. If you have an MPU6050, start with it; most GY-521 modules have a regulator and pull-up resistors, so they can connect straight to the Uno's 5 V. If you're building a battery-powered device, the ADXL345 is by far the better choice because it draws about 30 times less current. Neither sensor's I2C address clashes with the OLED display's 0x3C, so you can put both on the same two wires. You can read how I2C works in the What is I2C guide.
Wiring: MPU6050, OLED and button
| Connection | Arduino Uno | ESP32 (ADXL345) | Raspberry Pi Pico |
|---|---|---|---|
| Sensor VCC | 5V | 3V3 | 3V3(OUT), pin 36 |
| GND | GND | GND | GND, pin 38 |
| SDA | A4 | GPIO 21 | GP4, pin 6 |
| SCL | A5 | GPIO 22 | GP5, pin 7 |
| Address pin | AD0 → GND (0x68) | SDO → GND (0x53), CS → 3V3 | AD0 → GND (0x68) |
| OLED (0x3C) | Same SDA/SCL, VCC 5V | Optional, same bus | Optional, same bus |
| Reset button | D2 → GND | - | - |
Step by step: a pedometer with an Arduino Uno and OLED
- Install the Adafruit SSD1306 and Adafruit GFX libraries from the Library Manager. The MPU6050 needs no library; the code reads the sensor's registers directly with Wire.
- Connect the MPU6050 and the OLED to the A4/A5 bus as in the table, and the button between D2 and GND.
- Change BOY_CM and KILO_KG in the code to your own values and upload it. The OLED should show 0 steps.
- Power the circuit from a power bank, fix it in your pocket or on your wrist and count 100 steps. If the display shows between 95 and 105, the tuning is good.
- If the count is too low, lower ESIK_G to 0.10; if it counts too many, raise it to 0.15. For running you can set MIN_ARALIK to 250 ms.
1// Arduino adım sayar: MPU6050 + SSD1306 OLED
2// Arduino pedometer: MPU6050 + SSD1306 OLED
3// I2C: A4 (SDA), A5 (SCL); MPU6050 0x68, OLED 0x3C; sıfırlama butonu / reset button: D2
4#include <Wire.h>
5#include <Adafruit_GFX.h>
6#include <Adafruit_SSD1306.h>
7
8const uint8_t MPU_ADRES = 0x68;
9const uint8_t BUTON_PIN = 2;
10const float BOY_CM = 175.0; // Boyun / Your height
11const float KILO_KG = 70.0; // Kilon / Your weight
12const float ADIM_CM = BOY_CM * 0.415; // Yürüyüş adım uzunluğu / Walking step length
13const float ESIK_G = 0.12; // Tepe eşiği (g) / Peak threshold (g)
14const unsigned long MIN_ARALIK = 300; // İki adım arası en az (ms) / Min time between steps
15const unsigned long MAX_ARALIK = 2000; // Ritmin koptuğu süre (ms) / Rhythm timeout (ms)
16
17Adafruit_SSD1306 ekran(128, 64, &Wire, -1);
18
19float suzulmus = 1.0; // Alçak geçiren süzgeç / Low-pass filter output
20float taban = 1.0; // Yavaş ortalama, dinamik eşik / Slow average, dynamic threshold
21bool ustte = false; // Eşiğin üstünde mi / Above the threshold?
22uint8_t aday = 0; // Ardışık aday adım / Consecutive candidate steps
23unsigned long sonAdim = 0; // Son adımın zamanı / Time of last step
24unsigned long adim = 0; // Toplam adım / Total steps
25unsigned long sonOrnek = 0; // Son örnek zamanı / Last sample time
26unsigned long sonEkran = 0; // Son ekran güncellemesi / Last display update
27
28void mpuYaz(uint8_t reg, uint8_t deger) {
29 Wire.beginTransmission(MPU_ADRES);
30 Wire.write(reg);
31 Wire.write(deger);
32 Wire.endTransmission();
33}
34
35// Üç eksenin vektör büyüklüğü (g) / Vector magnitude of the three axes (g)
36float ivmeBuyuklugu() {
37 Wire.beginTransmission(MPU_ADRES);
38 Wire.write(0x3B); // ACCEL_XOUT_H
39 Wire.endTransmission(false);
40 Wire.requestFrom(MPU_ADRES, (uint8_t)6);
41 int16_t ham[3];
42 for (uint8_t i = 0; i < 3; i++) {
43 int16_t yuksek = Wire.read(); // Önce yüksek bayt / High byte first
44 int16_t dusuk = Wire.read();
45 ham[i] = (yuksek << 8) | dusuk;
46 }
47 float x = ham[0] / 16384.0; // ±2 g: 16384 LSB/g
48 float y = ham[1] / 16384.0;
49 float z = ham[2] / 16384.0;
50 return sqrt(x * x + y * y + z * z);
51}
52
53void adimKontrol(float g, unsigned long simdi) {
54 suzulmus += 0.25 * (g - suzulmus); // Titreşimi yumuşat / Smooth out jitter
55 taban += 0.02 * (suzulmus - taban); // Yaklaşık 1 sn ortalama / About 1 s average
56 if (!ustte && suzulmus > taban + ESIK_G) {
57 ustte = true; // Tepe başladı / Peak started
58 } else if (ustte && suzulmus < taban + ESIK_G / 2) {
59 ustte = false; // Tepe bitti: aday adım / Peak ended: candidate step
60 unsigned long gecen = simdi - sonAdim;
61 if (gecen >= MIN_ARALIK) {
62 if (gecen > MAX_ARALIK) aday = 0; // Ritim koptu / Rhythm broken
63 sonAdim = simdi;
64 if (aday < 4) {
65 aday++;
66 if (aday == 4) adim += 4; // 4 ritmik adım: hepsini say / 4 rhythmic steps: count them all
67 } else {
68 adim++;
69 }
70 }
71 }
72}
73
74void ekranGuncelle() {
75 float km = adim * ADIM_CM / 100000.0;
76 float kcal = 0.7 * KILO_KG * km; // Yürüyüş için yaklaşık / Approximate for walking
77 ekran.clearDisplay();
78 ekran.setTextColor(SSD1306_WHITE);
79 ekran.setTextSize(1);
80 ekran.setCursor(0, 0);
81 ekran.print("ADIM / STEPS");
82 ekran.setTextSize(3);
83 ekran.setCursor(0, 14);
84 ekran.print(adim);
85 ekran.setTextSize(1);
86 ekran.setCursor(0, 46);
87 ekran.print(km, 2);
88 ekran.print(" km");
89 ekran.setCursor(0, 56);
90 ekran.print(kcal, 0);
91 ekran.print(" kcal");
92 ekran.display();
93}
94
95void setup() {
96 Serial.begin(115200);
97 pinMode(BUTON_PIN, INPUT_PULLUP);
98 Wire.begin();
99 mpuYaz(0x6B, 0x00); // Uyku modundan çık / Wake up from sleep
100 mpuYaz(0x1C, 0x00); // İvme aralığı ±2 g / Accel range ±2 g
101 mpuYaz(0x1A, 0x03); // Dahili süzgeç 44 Hz / Internal filter 44 Hz
102 if (!ekran.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
103 Serial.println("OLED yok / OLED not found");
104 }
105 ekranGuncelle();
106}
107
108void loop() {
109 unsigned long simdi = millis();
110 if (simdi - sonOrnek >= 20) { // 50 Hz örnekleme / 50 Hz sampling
111 sonOrnek = simdi;
112 adimKontrol(ivmeBuyuklugu(), simdi);
113 }
114 if (digitalRead(BUTON_PIN) == LOW) { // Sayacı sıfırla / Reset the counter
115 adim = 0;
116 aday = 0;
117 }
118 if (simdi - sonEkran >= 500) {
119 sonEkran = simdi;
120 ekranGuncelle();
121 }
122}| Code part | What it does |
|---|---|
| mpuYaz(0x6B, 0x00) | Wakes the MPU6050 from its power-on sleep mode |
| ivmeBuyuklugu() | Reads 6 bytes from 0x3B and computes √(x² + y² + z²) |
| suzulmus += 0.25 * (…) | Low-pass filter that smooths sudden jitter |
| taban += 0.02 * (…) | About 1 s average, centre of the dynamic threshold |
| MIN_ARALIK / MAX_ARALIK | Rejects peaks closer than 300 ms or further apart than 2 s |
| simdi - sonOrnek >= 20 | 50 Hz sampling without delay() |
The code uses millis() instead of delay(), so sampling doesn't stall while the display updates or the button is read. You'll find the details of this method in the millis vs delay guide. For using the OLED and choosing its address, see the SSD1306 OLED display guide. Because the OLED's frame buffer takes half of the Uno's 2 KB of RAM, avoid adding large arrays to this sketch.
A battery-powered wrist version

The Uno is too big to wear on your wrist. For a wearable version, use an Arduino Pro Mini 3.3 V / 8 MHz or an ESP32-C3 Super Mini, an ADXL345, a small 0.91 inch OLED, a 300 mAh Li-Po cell and a TP4056 charging module. Feed the cell's 3.7–4.2 V to the Pro Mini's RAW pin; the board's regulator produces 3.3 V and also powers the sensor. The display draws the most current, so switch it on for only 5 seconds when a button is pressed. Estimated consumption: about 4 mA for the Pro Mini with its power LED removed, 0.1 mA for the ADXL345, and an average of 1.25 mA for an OLED that is on for 5 seconds per minute; at roughly 5.4 mA in total a 300 mAh cell lasts more than 50 hours. If you put the microcontroller to sleep between samples, this stretches to weeks; see the Arduino sleep mode and ESP32 deep sleep guides. You can work out battery life with your own values in the battery life calculator.
Pedometer with an ESP32: ADXL345 and persistent storage
The ESP32 version uses the low-power ADXL345 and writes the step count to the chip's persistent memory (NVS) with the Preferences library, so the count survives a power cycle. To spare the flash, it saves every 50 steps rather than on every step. ADXL345 data comes low byte first and each unit is 3.9 mg in full-resolution mode; those two details are the only differences from the MPU6050. The algorithm is the same as in the Uno version, so you can carry settings such as ESIK_G between the two boards.
1// ESP32 adım sayar: ADXL345 + adımı kalıcı belleğe kaydetme
2// ESP32 pedometer: ADXL345 + saving steps to flash
3// I2C: GPIO21 (SDA), GPIO22 (SCL); ADXL345 0x53 (SDO = GND, CS = 3V3)
4#include <Wire.h>
5#include <Preferences.h>
6
7const uint8_t ADXL_ADRES = 0x53;
8const float ESIK_G = 0.12; // Tepe eşiği (g) / Peak threshold (g)
9const unsigned long MIN_ARALIK = 300; // ms
10const unsigned long MAX_ARALIK = 2000; // ms
11
12Preferences hafiza; // Kalıcı bellek (NVS) / Persistent storage (NVS)
13float suzulmus = 1.0, taban = 1.0;
14bool ustte = false;
15uint8_t aday = 0;
16unsigned long sonAdim = 0, sonOrnek = 0;
17unsigned long adim = 0, kayitli = 0;
18
19void adxlYaz(uint8_t reg, uint8_t deger) {
20 Wire.beginTransmission(ADXL_ADRES);
21 Wire.write(reg);
22 Wire.write(deger);
23 Wire.endTransmission();
24}
25
26float ivmeBuyuklugu() {
27 Wire.beginTransmission(ADXL_ADRES);
28 Wire.write(0x32); // DATAX0
29 Wire.endTransmission(false);
30 Wire.requestFrom(ADXL_ADRES, (uint8_t)6);
31 float e[3];
32 for (int i = 0; i < 3; i++) {
33 int16_t dusuk = Wire.read(); // ADXL345'te önce düşük bayt / Low byte first on ADXL345
34 int16_t yuksek = Wire.read();
35 e[i] = (int16_t)((yuksek << 8) | dusuk) * 0.0039; // 3,9 mg/LSB
36 }
37 return sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2]);
38}
39
40void setup() {
41 Serial.begin(115200);
42 Wire.begin(21, 22);
43 adxlYaz(0x2C, 0x09); // 50 Hz veri hızı / 50 Hz output rate
44 adxlYaz(0x31, 0x08); // Tam çözünürlük, ±2 g / Full resolution, ±2 g
45 adxlYaz(0x2D, 0x08); // Ölçüm modu / Measurement mode
46 hafiza.begin("pedometre", false);
47 adim = hafiza.getULong("adim", 0); // Önceki sayıyı geri yükle / Restore previous count
48 kayitli = adim;
49 Serial.printf("Kayitli adim / Saved steps: %lu\n", adim);
50}
51
52void loop() {
53 unsigned long simdi = millis();
54 if (simdi - sonOrnek < 20) return; // 50 Hz
55 sonOrnek = simdi;
56
57 float g = ivmeBuyuklugu();
58 suzulmus += 0.25 * (g - suzulmus);
59 taban += 0.02 * (suzulmus - taban);
60 if (!ustte && suzulmus > taban + ESIK_G) {
61 ustte = true;
62 } else if (ustte && suzulmus < taban + ESIK_G / 2) {
63 ustte = false;
64 unsigned long gecen = simdi - sonAdim;
65 if (gecen >= MIN_ARALIK) {
66 if (gecen > MAX_ARALIK) aday = 0;
67 sonAdim = simdi;
68 if (aday < 4) {
69 aday++;
70 if (aday == 4) adim += 4;
71 } else {
72 adim++;
73 }
74 Serial.printf("Adim / Steps: %lu\n", adim);
75 }
76 }
77
78 // Her 50 adımda bir kaydet, flash'ı yormaz / Save every 50 steps to spare the flash
79 if (adim - kayitli >= 50) {
80 hafiza.putULong("adim", adim);
81 kayitli = adim;
82 }
83}Pedometer with a Raspberry Pi Pico (MicroPython)
The Pico version reads the MPU6050 on the I2C0 bus (GP4, GP5) at 400 kHz and prints the result to Thonny's shell. It needs no extra driver file; MicroPython's built-in readfrom_mem function is enough to read the registers. Time differences are calculated with ticks_diff, which is safe against counter overflow. If you want a display, copy the ssd1306.py driver to the Pico and reuse the same I2C object. If you're new to MicroPython, the MicroPython basics guide is a good starting point.
1# Raspberry Pi Pico adım sayar: MPU6050 (MicroPython)
2# Raspberry Pi Pico pedometer: MPU6050 (MicroPython)
3# I2C0: GP4 (SDA), GP5 (SCL), MPU6050 0x68
4from machine import Pin, I2C
5import math
6import time
7
8i2c = I2C(0, sda=Pin(4), scl=Pin(5), freq=400000)
9MPU = 0x68
10i2c.writeto_mem(MPU, 0x6B, b"\x00") # Uyandır / Wake up
11i2c.writeto_mem(MPU, 0x1C, b"\x00") # ±2 g
12i2c.writeto_mem(MPU, 0x1A, b"\x03") # Dahili süzgeç / Internal filter 44 Hz
13
14BOY_CM, KILO_KG = 175, 70
15ADIM_CM = BOY_CM * 0.415 # Adım uzunluğu / Step length
16ESIK_G = 0.12 # Tepe eşiği / Peak threshold
17MIN_MS, MAX_MS = 300, 2000
18
19
20def ivme():
21 d = i2c.readfrom_mem(MPU, 0x3B, 6)
22 t = 0.0
23 for i in (0, 2, 4):
24 v = (d[i] << 8) | d[i + 1]
25 if v > 32767:
26 v -= 65536 # İşaretli sayıya çevir / Convert to signed
27 t += (v / 16384) ** 2
28 return math.sqrt(t)
29
30
31suz = taban = 1.0
32ustte = False
33aday = adim = 0
34son_adim = time.ticks_ms()
35
36while True:
37 simdi = time.ticks_ms()
38 suz += 0.25 * (ivme() - suz)
39 taban += 0.02 * (suz - taban)
40 if not ustte and suz > taban + ESIK_G:
41 ustte = True
42 elif ustte and suz < taban + ESIK_G / 2:
43 ustte = False
44 gecen = time.ticks_diff(simdi, son_adim)
45 if gecen >= MIN_MS:
46 if gecen > MAX_MS:
47 aday = 0 # Ritim koptu / Rhythm broken
48 son_adim = simdi
49 if aday < 4:
50 aday += 1
51 if aday == 4:
52 adim += 4
53 else:
54 adim += 1
55 km = adim * ADIM_CM / 100000
56 print("adim/steps:", adim, " km: %.2f" % km, " kcal: %.0f" % (0.7 * KILO_KG * km))
57 time.sleep_ms(20) # Yaklaşık 50 Hz / About 50 HzCommon mistakes and fixes
| Symptom | Cause | Fix |
|---|---|---|
| Always 0 on screen, |a| = 0 on Serial | MPU6050 still asleep or wrong address | Write 0 to register 0x6B, check the address with an I2C scan |
| Every step counted twice | Threshold too low or no minimum interval | Raise ESIK_G, check that MIN_ARALIK is 300 ms |
| Misses steps when walking slowly | Peaks don't reach the 0.12 g threshold | Lower ESIK_G to 0.08–0.10, move the sensor to your waist or pocket |
| Steps increase when waving your hand at the desk | Arm motion on the wrist looks like steps | Keep the rhythm check (4 candidate steps), move the sensor to the waist |
| OLED blank, count visible on Serial | OLED address is 0x3D or RAM is short | Change the address, remove large arrays from the sketch |
A pedometer teaches you to read accelerometer data, build a filter and test a simple algorithm step by step, all in one project. If you'd like to try the basic parts such as a button counter and an OLED display first, the button and SSD1306 OLED projects in the BlueGrays app give you the wiring diagram and code step by step; once those parts work, adding the MPU6050 code from this article on top is easy.
Frequently asked questions
How do you make a pedometer with Arduino?
Connect an accelerometer (MPU6050 or ADXL345) to the Arduino over I2C, compute the vector magnitude of the three axes 50 times per second and count the peaks in that signal. Reduce noise with a filter, require at least 300 ms between two steps and show the result on an OLED display.
What sensor does a pedometer use?
Pedometers use a three-axis accelerometer. In hobby projects the most common choices are the MPU6050 and the ADXL345. No gyroscope is needed; for a battery-powered device the ADXL345 is the better fit because it draws far less current.
How do you calculate step length?
The practical walking formula is height × 0.415 for men or height × 0.413 for women, which gives about 72 cm for a height of 175 cm. For a more accurate result, take 20 steps on flat ground, measure the distance and divide it by 20.
How many kilometres and calories is 10,000 steps?
For someone 175 cm tall, 10,000 steps is about 7.3 km. A 70 kg person walking that distance at a normal pace burns about 350 kcal. The shortcut formula for walking is 0.7 × kg × km, with a margin of error of ±20%.
How accurate is an MPU6050 pedometer?
With a well-tuned threshold and a rhythm check, you can get within 3–5 steps per 100 when the sensor sits on your waist or in a pocket. On the wrist the error grows because of arm movements. To improve accuracy, tune ESIK_G to yourself with a 100-step test walk.
How long does a pedometer run on a battery?
The wrist version in this article draws about 5.4 mA and runs for more than 50 hours on a 300 mAh Li-Po. The display is the biggest consumer, so switch it on only when a button is pressed. If you put the microcontroller to sleep and use the ADXL345's interrupts, battery life stretches to weeks.
Projects to build after reading this
See all projects
LED Control with a Push Button (Push)
Just like a doorbell: the light stays on as long as you press, and goes off when you let go.

LED Blink with ESP32
Teaches basic GPIO output usage with ESP32. We achieve a blinking effect by turning an LED on and off from a digital pin. ESP32 version of the classic blink project on Arduino UNO; the basic blink commands in the Arduino environment are the same, but the ESP32's pin layout and 3.3 V GPIO levels differ from those of the Arduino UNO.

Raspberry Pi Pico Button Controlled LED (Push)
First input project with Pico — button read! LED lights while button is pressed, off when released. This is the big step after LED animations: signal input from the world to Pico. Learn Pin.IN (input mode), Pin.PULL_UP (internal pull-up resistor — standard for buttons), button.value() reading. GP14 LED, GP2 button (internal PULL_UP). Pressed = LOW (0), released = HIGH (1) — reverse logic seems confusing at first but is industry standard.

Using LCD Screen with I2C
Give your Arduino its own screen and make it write its first message. The two-line LCD screen hooks up with just a few wires; a greeting appears on the top line, then a second message on the bottom…

ESP32 I2C LCD Display (16x2)
In this project we connect a 16x2 character LCD to the ESP32 over I2C and display text. With I2C, just 2 data pins (SDA and SCL) control the screen, instead of the 6+ pins a classic parallel connection wastes. The code prints a fixed message on the first line and a counter that goes up every second on the second. At startup an I2C scanner also prints the display's address to the Serial Monitor (usually 0x27 or 0x3F).

Paddle Ball Game - SSD1306
A ball, two paddles and you: you play table tennis, one of the very first video games, on a small OLED screen.

ESP32 HTTPClient + Weather API (with SSD1306 OLED Display)
In this project the ESP32 makes a REST API call over the internet to a weather API (wttr.in) using HTTPClient.h. Unlike the I2C LCD version, it uses an SSD1306 OLED (128×64) display, with large text and vector icons for a richer look. Seven weather icons (sunny, rainy, snowy and more) are drawn on the fly, with no bitmap files.

ESP32 Deep Sleep — Battery Saving (OLED + RTC RAM Counter)
The ESP32's Deep Sleep mode shuts down the CPU and most peripherals, cutting current draw to about 10µA, which is vital for battery-powered IoT devices. This project uses three wake-up sources: a timer (15 s), an external pin (EXT0, the button on GPIO 33) and a touch pin (T0/GPIO 4). Counters marked with RTC_DATA_ATTR survive deep sleep.
More articles
BlueGrays app
Build this circuit step by step on your phone
Wiring diagram, code and parts list on one screen. 500+ Arduino, ESP32, ESP8266, Pico, mBot and micro:bit projects ready to build.
Scan with your phone
Point your camera at the code and your phone's app store opens.
or open the store

