Trying to measure the pH of a falling liquid

Just as background, I'm completely new to Arduino and electronics/coding in general, I've been fooling around with it these past few days so I have a feel for it now. I'm working on an idea for a device that could measure the pH of a liquid automatically.

So, you mount the device against the wall of a toilet or a sink, use a PIR to detect when a liquid is falling, dispense a litmus paper that goes into the stream, and then hopefully discard the paper (once it's been analyzed by the chemist) into the sink or toilet.

Now, I am stumped on what mechanism to use for the dispensing of the litmus paper, and even more perplexed by possible discarding/reloading mechanisms. Are there any parts or sensors that could help me achieve this purpose? I would appreciate any guidance on the topic.

For dispensing, can you get it on a roll and use a small print head like from a thermal printer?
I think I've seen small printheads at adafruit.com for example.

Why litmus paper?

I'd extend a small sample cup into the stream, take a sample and then analyze it with a conventional electronic pH meter.

Depending on the source of the water, it may be necessary to ensure the sample samples the whole width of the stream. I've seen samplers the size of houses which do this for coal on a conveyor belt. (Big lumps migrate to the middle and they may have different properties to the small lumps.)

Put a pH meter in the water line feeding the toilet.

Litmus paper won't show you pH, just <7 or >7. And city water supplies always run >7 so you wouldn't really get any useful data out of that.

The ideas for bypassing the litmus paper are excellent. However, eventually this wouldn't be solely for litmus paper. Eventually, I envision being able to put ketone strips, leukocyte detecting strips, and other types of urinalysis (or other liquid) devices in there. The litmus paper itself does not matter, but the automatic dispensing/discarding does. It is simply a starting point for my project.

That sounds like a mechanical problem in a very harsh environment. Corrosive water, abusive customers, poor maintenance... You have everything working against you. Even if you make all your mechanics be stainless steel and washable.

What is the expected lifetime of this device? How much maintenance can you afford?

I realize that this is (probably) just a school project but "little tiny plastic arm that picks out a piece of paper from a stack" is not going to last 5 minutes in the real world. Just draw a drawing. Make the drawing look good and it doesn't matter that it's totally impractical. Leonardo da Vinci gets a lot of credit for drawings that would never ever work.

Although your concerns about the final product and it's applicability are well founded, I wanted to build a prototype first and then think about commercial feasibility. It's something I'm doing out of school. I've considered the 'plastic little arm' idea but I don't think it's practical, easy to build, or easy to code. Currently, my idea was something similar to a ticket dispenser at a carnival, but I have no idea how to make that fit on the inside of a toilet or a sink. That's why I'm looking for other alternative mechanisms.

Electronic pH probe was my first thought as well. I don't know about the rest of the tests you want to run - is it even possible to do this instantly? Who is going to interpret the results of those strips? How're you going to present the paper (or any other result) in a hygienic manner?

Lithmus paper can do a bit better than >7/<7 but closer than 1-2 pH points you're not going to get. Probably not nearly the accuracy you need.

Carnival ticket dispensers are one way systems. They take a roll of pre-perforated paper and push out a piece, relying on the customer to tear it off. If you put this in the rim of a toilet bowl, you're basically asking the user to stick their head in the bowl to see the paper, then press a button or so to tell your system they've seen it and noted the result, so the paper can be removed and discarded. Doesn't sound workable to me.

Urine analyses inside the bowl has more issues: dilution by the flush water (which also totally messes up the pH), contamination with whoever came before them.

So, you mount the device against the wall of a toilet or a sink, use a PIR to detect when a liquid is falling

Have you tested that the Passive Infrared Sensor will actually sense the falling liquid? I have my doubts.

Passive IR needs a temperature difference from background.

I'm wondering if it wouldn't be easier to sample a quantity of water and mix in liquid indicator dye with
a stepper/syringe mechanism, measure the optical characteristics and then drain away the old sample.

MarkT:
I'm wondering if it wouldn't be easier to sample a quantity of water and mix in liquid indicator dye with
a stepper/syringe mechanism, measure the optical characteristics and then drain away the old sample.

No, it's not. There are no dyes that show colour depending on the pH with any accuracy (it's like litmus paper). Taking pure sample, then sticking a pH probe in it, that may work.
Does require some very thorough cleaning and drying mechanisms, especially for the probe (otherwise samples cross-contaminate each other, or you dilute it with the rinse water, spoiling your measurements). The sample container may be disposable.

For the urine or pH analysis, I was thinking of setting up a camera using Raspberry Pi, that could then upload a snapshot of the developed urine strip to Matlab where I can run processing software to match the color given to me to a reference... so yes, hopefully not having the customer sticking their head in the toilet bowl. Does anyone know of there's a way to connect suction cups to the arduino? That, and magnets, are two ideas I've thought of recently.

What? Is the Arduino inside the toilet? It has to be in a dry place.

NeonCop:
For the urine or pH analysis, I was thinking of setting up a camera using Raspberry Pi...

Camera in toilet sending pictures somewhere? I think you will have hard time to convince people it is an innocent feature caring for their health. I looks like a strange form of porn instead.

Urine...Uric Acid.

Just go give you a hint...it is alreayd acidic and tells you nothing about potential drug use.
Unless you are trying to tell people they need to drink more water...then turbidity/colorimetry is more applicable.

wvmarle:
No, it's not. There are no dyes that show colour depending on the pH with any accuracy

How exactly do you think pH paper works? It's all based on dyes that change color in relation to pH. The same is done quite often in aqueous solutions. To get more accuracy you use a combination of dyes. But to that end, it is no more or less accurate than the paper and suffers from exactly the same sets of interference. If you want a real measurement of pH you go for a pH probe and meter.