02Lesson
Robotics Lab: Raspberry Pi 4 Model B Lesson and Pinout
Select a board in Robotics Lab to see its specifications, pin functions and component guide.
Board overview
Robotics Lab board guide · Raspberry Pi · 2019
The Raspberry Pi 4 is not a microcontroller but a complete Linux computer: plug in a monitor, a keyboard and a network cable and it works like a desktop PC. Robotics Lab includes the Pi 4 as an example of a robot’s main computer. It can process video, run neural networks and ROS, and talk to motors and sensors through its 40 GPIO pins.
- Clock
- 1.5 GHz
- Flash
- microSD
- RAM
- 1–8 GB
- GPIO pins
- 26
- Logic level
- 3.3 V
- Price
- ≈ $35–75
Specs
Compare the electrical specs with other Robotics Lab boards. See the hardware references.
- Processor
- Broadcom BCM2711, 4 × Cortex-A72, 64-bit
- Clock speed
- 1.5 GHz (1.8 GHz with newer firmware)
- RAM
- 1, 2, 4 or 8 GB LPDDR4
- Storage
- microSD card (can also boot from a USB drive)
- Wi-Fi & Bluetooth
- 802.11ac 2.4 / 5 GHz, Bluetooth 5.0
- Wired network
- Gigabit Ethernet
- USB
- 2 × USB 3.0 and 2 × USB 2.0
- Video
- 2 × micro-HDMI, up to 4K
- GPIO
- 40-pin header, 3.3 V logic
- Camera & display
- CSI and DSI ribbon connectors
- Power
- 5 V, 3 A over USB-C
- Size
- 85 × 56 mm
What’s on the board
18 parts match the numbered labels in Robotics Lab. Click one and the camera flies to it.
Strengths and pitfalls
Use these trade-offs when choosing a board in Robotics Lab.
Strengths
- Full Linux: Python, OpenCV, ROS and neural networks run right on the board
- Camera port, Wi-Fi, Ethernet and four USB ports are built in — nothing extra to buy
- 40-pin GPIO header with I²C, SPI, UART and PWM for sensors and motor drivers
- A huge community: tutorials and libraries for almost any project
Watch out
- GPIO pins are 3.3 V only. Feeding 5 V into an input destroys the processor — there is no protection
- There are no analog inputs: a potentiometer or analog sensor needs an external ADC (for example the MCP3008)
- Use a 5 V 3 A power supply. A weak phone charger causes freezes and corrupts files on the card
- No more than 16 mA from a single GPIO pin. Power motors and servos from a separate supply through a driver
- Do not pull the plug without shutting down first — you can damage the system on the microSD card
Pins
Learn which pins to use on the Robotics Lab workbench.
Power
Pins 2 and 4 are 5 V straight from the power supply; pins 1 and 17 are 3.3 V for sensors. Ground (GND) is on pins 6, 9, 14, 20, 25, 30, 34 and 39. Never power motors from these pins — use a separate supply.
3.3 V only
Every GPIO works at 3.3 V. Connect a sensor with a 5 V output (for example the HC-SR04) through a two-resistor divider or a level shifter.
GPIO numbers vs pin numbers
Each contact has two numbers: the physical one (1–40, in order) and the GPIO number you use in code. For example, pin 11 is GPIO17. In the Robotics Lab model, use the square pad to find pin 1 at the left end of the inner row.
I²C, SPI and UART buses
I²C: GPIO2 (SDA) and GPIO3 (SCL). SPI: GPIO10, GPIO9, GPIO11 with chip selects GPIO8 / GPIO7. UART: GPIO14 (TXD) and GPIO15 (RXD). Enable a bus in raspi-config before you use it.
PWM for servos
Hardware PWM is available on GPIO12, GPIO13, GPIO18 and GPIO19. On all other pins PWM is done in software — fine for an LED, but a servo may jitter.
Hover over a pin in the Robotics Lab viewer to see its name and function.
- Power
- Ground
- Digital
- Analog
- Buses: UART, I²C, SPI
- Control: RESET, EN, BOOT
- Not connected
First code
Try the Robotics Lab starter example on your physical board.
# Run it with: python3 blink.py# The gpiozero library comes preinstalled with Raspberry Pi OSfrom gpiozero import LED, Buttonfrom time import sleepled = LED(17) # LED: GPIO17 (pin 11) -> 330 ohm resistor -> GND (pin 9)button = Button(27) # button between GPIO27 (pin 13) and GND (pin 14)while True: if button.is_pressed: # button held down: stay on led.on() sleep(0.05) else: # otherwise blink once a second led.on() sleep(0.5) led.off() sleep(0.5)
Where it shines
Use the Robotics Lab workbench to plan the wiring for a project.
- Computer-vision robot: a camera plus OpenCV finds a line, a ball or a face
- On-board ROS computer that commands an Arduino driving the motors
- Wi-Fi controlled rover that streams video to a web browser
- Voice assistant or smart weather station with a web dashboard
- Server for a 3D printer or a smart home
Board background
See how this hardware fits into the Robotics Lab board collection.
The Raspberry Pi 4 is roughly 40 times faster than the very first model from 2012, yet the starting price is the same $35.
The Wi-Fi antenna is not a component at all — it is a specially shaped cut-out in the copper layer of the board itself.
Raspberry Pi boards are built at the Sony factory in Wales, and tens of millions of them have been sold.
Practice with this board
Try the same board in these Robotics Lab activities.
- Inspect the Robotics Lab 3D model to locate a component or connector.
- Try the Robotics Lab component quiz to check what you remember.
- Open the Robotics Lab workbench to simulate your wiring.
Sources
Manufacturer and hardware project documentation.
- Raspberry Pi 4 Model B specifications
Board processor, memory, networking, ports and power requirements.
- Raspberry Pi computer hardware documentation
GPIO header, pin numbering and electrical behavior.