Experiment 02 · Part B · With machine learning
Salt water conducts electricity better than tap water. Can a machine learn to tell them apart, and then your own samples?
Build two Wheatstone bridges on OrbitCore: bridge 1 with its probe in plain water, bridge 2 with the sample. Record labelled samples with notes, train a model on how the sample bridge differs from the water bridge, predict live, and then put the model on the board so it names the sample by itself.
Prefer a simple threshold first? Part A: the Detector, no machine learning.
About 40 minutes with a board. Works in Chrome or Edge on a laptop. Your recordings stay in this browser tab.
The whole journey
Select a step to jump to it. Steps open one at a time as you finish the one before.
Pure water barely conducts. Dissolved salt splits into charged ions (Na⁺ and Cl⁻) that move when a voltage is applied, so the resistance between two electrodes drops.
Bridge 1 has its probe in plain water, bridge 2 in the sample. Their difference B2 − B1 grows as the sample conducts better, while changes that hit both cups cancel out.
From that difference you build a dataset, train a model and copy it onto OrbitCore. It then blinks once, twice, three times… for each kind of sample you taught it.
The question you will answer
“Is the difference between the bridges alone enough, or does the model need more features to tell my samples apart?”
Start with tap water against salt water: the difference is large and a single number should do. Then bring your own samples, label them however you like (for example “Right leaf: healthy” and “Left leaf: not healthy”), and find out whether resistance is enough to separate them.
What you need
No board today? Use the simulated bridges to follow every step.
1Build the instrument
Two identical Wheatstone bridges. Bridge 1 keeps its probe in plain water; bridge 2 gets the sample. OrbitCore reads all four middle points and compares the bridges.
Unplug the USB cable while you connect wires. Build bridge 1 on A0/A1 and an identical bridge 2 on A2/A3.
R1 and R2 are fixed resistors, the same in both bridges. R3 is a potentiometer in each bridge (100 kΩ is a good start for tap water): connect one end and the middle pin (wiper), and use the knob to balance the bridge in step 2. The page uses R1 and R2 only to describe probe resistances; the model works from the voltages.
• Make the two probes identical: same metal, same spacing, same depth. Fix each pair of electrodes to a lolly stick so the distance never changes.
• Probe 1 stays in a cup of plain tap water for the whole session. Only probe 2 moves between samples.
• Use the same water for the reference cup as for your “water” samples, and keep both cups at room temperature.
• Before measuring, both probes go into the same water and each potentiometer is turned until its bridge reads 0 mV (step 2). After that, do not touch the knobs. Salt in cup 2 then makes the difference jump up.
| Part | From | To | Note |
|---|---|---|---|
| Bridge 1 · R1 (10 kΩ) | 5V | node A | water bridge, reference arm |
| Bridge 1 · R2 (10 kΩ) | node A | GND | |
| wire | node A | A0 | |
| Bridge 1 · R3 potentiometer | 5V | node B | one end pin to 5V, middle pin (wiper) to node B; turned to balance bridge 1 |
| Probe 1 (in plain water) | node B | GND | one electrode to node B, the other to GND |
| wire | node B | A1 | |
| Bridge 2 · R1 (10 kΩ) | 5V | node C | sample bridge, reference arm |
| Bridge 2 · R2 (10 kΩ) | node C | GND | |
| wire | node C | A2 | |
| Bridge 2 · R3 potentiometer | 5V | node D | its own potentiometer, turned to balance bridge 2 |
| Probe 2 (in the sample) | node D | GND | same electrodes, same spacing as probe 1 |
| wire | node D | A3 |
First balance: with both probes in water, turn each potentiometer R3 until its bridge reads 0 mV (tip: R3 equals the probe’s resistance at balance). Then move probe 2 into salt water and watch the difference.
Bridge 1 · A0 − A1
-1187 mV
Bridge 2 · A2 − A3
-1187 mV
Difference B2 − B1
0 mV
The probe side reads 5 V × R_probe ÷ (R3 + R_probe). The bridge is balanced (0 mV) when R3 equals the probe’s resistance (with R1 = R2), and it is most sensitive around that point.
Say what the board should send, in your own words. Tested templates answer bridge requests; anything else goes to the AI.
Nothing yet. Type a request below or pick one of the examples.
In simple words
OrbitCore’s analog pins turn a voltage between 0 and 5 V into a number from 0 to 1023, about 4.9 mV per step. Averaging 16 readings makes the steps finer and the noise smaller. The sketch converts everything to millivolts before sending it.Your code appears here after your first request.
Two ways to do it. Both end with OrbitCore sending millivolts over USB. The same firmware serves the Detector and the Machine learning pages.
The fastest route for a workshop. This installs MakeSense’s ready-made two-bridge firmware straight from the browser. It sends A0 to A3, both bridge outputs and their difference ten times per second. It runs the Detector rule by itself (LED on when the sample conducts better than water), and on the machine-learning page it can carry your trained model.
Inside each bridge, the reference arm (A0 or A2) comes from the same 5 V as the probe arm. If the USB voltage dips, both sides dip together and the bridge output changes much less than either pin.
The second bridge takes the same idea one level further. Water conducts a little better when it warms up, and the electrodes slowly change while current flows. Those changes hit both cups. Comparing the sample bridge with the water bridge (B2 − B1) cancels most of them, so what is left is the difference that really comes from the sample. Scientists call the water cup a control.
About direct current. Both bridges are powered by steady 5 V. Current through salty water slowly changes the electrode surfaces (electrolysis), so readings creep. Laboratory conductivity meters avoid this with alternating current. Here the drift is part of the lesson: step 4 measures it as a feature.
Next: step 2: Collect samples
Bridges wired and board flashed? No board today? Either way, continue: the next step also offers simulated bridges.