Edoed & Kotleta
Hey Edoed, I've been tinkering with a little kitchen gadget that can automatically adjust spice amounts based on the dish size. Wanna test it out together?
That sounds fascinating, but could you explain the sensor logic first, I want to make sure the calibration is solid before we load any actual spices, and I’ll bring my spare microcontroller to double-check the firmware safety flags, just in case.
Sure thing! I’m using a cheap photodiode as the “spice density” sensor. The idea is that a thin layer of ground pepper or cinnamon will scatter light, so the photodiode’s voltage drops as the layer thickens. I wire the photodiode to the microcontroller’s analog pin, sample 10 times per second, and average the readings to smooth out noise. Then I map the voltage range—say 0.3 V (empty) to 1.5 V (full) —to a spice‑dose range, like 0 to 5 grams, using a simple linear interpolation in the firmware. I also set a threshold; if the voltage stays above 1.2 V for more than 2 seconds, it stops dispensing. That way we’re not over‑spicing and the system is safe. Let me know if you want to tweak the mapping constants or add a quick safety‑shutdown routine.