<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Theodore Kovalev]]></title><description><![CDATA[Theodore Kovalev]]></description><link>https://www.waterengineeringlab.com</link><image><url>https://www.waterengineeringlab.com/img/substack.png</url><title>Theodore Kovalev</title><link>https://www.waterengineeringlab.com</link></image><generator>Substack</generator><lastBuildDate>Sat, 13 Jun 2026 12:35:33 GMT</lastBuildDate><atom:link href="https://www.waterengineeringlab.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Theodore Kovalev]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[theodorekovalev@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[theodorekovalev@substack.com]]></itunes:email><itunes:name><![CDATA[Theodore Kovalev]]></itunes:name></itunes:owner><itunes:author><![CDATA[Theodore Kovalev]]></itunes:author><googleplay:owner><![CDATA[theodorekovalev@substack.com]]></googleplay:owner><googleplay:email><![CDATA[theodorekovalev@substack.com]]></googleplay:email><googleplay:author><![CDATA[Theodore Kovalev]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Building a Website for Green Club]]></title><description><![CDATA[Decide how to decide]]></description><link>https://www.waterengineeringlab.com/p/decide-how-to-decide</link><guid isPermaLink="false">https://www.waterengineeringlab.com/p/decide-how-to-decide</guid><dc:creator><![CDATA[Theodore Kovalev]]></dc:creator><pubDate>Sat, 06 Jun 2026 13:05:17 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/296fb862-d2a0-4f78-9f22-6ff3fb5638a1_906x951.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The Green Club at school needed a website, so I volunteered to build one. It seemed like a nice way to be useful. Easy enough.</p><p>I quickly learned that you cannot build a website out of nothing. Before anything actually gets made, you have to pick the tools you are going to use to make it. So without realising it, the first thing I did wasn't building a website at all. It was trying to choose a platform to build one on.</p><p>My first instinct was to go for the fun part. The first platform I thought about using was Vercel. A friend had told me you could push your own code and have a live website within minutes, which sounded exciting until I started thinking about who would maintain it after I was gone, at which point the excitement cooled noticeably. So I kept looking. Then Wix. Then Notion. That evening I alternated between the tabs I had open and made absolutely no progress, picking one platform over another and then endlessly justifying my choice. I was losing a battle with myself, which is the most annoying kind of battle to lose.</p><p>I had quietly jumped from "build a website" to "choose a platform" without noticing, and then it went a rung deeper. The problem wasn't picking a platform. The problem was that I had no rules for picking a platform. I was choosing based on whichever option looked nicest to me ten minutes ago. Then a slightly unpleasant thought came to me. Picking a platform is work. It is an actual task, just like building the site, or writing, or anything else. And task work cannot be done on gut feeling. There has to be a process. So the first task wasn't deciding which website-building tool to use. The first task was deciding how I was going to decide which website-building tool to use. I had to build a process, then run the process, then decide.</p><p>What got me there was, of all things, curiosity. I had hit a dead end and figured: people build software for a living, surely they have a better way of choosing software than I do. So I looked it up. It turns out professional software engineers have a very dry, very structured way of making decisions, and they actually write the reasoning down beforehand. The format even has a name. An ADR, short for Architecture Decision Record. I borrowed the system.</p><p>The funny moment came when I started writing my first one. I was using the ADR format, and when I got to the "A" for "architecture," I had to pause. I wasn't designing any software. I was choosing a way to decide. I almost gave up on the format right there, until I realised that what I was choosing was architecture, just not software architecture. A method is a way of structuring how a team works and decides. That is organisational architecture. So it actually belonged in an ADR. This became <strong>ADR-1</strong>: the method itself.</p><p>The method I landed on had two steps. First, score every option against a set of hard criteria and throw out anything that fails any of them. No exceptions, no special cases, no rescuing your favourite option just because you like it. Then take what is left, and score those options against what each team member weights as most important. The second pass makes sure that a small win on something genuinely important doesn't get cancelled out by a small win on something trivial.</p><p>The process forced me to be honest with myself about who I was actually building the website for. I will be graduating in two years.</p><p>The people who will come after me to update the site, to post events and announcements, are not programmers and won't be. The only person who could realistically deal with a technical problem on the site is me, and I will not be there. Engineers have a slightly dark term for this sort of situation, the "bus factor." How many people would have to be hit by a bus before the project is abandoned? Mine was one. Me.</p><p>Only one thing defeated my first choice. I wanted to build something impressive. Something custom-coded, fast, and showcase-worthy. I could have built it. But once I was honest with myself that I would be the only person on Earth able to maintain it, it failed one of my own criteria, and I had to drop it. No matter how much I liked the idea.</p><p>The options I had been least excited about were the ones that remained. I scored them, and the clear winner was Google Sites. By far the least exciting option on my original list. The right answer was the boring one. That frustrated me for about a day. Then it stopped frustrating me, because I understood why. A website that goes dead the moment its one technical person leaves isn't a better website. It is a worse website that happens to be clever.</p><p>Looking back, the choosing itself had two distinct steps rather than one. Step one was choosing the method. Decide how I would decide, then write it down. That became ADR-1. Step two was the actual choosing. Run the method, score the options, write down the outcome. That became ADR-2. Only after both of those steps did I actually open a browser and start building.</p><p>The detour cost me about two evenings I had set aside for coding. They were two of the most useful evenings of the whole project, and I don't think that had very much to do with the website itself. It was the first time I caught myself falling in love with the most complicated option, mid-fall. Before this, I had been optimising for what would impress people, and what would impress me, rather than what would actually be useful for the club after I was gone.</p><p>So I ended up with two of these records. <strong>ADR-1</strong> contained the method, the rules I would use to choose. <strong>ADR-2</strong> was the result of actually applying the method, written up the same way. Two steps of work, two records. I like that they exist. They show that the choice wasn't made impulsively, and they leave a note for whoever inherits the site about why it is the way it is. They are included below, in all their boring formatting.</p><p>Architecture Decision Records:</p><ol><li><p><a href="https://github.com/Steamrol1er/green-club-site/blob/main/0001-decision-making-methodology.md">ADR-0001: Decision-Making Methodology for the Green Club Website</a></p></li><li><p><a href="https://github.com/Steamrol1er/green-club-site/blob/main/0002-website-platform.md">ADR-0002: Website Platform for the Green Club</a></p></li></ol>]]></content:encoded></item><item><title><![CDATA[My Engineering Club Lecture: How to Identify a Leak]]></title><description><![CDATA[The hidden mathematics of listening to broken pipes &#8212; and why it's the same maths behind MRI scans, Wi-Fi, and MP3s.]]></description><link>https://www.waterengineeringlab.com/p/my-engineering-club-lecture-how-to</link><guid isPermaLink="false">https://www.waterengineeringlab.com/p/my-engineering-club-lecture-how-to</guid><dc:creator><![CDATA[Theodore Kovalev]]></dc:creator><pubDate>Wed, 06 May 2026 13:47:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!_lhm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff15c9e41-5921-4253-ac07-77648b62edd9_1920x890.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The UK loses 3 billion liters of perfectly good drinking water every single day. The water is losing its fight against the damaged pipes beneath the ground. The cracks in the pipes are unrepaired since the pipes are neither easy to access nor easy to trace. I presented this problem to the Engineering Club and asked the following question:</p><blockquote><p>What is the best way to locate an unseen and inaccessible leak in a pipe that we cannot dig out and repair?</p></blockquote><p>My idea is that the solution is actually a simple answer. It is mathematics. More specifically, a type of math that originated about 200 years ago with a Frenchman interested in the movement of heat through metal.</p><div><hr></div><h1>Everything can be considered a signal</h1><p>When sounds are made, changes in the air pressure are made over time. The sound of a heartbeat is the measurement of changing voltages over time. A pipe that is leaking also produces a vibration that is a measurement of amplitude changing over time. While most things can be considered a measurement of a changing signal, there is a problem. If you are looking at a raw measurement of a vibration, it will most likely appear to be a chaotic mess. It will be an honest measurement of a signal, but a wholly meaningless display of one.</p><p>This is represented in the graphs below.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_lhm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff15c9e41-5921-4253-ac07-77648b62edd9_1920x890.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_lhm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff15c9e41-5921-4253-ac07-77648b62edd9_1920x890.png 424w, https://substackcdn.com/image/fetch/$s_!_lhm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff15c9e41-5921-4253-ac07-77648b62edd9_1920x890.png 848w, https://substackcdn.com/image/fetch/$s_!_lhm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff15c9e41-5921-4253-ac07-77648b62edd9_1920x890.png 1272w, https://substackcdn.com/image/fetch/$s_!_lhm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff15c9e41-5921-4253-ac07-77648b62edd9_1920x890.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_lhm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff15c9e41-5921-4253-ac07-77648b62edd9_1920x890.png" width="1456" height="675" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f15c9e41-5921-4253-ac07-77648b62edd9_1920x890.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:675,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1831081,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://theodorekovalev.substack.com/i/200890203?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff15c9e41-5921-4253-ac07-77648b62edd9_1920x890.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_lhm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff15c9e41-5921-4253-ac07-77648b62edd9_1920x890.png 424w, https://substackcdn.com/image/fetch/$s_!_lhm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff15c9e41-5921-4253-ac07-77648b62edd9_1920x890.png 848w, https://substackcdn.com/image/fetch/$s_!_lhm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff15c9e41-5921-4253-ac07-77648b62edd9_1920x890.png 1272w, https://substackcdn.com/image/fetch/$s_!_lhm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff15c9e41-5921-4253-ac07-77648b62edd9_1920x890.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h1>The Cake and The Recipe</h1><p>One raw signal is like a cake with no recipe. A raw signal is essentially a cake and with no recipe you can&#8217;t really decipher what the ingredients are. When you see a cake you probably think that the cake is the final product and the recipe is the process behind the creation of the final product. The Fourier Transform is the machine that turns the cake back into the recipe. The Fourier Transform tells us that any raw signal can be constructed by simple sine waves and that every frequency and every raw signal completely describes itself and makes a unique fingerprint and will be found by the transform. Just by knowing this and how to describe these simple sine waves allows us to create MRI images and Wi-Fi, MP3&#8217;s and JPG images.</p><h1>Listening to The Pipe</h1><p>When pressurized water leaks out of a pipe it causes a vibration in the pipe. When this vibration occurs it then starts a chain of acoustic emissions and these emissions will spread throughout the length of the pipe. If you put sensors above the pipe in the location where the emissions have spread, you can use the Fourier Transform and cross correlate both recorded signals. The time delay between when the emissions are heard will provide a location of the leak, sometimes within a meter of where the actual leak is, without having to lift a single paving slab.</p><p>The telltale sound of a leak is determined by pipe type. For metal, it&#8217;s the 100 &#8211; 1000 Hz range. For plastic, the range is 20 &#8211; 250 Hz. However, these frequencies are coupled with a 50 Hz mains hum, noise from low-frequency traffic, pumps, and random thermal noise.</p><p>In these situations, the philosophy of &#8220;noise&#8221; becomes interesting. <strong>Noise is not incorrect data</strong>. Noise is everything in the data that does not pertain to the answer of the question posed. To a leak hunter, a rumbling bus is considered noise. To a bridge engineer, the leak is the noise.</p><h2>Same Data, Different Lens</h2><p>The best example I could provide the club was the following. Take a recording that looks like chaos, and apply the Fast Fourier Transform. Suddenly, you can see. The rumble of the low-frequency traffic is in a clump on the left. The sharp spike of the mains hum is at 50 Hz. In the leak frequency range, there is a suspicious peak. Something is in that pipe.</p><p>You have not altered the data. You have altered the question to something you can now see.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ObNg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0ac4d8f-4fda-48ae-b361-53c43dfa596e_2618x890.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ObNg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0ac4d8f-4fda-48ae-b361-53c43dfa596e_2618x890.png 424w, https://substackcdn.com/image/fetch/$s_!ObNg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0ac4d8f-4fda-48ae-b361-53c43dfa596e_2618x890.png 848w, https://substackcdn.com/image/fetch/$s_!ObNg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0ac4d8f-4fda-48ae-b361-53c43dfa596e_2618x890.png 1272w, https://substackcdn.com/image/fetch/$s_!ObNg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0ac4d8f-4fda-48ae-b361-53c43dfa596e_2618x890.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ObNg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0ac4d8f-4fda-48ae-b361-53c43dfa596e_2618x890.png" width="1456" height="495" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a0ac4d8f-4fda-48ae-b361-53c43dfa596e_2618x890.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:495,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:930707,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://theodorekovalev.substack.com/i/200890203?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0ac4d8f-4fda-48ae-b361-53c43dfa596e_2618x890.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!ObNg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0ac4d8f-4fda-48ae-b361-53c43dfa596e_2618x890.png 424w, https://substackcdn.com/image/fetch/$s_!ObNg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0ac4d8f-4fda-48ae-b361-53c43dfa596e_2618x890.png 848w, https://substackcdn.com/image/fetch/$s_!ObNg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0ac4d8f-4fda-48ae-b361-53c43dfa596e_2618x890.png 1272w, https://substackcdn.com/image/fetch/$s_!ObNg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0ac4d8f-4fda-48ae-b361-53c43dfa596e_2618x890.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>The Bigger Picture</h2><p>I wanted to end my lecture with a statement I hold dear. New infrastructure is simply old hardware and a new way to think about math. Civil engineering is becoming an information science.</p><p>Many infrastructure failures have tell-tale signs long before people realize they are happening. Data repeatedly sent out. The only question is if anyone is picking it up.</p><div><hr></div><p>This was a lecture that lasted about an hour and a half. We began with signal math and moved into the Fourier Transform. After, we played a real pipe recording. We finished by revealing a hidden leak using frequency spectrum. If you want to go deeper look up acoustic leak detection and cross-correlation, and be warned: the rabbit hole is very, very deep.</p><p>My full presentation below</p><div class="file-embed-wrapper" data-component-name="FileToDOM"><div class="file-embed-container-reader"><div class="file-embed-container-top"><image class="file-embed-thumbnail-default" src="https://substackcdn.com/image/fetch/$s_!0Cy0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack.com%2Fimg%2Fattachment_icon.svg"></image><div class="file-embed-details"><div class="file-embed-details-h1">How To Hear A Leak</div><div class="file-embed-details-h2">1.1MB &#8729; PDF file</div></div><a class="file-embed-button wide" href="https://theodorekovalev.substack.com/api/v1/file/efa0be4c-b39a-45b7-b87a-f2eaa9322835.pdf"><span class="file-embed-button-text">Download</span></a></div><a class="file-embed-button narrow" href="https://theodorekovalev.substack.com/api/v1/file/efa0be4c-b39a-45b7-b87a-f2eaa9322835.pdf"><span class="file-embed-button-text">Download</span></a></div></div><p>:</p><p></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.waterengineeringlab.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[We Built a Water Tester. Cambridge Just Called it ‘Highly Commended’ ]]></title><description><![CDATA[My classmates and I built a portable water tester that indicates if drinking water is safe within minutes and without the use of a laboratory or electrical outlets.]]></description><link>https://www.waterengineeringlab.com/p/we-built-a-water-tester-cambridge</link><guid isPermaLink="false">https://www.waterengineeringlab.com/p/we-built-a-water-tester-cambridge</guid><dc:creator><![CDATA[Theodore Kovalev]]></dc:creator><pubDate>Sun, 19 Apr 2026 08:09:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!PS5c!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F954960a1-4f39-4164-bed1-6c787a50c022_2562x1814.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>My classmates and I built a portable water tester that indicates if drinking water is safe within minutes and without the use of a laboratory or electrical outlets. Our project was awarded the title of &#8216;Highly Commended&#8217; at the <strong>Davidson Inventors Challenge</strong>. This challenge, organized by the University of Cambridge&#8217;s Chemical Engineering and Biotechnology department, is in collaboration with the Institution of Chemical Engineers (IChemE).</p><p>Our certificate was signed by Professor Clemens Kaminski and Raffaella Ocone OBE. It describes the award as being given for "showcasing exceptional creativity, groundbreaking innovation, and a passion for solving real-world challenges." I have read that sentence at least twenty times. I hate it, appreciate it, and am grateful for it, all in roughly equal amounts.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PS5c!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F954960a1-4f39-4164-bed1-6c787a50c022_2562x1814.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PS5c!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F954960a1-4f39-4164-bed1-6c787a50c022_2562x1814.png 424w, https://substackcdn.com/image/fetch/$s_!PS5c!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F954960a1-4f39-4164-bed1-6c787a50c022_2562x1814.png 848w, https://substackcdn.com/image/fetch/$s_!PS5c!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F954960a1-4f39-4164-bed1-6c787a50c022_2562x1814.png 1272w, https://substackcdn.com/image/fetch/$s_!PS5c!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F954960a1-4f39-4164-bed1-6c787a50c022_2562x1814.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PS5c!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F954960a1-4f39-4164-bed1-6c787a50c022_2562x1814.png" width="1456" height="1031" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/954960a1-4f39-4164-bed1-6c787a50c022_2562x1814.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1031,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2146014,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://theodorekovalev.substack.com/i/200897662?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F954960a1-4f39-4164-bed1-6c787a50c022_2562x1814.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PS5c!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F954960a1-4f39-4164-bed1-6c787a50c022_2562x1814.png 424w, https://substackcdn.com/image/fetch/$s_!PS5c!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F954960a1-4f39-4164-bed1-6c787a50c022_2562x1814.png 848w, https://substackcdn.com/image/fetch/$s_!PS5c!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F954960a1-4f39-4164-bed1-6c787a50c022_2562x1814.png 1272w, https://substackcdn.com/image/fetch/$s_!PS5c!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F954960a1-4f39-4164-bed1-6c787a50c022_2562x1814.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">The Highly Commended certificate from the Davidson Inventors Challenge</figcaption></figure></div><p>This is the story of how we built it, and why. The problem we set out to solve isn't the kind of problem that gets solved easily, but we figured we should at least try.</p><h1>Millions Live Without Safe Drinking Water</h1><p>More than 2 billion individuals do not have safe drinking water. We researched and studied the statistics, and we were shocked to find that, in Sub-Saharan Africa, approximately 33% of the population rely on surface water that could be contaminated with waterborne pathogens.</p><p>The standard way to check if water is microbiologically safe is to culture a sample in a lab and measure how much grows. It's reliable but slow. One to three days, typically. If you are standing in front of a stream right now, wondering whether you can drink from it, three days is not a useful answer.</p><p>So we asked ourselves the question: could you build something that gives an answer in minutes, costs almost nothing, and runs on sunlight? It sounded slightly insane when we wrote it down. But that was the goal.</p><h1>What we invented: the Firefly Hydrolyte</h1><p>The solution was the device, the <strong>Firefly Hydrolyte</strong>, which is portable and completely reusable, and tests water for four parameters:</p><p>- <strong>Microbiological activity</strong>, via ATP-bioluminescence, which is the same chemistry that produces glowing light in fireflies. Since ATP is a biomolecule and exists in all living organisms, its detection is a rapid and reliable indicator of the presence of an organism in the water.</p><p>- <strong>pH</strong>, in case of chemical imbalance.</p><p>- <strong>Total Dissolved Solids (TDS)</strong>, which is a quick measurement of dissolved ionic contamination.</p><p>- <strong>Temperature</strong>, which, as I&#8217;ll elaborate, is of more importance than it seems.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!X2t0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52c0bec4-0bfd-417d-9943-5bb67b47229d_592x706.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!X2t0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52c0bec4-0bfd-417d-9943-5bb67b47229d_592x706.png 424w, https://substackcdn.com/image/fetch/$s_!X2t0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52c0bec4-0bfd-417d-9943-5bb67b47229d_592x706.png 848w, https://substackcdn.com/image/fetch/$s_!X2t0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52c0bec4-0bfd-417d-9943-5bb67b47229d_592x706.png 1272w, https://substackcdn.com/image/fetch/$s_!X2t0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52c0bec4-0bfd-417d-9943-5bb67b47229d_592x706.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!X2t0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52c0bec4-0bfd-417d-9943-5bb67b47229d_592x706.png" width="592" height="706" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/52c0bec4-0bfd-417d-9943-5bb67b47229d_592x706.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:706,&quot;width&quot;:592,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:694770,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://theodorekovalev.substack.com/i/200897662?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52c0bec4-0bfd-417d-9943-5bb67b47229d_592x706.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!X2t0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52c0bec4-0bfd-417d-9943-5bb67b47229d_592x706.png 424w, https://substackcdn.com/image/fetch/$s_!X2t0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52c0bec4-0bfd-417d-9943-5bb67b47229d_592x706.png 848w, https://substackcdn.com/image/fetch/$s_!X2t0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52c0bec4-0bfd-417d-9943-5bb67b47229d_592x706.png 1272w, https://substackcdn.com/image/fetch/$s_!X2t0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52c0bec4-0bfd-417d-9943-5bb67b47229d_592x706.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">One of our early physical models &#8212; roughly 9.6 &#215; 5.5 &#215; 10.1 cm &#8212; mapping out the cap, solar panel, sensors and onboard electronics</figcaption></figure></div><p>We made the output deliberately simple. A safety rating from 1 (unsafe) to 3 (safe), shown on a small screen. That wasn't the plan at first. Originally we had a much fancier interface with numbers, units, and graphs. Then we surveyed potential users, and almost every one of them said the same thing: just tell me if I can drink it. We overhauled the design around that.</p><p>The feature that I lost the most sleep over</p><p>My job on the team was to get the device to self-calibrate and run on solar power. It turned out to be the hardest part by some distance.</p><p>Here was the problem. The enzyme that makes the glow happen, luciferase, is fussy about temperature. The same water sample will produce different amounts of light depending on how warm the water is when you test it. If you don&#8217;t account for this, your readings are just wrong. And a water tester that gives wrong readings is genuinely worse than no tester at all, because at least with no tester, nobody is being lied to.</p><p>So I used published activity data to draw a curve relating luciferase activity to temperature. With that curve, you can take a raw light reading at any temperature, work out what fraction of peak activity the enzyme is running at, and back out what the reading would have been under standard conditions. We built that logic into the device. I also added a precaution: if the temperature or pH reading is unreasonable, the device throws an error rather than confidently making things up.</p><p>The same self-calibration logic applies to the hardware overall. The device doesn&#8217;t slowly drift out of accuracy, and doesn&#8217;t need a reference standard to stay reliable. It also runs on solar power, which means it can be used out in the field, where wall sockets tend to be in short supply.</p><p>One of the biggest lessons I learned came from the many attempts to get that curve right, not from the things that worked out on the first try.</p><h1>Testing</h1><p>This was not a "poster and pray" project. We built a working prototype around an Arduino, wired up the sensors, and tested it with real water samples.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!w_Qt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde81e833-9f5e-4069-b6ed-ac2335739377_1268x614.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!w_Qt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde81e833-9f5e-4069-b6ed-ac2335739377_1268x614.png 424w, https://substackcdn.com/image/fetch/$s_!w_Qt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde81e833-9f5e-4069-b6ed-ac2335739377_1268x614.png 848w, https://substackcdn.com/image/fetch/$s_!w_Qt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde81e833-9f5e-4069-b6ed-ac2335739377_1268x614.png 1272w, https://substackcdn.com/image/fetch/$s_!w_Qt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde81e833-9f5e-4069-b6ed-ac2335739377_1268x614.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!w_Qt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde81e833-9f5e-4069-b6ed-ac2335739377_1268x614.png" width="1268" height="614" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/de81e833-9f5e-4069-b6ed-ac2335739377_1268x614.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:614,&quot;width&quot;:1268,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1495325,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://theodorekovalev.substack.com/i/200897662?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde81e833-9f5e-4069-b6ed-ac2335739377_1268x614.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!w_Qt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde81e833-9f5e-4069-b6ed-ac2335739377_1268x614.png 424w, https://substackcdn.com/image/fetch/$s_!w_Qt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde81e833-9f5e-4069-b6ed-ac2335739377_1268x614.png 848w, https://substackcdn.com/image/fetch/$s_!w_Qt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde81e833-9f5e-4069-b6ed-ac2335739377_1268x614.png 1272w, https://substackcdn.com/image/fetch/$s_!w_Qt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde81e833-9f5e-4069-b6ed-ac2335739377_1268x614.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Our three test samples: filtered tap water (1), unfiltered tap water (2), and water we deliberately infused with dirt (3)</figcaption></figure></div><p>Below are our three test samples, in increasing order of how &#8220;dirty&#8221; we thought they were:</p><ul><li><p>Filtered tap water was 87 mg/L (which is a safe drinking water level) and received a safety rating of 3.</p></li><li><p>Regular tap water measured at 303 mg/L.</p></li><li><p>As for the water with dirt, which measured at 838 mg/L, the device was right to flag it as a very serious issue.</p></li></ul><p>We also compared pH across a few different solutions. For fun, we ran some Coca-Cola through the device, which came back at 2.61. That is exactly the pH of Coca-Cola, so the device passed its surprise audit. The results across the board matched what we expected, which was the first real evidence that the design actually worked.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!b3xl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe88902ab-acfd-4493-bae1-6420fc715e96_1454x1620.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!b3xl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe88902ab-acfd-4493-bae1-6420fc715e96_1454x1620.png 424w, https://substackcdn.com/image/fetch/$s_!b3xl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe88902ab-acfd-4493-bae1-6420fc715e96_1454x1620.png 848w, https://substackcdn.com/image/fetch/$s_!b3xl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe88902ab-acfd-4493-bae1-6420fc715e96_1454x1620.png 1272w, https://substackcdn.com/image/fetch/$s_!b3xl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe88902ab-acfd-4493-bae1-6420fc715e96_1454x1620.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!b3xl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe88902ab-acfd-4493-bae1-6420fc715e96_1454x1620.png" width="1454" height="1620" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e88902ab-acfd-4493-bae1-6420fc715e96_1454x1620.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1620,&quot;width&quot;:1454,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2172432,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://theodorekovalev.substack.com/i/200897662?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe88902ab-acfd-4493-bae1-6420fc715e96_1454x1620.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!b3xl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe88902ab-acfd-4493-bae1-6420fc715e96_1454x1620.png 424w, https://substackcdn.com/image/fetch/$s_!b3xl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe88902ab-acfd-4493-bae1-6420fc715e96_1454x1620.png 848w, https://substackcdn.com/image/fetch/$s_!b3xl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe88902ab-acfd-4493-bae1-6420fc715e96_1454x1620.png 1272w, https://substackcdn.com/image/fetch/$s_!b3xl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe88902ab-acfd-4493-bae1-6420fc715e96_1454x1620.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">The prototype reporting a safety rating of 3 &#8212; the whole point, distilled into one number anyone can read.</figcaption></figure></div><h1>What this taught me</h1><p>The thing I'm proudest of, looking back, is that the whole process actually held together from start to finish. We started from a real problem, grounded it in the literature, looked at existing solutions and where they fall short, talked to actual potential users, designed around what they told us, built a prototype, tested it against controls, and refined it based on what came out. None of those steps got skipped, even the boring ones.</p><p>I honestly didn&#8217;t expect a school project to involve all of that. But I think this is how real engineering projects more or less go, and finishing one made me appreciate the profession quite a bit more, especially given that we wrapped this one up when I was sixteen, about to turn seventeen.</p><p>The UN&#8217;s Sustainable Development Goals 6 (Clean Water) and 12 (Responsible Consumption) were both on our minds when we designed the device. Being recognised as Highly Commended by Cambridge and IChemE mattered to us, not because of the award itself, but because it felt like a signal that the idea was worth building further.</p><p>Thanks for reading. More soon.</p>]]></content:encoded></item><item><title><![CDATA[How Our Water Sensor Came Close to Faking Results Thanks to an Enzyme From a Firefly]]></title><description><![CDATA[A team of five of us, myself included, built a water-quality-testing prototype we called the Firefly Hydrolyte.]]></description><link>https://www.waterengineeringlab.com/p/how-our-water-sensor-came-close-to</link><guid isPermaLink="false">https://www.waterengineeringlab.com/p/how-our-water-sensor-came-close-to</guid><dc:creator><![CDATA[Theodore Kovalev]]></dc:creator><pubDate>Fri, 10 Apr 2026 12:33:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!54j0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7f93129-83ed-40d4-b2f1-4d7e7ab61d60_1406x1438.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A team of five of us, myself included, built a water-quality-testing prototype we called the Firefly Hydrolyte. The idea was simple. Dip a sample into the device, walk away for a few minutes, come back to a safety rating on the screen. A rugged, low-tech solution for places where shipping samples to a lab and waiting three days isn't really an option.</p><p>My job was to make sure the device actually delivered on the claims we were making. That the readings could be trusted. It turned out to be a lot more interesting than I expected.</p><h1>How the Device Detects Contamination</h1><p>The main trick comes from the firefly. All living cells contain a molecule called ATP. There is an enzyme called luciferase that reacts to ATP and produces light:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{ATP} + \\text{luciferin} + \\text{O}_2 \\rightarrow \\text{oxyluciferin} + \\text{AMP} + \\text{CO}_2 + \\textbf{light (560 nm)}&quot;,&quot;id&quot;:&quot;QTSHOIQXKH&quot;}" data-component-name="LatexBlockToDOM"></div><p>The brightness is proportional to the amount of ATP in the sample. High ATP means a lot of living cells, because ATP breaks down once a cell dies. So a <em>darker</em> reading is actually the reassuring one. A <em>bright</em> reading means the water might be dangerous, which is the opposite of what your instinct says. The sample passes through a luminometer that counts the photons, and an Arduino turns the count into a safety rating from 1 to 3.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!54j0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7f93129-83ed-40d4-b2f1-4d7e7ab61d60_1406x1438.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!54j0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7f93129-83ed-40d4-b2f1-4d7e7ab61d60_1406x1438.png 424w, https://substackcdn.com/image/fetch/$s_!54j0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7f93129-83ed-40d4-b2f1-4d7e7ab61d60_1406x1438.png 848w, https://substackcdn.com/image/fetch/$s_!54j0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7f93129-83ed-40d4-b2f1-4d7e7ab61d60_1406x1438.png 1272w, https://substackcdn.com/image/fetch/$s_!54j0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7f93129-83ed-40d4-b2f1-4d7e7ab61d60_1406x1438.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!54j0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7f93129-83ed-40d4-b2f1-4d7e7ab61d60_1406x1438.png" width="1406" height="1438" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e7f93129-83ed-40d4-b2f1-4d7e7ab61d60_1406x1438.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1438,&quot;width&quot;:1406,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:671823,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://theodorekovalev.substack.com/i/200895264?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7f93129-83ed-40d4-b2f1-4d7e7ab61d60_1406x1438.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!54j0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7f93129-83ed-40d4-b2f1-4d7e7ab61d60_1406x1438.png 424w, https://substackcdn.com/image/fetch/$s_!54j0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7f93129-83ed-40d4-b2f1-4d7e7ab61d60_1406x1438.png 848w, https://substackcdn.com/image/fetch/$s_!54j0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7f93129-83ed-40d4-b2f1-4d7e7ab61d60_1406x1438.png 1272w, https://substackcdn.com/image/fetch/$s_!54j0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe7f93129-83ed-40d4-b2f1-4d7e7ab61d60_1406x1438.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This would be the whole story, but it actually isn&#8217;t.</p><h1>An Inherent Problem with Chemistry</h1><p>Luciferase is fussy about temperature. Most enzymes are. When they get cold they go sluggish. When they get hot they fall apart. So the light output doesn't just depend on how much ATP is in the water. It also depends on how warm the water was when we measured it.</p><p>The published info on this is practically all we have (Activity curve from the literature &#8212; Bechara &amp; Stevani, 2018):</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!39Om!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F007625fb-33dd-4ebb-84d5-6b768f5417a6_1302x1162.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!39Om!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F007625fb-33dd-4ebb-84d5-6b768f5417a6_1302x1162.png 424w, https://substackcdn.com/image/fetch/$s_!39Om!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F007625fb-33dd-4ebb-84d5-6b768f5417a6_1302x1162.png 848w, https://substackcdn.com/image/fetch/$s_!39Om!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F007625fb-33dd-4ebb-84d5-6b768f5417a6_1302x1162.png 1272w, https://substackcdn.com/image/fetch/$s_!39Om!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F007625fb-33dd-4ebb-84d5-6b768f5417a6_1302x1162.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!39Om!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F007625fb-33dd-4ebb-84d5-6b768f5417a6_1302x1162.png" width="1302" height="1162" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/007625fb-33dd-4ebb-84d5-6b768f5417a6_1302x1162.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1162,&quot;width&quot;:1302,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1115803,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://theodorekovalev.substack.com/i/200895264?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F007625fb-33dd-4ebb-84d5-6b768f5417a6_1302x1162.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!39Om!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F007625fb-33dd-4ebb-84d5-6b768f5417a6_1302x1162.png 424w, https://substackcdn.com/image/fetch/$s_!39Om!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F007625fb-33dd-4ebb-84d5-6b768f5417a6_1302x1162.png 848w, https://substackcdn.com/image/fetch/$s_!39Om!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F007625fb-33dd-4ebb-84d5-6b768f5417a6_1302x1162.png 1272w, https://substackcdn.com/image/fetch/$s_!39Om!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F007625fb-33dd-4ebb-84d5-6b768f5417a6_1302x1162.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Since we didn't have a lab where we could measure enzyme kinetics ourselves, we used published values as our starting point. Worth flagging that this introduces real uncertainty. Published enzyme curves vary between studies, and the conditions in our device (buffer, pH, reagent purity) aren't identical to the conditions in the paper. We took the best data we could find and assumed it was close enough. Usually a fine assumption. Sometimes not.</p><p>Between 25 and 35&#176;C, the enzyme runs at near 100% activity. At 5&#176;C it drops to 50&#8211;70%. Above 37&#176;C it falls off sharply. In practice, the same contaminated sample could glow nearly twice as bright on a warm afternoon as it would in cold mountain runoff.</p><p>This was the first real crack in what we&#8217;d built. I&#8217;d been assuming the device measured contamination. It doesn&#8217;t. Without correction, it measures contamination plus whatever mood the enzyme happens to be in that day. Two variables collapsed into a single number.</p><p>The Firefly Hydrolyte is meant to work outdoors, often near streams that can be much colder than a room. A device that only works at room temperature isn't very useful in the field. And if the same stream gets rated <em>Unsafe</em> in July and <em>Fine</em> in February, same water, just a different season, the rating can't really be trusted.</p><h1>The fix: measure the temperature, then undo it</h1><p>The correction has three parts. First, add a temperature sensor. Then use the activity curve to scale the raw reading back to what it would have been at the enzyme's peak activity. That way, readings can be compared regardless of the temperature at which they were taken.</p><p>The last step is a pretty basic math idea:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{Actual rate} = \\frac{\\text{Measured rate} \\times 100}{\\text{relative activity at that temperature}}&quot;,&quot;id&quot;:&quot;MGUINXHCYF&quot;}" data-component-name="LatexBlockToDOM"></div><p>So if you measured a light output of 50 from a sample where the enzyme was running at 50% activity, the corrected value would be 100. If you measured 100 from a sample where the enzyme was at 96% activity, the corrected value would be about 104.</p><p>The hardest part was getting &#8220;relative activity at any given temperature&#8221; to actually live inside an Arduino. Published data only gives values at specific temperatures, but a sample could be at anything in between. We needed a continuous function. I ended up fitting a quartic regression to data points I'd read off the curve in Desmos:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qN8P!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b61459e-c0ff-4ddf-bdbc-54cce12a338d_1568x1124.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qN8P!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b61459e-c0ff-4ddf-bdbc-54cce12a338d_1568x1124.png 424w, https://substackcdn.com/image/fetch/$s_!qN8P!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b61459e-c0ff-4ddf-bdbc-54cce12a338d_1568x1124.png 848w, https://substackcdn.com/image/fetch/$s_!qN8P!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b61459e-c0ff-4ddf-bdbc-54cce12a338d_1568x1124.png 1272w, https://substackcdn.com/image/fetch/$s_!qN8P!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b61459e-c0ff-4ddf-bdbc-54cce12a338d_1568x1124.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qN8P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b61459e-c0ff-4ddf-bdbc-54cce12a338d_1568x1124.png" width="1456" height="1044" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4b61459e-c0ff-4ddf-bdbc-54cce12a338d_1568x1124.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1044,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:922582,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://theodorekovalev.substack.com/i/200895264?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b61459e-c0ff-4ddf-bdbc-54cce12a338d_1568x1124.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qN8P!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b61459e-c0ff-4ddf-bdbc-54cce12a338d_1568x1124.png 424w, https://substackcdn.com/image/fetch/$s_!qN8P!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b61459e-c0ff-4ddf-bdbc-54cce12a338d_1568x1124.png 848w, https://substackcdn.com/image/fetch/$s_!qN8P!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b61459e-c0ff-4ddf-bdbc-54cce12a338d_1568x1124.png 1272w, https://substackcdn.com/image/fetch/$s_!qN8P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4b61459e-c0ff-4ddf-bdbc-54cce12a338d_1568x1124.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You plug in a temperature, get a relative activity, and apply the correction. There is also a fail-safe. If either the pH or temperature reading is unreasonable, the device throws an error rather than confidently reporting nonsense. Since the entire problem we were trying to solve was the device confidently reporting nonsense, the fail-safe was not optional.</p><p>A quartic isn't meaningful in a biological sense. There's no theoretical reason enzyme activity should be a fourth-degree polynomial. But given the data we actually had between 5&#176;C and 40&#176;C, it was the best fit available. Honestly, it was also the only fit available. The fail-safe boundaries were there to stop the regression operating outside the data range, where it could happily generate garbage with full confidence.</p><h1>Did it work?</h1><p>We tested three samples. Filtered tap water (clean), unfiltered tap water, and water we'd deliberately contaminated by adding dirt to it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TMs0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46e53e2-242a-4ce2-a890-cc27684acc54_1141x538.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TMs0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46e53e2-242a-4ce2-a890-cc27684acc54_1141x538.png 424w, https://substackcdn.com/image/fetch/$s_!TMs0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46e53e2-242a-4ce2-a890-cc27684acc54_1141x538.png 848w, https://substackcdn.com/image/fetch/$s_!TMs0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46e53e2-242a-4ce2-a890-cc27684acc54_1141x538.png 1272w, https://substackcdn.com/image/fetch/$s_!TMs0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46e53e2-242a-4ce2-a890-cc27684acc54_1141x538.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TMs0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46e53e2-242a-4ce2-a890-cc27684acc54_1141x538.png" width="1141" height="538" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f46e53e2-242a-4ce2-a890-cc27684acc54_1141x538.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:538,&quot;width&quot;:1141,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:708784,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://theodorekovalev.substack.com/i/200895264?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46e53e2-242a-4ce2-a890-cc27684acc54_1141x538.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TMs0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46e53e2-242a-4ce2-a890-cc27684acc54_1141x538.png 424w, https://substackcdn.com/image/fetch/$s_!TMs0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46e53e2-242a-4ce2-a890-cc27684acc54_1141x538.png 848w, https://substackcdn.com/image/fetch/$s_!TMs0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46e53e2-242a-4ce2-a890-cc27684acc54_1141x538.png 1272w, https://substackcdn.com/image/fetch/$s_!TMs0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff46e53e2-242a-4ce2-a890-cc27684acc54_1141x538.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The results for dissolved solids were 87 mg/L, 303 mg/L, and 838 mg/L respectively, and the temperature adjusted safety ratings on the prepared samples were reasonable for the scenario.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zG0z!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F074d43ba-1e75-4a39-8bc0-259e27b6bca4_1094x1216.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zG0z!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F074d43ba-1e75-4a39-8bc0-259e27b6bca4_1094x1216.png 424w, https://substackcdn.com/image/fetch/$s_!zG0z!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F074d43ba-1e75-4a39-8bc0-259e27b6bca4_1094x1216.png 848w, https://substackcdn.com/image/fetch/$s_!zG0z!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F074d43ba-1e75-4a39-8bc0-259e27b6bca4_1094x1216.png 1272w, https://substackcdn.com/image/fetch/$s_!zG0z!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F074d43ba-1e75-4a39-8bc0-259e27b6bca4_1094x1216.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zG0z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F074d43ba-1e75-4a39-8bc0-259e27b6bca4_1094x1216.png" width="1094" height="1216" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/074d43ba-1e75-4a39-8bc0-259e27b6bca4_1094x1216.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1216,&quot;width&quot;:1094,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1309223,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://theodorekovalev.substack.com/i/200895264?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F074d43ba-1e75-4a39-8bc0-259e27b6bca4_1094x1216.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zG0z!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F074d43ba-1e75-4a39-8bc0-259e27b6bca4_1094x1216.png 424w, https://substackcdn.com/image/fetch/$s_!zG0z!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F074d43ba-1e75-4a39-8bc0-259e27b6bca4_1094x1216.png 848w, https://substackcdn.com/image/fetch/$s_!zG0z!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F074d43ba-1e75-4a39-8bc0-259e27b6bca4_1094x1216.png 1272w, https://substackcdn.com/image/fetch/$s_!zG0z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F074d43ba-1e75-4a39-8bc0-259e27b6bca4_1094x1216.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h1>What I learned</h1><p>Most of the work that goes into a device like this happens in places nobody can see. The people who look at it don't see the correction equation. They see a number on a screen that is, conveniently, correct. What this project taught me is that a measurement is only ever as good as your model of what you're actually measuring. The gap between <em>the glow</em> and <em>the contamination</em> is where the most interesting, and the most worrying, part of instrument design lives.</p>]]></content:encoded></item><item><title><![CDATA[Post equation I know is wrong]]></title><description><![CDATA[I shipped a &#8220;wrong&#8221; equation once &#8212; and I would do it again in a heartbeat]]></description><link>https://www.waterengineeringlab.com/p/post-equation-i-know-is-wrong</link><guid isPermaLink="false">https://www.waterengineeringlab.com/p/post-equation-i-know-is-wrong</guid><dc:creator><![CDATA[Theodore Kovalev]]></dc:creator><pubDate>Wed, 11 Mar 2026 15:17:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!UKv5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a1a005-eb49-4336-b361-ec87acbe709e_1564x1038.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>There is a line of code in one of the devices I worked on that I cannot mathematically justify. I knew it was wrong while I was writing it. I would do the exact same thing in the exact same circumstance again, and I can tell you why. Working out the reasoning behind that decision taught me more than any of the parts of the project that actually worked properly.</p><p>Some context. A few classmates and I built a portable water-quality tester that uses a firefly enzyme called luciferase. Luciferase glows in proportion to the biological activity in a water sample, which is a very neat property to have, except that luciferase is also fussy about temperature. Cold makes it sluggish. Heat makes it fall apart. The brightness of the glow ends up depending not just on how much life is in the water, but on how warm the water happens to be. My job was to deal with that. Measure the temperature, work out how much activity the luciferase had lost, and adjust the reading back to a standard.</p><p>To do this, I needed a way to express any given temperature as a "percent of peak activity." The published data I had was only available at specific temperatures, but a real sample could be at anything in between, so I needed a continuous function. I decided to use a quartic regression. Below is the equation I actually shipped.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;y = 0.000365544x&#8308; &#8722; 0.035594x&#179; + 1.00384x&#178; &#8722; 8.69315x + 93.61146&quot;,&quot;id&quot;:&quot;DISGZNLARK&quot;}" data-component-name="LatexBlockToDOM"></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!UKv5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a1a005-eb49-4336-b361-ec87acbe709e_1564x1038.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UKv5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a1a005-eb49-4336-b361-ec87acbe709e_1564x1038.png 424w, https://substackcdn.com/image/fetch/$s_!UKv5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a1a005-eb49-4336-b361-ec87acbe709e_1564x1038.png 848w, https://substackcdn.com/image/fetch/$s_!UKv5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a1a005-eb49-4336-b361-ec87acbe709e_1564x1038.png 1272w, https://substackcdn.com/image/fetch/$s_!UKv5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a1a005-eb49-4336-b361-ec87acbe709e_1564x1038.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UKv5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a1a005-eb49-4336-b361-ec87acbe709e_1564x1038.png" width="1456" height="966" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/59a1a005-eb49-4336-b361-ec87acbe709e_1564x1038.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:966,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:874392,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://theodorekovalev.substack.com/i/200893708?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a1a005-eb49-4336-b361-ec87acbe709e_1564x1038.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UKv5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a1a005-eb49-4336-b361-ec87acbe709e_1564x1038.png 424w, https://substackcdn.com/image/fetch/$s_!UKv5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a1a005-eb49-4336-b361-ec87acbe709e_1564x1038.png 848w, https://substackcdn.com/image/fetch/$s_!UKv5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a1a005-eb49-4336-b361-ec87acbe709e_1564x1038.png 1272w, https://substackcdn.com/image/fetch/$s_!UKv5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F59a1a005-eb49-4336-b361-ec87acbe709e_1564x1038.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>Substitute a temperature in, get an estimated activity percent out. Not mathematically correct, but functional.</p><div><hr></div><h1>Why it&#8217;s wrong</h1><p>There is no fourth-degree function in a biological sense. Nothing in enzyme kinetics is fourth-degree. I picked a quartic because it happened to fit the data nicely between 5 and 40 &#176;C, which is the entire scientific reasoning behind the choice.</p><p>The real curve is the result of a balance between two competing things. The reaction rate goes up with temperature, while the protein itself starts denaturing as it gets hotter. A proper model would combine both processes and would have parameters with actual physical meaning, like denaturation rates and activation energies. My parameters mean nothing. They are the numbers Desmos handed back.</p><p>This sounds like a cosmetic issue, but it has teeth. My polynomial is only reliable between 5 and 40 &#176;C. Outside that range, a quartic is free to go wherever it wants. It can shoot off to infinity, while in reality the enzyme would have given up entirely. My function will happily hand back a confidently wrong number. This is the worst kind of failure. Not a crash, not an error, just a number that looks fine and is actually completely false.</p><h1>So why keep it?</h1><p>The question I had to answer was not "what is the most correct model of this enzyme?" The question I had to answer was "what is the most correct model of this enzyme for a cheap device that has to run on an Arduino in the field and never mislead anyone?" Those are very different questions. A lot of engineering, I think, is about quietly answering the second one while everyone assumes you've been answering the first.</p><p>A research instrument needs the mechanistic model, because accuracy is the whole point and the extra complexity is worth it. A two-pound microcontroller in a portable water tester is a very different thing. Within the range of temperatures water can realistically reach, the quartic and the "proper" enzyme kinetics model would probably give nearly identical answers. The extra rigour would buy me accuracy I cannot actually use, in exchange for more complex code running on hardware I barely trust to begin with.</p><p>What justifies the decision isn't the polynomial. It's the fact that I bounded the polynomial honestly. There's a fail-safe. If the temperature or pH reads an unreasonable value, the device throws an error rather than guessing. The quartic is not allowed to operate in a region where it would be lying. That guardrail, not the polynomial itself, is the part of the design I would defend the hardest.</p><h1> What this changed about how I think</h1><p>I used to think the most complex solution was always the best one. I thought of approximations as a more rigorous answer that just hadn't been figured out yet. I don't really think that anymore. An approximation that is understood and bounded can be a better engineering choice than a precise solution pointed at the wrong problem.</p><p>I don't want this to become a crutch or an excuse. The honest position isn't <em>"approximations are acceptable."</em> The honest position is: I can tell you exactly how my model fails, where it fails, and what I have in place to make sure it doesn't fail dangerously. Not knowing how your model fails is dangerous. Refusing to figure it out is worse.</p><p>If I come back to this project, the first thing I would do is not redesign the device. The first thing I would do is run the experiment. Swap in a proper denaturation-based model and see how much accuracy I actually gain across realistic water temperatures. I suspect the answer would be "not much," which would justify the original decision. But I don't know yet. And really, the point isn't whether I turn out to be right. The point is that the trade-off needs to be tested, not just assumed.</p>]]></content:encoded></item></channel></rss>