Skip to content

sn-lab/Mouse-Breathing-Sensor

Repository files navigation

Mouse-Breathing-Sensor

Matlab app for the breathing sensor can be installed as a standalone app or opened from within Matlab. Upload Arduino code to Arduino before opening Matlab code. Matlab app will query connected Arduinos for correct uploaded program. On Windows, for the first use, the program will ask if the AC power system used is 50Hz or 60Hz. This will establish preliminary sampling rate and filtering options that can be changed later.

App can allow for variable sampling rate from the sensor up to 5kHz. Parameters for max detectable breathing rate and minimum peak prominence signal are editable in real-time. Window can be viewed from 1 second up to 60 seconds. To save on RAM, data is maintained at 90 seconds max.

For revision, data can be saved while viewing to a .bin file for later review or analysis. Voltage data is stored as 10 bit values from 0 to 1023 for 0-5V range. Binary file can be read manually using fread() or similar function in any coding language. Date and time are stored as a double value at the beginning of the file, followed by the sampling rate as a double value. The next byte indicates the number of channels, typically 1. A loop begins until the number of channels are met where by the next byte indicates the number of characters for the channel name and the following characters are the channel name. All data following is saved as unsigned 16-bit values for voltage.

When running with trigger, the microcontroller can output TTL pulses during acquisition, every N pulses, or toggled every N pulses. Alternatively, the microcontroller can read in a trigger pulse and record to the output .bin file. The trigger is recorded as a logical embedded within the MSB of the 16-bit value.

v2 Notes: Some component values were changed from v1 to v2

  • resistors in the precision rectifier reduced from 1M to 1k
  • some resistor/capacitor values adjusted for filtering
  • resistor for piezo reduced from 1M to 220k A zener diode was added at the piezo to prevent overvoltage spikes due to impacts from damaging the first op-amp. The value is set at 5.1V in the parts list but can range between 5 and 6V based on the op-amp's tolerance.

When producing a board, be sure the PCB version folder and parts list match. The overall footprint of the board and microcontroller code has not changed.

v3 Notes:

  • Layout was modified to have microcontroller (Nano or Nano Every or similar footprint) soldered directly to the board for secure connections
  • The digital pin used for I/O TTL signals has been changed
  • PCB zip files have two versions where one is for the user to read the values and do the assembly. The second version has component labels for 3rd-party assembly services.
  • STL files were adjusted for better fits from the lid to the housing body. In addition, the "Imperial" file uses 4-40 screws for securing the PCB while the "Metric" file uses M3x0.5 screws
  • The app now displays input TTL signals to the microcontroller
  • A Windows and Mac version of the app will both be available.

v4 Notes:

  • the calculated respiratory and heart rates are now displayed below the initial plots. These can be hidden and the displayed time can be adjusted from the previous 10 seconds to the previous 3 minutes
  • the signal for the heart rate calculation and respiratory rate calculation can now be inverted independently for more accurate simultaneous measures
  • a Mac- and Windows- compatible mlapp that can be run in MATLAB (2024b and later) is now available. We are troubleshooting the standalone Mac app to ensure proper function
  • some additional behavioral changes were added

Planned updates:

  • a new board design that allows for 2 simultaneous piezos to be read with the same footprint
  • we promise, a standalone Mac app is on the way

About

Matlab apps and Arduino code for monitoring and recording respiratory signal from anesthetized mice

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors