Project Files of Focus Stacking Rail on Raspberry Pi 5: Proteus Simulation Project
cb012ae4ed044055aa4c95c533b37499.zip

Focus Stacking Rail on Raspberry Pi 5: Proteus Simulation Project V1.0
Focus Stacking Rail on Raspberry Pi 5: Proteus Simulation Project V1.0 comes as a ZIP archive of 144 files (14.3 MB, 28.0 MB unpacked) holding Proteus library files, simulation model DLLs, a Proteus simulation, source code and a nested archive.
- LIBProteus library
- DLLProteus model
- DSNProteus simulation
- SRCSource code
- ZIPNested archive
Description
Focus-Stacking-Rail-Raspberry-Pi-5-Proteus-Simulation-v1.0.zip: the complete Proteus simulation project (Raspberry Pi 5, TMC2209, the NEMA 17 linear stage, two PC817 optocouplers, LEDs, resistors, the Laptop and Mobile WiFi Monitors), the Python program focus_rail.py, every LIB and DLL the simulation needs, the TEPPi Python runtime and a README.
File Structure
39.5 KB21.8 KB19.1 KB13.1 KB30 KB306.9 KB60.5 KB16 KB3.3 MB34.3 KB620.8 KB36 KB169.8 KB628.1 KB99.3 KB65.3 KB4.8 MB4.1 MB80 B97.8 KB26.8 KB1.2 MB1.1 MB88.9 KB27.3 KB55.8 KB79.8 KB105.8 KB193.8 KB113.8 KB48.8 KB145.8 KB36.8 KB29.3 KB42.3 KB28.8 KB67.3 KB89.3 KB153.8 KB22.8 KB38.8 KB2.1 KB9.9 KB4.1 KB1.3 KB4.7 KB431 B2.5 KB17.5 KB283 B6.5 KB37.9 KB11.1 KB5.5 KB885 B13.6 KB9 KB878 B1.5 KB4 KB1004 B10 B110 B2.6 KB1.1 KB8.9 KB58.5 KB12.4 KB6.6 KB18.5 KB20.7 KB27.8 KB21.1 KB7.1 KB7.7 KB2.7 KB51.2 KB100.9 KB1.2 KB24.3 KB7.4 KB53.6 KB26.1 KB20.5 KB60.5 KB19.6 KB1.6 KB8.4 KB20.9 KB2.6 KB539 B1.4 KB9.7 KB2.8 KB21 B92 B7.9 KB264 B3.4 KB3.8 KB17.5 KB55.2 KB3.3 KB10.8 KB1.5 KB4.2 KB7.3 KB2.5 KB32.6 KB14.5 KB283 B17.4 KB257 B691 B14.5 KB12.8 KB3.6 KB1.7 KB37 KB418 B6.2 KB7 KB37.3 KB10.6 KB23.7 KB28.7 KB8.8 KB16.9 KB289.5 KB311.5 KB2.9 MB306 KB311 KB300 KB9.6 KB36.2 KB289.5 KB311.5 KB2.9 MB306 KB311 KB300 KB9.6 KB10.5 KBGallery12 images from the tutorialOpen the tutorial
The circuit, the board and the results as they appear in Focus Stacking Rail on Raspberry Pi 5: Proteus Simulation Project. Open an image for its full size.












README
===============================================================================================================
Focus Stacking Rail on Raspberry Pi 5: Proteus Simulation Project V1.0
The Engineering Projects - www.TheEngineeringProjects.com
===============================================================================================================
IMPORTANT LINKS
The project tutorial (circuit, code, simulation results):
https://www.theengineeringprojects.com/2026/11/focus-stacking-rail-raspberry-pi-5-proteus-simulation.html
The libraries this project is built from (each post has its own full download and tutorial):
Raspberry Pi 5 board:
https://www.theengineeringprojects.com/2026/10/raspberry-pi-5-library-for-proteus.html
TMC2209 stepper driver:
https://www.theengineeringprojects.com/2026/11/tmc2209-stepper-driver-library-for-proteus.html
NEMA 17 linear stage:
https://www.theengineeringprojects.com/2026/11/nema-17-linear-stage-library-for-proteus.html
PC817 optocoupler:
https://www.theengineeringprojects.com/2026/11/pc817-optocoupler-library-for-proteus.html
5 mm LED:
https://www.theengineeringprojects.com/2026/11/5mm-led-library-for-proteus.html
Resistor:
https://www.theengineeringprojects.com/2026/11/resistor-library-for-proteus.html
Laptop WiFi Monitor:
https://www.theengineeringprojects.com/2026/10/laptop-wifi-monitor-library-for-proteus.html
Mobile WiFi Monitor:
https://www.theengineeringprojects.com/2026/10/mobile-wifi-monitor-library-for-proteus.html
Support our free work: https://www.theengineeringprojects.com/donate
FILE STRUCTURE
Pi-5-Focus-Stacking-Rail-TEP-v1.0/
|-- Proteus Library Files/
| |-- TEPLAPTOP.LIB 39.5 KB a part of the project -> LIBRARY folder
| |-- TEPLED5MM.LIB 21.8 KB a part of the project -> LIBRARY folder
| |-- TEPLINSTAGE.LIB 19.1 KB a part of the project -> LIBRARY folder
| |-- TEPMOBILE.LIB 13.1 KB a part of the project -> LIBRARY folder
| |-- TEPOPTO.LIB 30.0 KB a part of the project -> LIBRARY folder
| |-- TEPRESISTOR.LIB 306.9 KB a part of the project -> LIBRARY folder
| |-- TEPRPI5.LIB 60.5 KB a part of the project -> LIBRARY folder
| |-- TEPTMC2209.LIB 16.0 KB a part of the project -> LIBRARY folder
|-- Proteus Model Files/
| |-- TEPLED5MM.DLL 289.5 KB a model -> MODELS folder
| |-- TEPLINSTAGE.DLL 311.5 KB a model -> MODELS folder
| |-- TEPNET.DLL 2.89 MB a model -> MODELS folder
| |-- TEPOPTO.DLL 306.0 KB a model -> MODELS folder
| |-- TEPRESISTOR.DLL 311.0 KB a model -> MODELS folder
| |-- TEPTMC2209.DLL 300.0 KB a model -> MODELS folder
| |-- TEPPi/python/ 17.54 MB Python 3.11 embeddable -> MODELS\TEPPi (33 files)
| |-- TEPPi/runtime/ 1.11 MB TEP Pi runtime, gpiozero -> MODELS\TEPPi (87 files)
|-- Proteus Simulation/
| |-- focus_rail.py 9.6 KB the program PI1 runs
| |-- Pi-5-Focus-Stacking-Rail.pdsprj 36.2 KB the project simulation
| |-- TEPLED5MM.DLL 289.5 KB copy of the model
| |-- TEPLINSTAGE.DLL 311.5 KB copy of the model
| |-- TEPNET.DLL 2.89 MB copy of the model
| |-- TEPOPTO.DLL 306.0 KB copy of the model
| |-- TEPRESISTOR.DLL 311.0 KB copy of the model
| |-- TEPTMC2209.DLL 300.0 KB copy of the model
|-- Python Code/
| |-- focus_rail.py 9.6 KB the program (the same file)
|-- README.txt ~10.2 KB this file
Total: 27.96 MB (unzipped). The C++ source code of the models is not included.
WHAT IS IT?
A macro focus rail for focus stacking that you can run in Proteus: a Raspberry Pi 5 moves a camera along a 100 mm
linear stage in small, exact steps and takes a photo at every step, so that the slices in focus can be merged into
one sharp picture of a tiny subject; a web dashboard sets the stack and starts it.
* TMC2209 driver (TMC2209TEP, U1): STEP GPIO17 (pin 11), DIR GPIO27 (pin 13), EN GPIO22 (pin 15, low = on); MS1 /
MS2 to GND = 1/8 microsteps; VM +12V, VDD +3.3V; A1 A2 B1 B2 to the stage's A+ A- B+ B-.
* NEMA 17 linear stage (STAGE100TEP, M1): a T8 lead screw (8 mm a turn) - 200 pulses a millimetre, 5 um a pulse;
START 6 mm, PAYLOAD 0.8 kg (a camera); MIN to GPIO23 (pin 16), MAX to GPIO24 (pin 18), COM to GND.
* Two PC817 optocouplers (PC817TEP, U2 FOCUS / U3 SHUTTER): A from GPIO5 (pin 29) / GPIO6 (pin 31) through R1 / R3
330 ohm, K to GND; each transistor (C, E to GND) sinks a yellow LED (D1 / D2) from the 5 V rail through R2 / R4
1 kohm - the camera's focus / shutter input of a wired remote, with no wire shared with the Pi.
* RASPBERRY PI 5 (PI1) runs focus_rail.py on Ethernet at 192.168.1.51 (port 8000).
* Laptop WiFi Monitor (PC1) and Mobile WiFi Monitor (MOB1) open http://192.168.1.51:8000/.
The rules (at the top of the program):
* homing at power-up: back to MIN in 0.2 mm bites at 3 mm/s, 0.5 mm off it, then 10 micron bites at 0.5 mm/s:
MIN closing is the zero; then the rail goes to NEAR;
* a stack from NEAR to FAR in STEP mm (4.00 to 6.00 mm in 0.25 mm at the start: 9 shots); at each position: the
move at 5 mm/s, 0.3 s to settle, FOCUS 0.15 s, SHUTTER 0.2 s, 0.3 s for the exposure;
* the pulses are timed by the Pi (lgpio tx_pulse); after homing the driver stays on (EN low): its holding
torque keeps the camera still between the shots.
Its pages:
/ the dashboard: the controls, the state, the position, the stack settings, the events
/start /stop a stack /home find MIN again
/jog_back /jog_fwd 0.5 mm /near /far the position now as NEAR / FAR
/step the step: 0.05, 0.1, 0.25 or 0.5 mm /data everything as JSON
No extra Python library: lgpio (in the TEPPi runtime and on Raspberry Pi OS), threading, queue, http.server.
TEST STATUS
Tested in Proteus 8 Professional on Windows 11, the run that made the tutorial's screenshots (the program's times):
- 2.3 s: "homed: MIN closed after 4.00 mm - the zero" (the carriage started at 6 mm; MIN closes 2 mm from the end);
the rail at NEAR, 4.00 mm, the TMC2209 holding at 1.2 A.
- 6.9 s: START from the laptop: "stack: 9 shots, 4.00 to 6.00 mm, 0.25 mm apart"; a shot every 1.0 s; the third
caught with FOCUS and SHUTTER on - both yellow LEDs lit, the shutter PC817 sinking 3.10 mA at VCE 0.13 V.
- 15.9 s: "stack done: 9 shots in 9.0 s"; the rail back at NEAR.
- 18.5 s: STEP = 0.50 mm from the phone; JOG - twice; 20.9 s: NEAR = 3.00 mm; 21.5 s: START - 7 shots,
3.00 to 6.00 mm.
- 24.9 s: STOP from the laptop during the fourth shot: "stack stopped after 4 shots" (the shot under way finishes).
- 28.8 s of simulation in 439 s.
INSTALLATION
1. Close Proteus. Extract the WHOLE zip file, for example to your Desktop.
2. Copy the files from "Proteus Library Files" into the LIBRARY folder of Proteus, for example
C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY
3. Copy everything in "Proteus Model Files" - the DLL files and the TEPPi folder - into the MODELS folder (next
to LIBRARY).
4. Start Proteus. Press P in the schematic and search for RASPBERRY PI 5, TMC2209TEP or STAGE100TEP to check that
the parts are there.
RUN THE SIMULATION
1. Open "Proteus Simulation\Pi-5-Focus-Stacking-Rail.pdsprj". Keep focus_rail.py and the DLL files beside it.
2. Press Play. The rail homes on MIN and goes to NEAR (4 mm).
3. Open the Laptop WiFi Monitor (PC1) or the Mobile WiFi Monitor (MOB1) and press Go: START a stack - the yellow
LEDs (the camera's FOCUS and SHUTTER) flash at every step; JOG, NEAR, FAR and STEP set a new stack.
4. Watch the stage's, the TMC2209's and the PC817s' pop-ups.
Your own program: edit focus_rail.py beside the project (PI1's PROGRAM property) and press Play again.
PROPERTIES USED IN THIS PROJECT
PI1 RASPBERRY PI 5 PROGRAM=focus_rail.py, ETHERNET=IN (192.168.1.51)
U1 TMC2209TEP (no changes: VREF=1.2 - 1.2 A peak)
M1 STAGE100TEP START=6 (mm), PAYLOAD=0.8 (kg), ORIENT=Horizontal
U2, U3 PC817TEP (no changes)
R1, R3 330 ohm; R2, R4 1 kohm; D1, D2 yellow 5 mm LEDs
PC1, MOB1 HOMEPAGE=http://192.168.1.51:8000/
TROUBLESHOOTING
* HOMING FAILED: MIN never closed - MIN / COM not wired, or DIR the wrong way round (swap A+ and A-).
* The rail moves the wrong way: swap A+ with A- (or invert DIR in the program).
* Lost steps (the stage's pop-up counts them): the speed too high for the load - lower MOVE_HZ.
* The LEDs never flash: the PC817's A and K swapped, or the LED's supply missing.
* The terminal cannot start Python: the TEPPi folder is not in MODELS.
LICENCES
* The project, the program, the parts (LIB files) and the models (DLL files) are made by The Engineering Projects
and are free for learning and for your own projects. The models use only standard Windows libraries.
The C++ source code of the models is not included; the source code is not included for any model.
* TEPPi\python is the Python 3.11 Windows embeddable package (Python Software Foundation License); TEPPi\runtime
holds our TEP Pi runtime with gpiozero and colorzero (BSD licences) - their licence files are inside the folders.
* Proteus is a product of Labcenter Electronics and is not included. Raspberry Pi is a trademark of Raspberry Pi
Ltd; the TMC2209 is a product of Analog Devices (Trinamic); the PC817 of Sharp and others.
This project is not made or endorsed by them.
VERSION
V1.0 - the first release of the project.
===============================================================================================================Development1 release
-
V1.0Focus Stacking Rail on Raspberry Pi 5: Proteus Simulation Project V1.0this page
V1.0 is the only release in the Download Center so far. When a newer version is published, it appears above with its own download page.
Installation7 steps
From the download to a working project, in order. The steps follow what the package contains.
You will need
- Proteus Design SuiteProteus 8 or newer (Labcenter), on Windows
- Pythonto build the source files into firmware
- Any archive toolWindows, macOS and Linux extract ZIP files on their own
Steps
- 1
Extract the archive
Right-click cb012ae4ed044055aa4c95c533b37499.zip and choose Extract All (or open it with 7-Zip or WinRAR) into a folder you can find again. Keep its folder structure (Pi-5-Focus-Stacking-Rail-TEP-v1.0) as it is.
- 2
Copy the library files into Proteus
Move TEPLAPTOP.LIB, TEPLED5MM.LIB and TEPLINSTAGE.LIB and 5 more and the files into the LIBRARY folder of your Proteus installation: C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY for Proteus 8, or the matching Proteus 7 folder. Older versions keep it under ProgramData\Labcenter Electronics. If Proteus is open, close it first.
- 3
Add the simulation model
Copy TEPLED5MM.DLL, TEPLINSTAGE.DLL and TEPNET.DLL and 10 more into the MODELS folder next to LIBRARY, so the component can run, not only be drawn.
- 4
Restart Proteus and place the component
Start Proteus, open a schematic, press P (Pick Devices) and search for the component by the name used in the tutorial. It appears with its pins ready to wire.
- 5
Build the source code
Open focus_rail.py, attr.py and color.py and 28 more in the compiler named in the tutorial (MikroC, Keil, MPLAB, Code Composer or the Arduino IDE) and build it to get the firmware.
- 6
Open the example simulation
Open Pi-5-Focus-Stacking-Rail.pdsprj in Proteus to see the wiring exactly as in the tutorial. Check the controller's Program File path, then press Play.
- 7
Follow the tutorial
Focus Stacking Rail on Raspberry Pi 5: Proteus Simulation Project explains every connection and setting in order; keep it open beside the files while you build.
FAQs8 questionsContact TEP
How do I download Focus Stacking Rail on Raspberry Pi 5: Proteus Simulation Project V1.0?
Wait for the 30-second guest countdown on this page, then press the download button; the file comes straight from our storage. Members who are logged in skip the wait. If the browser opens the file instead of saving it, use its Save as option. The download link is made for you when the countdown ends and works for 15 minutes; a saved or shared link stops working, so share this page instead.
What is inside the archive?
Focus Stacking Rail on Raspberry Pi 5: Proteus Simulation Project V1.0 comes as a ZIP archive of 144 files (14.3 MB, 28.0 MB unpacked) holding Proteus library files, simulation model DLLs, a Proteus simulation, source code and a nested archive. Open the File Structure tab for the full list of 144 files.
What should I do if the download does not start?
Check the browser's download list first; an ad blocker or a company firewall can also hold it back, so try another browser or network. If the file arrives incomplete, download it again. For an installation problem, read the Install tab or tell us in the comments with your software version and the exact error message.
Is this file free?
Yes. Every file in the TEP Download Center is free for learning, personal and student projects. If you share it, link back to this page or the tutorial so others find the latest version.
How do I check that the file arrived complete?
Compare its SHA-256 with the one on this page, b1a8b468eac8c79c8a248097632465b343fcf57e7af4f2f5b08963760b27f0ea. In PowerShell run Get-FileHash "cb012ae4ed044055aa4c95c533b37499.zip"; on macOS or Linux run shasum -a 256 "cb012ae4ed044055aa4c95c533b37499.zip". The same value means the file is exactly the one in our storage; a different one means the download broke off, so download it again.
Do I need WinRAR to open the ZIP file?
No. Windows, macOS and Linux open ZIP archives on their own (Extract All, or double-click). WinRAR and 7-Zip work too. Extract the whole archive before using the files.
Where do I put the LIB and IDX files?
Both files go into the LIBRARY folder of your Proteus installation (Proteus 8: C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\LIBRARY; Proteus 7 has the same folder under its own name). Restart Proteus afterwards and search for the component with P.
Which Proteus version does the library need?
The tutorial names the Proteus version the library was made and tested with. Most TEP libraries work in Proteus 7 and Proteus 8; if the component does not appear after a restart, check that both the LIB and the IDX file were copied and that Proteus was fully closed while copying.
Members skip the wait. Log in or join TEP.
- 0Total downloads
- 4%Popularity
- Raspberry PiCategory
- 0Comments
- ssyedzainnasirUploaded by
- 16 Nov 2026Uploaded at
b1a8b468eac8c79c8a248097632465b343fcf57e7af4f2f5b08963760b27f0ea






















Comments
0