Raspberry Pi 3 Model B Library for Proteus: a Wi-Fi air station with a PMS5003, an AHT20, a fan relay and a phone

Raspberry Pi 3 Model B Library for Proteus: WiFi Sensor Station

2.5K Views
40
700
60
25
60
PCBWay

Hello friends, I hope you all are doing great. Today, I am going to share the Raspberry Pi 3 Model B Library for Proteus. The Raspberry Pi 3 was the first Pi with Wi-Fi and Bluetooth on the board, and its BCM2837 brought four 64-bit Cortex-A53 cores at 1.2 GHz - in the same shape and with the same 40-pin header as the Pi 2. With this library the board runs your Python program against the circuit in Proteus 8.5, and its wlan0 joins our virtual Wi-Fi network.

Updates

Raspberry Pi 3 Model B Library for Proteus

Latest version: V1.0 (October 2026, this tutorial)

Helping Tools

This is the fourth library of our Raspberry Pi series, and every library of the series connects the Pi to a different module. This time the Pi sends sensor data over Wi-Fi: a PMS5003 particle sensor on the UART and an AHT20 temperature and humidity sensor on I2C feed a small air station, a relay switches a fan, and a web page served by the Pi shows everything on a laptop and a phone, with buttons to switch the fan.

NOTICE: this library does not run Raspberry Pi OS. It runs your Python program, with the same Python libraries a Pi uses for its pins and its network, in step with the simulation. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below or in the Raspberry Pi 3 Model B board of our forum. And if our free libraries help you, you can buy us a coffee. So, let's get started with the Raspberry Pi 3 Model B Library for Proteus:

Raspberry Pi 3 Model B Library for Proteus: a Wi-Fi air station with a PMS5003, an AHT20, a fan relay and a phone
Figure: The Raspberry Pi 3 Model B Library for Proteus: PI1 runs air_station.py on Wi-Fi - the PMS5003 reads smoke, the program has switched the fan's relay on (D1 lit), and the phone shows the page with the readings and the fan buttons.

What is the Raspberry Pi 3 Model B?

The Raspberry Pi 3 Model B came out in February 2016, again at 35 dollars and again in the shape of the Model B+ and the Pi 2: 85 x 56 mm, four mounting holes, the 40-pin header, four USB ports, 10/100 Ethernet through the SMSC LAN9514, HDMI, a microSD slot and the 4-pole A/V jack. The processor became the Broadcom BCM2837: four 64-bit Cortex-A53 cores at 1.2 GHz, still with 1 GB of RAM on the underside of the board.

The big news was the radio. A Broadcom BCM43438 gives the Pi 3 802.11n Wi-Fi on 2.4 GHz and Bluetooth 4.1 with Bluetooth Low Energy, through a small chip antenna on the left edge of the board. The PWR and ACT LEDs moved to the left edge next to the micro-USB socket, and the RUN pads went beside the top-right mounting hole. A Pi no longer needed a USB Wi-Fi dongle to join a network - and that is what this library adds.

The Raspberry Pi 2 Model B and the Raspberry Pi 3 Model B
Raspberry Pi 2 Model B (2015)Raspberry Pi 3 Model B (2016)
ProcessorBCM2836, four Cortex-A7 cores at 900 MHzBCM2837, four 64-bit Cortex-A53 cores at 1.2 GHz
RAM1 GBthe same
Wirelessnone802.11n Wi-Fi (2.4 GHz) and Bluetooth 4.1
GPIO header, USB, Ethernet40 pins, 4 USB, 10/100 Ethernetthe same
Status LEDsPWR and ACT under pin 1PWR and ACT at the left edge, by the micro-USB
UART on GPIO14 / GPIO15the full UART (ttyAMA0)the mini UART (ttyS0): the full one serves Bluetooth

In Proteus, our Raspberry Pi Model B Library for Proteus covers how the board runs a Python program: the program and Proteus work in lockstep, every sleep, pin wait and bus transfer moves the simulation clock, and the Python libraries for the pins answer as on a Pi. Our Raspberry Pi 1 Model B+ Library for Proteus added the 40-pin header and a touch TFT, the Raspberry Pi 2 Model B Library for Proteus four I2C parts and an OLED. The Pi 3 adds Wi-Fi, and a GPIO call costs about 3 us of simulation time on its faster cores.

Features of the Raspberry Pi 3 Model B Library for Proteus

  • The board as it looks: the green Pi 3 at its real size with the 40-pin header, the white Wi-Fi / Bluetooth chip antenna, PWR and ACT standing at the left edge, the RUN pads by the top-right hole, the BCM2837 and the LAN9514, the USB pairs and the RJ45 with its own LEDs, micro-USB, HDMI, the camera and display connectors, the A/V jack and the microSD card.
  • Wi-Fi: wlan0 joins the network in the WIFISSID and WIFIPASS properties - our router TEP-WiFi by default - and gets 192.168.1.51, the name raspberrypi.local; sockets, http.server and urllib work on it as on Ethernet.
  • Your Python program: any .py file in the PROGRAM property; Python 3.11 and its standard library are included.
  • The UART with pyserial: /dev/serial0 on GPIO14 and GPIO15 at any baud rate, with timeouts and back-to-back bytes - a sensor's whole frame arrives intact.
  • I2C, SPI, 1-Wire and the DHT sensors: smbus2, spidev and the kernel's files, as on the earlier boards.
  • RPi.GPIO and gpiozero: outputs, inputs, pull-ups and pull-downs, edges with callbacks, software PWM, and gpiozero's OutputDevice, LED, Button and the rest.
  • The Pi Terminal: the output, the errors (a thread's too, as Python prints them on a Pi), a line for input(), and a Board tab with the GPIOs, the LEDs and the supply pins - with our TEP header, no Windows title bar.
  • A complete package: about 13.8 MB with the board, Python, the runtime, the sensor, relay and monitor libraries and the demo, without the source code of the models.

The Raspberry Pi 3 Model B in Proteus

Raspberry Pi 3 Model B in Proteus: the board with the Wi-Fi antenna and the 40-pin GPIO header with colour-coded pin tags
Figure: The part as the library draws it: the 40-pin header along the top edge with a colour-coded tag on each pin, the white chip antenna on the left edge, ACT and PWR at the left edge by the micro-USB, the RUN pads by the top-right hole, the BCM2837 and the LAN9514, the USB pairs and the RJ45 on the right, HDMI, the camera connector and the A/V jack along the bottom.

Search RASPBERRY in Pick Devices; the device RASPBERRY PI 3 MODEL B is in TEPRPI3B.LIB (Microprocessor ICs, Raspberry Pi), with the prefix PI. The 40 pins leave the top edge as one comb, each pin above its column of the header, with a tag in the colour of its kind: 5V red, 3V3 orange, GND black, GPIO green, I2C blue, SPI pink, UART purple and the ID pins grey. Click the HDMI socket or the processor to open the Pi Terminal.

Raspberry Pi 3 Model B in Proteus running a program, its header pins wired to net labels
Figure: PI1 in the running demo: eight header pins go up to net labels - 3V3, 5V, SDA, SCL, GND, TXD, RXD and FAN (GPIO17); PWR is lit.

Wi-Fi and Ethernet

At Run the board boots for half a second and wlan0 joins the network named in its WIFISSID property with the password in WIFIPASS - by default our router TEP-WiFi with 12345678, the network of our ESP32 boards, our other Wi-Fi parts and of the Laptop WiFi Monitor and the Mobile WiFi Monitor. The join and DHCP take the time they take on a real network, and 2.3 to 3.5 s after Run the Pi has 192.168.1.51 and the name raspberrypi.local. A wrong name or password shows up in the simulation log, and the program simply waits.

The board keeps one network interface at a time: wlan0 while the Ethernet cable is out - ETHERNET OUT, the default on this board - and eth0 when the cable is in at Run (ETHERNET IN). Programs do not need to care: sockets work the same on both.

The 40-Pin Header

The 40 pins with their BCM numbers
PinsNamePinsName
13V325V
3GPIO2 (SDA)45V
5GPIO3 (SCL)6GND
7GPIO48GPIO14 (TXD)
9GND10GPIO15 (RXD)
11GPIO1712GPIO18
13GPIO2714GND
15GPIO2216GPIO23
173V318GPIO24
19GPIO10 (MOSI)20GND
21GPIO9 (MISO)22GPIO25
23GPIO11 (SCLK)24GPIO8 (CE0)
25GND26GPIO7 (CE1)
27ID_SD28ID_SC
29GPIO530GND
31GPIO632GPIO12
33GPIO1334GND
35GPIO1936GPIO16
37GPIO2638GPIO20
39GND40GPIO21

The GPIOs work at 3.3 V; GPIO2 and GPIO3 have the Pi's 1.8 k pull-ups. The 5V and 3V3 pins power the modules wired to them. ID_SD and ID_SC are kept for a HAT's ID EEPROM, so leave them free, as on a real Pi.

Download Raspberry Pi 3 Model B Library for Proteus

Click the button below to download Raspberry-Pi-3-Model-B-Library-for-Proteus-v1.0.zip (about 13.8 MB with Python included, without the source code of the models):

Raspberry Pi 3 Model B Library for Proteus V1.0
  • README.txt: the device, Wi-Fi, installation, the demo, the header, the properties, troubleshooting and the limits.
  • Proteus Library Files: TEPRPI3B.LIB (the Raspberry Pi 3 Model B) and the demo's parts: TEPPMS5003.LIB, TEPAHT20.LIB, TEPRELAY.LIB, TEPLAPTOP.LIB and TEPMOBILE.LIB.
  • Proteus Model Files: TEPNET.DLL (the Pi, the laptop, the phone and the network), the parts' TEPPMS5003.DLL, TEPAHT20.DLL and TEPRELAY.DLL, and the TEPPi folder - Python 3.11 and the TEP Pi runtime.
  • Python Code: blink.py and air_station.py.
  • Proteus Simulation: the demo project, its program and copies of the DLLs.

No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.

How to Install Raspberry Pi 3 Model B Library for Proteus

  1. Close Proteus and extract the whole zip file, for example to your Desktop.
  2. Copy the files from Proteus Library Files into the LIBRARY folder of Proteus (usually C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY).
  3. Copy everything from Proteus Model Files - the DLLs and the TEPPi folder - into the MODELS folder, replacing an older TEPNET.DLL and TEPPi folder (these are the newest; they also run our Model B, Model B+ and Pi 2).
  4. Delete TEPRPI3B.IDX from the LIBRARY folder if it is there.
  5. Start Proteus, press P and search for RASPBERRY.

There is nothing else to install: Python comes in the TEPPi folder, so you need no Python on your PC.

Demo: a Wi-Fi Air Station

Open Pi-3-Model-B-WiFi-Air-Station.pdsprj. PI1 runs air_station.py on Wi-Fi. The parts come from our own libraries, each with its article: U1 from the PMS5003 Particle Sensor Library for Proteus, U2 from the AHT20 Sensor Library for Proteus and RLY1 from the Relay Module Library for Proteus. All three are the Advance versions: each opens a pop-up window at Run with its live values and the controls to change them. PC1 is the Laptop WiFi Monitor and MOB1 the Mobile WiFi Monitor, both on the same Wi-Fi network as the Pi.

Raspberry Pi 3 Model B Proteus simulation: a PMS5003, an AHT20 and a relay with the Laptop and Mobile WiFi Monitors
Figure: The whole demo: the titles, PI1 with eight header pins going to net labels, the PMS5003 and the AHT20 with their pins to labels, and below them the laptop, the phone and the relay with R1 and D1 in the fan's place.

The PMS5003 is a laser particle counter: a fan draws air through a laser beam, and the sensor counts the light the particles scatter. It sends its readings on its own, as 32-byte frames on a 9600-baud UART. The AHT20 measures temperature and humidity on I2C. The relay module switches the fan; in the simulation R1 and the LED D1 stand in for the fan, so D1 lights while the fan would run. Net labels connect everything:

The wiring of the air station
Part pinNet labelPi pinWhat it does
PMS5003 VCC, GND5V, GND2, 6the sensor and its fan from the Pi's 5 V
PMS5003 TXRXD10 (GPIO15)the frames to the Pi
PMS5003 RXTXD8 (GPIO14)commands from the Pi (not used here)
PMS5003 SET, RESETopen-the sensor's own pull-ups: awake, running
AHT20 VIN, GND3V3, GND1, 6power
AHT20 SDA, SCLSDA, SCL3, 5 (GPIO2, GPIO3)I2C at 0x38
Relay VCC, GND5V, GND2, 6the coil needs 5 V
Relay INFAN11 (GPIO17)LOW = the relay pulls in
Relay COM, NO5V, R1-the fan's supply: COM from 5V, NO to the load

The PMS5003 on the UART

The program needs pyserial for the UART, smbus2 for I2C and gpiozero for the relay. On a Pi 3, /dev/serial0 is the UART on GPIO14 and GPIO15. The relay's input is active LOW, so the OutputDevice is told so, and it starts off:

bus = SMBus(1)
uart = serial.Serial('/dev/serial0', 9600, timeout=3)
fan = OutputDevice(17, active_high=False, initial_value=False)   # the relay's IN: LOW = on (it starts HIGH = off)

A PMS5003 frame starts with 0x42 0x4D, then the frame length, 13 data words with the high byte first, and a checksum - the sum of all the bytes before it. The function waits for the two start bytes, reads the other 30, checks the sum and returns the PM1.0, PM2.5 and PM10 values measured "under atmospheric environment", the ones made for room air:

def pms5003():
    """The PMS5003's next frame: 0x42 0x4D, the length, 13 words (high byte first) and a checksum (the sum of the bytes before it)."""
    while True:
        if uart.read(1) != b'\x42' or uart.read(1) != b'\x4d':
            continue
        rest = uart.read(30)
        frame = b'\x42\x4d' + rest
        if len(frame) != 32 or sum(frame[:30]) != (frame[30] << 8 | frame[31]):
            continue
        words = [frame[4 + 2 * k] << 8 | frame[5 + 2 * k] for k in range(13)]
        return words[3], words[4], words[5]                # PM1.0, PM2.5, PM10 under atmospheric environment

The AHT20 on I2C

The AHT20 answers at 0x38. Its status byte tells whether it is calibrated; if not, the initialize command 0xBE 0x08 0x00 does it. A measurement starts with 0xAC 0x33 0x00 and takes 80 ms; then seven bytes come back - the status, 20 bits of humidity, 20 bits of temperature and a CRC - and two formulas from the datasheet turn them into percent and degrees:

def aht20():
    """Temperature (C) and humidity (%) from the AHT20: trigger a measurement, wait 80 ms, read 7 bytes."""
    if not bus.read_byte(0x38) & 0x08:                     # not calibrated yet: initialize
        bus.write_i2c_block_data(0x38, 0xBE, [0x08, 0x00])
        time.sleep(0.01)
    bus.write_i2c_block_data(0x38, 0xAC, [0x33, 0x00])     # trigger
    time.sleep(0.08)
    msg = i2c_msg.read(0x38, 7)                            # status, 20 bits humidity, 20 bits temperature, CRC
    bus.i2c_rdwr(msg)
    d = list(msg)
    h = (d[1] << 12 | d[2] << 4 | d[3] >> 4) * 100 / 1048576
    t = ((d[3] & 0x0F) << 16 | d[4] << 8 | d[5]) * 200 / 1048576 - 50
    return t, h

The Fan and Its Automatic Mode

A thread reads the sensors: each PMS5003 frame, every 2.3 s, brings a reading. In AUTO mode the fan goes on above 35 ug/m3 of PM2.5 and off only below 25 - the gap keeps the relay from chattering around one value. Every reading is printed in the terminal:

def sampler():
    while True:
        pm1, pm25, pm10 = pms5003()
        t, h = aht20()
        with lock:
            if air['mode'] == 'AUTO':
                if pm25 > 35:
                    fan.on()
                elif pm25 < 25:
                    fan.off()
            air.update(pm1=pm1, pm25=pm25, pm10=pm10, t=t, h=h, time=time.strftime('%H:%M:%S'), count=air['count'] + 1)
        print('%s  PM1.0 %3d  PM2.5 %3d  PM10 %3d ug/m3  %.1f C  %.1f %%  fan %s (%s)' %
              (air['time'], pm1, pm25, pm10, t, h, 'ON' if fan.value else 'OFF', air['mode']))

The Web Page

The page is a small HTML template with the readings, the fan's state and three links. The meta refresh asks a browser to reload it every 5 seconds:

PAGE = """<html><head><title>Pi Air Station</title><meta http-equiv="refresh" content="5"></head>
<body><h2>Raspberry Pi 3 air station</h2>
<p>PM2.5: <b>{pm25} ug/m3</b> - {quality}</p>
<p>PM1.0: {pm1} ug/m3, PM10: {pm10} ug/m3</p>
<p>Temperature: <b>{t:.1f} C</b></p>
<p>Humidity: <b>{h:.1f} %</b></p>
<p>Fan: <b>{fan}</b> ({mode})</p>
<p><a href="/fan/on">FAN ON</a></p>
<p><a href="/fan/off">FAN OFF</a></p>
<p><a href="/fan/auto">AUTO</a></p>
<p>Reading {count} at {time}</p></body></html>"""

Python's http.server calls do_GET for every request. A request for /fan/on or /fan/off switches the relay by hand and puts the fan in MANUAL mode, /fan/auto gives it back to the sensor - and every request is answered with the page:

class Handler(BaseHTTPRequestHandler):
    def do_GET(self):
        with lock:
            if self.path == '/fan/on':
                air['mode'] = 'MANUAL'
                fan.on()
            elif self.path == '/fan/off':
                air['mode'] = 'MANUAL'
                fan.off()
            elif self.path == '/fan/auto':
                air['mode'] = 'AUTO'
            if self.path.startswith('/fan/'):
                print('%s  the page: %s - fan %s (%s)' % (time.strftime('%H:%M:%S'), self.path, 'ON' if fan.value else 'OFF', air['mode']))
            body = PAGE.format(quality=quality(air['pm25']), fan='ON' if fan.value else 'OFF', **air).encode()
        self.send_response(200)
        self.send_header('Content-Type', 'text/html')
        self.send_header('Content-Length', str(len(body)))
        self.end_headers()
        self.wfile.write(body)

Wi-Fi takes a few seconds after boot, so the program waits for an address first - connecting a UDP socket sends nothing, but it tells which address the Pi would send from. Then the sampler thread starts and the server runs on port 8000 (a program without root rights cannot use port 80 on a Pi):

def my_ip():
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    s.connect(('8.8.8.8', 80))
    ip = s.getsockname()[0]
    s.close()
    return ip
print('waiting for Wi-Fi ...')
while my_ip() == '0.0.0.0':
    time.sleep(0.5)
threading.Thread(target=sampler, daemon=True).start()
print('serving on http://%s:8000/' % my_ip())
HTTPServer(('', 8000), Handler).serve_forever()

Run the Demo

Press Run. The board boots for half a second, wlan0 joins TEP-WiFi, and about 2.5 s after Run the program serves its page at 192.168.1.51. The PMS5003's fan needs 30 s to settle, so its first readings are low - clean air:

Raspberry Pi 3 Model B in Proteus running the Wi-Fi air station
Figure: The demo running: PI1 on Wi-Fi with PWR lit, the PMS5003 and the AHT20 reading, the laptop and the phone, the relay off.
pi@raspberrypi:~ $ python3 air_station.py
waiting for Wi-Fi ...
serving on http://192.168.1.51:8000/
10:00:43  PM1.0   1  PM2.5   1  PM10   1 ug/m3  24.0 C  50.0 %  fan OFF (AUTO)
10:00:44  PM1.0   1  PM2.5   2  PM10   3 ug/m3  24.0 C  50.0 %  fan OFF (AUTO)
10:00:46  PM1.0   0  PM2.5   2  PM10   3 ug/m3  24.0 C  50.0 %  fan OFF (AUTO)
Pi Terminal in Proteus: the Raspberry Pi 3 on Wi-Fi serving its page and printing the readings
Figure: The Pi Terminal: waiting for Wi-Fi, the address of the page, and a line per PMS5003 frame.
PMS5003 particle sensor and AHT20 sensor in Proteus read by a Raspberry Pi 3
Figure: Closer: the PMS5003 with its fan and its PWR, FAN and TX LEDs, and the AHT20 on the I2C bus.

Now open the page. On the laptop click Browser, check the address http://192.168.1.51:8000/ and click Go; on the phone the same:

Laptop WiFi Monitor in Proteus showing the Raspberry Pi 3 air station page
Figure: The laptop: PM2.5 2 ug/m3 - GOOD, the temperature and humidity, Fan: OFF (AUTO) and the three links.
Mobile WiFi Monitor in Proteus showing the Raspberry Pi 3 air station page with the fan buttons
Figure: The phone: the same page; its browser shows the links as buttons.

Smoke in the Room

The PMS5003's pop-up sets the air at the sensor. Click SMOKE: the sensor goes into its fast mode and the readings climb. The first reading over 35 ug/m3 switches the fan on - the relay pulls in and D1 lights:

PMS5003 Advance pop-up in Proteus: the SMOKE preset and the frames read by the Raspberry Pi
Figure: The PMS5003's pop-up after SMOKE: the air at 300 ug/m3, the readings rising while the fan settles, the last 32-byte frame byte by byte and the chart.
10:00:49  PM1.0  33  PM2.5  34  PM10  36 ug/m3  24.0 C  50.0 %  fan OFF (AUTO)
10:00:49  PM1.0  55  PM2.5  68  PM10  75 ug/m3  24.0 C  50.0 %  fan ON (AUTO)
10:00:50  PM1.0  76  PM2.5  92  PM10  97 ug/m3  24.0 C  50.0 %  fan ON (AUTO)
10:00:51  PM1.0 108  PM2.5 122  PM10 136 ug/m3  24.0 C  50.0 %  fan ON (AUTO)
Raspberry Pi 3 Model B in Proteus: high PM2.5, the fan relay switched on in AUTO mode
Figure: The whole circuit after SMOKE: the relay on, D1 lit.
Relay module in Proteus switched on by a Raspberry Pi 3, the LED in the fan's place lit
Figure: Closer: RLY1 pulled in - IN LOW, the contact on NO - and D1 lit through R1.
Relay module Advance pop-up in Proteus: K1 on, the coil current and the contact
Figure: The relay's pop-up: K1 ON, the coil current from 5 V, NO closed, and the last switching from the IN edge.
Mobile WiFi Monitor in Proteus: high PM2.5 on the Raspberry Pi 3 page, the fan on
Figure: The phone after a reload: PM2.5 122 ug/m3 - POOR, Fan: ON (AUTO).

Switch the Fan from the Phone

Tap FAN OFF on the phone. The request switches the relay off and puts the fan in MANUAL mode, so it stays off although the air is still bad; AUTO would give it back to the sensor:

10:00:51  PM1.0 106  PM2.5 150  PM10 163 ug/m3  24.0 C  50.0 %  fan ON (AUTO)
10:00:52  the page: /fan/off - fan OFF (MANUAL)
10:00:52  PM1.0 135  PM2.5 155  PM10 172 ug/m3  24.0 C  50.0 %  fan OFF (MANUAL)
10:00:53  PM1.0 143  PM2.5 192  PM10 193 ug/m3  24.0 C  50.0 %  fan OFF (MANUAL)
Mobile WiFi Monitor in Proteus: FAN OFF tapped on the Raspberry Pi 3 page, manual mode
Figure: The phone after FAN OFF: Fan: OFF (MANUAL).
Relay module in Proteus switched off from a phone through a Raspberry Pi 3, the LED dark
Figure: Closer: RLY1 released, D1 dark.
Relay module Advance pop-up in Proteus: K1 off after FAN OFF from the phone
Figure: The relay's pop-up: the relay is off, IN HIGH, the coil current falling in the trace.
Pi Terminal in Proteus: the Raspberry Pi 3 readings with the fan off in manual mode
Figure: The Pi Terminal later: high PM values, the fan OFF (MANUAL).

After its 30 s the PMS5003 has settled: its pop-up shows the steady readings again, a frame every 2.3 s. The AHT20's pop-up, meanwhile, shows the room it measures - change the temperature or the humidity there and the next reading follows:

PMS5003 Advance pop-up in Proteus after its fan has settled, read by a Raspberry Pi 3
Figure: The PMS5003's pop-up after the settling time.
AHT20 Advance pop-up in Proteus: the temperature and humidity read by a Raspberry Pi 3
Figure: The AHT20's pop-up: the room's 24.0 C and 50 %RH, what the program read (23.98 C, 50.02 %RH), the status byte and the bytes of the last I2C read.

The Pi Terminal

The Pi Terminal opens at Run, in the look of our TEP Serial Monitor Advance for Proteus - our own TEP header, no Windows title bar. Its Monitor tab shows the program's output (OUT), errors (ERR) and the lines you type for input() (IN). The Board tab shows the board live - the GPIOs (GPIO14 and GPIO15 HIGH: the idle UART lines, GPIO17 the relay), the LEDs and the supply pins - and RESTART PROGRAM starts the program again:

Pi Terminal Board tab in Proteus: the Raspberry Pi 3 Model B GPIOs, LEDs and supply pins
Figure: The Board tab during the demo: the BCM2837 at 1.2 GHz, the GPIOs by BCM number, the LEDs, 5V and 3V3, the program and the speed.

Properties of the Raspberry Pi 3 Model B

Double-click the Pi to change them
PropertyWhat it does
PROGRAMthe Python program (default blink.py; a name next to the project or a full path)
AUTOOPENthe Pi Terminal at Run: YES (default) or NO
ETHERNETthe cable at Run: OUT (default: the network on wlan0) or IN (eth0)
WIFISSID, WIFIPASSthe network wlan0 joins and its password (default TEP-WiFi, 12345678)
PYTHON, RUNTIMEa python.exe and a runtime folder of your own (empty: the TEPPi folder)

Your own programs go next to your project; set PROGRAM to the file's name. The default blink.py blinks an LED on GPIO17:

from time import sleep
from gpiozero import LED

led = LED(17)
while True:
    led.on()
    print('LED on')
    sleep(0.5)
    led.off()
    print('LED off')
    sleep(0.5)

Troubleshooting

  • The program waits for Wi-Fi forever: check WIFISSID and WIFIPASS - the simulation log says "not found" or "wrong password" - or the cable is in (ETHERNET IN): then eth0 carries the network.
  • The page does not open: the address is http://192.168.1.51:8000/ - the port the program serves - and the program must have printed "serving on".
  • No PM readings: the PMS5003's TX goes to GPIO15 (RXD) at 9600 baud, and its SET pin must be open or HIGH (LOW puts it to sleep).
  • OSError: [Errno 121] Remote I/O error: no part answers at that address - check the AHT20's VIN, GND, SDA and SCL.
  • The relay does not switch: its VCC needs 5 V (the IN pin takes the Pi's 3.3 V); IN is active LOW.
  • The TEPPi folder was not found: copy it from Proteus Model Files into MODELS, or next to your project.

Things to Know Before Using a Real Raspberry Pi

  • Wi-Fi: set the network name, the password and the country when you write the card with Raspberry Pi Imager; the Pi then joins at every boot.
  • The UART: turn on the serial port and turn off the serial login console with sudo raspi-config. On a Pi 3 the header's UART is the mini UART, whose baud rate follows the core clock - enable_uart=1 in config.txt fixes the clock.
  • The PMS5003: its fan wants 5 V, but its UART and its SET and RESET pins are 3.3 V logic - a direct link to the Pi's GPIO14 and GPIO15 is fine. Give it 30 s after power-up before you trust a reading.
  • The relay: power the module from 5 V and drive IN from a GPIO; switch the fan's own supply through COM and NO, never mains wiring on a breadboard.
  • Libraries: on a real Pi you can also use a PMS5003 or AHT20 driver from PyPI, or Flask for the page; this program shows what they do underneath.

Limitations of the Simulation

  • The board does not run Raspberry Pi OS: there is no desktop, no shell commands and no apt. It runs one Python program; its threads take turns, so the four cores are not modelled.
  • Bluetooth is not modelled, and the board uses one network interface at a time - wlan0, or eth0 with the cable in.
  • HDMI, the A/V jack, the camera and display connectors, USB, the microSD card's files and a HAT's ID EEPROM are drawn but not simulated.
  • C programs and Python packages with C code do not run. Pure Python code takes no simulation time; only the pin, bus, sleep and network calls move the clock.
  • The router, the board's address, the boot time and the Pi Terminal are TEP additions.
  • Raspberry Pi is a trademark of Raspberry Pi Ltd; this library is not made or endorsed by Raspberry Pi Ltd or Labcenter.
  • Tested in Proteus 8.5 in October 2026 (the demo as shipped, about 5 to 15 % of real time on our PC with the five pop-ups and both pages open). Proteus 7 is not supported.

So, that was all about the Raspberry Pi 3 Model B Library for Proteus. I hope it helps you try a Wi-Fi project on the Pi before you touch the hardware - a sensor on the UART, another on I2C, a relay, and a web page that a laptop and a phone open over Wi-Fi. The next boards of our Raspberry Pi series bring other modules. If you use the library in a project, please share it in the comments or in our forum, and if you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!


Comments

0

Join the conversation