- Background: I am creating an automatic tea brewing machine using an Arduino and an electric water kettle from Amazon. My family and I drink lots of tea and we have many different sizes of glasses. I was going to use a peristaltic pump to transfer the water from the kettle to the tea glass (mainly because it's food safe and self-priming).
Task at hand: I need a way to know when to stop pumping the boiling water from the kettle as to not overflow the tea cup. I was thinking of 3D printing a bracket that will hang over the lip of the cup (like on the side) that will have two wires facing down towards the bottom of the cup. One wire would be connected to ground and one to an input on the Arduino. That way, as the water fills to the top and eventually touches the exposed ends of the wire, the Arduino would know to stop pumping because the wires are now conducting to Ground.
My question is: Is my method listed above safe to do in drinking water (exposing a path to ground in the water for a few seconds), or is there a better/safer/easier way to accomplish my task?
I was thinking of 3D printing a bracket that will hang over the lip of the cup (like on the side) that will have two wires facing down towards the bottom of the cup. One wire would be connected to ground and one to an input on the Arduino.
That technique should work for you. It is commonly used by visually impaired people for that task.
Figure 1. Liquid level sensor alarm for cup / mug.
Because you are feeding into a micro-controller GPIO you will need to make some test measurements.
Figure 1. Probes and pull-up.
Without the micro-controller connected run some tests with a volt-meter connected between 'GPIO' and GND. Adjust R1 (a pot might be handy for this) until you can guarantee that GPIO gets reliably pulled down to about 1 V or so when the probes are covered to the required depth. 'GPIO' will read 5 V when probes are dry.
You could use a rangefinder mounted above the cup to measure how much fluid you are adding to the cup, and have the cup set up to automatically add a specific "height" of fluid, eg. 4 cm. You would even adapt Solar Mikes suggestion and have presets (1 cm, 2 cm, etc.)
You could look into items like an ultrasonic sensor (Google arduino ultrasonic sensor, or https://www.sparkfun.com/products/9495), or an infrared rangefinder (https://www.sparkfun.com/products/8958). I've used the ultrasonic sensor before and it has a resolution of about 1 cm, which might be a bit low for this application. I believe the infrared sensor has a better resolution, but I've never used one.
After a bit of thought, one clever, but arduous and tedious solution would be to attach RFID tags to each cup bottom, and a reader on device, then program the desired amount manually.
I'd go a completely different route:
- have a device that identifies cups/glasses
- calibrate your containers
The second part is really easy. Have a mode in your firmware where you push a button until the cup is sufficiently full. Your firmware then memorizes that amount of pumping and applies it next time it encounters the same container automatically.
The first part might be harder, but on the other hand, cups sound relatively easy to tell apart when they're always placed on the very same spot in front of a camera. I'd recommend a webcam, a white LED to illuminate the observed site of the cup, and something like a raspberry pi.
Apply OpenCV's classical object classification, or experiment with the fancy deep neural networks (DNN) everyone and their mother plays with these days – tensorflow might be a good tool to start with, and they have a tutorial where they recognize digits that are horribly scrabbled; well-placed, optically precossed cups (edge detection?) should be easier.
Answering your actual question, instead of proposing alternatives: of course it would be safe. Why would it not be? @Transistor shows an off-the-shelf product that you could adapt for purpose. There are others, like water sensors to put on the floor near a water heater to sound an alarm if it starts leaking.