Automated Viscosity Measurement System

PCB & embedded lead with Endress+Hauser — 400× gain signal chain separating 252 cP from 1676 cP; three Altium boards, two manufactured by JLCPCB

A current window of 6 mA — the difference between diluted and pure soap at 30 RPM — amplified 400× into the ESP32 ADC range, reliably separating 252 cP from 1676 cP on a custom two-stage op-amp board. Industrial Automation challenge at Tec de Monterrey with Endress+Hauser (team of 4): an automated fluid-handling cycle combining PLC sequencing and ESP32 measurement, from Altium PCB design to physical validation.

SolidWorks render of the full system
Design: SolidWorks CAD model of the rotary measurement station, viscosity measurement unit, and dispenser as originally planned.
Integrated system during the final presentation
Build: Integrated system presented as the final prototype, combining relays, emergency-stop system, water pump, container sorting, stepper motors, DC motor with encoder, infrared sensors, and conveyor belts for container transport.

Design at a glance

Op-amp board built and wired
Op-amp board built and wired
Op-amp board layout
Op-amp board layout
ESP32 master board (JLCPCB)
ESP32 master board (JLCPCB)
Multisim check at 61 mA
Multisim check at 61 mA

Design decisions, from first principles

Decision Engineering reasoning Result
Measure viscosity through motor current Viscous drag raises spindle torque, and DC-motor torque is proportional to current; a 1 Ω shunt turns it into voltage 6 mV window between diluted and pure soap at 30 RPM
Gain ≈ 400 in two stages (×100, then ×4) Maps the 6 mV window onto 0–3.3 V while keeping the first stage inside the ±12 V rails 252 cP and 1676 cP reliably separated
5 V → 3.3 V level converter At 130 RPM the output reached about 4 V, above the ESP32 ADC limit ADC protected at all speeds
PID off during the measurement Closed-loop speed control pushed the current to 63–72 mA, outside the measurement window Stable readings at constant 30 RPM
Full technical write-up

Challenge

Automate a full fluid-handling cycle: identify a sample by its color tag, measure its viscosity, dilute it to a target (±10%), then sort it. Two constraints shaped the design: viscosity had to be inferred from the spindle motor’s current, with no commercial viscometer, and control was split between PLC stations (supply and sorting) and an ESP32 station (measurement), which communicate with each other.

My contribution

  • PCB design: designed all three boards of the measurement station in Altium Designer — the ESP32 master and slave boards (two-layer, IPC-2221 trace sizing, manufactured by JLCPCB) and the op-amp board for viscosity measurement, which I built on copper-clad laminate so the circuit could be debugged and tuned
  • Signal conditioning: co-developed the current-sensing chain (1 Ω shunt, two-stage UA741 amplification, about 400× gain), simulated it at 61 mA and 67 mA, and verified it on our own PCB
  • Embedded (co-developed with a teammate): homing and measuring routines, moving-average filtering of the current signal, color-tag reading over I²C, Bluetooth link to the LabVIEW HMI, UART between the two ESP32s, and the song the slave board’s buzzer plays while the motors move (it stops during the cup, color and viscosity checks)
  • PLC & manufacturing: co-built the conveyor belts, co-programmed the ladder logic, and placed and calibrated the FC-51 sensors

Teammates led the mechanical design of the stations, the PLC sequence design, and the LabVIEW HMI.

Integration

The full bench integration, with most of the automatic sequence running: the carousel, measurement station and control electronics working together.

Integration demo: most of the automatic sequence running on the bench.
The revolver (rotating cup holder) turning with the sample cups loaded.

PCB design

All boards were designed in Altium Designer. The two ESP32 boards were manufactured by JLCPCB. The op-amp board was instead built on copper-clad laminate: for practicality and debugging, this let us test the conditioning circuit and modify component values with experimental results, which a fabricated board would not have allowed as quickly.

ESP32 master board
ESP32 master board: drives the main motors, including the stepper of the carousel (stepper and encoder terminals, I²C connector, level shifter).
ESP32 slave board
ESP32 slave board: sensors and peripherals (PLC signals, fan and water pump), plus the buzzer that plays the song while the mechanisms move.
Op-amp measurement board layout
Op-amp measurement board: PCB layout.
Fabricated and wired op-amp board
The same board, built on copper-clad laminate so values could be changed while debugging.
Master board schematic
Master schematic: ESP32 headers, stepper STEP/DIR, and encoder and inductive-sensor inputs level-shifted from 5 V to 3.3 V.
Slave board schematic
Slave schematic: sensor inputs, fan and water-pump outputs, PLC color/start signals, UART, RGB LED, buzzer and push button.

Signal conditioning

Viscosity was inferred from the motor’s supply current through a 1 Ω shunt: about 61 mV for 75% soap and 67 mV for pure soap at 30 RPM, a 6 mV window. A gain of about 400 (×100, then a differential stage with ×4) maps that window to 0–3.3 V, split in two stages so the first one stays inside the ±12 V rails. At 130 RPM the output still reached about 4 V with a 3.3 V Zener alone, so a 5 V → 3.3 V logic-level converter was added to protect the ESP32 ADC.

Multisim simulation at 61 mA
Multisim at 61 mA: 61 mV across the 1 Ω shunt becomes about 250 mV at the ADC input.
Multisim simulation at 67 mA
Multisim at 67 mA: 67 mV becomes about 2.67 V, clamped by the 3.3 V Zener.

Conveyors

The original sorting idea (a vending-machine-style stepper, screw and spring) was dropped because exactly spaced springs were not available and the ladder logic was complex. For practicality and material feasibility, the final integration uses small conveyor belts instead, driven by an Arduino Mega running OpenPLC.

Conveyor belts with FC-51 sensors
Conveyors: the sorting belts I co-built, with FC-51 sensors for cup detection.
My PLC logic validation: moving a cup along the conveyor belt with the FC-51 sensors.

Tools & technologies

  • PCB design (IPC-2221, JLCPCB): ESP32 master/slave boards, op-amp measurement board
  • Multisim: simulation of the two-stage amplifier across the 61–67 mA range
  • ESP32 (C++, ESP-IDF): homing and measuring routines, digital filtering, TCS34725 color sensor over I²C, Bluetooth, master/slave over UART
  • OpenPLC on Arduino Mega (ladder): conveyor control at the supply station
  • FC-51 IR sensors: cup detection on the belts
  • Laser-cut MDF, aluminum rollers, rubber belts: conveyor manufacturing

Results & lessons

  • Viscosity measurement: a 6 mA current window, amplified about 400× into the ESP32 ADC range, gave a repeatable separation between diluted and pure soap (252 vs 1676 cP)
  • Water dosing: running the pump at 5 V made it controllable, delivering 19/26/36 ml against 18/27/36 ml targets
  • Conveyors: the belts carried 5 kg (supply) and 8 kg (sorting) against a requirement below 1 kg
  • Outcome: the automatic sequence ran on video, but the live demo failed because of wiring faults and short circuits — the PLC boards were swapped for breadboards after the FC-51 sensors drew more current than the board supply could deliver
  • Measurement lessons: PID control had to be dropped for the 30 RPM measurement because it pushed the current to 63–72 mA, outside the 61–67 mA window; swapping the UA741CN for the UA741CP fixed an output that froze
  • Lessons: route a short common ground for inter-board UART, since a RX/TX mismatch on the slave board cost debugging time; budget sensor supply current before routing a board, and check pin assignments against the target software (OpenPLC addressing) before fabrication

Context: Tec de Monterrey, Aug–Dec 2025, Industrial Automation challenge with Endress+Hauser as industry partner, team of 4. Result: current-based viscosity measurement separating 252 cP from 1676 cP on a custom PCB. Stack: ESP32/ESP-IDF, custom PCB design (IPC-2221), Multisim, OpenPLC (Arduino Mega), I²C, UART, Bluetooth, LabVIEW HMI

Team at Endress+Hauser
The team at Endress+Hauser, in front of their process instrumentation.