Experiment 02 · Part B · With machine learning

Resistance Lab: Teach a Model

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.

Bridge 1 · water reference5V (OrbitCore)GNDR110 kΩR210 kΩR3potturnProbeplain waterA0A1bridge outputA0 − A1referencearmprobearmBridge 2 · sample5V (OrbitCore)GNDR110 kΩR210 kΩR3potturnProbesalt water?A2A3bridge outputA2 − A3referencearmprobearm

The whole journey

From a cup of water to a blinking prediction, in ten steps

Select a step to jump to it. Steps open one at a time as you finish the one before.

Salt carries current

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.

Two bridges compare

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.

The board learns to answer

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

  • An OrbitCore board and its USB cable
  • Four 10 kΩ resistors and two potentiometers (one per bridge, 100 kΩ is a good start), a breadboard and jumper wires
  • Two identical probes, each two electrodes (stainless-steel wire, nails or pencil leads) held a fixed distance apart
  • A cup of plain tap water for probe 1, cups of tap water and salt water (one teaspoon of salt in a cup) for probe 2, paper towels
  • Chrome or Edge on a laptop or desktop

No board today? Use the simulated bridges to follow every step.

This is a learning experiment, not a diagnostic test. A bridge measures how well a sample conducts electricity, nothing more. If you label samples “healthy” and “not healthy”, the model learns to repeat your labels for samples like the ones you recorded. It cannot judge the health of a person, plant or food.
Safety and good habits
  • Only use the board’s 5 V USB supply. Never connect the electrodes to mains power, batteries above 5 V, or a person’s body.
  • The bridge runs on direct current. In salty water this causes electrolysis: tiny bubbles form and the electrodes slowly corrode, so readings drift. Keep each recording short (20 to 30 seconds) and lift probe 2 out between samples.
  • Rinse the electrodes in tap water and dry them between samples, so one sample does not leak into the next.
  • Keep liquids away from the board and the USB cable. Put the cup on a tray, not next to the laptop.
  • Do not drink the samples, and wash your hands after handling biological material.

1Build the instrument

Build two bridges and program OrbitCore

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.

AWire the two Wheatstone bridges

Unplug the USB cable while you connect wires. Build bridge 1 on A0/A1 and an identical bridge 2 on A2/A3.

Bridge 1 · water reference5V (OrbitCore)GNDR110 kΩR210 kΩR3potturnProbeplain waterA0A1bridge outputA0 − A1referencearmprobearmBridge 2 · sample5V (OrbitCore)GNDR110 kΩR210 kΩR3potturnProbethe sampleA2A3bridge outputA2 − A3referencearmprobearm

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.

PartFromToNote
Bridge 1 · R1 (10 kΩ)5Vnode Awater bridge, reference arm
Bridge 1 · R2 (10 kΩ)node AGND
wirenode AA0
Bridge 1 · R3 potentiometer5Vnode Bone end pin to 5V, middle pin (wiper) to node B; turned to balance bridge 1
Probe 1 (in plain water)node BGNDone electrode to node B, the other to GND
wirenode BA1
Bridge 2 · R1 (10 kΩ)5Vnode Csample bridge, reference arm
Bridge 2 · R2 (10 kΩ)node CGND
wirenode CA2
Bridge 2 · R3 potentiometer5Vnode Dits own potentiometer, turned to balance bridge 2
Probe 2 (in the sample)node DGNDsame electrodes, same spacing as probe 1
wirenode DA3

BPlay with the two bridges before you build them

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 · water reference5V (OrbitCore)GNDR110 kΩR210 kΩR310 kΩturnProbeplain waterA02.50 VA13.69 Vbridge outputA0 − A1 = -1187 mVreferencearmprobearmBridge 2 · sample5V (OrbitCore)GNDR110 kΩR210 kΩR310 kΩturnProbe28.1 kΩA22.50 VA33.69 Vbridge outputA2 − A3 = -1187 mVreferencearmprobearm

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.

CPhysical Vibe Coding

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 sketch

Your code appears here after your first request.

DPut the program on the board (“flashing”)

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.

Why two bridges, and a cup of plain water?

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.