Arduino-based automation controller for a laboratory / medical tissue processor.
The system manages:
- Automated movement between processing tanks
- Vibration control during immersion
- Wax heater management
- Tank identification and sequencing
- Safety interlocks and fault detection
- LCD status display and operator controls
The firmware is implemented as a deterministic Finite State Machine (FSM) using the MicroBeaut Finite-State library for predictable and maintainable behavior.
This project was created to restore a heavily damaged:
Histokinette E7326 tissue processor.
The original machine was fully mechanical and its control system was no longer reliable.
An Arduino-based controller was added to replace the damaged control hardware while preserving the original mechanical system.
The goal of this project is to give the machine a second life using modern, maintainable, and open-source electronics.
This implementation adds:
- Deterministic FSM-based control logic
- Motor timeout protection
- Sensor validation and debouncing
- Wax temperature verification
- Watchdog-based recovery
- LCD diagnostics and runtime information
- Structured development workflow
- Automated builds and testing support
This project demonstrates how older laboratory and industrial equipment can be restored, documented, and maintained using modern embedded development practices while keeping the original machine functional and operational.
- Sequential processing across 12 tanks
- Configurable dwell times per tank
- Automatic tank transition detection
- Multi-cycle support for wax tanks
- Inspection / manual intervention mode
The controller is structured entirely around explicit FSM states:
- Startup verification
- Recovery modes
- Lowering / raising
- Tank dwell timing
- Transition handling
- Error shutdown
This improves:
- Reliability
- Debugging
- Safety validation
- Long-term maintainability
Built-in protection mechanisms include:
- Motor runtime timeout protection
- Sensor sanity validation
- Wax readiness verification
- Invalid tank detection
- Watchdog recovery (
avr/wdt) - Debounced sensors and buttons
- Controlled motor switching delays
- 16x2 I2C LCD status display
- Remaining process time display
- Start / pause / inspection controls
- Real-time tank information
| Function | Pin | Description |
|---|---|---|
| Movement Motor | D8 | Vertical movement motor |
| Vibration Motor | D7 | Tank vibration motor |
| Heater 1 | D6 | Wax heater 1 |
| Heater 2 | D5 | Wax heater 2 |
| Sensor | Pin | Description |
|---|---|---|
| Bottom Sensor | A0 | Lower limit switch |
| Top Sensor | A1 | Upper limit switch |
| Wax Sensor 1 | D3 | Wax ready thermostat 1 |
| Wax Sensor 2 | D4 | Wax ready thermostat 2 |
| Pins | Description |
|---|---|
| D9βD12 | 4-bit binary tank identifier |
| Control | Pin | Description |
|---|---|---|
| Start / Stop Button | D2 | Start or pause process |
| Skip Tank Button | D1 | Skip current tank |
| Raise / Continue Button | D0 | Raise sample for inspection |
| Interface | Pins |
|---|---|
| I2C LCD | A4 (SDA), A5 (SCL) |
LCD address:
0x27On boot:
- Hardware initializes
- Sensors are validated
- Tank position is synchronized
- FSM enters verification mode
- System transitions to
IDLE
| State | Purpose |
|---|---|
S_VERIFYING |
Initial startup verification |
S_IDLE |
Waiting for operator input |
S_STARTING_NEW_TANK |
Tank initialization |
S_LOWERING |
Moving sample downward |
S_PRE_DOWN |
Motor safety delay |
S_DOWN |
Active tank dwell period |
S_CHECKING |
Wax and cycle verification |
S_PRE_RAISING |
Motor switching delay |
S_RAISING |
Raising sample upward |
S_UP |
Inspection / top position |
S_TRANSITIONING |
Waiting for next tank |
S_ERROR |
Emergency shutdown |
If the movement motor runs longer than:
60 secondswithout reaching the target sensor, the system enters:
S_ERRORThe controller immediately halts if:
- Top and bottom sensors activate simultaneously
- Tank ID becomes invalid
- Wax conditions fail unexpectedly
- Mechanical motion becomes inconsistent
The AVR watchdog timer automatically resets the controller if the firmware hangs.
wdt_enable(WDTO_2S);All sensors and buttons are software debounced:
20 msto eliminate false triggers caused by electrical noise.
Tank behavior is configured through a compact PROGMEM table:
struct TankProfile
{
uint8_t dwellMinutes;
uint8_t requiredHeater;
WaxRequirement requiredWax;
uint8_t cycles;
};| Tank | Duration | Heaters | Wax Check | Cycles |
|---|---|---|---|---|
| 1β9 | 60 min | None | None | 1 |
| 10 | 60 min | Heater 1 | None | 1 |
| 11 | 120 min | Both | Wax 1 | 2 |
| 12 | 120 min | Both | Wax 1 + 2 | 2 |
Status: Idle
Press Start
Tank: 05
Time: 00:42:11
ERROR
MOTOR OVER TIME
The firmware supports optional compile-time development modes.
#define DEBUGEnables verbose serial logging for:
- FSM transitions
- Sensor events
- Timing diagnostics
- Safety faults
#define TESTChanges timing behavior for rapid testing:
| Normal | TEST Mode |
|---|---|
| 1 minute | 1 second |
| 1 hour dwell | 60 seconds |
| 60s timeout | 10s timeout |
Useful for validating full process cycles quickly.
Required Arduino libraries:
| Library | Version |
|---|---|
| Finite-State | 1.6.0 |
| LiquidCrystal_I2C | 1.1.2 |
| Wire | Built-in |
- Open the sketch
- Install required libraries
- Select target board
- Upload firmware
The repository includes a development workflow using make.
make buildor
make compilemake upload PORT=/dev/ttyACM0Windows example:
make upload PORT=COM3make monitor PORT=/dev/ttyACM0make formatUses:
clang-format
make lintUses:
cpplint
make testmake sizemake clean.
βββ TissueProcessor.ino
βββ Makefile
βββ README.md
βββ LICENSE
βββ build/
βββ tests/
- Power on the controller
- Ensure tank selector is correct
- Hold the Start button
- System begins automatic processing
During processing:
- Press the raise button
- Sample rises to top position
- Inspection can be performed safely
- Resume process afterward
Operator can manually skip the current tank using the skip button.
Recommended workflow:
#define DEBUG
#define TESTThis enables:
- Fast simulation cycles
- Full serial diagnostics
- Easier FSM validation
This project is intended for:
- Research
- Prototyping
- Educational purposes
Before use in a real laboratory or medical environment:
- Validate all timings
- Verify thermal safety systems
- Test all limit switches
- Confirm relay and power-stage isolation
- Perform independent safety certification
Licensed under the MIT License.
Copyright Β© 2026 Basher Hasan (abstract-333)
See: