Jestersix

DIY Smart Sensors w/ Matter (starting with TDS)

richiev

Supporting Member
I found my RODI had elevated TDS, despite DI resin not having changed colors. I decided I might as well get an inline TDS meter, but then I eventually decided to look into just buying the sensors and DIYing. $5 in aliexpress sensors + a $5 ESP32 + a bit of coding and a couple boring pictures come together:

AJFCJaXxal5OE29rvX-y6fOaOzldldWyTUbkqDIdzT9Pcf424Uab1gmA_hNhosEIp2QH7T9MXrmw94XuKqWz4F3-T45AJl_U3IO72d0X6yfbRQn0fGRa4ggBZCQsROWPl9OJoIK-Y80MamlXQ6sTontgpHs3Kj-EQ6DcpK-g5H54Misg1dwpdCG4nRVJ3q8XKq4eQKkc3dWi1JVCyYEhQdhGvJjR_93BaM-mpwwkMwwYU5j5CVCmUBzrDfIYYC6XbephAbwmnHK6g7C6utk96YvhcgnqlFD0ZQuhPMvLgdKYFKwai753KP2DiPpdBP9jRo59_In29b2nK1DEf3ZCydld-NtfgZdL5rSdkiIkS53LhePHdJh4bmnD5PHTHQ4kYZijspiHhhztHHw6jOQxnfJ2Eifu60N-B8jxk9EpZ4EPNdWcbRJ7ojSKU6130uefTCd92aPMOcD2UWM0Oe1k350e_ga-htkb6GZw1QCsa9E0YYkcvNeqgIGksUV_rlerK_DPysBHa-DS1Apa93XlgvIok1X4MtxnOqKC0GMq1ZSz0lgF8gcl9sVhS9gTrzRLu7uEZaVX-PfE5TxNF7_dxr24dKlXh6SPfEJMTd8IGjSKhWxlCXqRNp8GApMb_QlIwKmVuNzAn2HI-wql8txrsdfWmc38-91XCZFcOxCn-UN4kwW0zrr9mrREYTmI1VdKg-cMemb3lkvQLrG3qc1BuvR2w5eAlKOXX_apwc2Gb97wMbznelDKzcFogBl5zYH82YvfXwoo8C4j-7Hp_hegWN6Ubfa4wrRXvrmMUXAZFRXzfALd5BgP42OgVGgxyV9R-vUBW0odYEgRDpOA3g_RPX3Oc1WUskfBaGkox7hohmWoIpG2XRs4PInxS9OMOp0xPDuqd_Uc2GhPPUWZZ9HsH3pWMyJZ_GULEnobpCYmWenpsz9LFO88bFjPyXQ6T2JDj-g=w1728-h1122-s-no
AJFCJaWW7IAGJlSNpw8G5br0FvWn6bOMQBQY2yAD3jPwuuqWLdd-jJctBOO4OoHGgwgvA34vecX7-gbphiJ9tZ992S_sgYyKgf1ue1ML6hbfbnKm5gip_V7gyHU5lvSwTNz9s_TQBMUWhKSAPYUS3Ze2BQrpXw7P2SDIz4YnHzrbV2VCPRYbczL2kFut31ahyt2HQtmcCpQcIxPT8DfyGLQ168hM-ttggcXH_QThcWLdzLbbXqtWPUC8WslgOl4Q06M9zCEpFBmkWtwHLnmbYDELax3P0lU_kMmqtO4-zbzqUB9YqddkQ_qHqNG2LKaR9U1EgNQQJPmaEq2qIVPgCQCDVUB2PZKWBThxT7PUBqig6OX_Lmj3BCv14iBoMAv8LrMm9VQHbg17aCChoyJ_PlJ6nEVK03mFt8YvQT7Vl9lwtrLe2gKw9GiyiED0Fwp_lFFLGnKLHaa5C_vH-G7j1Pr1FW8wNWRzanH0xndjCLHfe7xAdJioJG_A-gzdmawwZtubFB9xdK-HxmJevUcl_UpUGkbnmyTkxNrqFCGrCF_k3yPwWlrz37TEK4pVSR_DQjcHsOG2YC4PcFHOPHkJ_Q-NTdbUCYrUwnJTT4rgLqj84KBwBADoZbgh7bVQHR5VLIfIGoh0aCzJCrVTLQAjJHoc8SFYBaueKkwOSFjfsOWJkuib6P5nd-Oid4m6VvrH8qZMYqvVllMpRa1EnqfIkFcm85ALXZHF-kPlRwcYgMsCqzJl18FOPJxM4O-HMhWJ7hnmjigwRivZwpgoB3grbt4DYXfv9zjRuWocZ94f2lVj2JVbe__hT5_z-TVncbIZ7wcppXW7UcVfe6GkJbwyLoLIwqy8mYuIDGsRHopw8962uPbRjypd9WqdR1mJegxcNvfOsKj0R2IYPL8RVf6OJH9ONyzzTH4boGwyJnZ4CT-iTPQWyAlCKc0AHJhsCpYY4bE=w1506-h2000-s-no


That's showing the TDS sensor (white cord) in a glass of water, connected to the ESP32 (little wifi/bluetooth microcontroller). Getting a reading from the device is literally 5 lines of code (that picture isn't the 5 lines ;) ).

The next part is getting the data somewhere usable. As I'd outlined in the smart home sensor thread, I've had this lingering suspicion for awhile the future of aquarium controllers should be built around standard smart devices. In particular with Matter being a common standard that companies have moved towards, it should be a lot easier to put together an interesting collection of devices all connected to various smart controllers (Google Home, Apple Homekit, plus in theory custom things like an aquarium controller).

I decided this was a good chance to test that out too. With a bunch more research, and a bit more coding, next comes this screenshot:

AJFCJaUNboQP98S9DzZHtN6F9-27eJZxxeUXnBicSMGcOhbZtGRENakL3wB9sIVKWAxbt8jE3VPX-QsQ6fIExD6QVgE7JgAC2oCjBqEuN9tJQSgJyqYLuIfrc3YoRAOemvJdMn4pj9W6h7eruXHSuTzLdBIo0Q3pntOaRV1OKpzsd4kPOYqgDI-dp2ORek3DNeeV0EQeCc4AhfjdE4R4zjD7m9aGSi3vQHCkickBZ6IAQp2kuGq7OkMaznD1VszGdZ3PEu_XSje4ZjoOFG4N0RAu5l-Np_RvSbXfbQQZn8_4xUyqOb3778Xc5o9Py-Am2DcjlETJR5E2c64kYD60HTjm3IdNd7hIstmE4eWaGJ6C1FbDGrSqlefat5Ecfh9n5HpdN-9mm507CABJVOgBY-J6j2VKcy2G90Rx_7kvoOZYxkVwow1AVZNRLh-r5QdyH1KlzqWe3Kh1hDcl0bC7i6kPg1tkUaQvUOzrE_FZSQZx0dEzwGiCHa-y5uZ3QBAHQhruN7IlGStY-DA0qhTm4buUQ0uwAtUYgXUXmX3ueZOi0dB0RRwiHn-ZbiQuWMZ6k1a7wyFs7i-tqb59CBG60KuqERmNdJojaQZkwGRYZazpMyQQtUs-rVkh8bY2-txJ4-9nO0jAI8CvgjPUVl4P_f9Y29wYPUH-eGpEXcWWHunsoo827nV1dp4D_YbQlukkZOejrWsL49HgZsL8Pu9KakPC4ulRE6MoaZfUacm4wyUEkGO6oVIiPVDRIuNDzhJn6xVk1hFOUaUczR3iYIdv6ZdoSlkKnrKTMO6wszZnXA4NLMRiUKUPyqC914K-NFXzkX2FH37-OvsokIIZZr0RSQFeekWuyGtarQf4n6Et30khPXMeVOb9D3EsteyDOp1wL3ZEbM8cAkRxQGRBvUUyrm0vDdd-UUWMVPKIFpqE0ov_d-ZKTJR3dME3vUQmAWZAQIo=w1080-h1548-s-no

That 83 represents the current TDS reading from my TDS sensor, viewed in Google Home connected wirelessly on my local wifi network via Matter. The fact that it says Temperature and °C is a hack and can be ignored. That's a side effect of some of the code I used, and it has nothing to do with temperature.

With this I can now say "Hey Google, what's my TDS" and google home will query the TDS sensor and read the value back. Same as any other smart device.

Getting that to work is a much bigger ordeal than I imagined, but generally feasible. My next step is getting things setup so I can pull data from some other sensors I have (CO2, pH, eventually my alkalinity tester). After that is connecting it to a controller device.

Anyway, is this more functional than the Apex version, or easier to setup, or whatever? No, definitely. For me doing the initial work it's also not cheaper. However, it's pretty neat how relatively straightforward this stuff is to put together (admittedly first requiring various bits of info) and I think it proves this is possible.
 
Also let me know if anyone wants a TDS reader with wifi, optional display, optional however many probes you want, independently viewable, and able to integrate into your smart home things. I can point you at how to do it or possibly build one for you. I'll push the code and parts list to github at some point. I might even design a case for it.

DIY cost is ~$7 per sensor (my math above was wrong because I forgot shipping) + ~$7 for the ESP32 + ~$4 for the display + either a power cord or a basic battery + some wires/solder. If I do it the cost is parts cost + $1 if you're nice :).
 
Here's another I've put together. This is a pH probe that's connected to my Home Assistant set-up. Gives me nice charts and I can setup whatever automation I want

I designed the enclosure myself. Will upload it all to some standard place at some point.
PXL_20240204_001907655.PORTRAIT.ORIGINAL.jpg

PXL_20240204_001934248.PORTRAIT.ORIGINAL.jpg


Screenshot_20240203-161941.png

Screenshot_20240203-162402.png
 
Back
Top