FAIL: touch button as liquid detection
Do you remember the need of a liquid-detection functionality, to find out if somebody is drinking? On the first version of the PCB, we tried to abuse a PCB capacitive touch button for this cause. It worked perfectly for a finger touch on the PCB, even with a bit of plastic as shielding. For the liquid detection, it didn’t. The signal was too weak, because of the large distance between PCB and liquid, only a bit of liquid in reach and a lot of interference if touching the sensor unit itself.
The first thought is to increase the size of the sensor, following the specifications Cypress is giving. This would increase the size of our calculation unit by 100% at minimum. Not an option. Another way would be to use an extra, flexible PCB as touch sensor and wrap it around the mouthpiece, to maximize the effect of water/no water in the overall signal. Which means extra work, more mechanical complexity and a flexible PCB (check the price!). No, we don’t do that.
WIN: Low power accelerometers are super cool
Low power accelerometers are a good indicator for that we already live in the future. These tiny pieces of silicon are a small miracle for themselves, the fact that you get them for less than a dollar is another wonder. And a solution to our problem!
The accelerometer is always on, using only 6 µA, while constantly checking the acceleration with a frequency of 50Hz. As soon as it detects acceleration stronger than a threshold (somebody gripping the straw), it tells the PSoC with an interrupt, which then switches on the power-hungry hall sensor. No movement and no hall counts for more than X seconds -> switch hall sensor off. Problem solved.
As the used MCU can wake up from all power saving modes on interrupt and we get this interrupt by the accelerometer now when significantly moved, we enjoy another benefit: we don’t need to fiddle around with different low power modes for the CPU and BLE module and all that. We simply put the PSoC into power off and let it restart with an interrupt from the accelerometer. Because the value of variables in the code isn’t maintained during power cycles and I didn’t feel like manipulating the PSoC's flash memory to store data in between power cycles, we add a little EEPROM to the PCB.
Note: in the earlier PCB, there was also space for an accellerometer, but the traces were not routed correctly. This version works now and became a little smaller, too.