#brain #capstone #rp2040 #autopsy #contact-detection

no-std bin+lib aps490_pfpu2_mini

Control software for PFPU2 automated brain detection system

3 unstable releases

0.4.1 May 23, 2024
0.4.0 Apr 14, 2024
0.3.1 Apr 12, 2024

#236 in Embedded development

Download history 207/week @ 2024-04-08 56/week @ 2024-04-15 129/week @ 2024-05-20 5/week @ 2024-06-03 5/week @ 2024-06-10

139 downloads per month


855 lines

Automated Brain Detection System

For the Multidisciplinary Capstone Project at the University of Toronto, our team (PFPU2) was tasked with identifying methods to avoid unintentional brain damage during autopsies. Typically, this is the result of the varying thickness of cranial bone, which makes it difficult to estimate the distance to the brain. When combined with the rapid turnaround needed in pathology units, this means some damage from the autopsy saw is not uncommon.

Our solution was a contact detection system, which measures conductivity by passing a high-frequency AC signal through the saw blade, and measuring the output to identify fluctuations in the signal. It is inspired and derived from the SawStop® automatic braking technology used in woodworking.

You can find a copy of our showcase poster here.

About the code

This pure Rust project was designed for the RP2040 (mainly the Pi Pico board). It generates a 100 kHz signal using PWM and measures the output with the ADC. The current implementation could use some improvements in analyzing the signal (especially with timing), but was sufficient to identify contact with highly conductive surfaces, and shows indications of doing the same with capacitance.

If you're building on the design, here are some useful references:

  • The schematic for our design can be found in the hardware branch of cam-rod/aps490_retraction_fsm. Don't copy the battery charger, instead reference the Pi Pico datasheet §4.5-4.6.
  • Look at the high/low voltage range of the signal, but also the voltage itself. I found it increases significantly with proximity (not just contact) with highly conductive surfaces, like the capacitive capabilities of the SawStop. See the poster (§5.0, Detected ΔVavg) for more information.

The logs/ folder contains some recorded test data used in system validation. It's not critical to the program.

About us

We are undergraduate students completing our BASc:

  • Zainab Ali, Mechanical Engineering
  • Olivia Lotzer, Mechanical Engineering
  • Cameron Rodriguez, Computer Engineering
  • Tina Sokhanvar, Mechanical Engineering
  • Zeynep Tibik, Mechanical Engineering

I'm Cameron, and wrote the software in this repo.


We would like to thank the following individuals:

  • Our client, Dr. Christoper Ball, forensic pathologist with the Provincial Forensic Pathology Unit (PFPU) in Ontario, Canada
  • Our industry advisor, Dr. Fabio Tironi, forensic pathologist
  • Our supervisor and APS490 course coordinator, Dr. Kamran Behdinan, professor in Mechanical Engineering and UT-IMDI director
  • Our TA, Ranjan Mishra, PhD candidate

We would also like to thank our additional contact points, the PFPU, and the entire APS490 course team for their assistance.


We took inspiration from the SawStop design, covered by the now-expired US patent 7,055,417, and which may be covered by continuations or international patents. We built our proof-of-concept for experimental use only, and have no plans to scale. If you intend to build on our design, you should consult for legal advice, especially if you plan to do so at a larger scale or commercially.

SawStop and all related terms are trademarks or registered trademarks of SawStop, LLC.


Copyright 2024 Cameron Rodriguez

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


~182K SLoC