I have very little experience programming and with arduino.I don't recommend building anything medically critical yourself.
Something like this needs to be very reliable and it needs to be designed so that it can monitor itself and set-off an alarm if anything goes wrong. And you might want redundancy, so if any one component or connection fails the system does not fail. The circuitry that monitors the the respiratory monitor needs its own separate power supply, so if the batteries (or power supply) to the respiratory-monitor fails the system-monitor can still detect a failure and make an alarm. And, there has to be a way to periodically test the system-monitor & alarm to make sure it's still monitoring the respiratory-monitor and detecting failures.
If you wanted to build a heart or respiratory monitor for "casual use" while you exercise, that wouldn't worry me. But if you are monitoring someone because they might have a heart attack, or stop breathing, that's best left to medical equipment manufacturers.You'll find this disclaimer in the ATmega datasheet,
and on most
...Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.
Of course, people do
build medical devices with chips that are not authorized for medical use, but the disclaimer limits the chip manufacturer's liability.