PyRaspBeta

Building it on a real Pi

Anything you build in PyRasp can go onto a real Raspberry Pi. In the Sandbox, a practice problem or a contest, press Export next to Run. In Lab mode, open Projects and press Export for a real Pi. You get a zip with one folder:

FileWhat it is
main.pyYour program. It uses the same libraries as a real Pi (gpiozero, RPi.GPIO, smbus2…), so it runs there as it is.
WIRING.mdThe shopping list, the header pins you use, and every connection, one jumper per row.
schematic.svgThe circuit as a schematic diagram, drawn with standard symbols and the same part names as WIRING.md. Opens in any browser.
README.mdWhat to switch on in raspi-config and which libraries to install, worked out from your parts and your imports.
circuit.pyThe circuit as PyRasp code. It only runs in PyRasp; WIRING.md describes the same circuit for a bench.
board.pngA picture of the board as it looked in the simulator.

The schematic

The same diagram is in the workspace: switch the board pane from Board to Schematic. It redraws a moment after you stop editing circuit.py. In the Lab, it comes with Export for a real Pi.

It is drawn the way a textbook or a datasheet draws a circuit, so it is also a good way to learn to read one:

  • Signal flows left to right. The Pi is on the left, with the GPIO pins you use on its right edge. Each part sits one step further right than the part that feeds it.
  • Simple parts are symbols. A zigzag is a resistor, a triangle with a bar and two arrows is an LED (current flows towards the bar, the cathode), two open circles under a bar is a push button. A light sensor (LDR) is a resistor with arrows pointing in; a potentiometer is a resistor with an arrow for the wiper.
  • Chips and modules are boxes with their pin names: signal pins on the sides, the supply pin on top and ground underneath.
  • Every part has a designator: R for resistors, D for LEDs, SW for switches, BZ for buzzers, M for motors and servos, U for chips and modules. WIRING.md uses the same names, so R2 on the schematic is R2 in the shopping list and the connection table.
  • Ground and supplies are symbols, not wires. Every ground symbol (three bars getting shorter) is joined to every other one and to the Pi's GND pins; every bar marked 3V3 is joined to the Pi's 3.3 V pin, and the same for 5V. The Pi's top and bottom edges show which header pins you used for them.
  • A dot means joined. Where three or more wires meet there is a dot. Two lines that cross without a dot are not connected.
  • Net labels. When a wire can't be drawn as a line, both ends get a tag with the same name (such as GPIO27): pins with the same tag are joined.

Breadboard builds get a schematic too: parts pushed into the same breadboard column (or power rail) are drawn joined, the way the strips inside the breadboard join them.

The wiring sheet

Pins are named the way you'll find them on the board: physical pin numbers on the 40-pin header (pin 11 is GPIO17), plus each part's own pin names from its datasheet, such as an LED's longer leg (the anode).

Modules from the shop, like the traffic light module, are listed as the loose parts inside them, with the wires that join them, because on a real bench you build them yourself.

The last section collects the datasheet warnings that matter on real hardware: 5 V outputs that need a divider before a GPIO, sensors that need a pull-up, and so on.

Before you power up

  • Wire everything with the Pi off, then check each row of WIRING.md against your breadboard.
  • The Pi's GPIO pins are 3.3 V only. A 5 V signal into a GPIO can damage the Pi.
  • Real parts are noisier than the simulator: expect sensor readings to jitter and the odd failed read.

Something behaves differently on your real Pi? Use Report a bug in the menu and tell us, so the simulator can be fixed.