1. Raspberry Pi Pico W Overview
The Raspberry Pi Pico W is a low-cost microcontroller board based on the RP2040 chip. It features:

- Dual-core Arm Cortex-M0+ processor
- 264KB of SRAM
- 2MB of flash memory
- Built-in Wi-Fi module (Infineon CYW43439)
- Multiple GPIOs with PWM, ADC, SPI, I2C, and UART support
The Pico W’s datasheet outlines power management, GPIO assignments, and communication protocols essential for embedded systems.
2. Components
- Arduino Board
- A4988 Stepper Motor Driver
- Stepper Motor
- Potentiometer
- External Power Supply
3. Circuit Connections
The stepper motor is connected to the A4988 driver, which is controlled by the Arduino.
STEP
(A4988) → Pin 9DIR
(A4988) → Pin 8POT
(Analog Input) → 28

4. Arduino Code
#define DIR_PIN 2
#define STEP_PIN 3
#define POT_PIN 28
void setup() {
pinMode(STEP_PIN, OUTPUT);
pinMode(DIR_PIN, OUTPUT);
digitalWrite(STEP_PIN, LOW);
}
void loop() {
int potValue = analogRead(POT_PIN);
int stepDelay = map(potValue, 0, 1023, 1, 10);
digitalWrite(DIR_PIN, HIGH);
for (int i = 0; i < 200; i++) {
digitalWrite(STEP_PIN, HIGH);
digitalWrite(STEP_PIN, LOW);
delay(stepDelay);
}
delay(500);
digitalWrite(DIR_PIN, LOW);
for (int i = 0; i < 200; i++) {
digitalWrite(STEP_PIN, HIGH);
digitalWrite(STEP_PIN, LOW);
delay(stepDelay);
}
delay(1000);
}