Jimmy Docs
A living oyster-mushroom network wired into a local language model on a Raspberry Pi 5 — the full build, parts list, fixes, and measured results.
Overview
A living oyster-mushroom network wired into a local language model running on a Raspberry Pi 5. Electrodes read the mycelium's electrical activity, an amplifier and ADC digitize it, and those numbers steer a small LLM's randomness and tone. The project also adds a stimulation path so the network can be electrically poked and its reaction measured.
What is and is not happening
The Raspberry Pi does all the computation in silicon. The mushroom does not run the language model, does not do math, and does not "think." The mushroom produces a real electrical signal. That signal is turned into a few numbers that bias the model. The relationship is influence, not computation.
Circuit map
Full wiring tables are in Tutorial; the AD620 pinout is in Bill of Materials.
Results
All numbers below are measured, not estimated. Scripts and raw summaries are in this repo.
Noise floor (amplifier inputs shorted, no mushroom):
- std dev: 2.79 mV
- peak-to-peak: 33.5 mV
- 6869 samples over 5 minutes, zero I/O errors
Passive signal, 1-hour untouched runs, same conditions:
| Wet paper towel (control) | Live mushroom | |
|---|---|---|
| events | 0 | 60 |
| std dev | 7.2 mV | 41.7 mV |
| peak-to-peak | 54 mV | 151 mV |
| biggest event | n/a | 18.3 mV |
The dead control produced zero events. The living plate produced sixty, all in the tens-of-millivolts range where fungal signals live, arriving in bursts with quiet gaps. The gap between the two is the result.
Stimulation (0.82 V pulses, live plate vs dead substrate): The live plate showed large early spike increases after pulses (+12, +16, +38, +49) that faded with repeated stimulation. The dead control never cleared +2 and had a flat baseline. The living network responds to stimulation in a way dead wet substrate does not.
Repo layout
.
├── README.md
├── docs/
│ ├── circuit-map.svg wiring diagram
│ ├── materials.md full bill of materials
│ ├── tutorial.md step-by-step build and run
│ └── troubleshooting.md every bug hit and its fix
├── src/
│ ├── read_test.py live single-channel voltage read
│ ├── noise_floor.py 5-minute baseline, std dev + peak-to-peak
│ ├── long_record.py long run with event detection
│ ├── calibrate.py measure a plate's spike/spread range
│ ├── mushroom_llm.py signal -> LLM temperature + mood
│ ├── stim_test.py bench-test DAC output voltage before it touches tissue
│ └── stim_loop.py stimulate -> read -> LLM response loop
└── data/
└── results.md recorded run summaries
Quick start
- Build the hardware per Bill of Materials and Tutorial.
- On the Pi: enable I2C, install libraries, confirm
i2cdetect -y 1shows the ADS1115 at 0x48. - Short the amplifier inputs and run
noise_floor.pyto get your baseline. - Put electrodes in a live colonized plate, run
long_record.py, compare to a dead-plate control. - Run
mushroom_llm.pyto drive the model from the live signal.
Full detail is in Tutorial.
A note on honesty
The model writes vivid, specific text. None of that comes from the mushroom. The mushroom contributes a spike count and a spread value that set the temperature and a mood word. The eloquence is the language model. The biology is a dial. Every claim in this repo is backed by a dead-substrate control, because a wet electrode on its own produces most of the raw signal and only the controlled comparison separates biology from artifact.
Built for learning, research, and art. Not a medical or safety-critical device.
Tutorial
This walks the full build from growing the mushroom to driving the model and adding stimulation. Read Troubleshooting alongside it; several steps map directly to bugs that were hit during the build.
Signal chain
mycelium -> electrodes -> AD620 amp -> 10 kΩ -> ADS1115 ADC -> I2C -> Raspberry Pi 5 -> Ollama -> text
^
optional stimulation: Pi -> MCP4725 DAC -> 5.1 kΩ -> stim electrode ---+ (returns through the GND electrode)
The dish, electrodes, and AD620 go inside a grounded metal box. The Pi, ADS1115, and MCP4725 stay outside it. The Pi is a noise source and the box shields the weak signal from it. Only three wires cross the box wall: Vout, 5 V, and GND. Add a fourth (the stim line) only when running stimulation.
Phase 1 — Grow the mycelium
- Mix MEA powder with distilled water in a mason jar at the packet ratio.
- Sterilize: 2-3 cm of water in the pressure cooker, jar on a rack above the water, lid loose or foil over the top, 15 psi for 15-20 min. Let it cool gradually in the cooker.
- Pour a shallow layer into each dish inside the still-air box. Let it set, then store inverted (agar-side up) so condensation drips onto the lid.
- Shake the liquid culture, flame-sterilize the needle, inject a few drops onto each plate, re-flame between plates. Seal each dish edge with paper tape.
- Incubate warm and dark 1-2 weeks until a dense connected white mat covers the dish. Toss any plate with green, black, or slimy growth or an off smell.
- Use fuller/deeper dishes. Shallow dishes give a thin mat that reads substrate more than organism.
Pour one extra uninoculated plate as a sterility control. If it stays clean, your technique and media are good.
Phase 2 — Electrode front end
- Shielded cable at the amp: red core to +S (J1), white core to -S (J1), shield pigtail to GND (J1). Ground the shield at the amp end only.
- At the dish: clip the two signal cores to two needles about 2 cm apart and the pigtail to a reference needle. Tin the wire tips so the clips bite solid metal.
- Clip rather than solder at the dish end while you are still finding good electrode spots.
- Dish and AD620 go inside the grounded box.
Phase 3 — Set up the Pi
sudo apt update && sudo apt full-upgrade -y
sudo raspi-config # Interface Options -> I2C -> Enable
sudo reboot
sudo apt install -y i2c-tools python3-pip
pip install --break-system-packages adafruit-circuitpython-ads1x15 \
adafruit-circuitpython-mcp4725 numpy scipy requests
sudo i2cdetect -y 1 # expect 0x48 (ADS1115), and 0x60 if the MCP is wired
If the bus is flaky, lower the I2C speed. Edit /boot/firmware/config.txt and set:
dtparam=i2c_arm=on,i2c_arm_baudrate=10000
Then reboot. The mushroom signal is sub-Hz, so bus speed does not affect it.
Phase 4 — Wire and bias the amplifier
Wiring (power off):
| From | To |
|---|---|
| ADS1115 VDD | Pi 3.3 V (pin 1), never 5 V |
| ADS1115 GND | common ground |
| ADS1115 SCL | Pi GPIO3 (pin 5) |
| ADS1115 SDA | Pi GPIO2 (pin 3) |
| ADS1115 A0 | AD620 Vout through the 10 kΩ |
| AD620 VIN | Pi 5 V (pin 2) |
| AD620 GND | its own wire to a separate Pi ground pin (see troubleshooting) |
| AD620 V- | nothing |
Set the operating point:
- Short +S to -S together.
- Run
read_test.py. - Turn the W103 (offset) trimpot until the reading sits around 1.6 V. The signal needs room to swing both up and down. If it will not come off the top rail, confirm V- reads negative and that VIN reads a full 5 V.
Phase 5 — Noise floor
With +S/-S still shorted, run:
python3 noise_floor.py
It records 5 minutes and prints std dev and peak-to-peak. Write those numbers down. Every later event has to beat them. Recorded baseline for this build was std dev 2.79 mV, peak-to-peak 33.5 mV.
Phase 6 — Read a live plate and control it
- Un-short +S/-S and clip the electrodes to a live colonized plate, agar-side down, lid off, inside the box.
- Run
long_record.pywithLABEL = "live"for an hour. Leave it untouched the whole time. Repositioning mid-run injects large fake spikes. - Run it again with
LABEL = "wet", needles in a damp paper towel or dead plate, same spacing and duration. - Compare event counts and amplitudes. The live plate should produce more events in the tens-of-millivolts range than the dead control. Recorded result: live 60 events, dead 0.
Run everything inside tmux so an SSH drop does not kill a long run:
tmux
python3 long_record.py
# detach with Ctrl-b then d, reattach with: tmux attach
Phase 7 — Drive the model
curl -fsSL https://ollama.com/install.sh | sh
ollama pull llama3.2:3b
ollama run llama3.2:3b "hello"
Calibrate to your plate first:
python3 calibrate.py # watch the spread and spike range for a few minutes
Set the mood thresholds in mushroom_llm.py from the range you observe, then:
python3 mushroom_llm.py
Each cycle samples the plate, extracts spread and spike count, drops anything over 80 mV as a movement artifact, and maps the result to the model temperature and a mood word in the prompt.
Phase 8 — Stimulation (optional)
- Reflow the MCP4725 header joints and wire it to the shared bus with short firm single wires. Confirm
i2cdetect -y 1holds 0x48 and 0x60 across several runs. - Wire MCP OUT through a 5.1 kΩ resistor to a stim electrode placed away from the measurement pair. The return path is the existing GND electrode.
- Bench-test the output before it touches the plate:
python3 stim_test.py # meter on OUT to GND, confirm it swings 0 to ~0.82 V
- Run the loop:
python3 stim_loop.py
- Run it on a dead plate too. Only the difference between the live and dead response counts as a real reaction.
Keep stimulation at or below 1 V. The series resistor limits current and the software caps the DAC value. More than that risks electrolysis at the electrodes or cooking the tissue.
Bill of Materials
Prices are approximate. Items marked owned were already on hand during the build.
Compute and power
| Part | Role | Notes |
|---|---|---|
| Raspberry Pi 5 | Runs everything | 64-bit Raspberry Pi OS |
| 27 W USB-C PSU | Pi power | Official supply |
| 128 GB microSD | Storage | Model is ~2 GB, loads to RAM |
| Heatsinks | Cooling | Passive held fine for bursty load; confirm with vcgencmd get_throttled |
Biology
| Part | Role | Notes |
|---|---|---|
| Oyster liquid culture syringe | The wetware | Pleurotus, food-safe, BSL-1 |
| Petri dishes (plastic, sterile) | Grow vessels | Use fuller/deeper dishes; shallow ones give a thin mat and weak signal |
| Malt Extract Agar (MEA) powder | Growth medium | Pre-mixed, add distilled water |
| Distilled water | Media mixing | Tap minerals add noise and contamination risk |
| Pressure cooker + mason jar | Sterilize media | 15 psi, 15-20 min, water in the bottom, jar on a rack, lid loose |
| Still-air box | Clean workspace | A clear storage tote works |
| Paper / micropore surgical tape | Seal dishes | Breathable; cling wrap works in a pinch, micropore is better |
| Isopropyl alcohol | Sterilize surfaces and tools | 70% |
| Lighter | Flame-sterilize the syringe needle | Between plates |
Analog front end
| Part | Role | Notes |
|---|---|---|
| AD620 instrumentation amplifier module (XY-FD) | Boost the microvolt signal | Charge-pump type with a V- pin. Confirm V- reads negative before trusting a board |
| ADS1115 ADC breakout (generic) | 16-bit I2C digitizer | No level shifting, so VDD runs at 3.3 V |
| MCP4725 DAC | Stimulation output | I2C, address 0x60 |
| Stainless steel needles | Electrodes | Acupuncture needles or 3D-printer nozzle cleaners, ~0.2-0.3 mm |
| Alligator clip leads | Electrode connections | Clip to needle handles; lets you reposition freely |
| Shielded 2-core cable | Electrode-to-amp leads only | Short as possible, under 15 cm; braid to GND at the amp end only |
| 10 kΩ resistor | ADC input protection | Inline on Vout to A0 |
| 5.1 kΩ resistor | Stimulation current limit | Inline on MCP OUT to the stim electrode |
| Full-size breadboard (830-point) | Shared I2C bus and power rails | Buy a decent one; a bad board caused hours of debugging |
| Jumper wires (M-M, M-F, F-F) | Board-to-board wiring | Single wires, no chaining on I2C lines |
| 2.54 mm male header pins | Solder onto the ADS1115 | 40-pin breakaway strip |
Enclosure and grounding
| Part | Role | Notes |
|---|---|---|
| Metal ammo can or cookie tin | Faraday enclosure | Must be actual metal, grounded at one point |
| M6 bolt, nut, star washer, flat washer | Cage ground bond | Scratch to bare metal, star washer bites |
| Plain hookup wire | Cage ground wire | A jumper works; not shielded |
| Velcro / foam tape / standoffs | Mount boards off the metal | Keeps bare solder joints from shorting on the cage |
Test gear
| Part | Role |
|---|---|
| Multimeter | Continuity, voltage, bring-up debugging. Non-negotiable |
| 9 V battery (optional) | Cleaner amp power if the Pi 5 V rail is noisy |
Reused across the whole build
Faraday cage, grounding scheme, noise-floor discipline, and the dead-plate control method all carry forward to later projects.
AD620 XY-FD pinout
J1 (input side): +S -S GND VIN
J3 (output side): GND Vout GND V-
Trimpots: W103 = offset W104 = gain
- +S / -S: electrode signal pair
- GND (J1): shield braid / reference electrode
- VIN: 5 V power
- Vout: through 10 kΩ to ADS1115 A0
- V-: leave connected to nothing. It is the charge-pump negative rail. Grounding it or wiring it to anything kills the board.
Troubleshooting
Every problem hit during the build, what caused it, and the fix. Ordered roughly by how much time each one cost.
I2C bus drops out intermittently
Symptom: i2cdetect -y 1 sometimes shows the devices, sometimes shows nothing. Scripts fail mid-read with OSError: [Errno 121] Remote I/O error even though i2cdetect just passed.
Causes and fixes, in the order they were found:
- Bad breadboard. A faulty board caused repeated dropouts. Direct-connecting the ADS1115 to the Pi worked every time. A breadboard adds a dozen spring contacts to the most timing-sensitive signals. Replace a suspect board, and direct-wire the four bus lines (VDD, GND, SDA, SCL) straight to the Pi header when in doubt.
- Long, chained jumper wires. Two jumpers spliced together to make a 14-inch run put a mid-air junction on each I2C line. Use single short wires under ~20 cm, no chaining. This meant moving the Pi to a closer wall of the box.
- Bus speed too high for a marginal bus. Set
dtparam=i2c_arm=on,i2c_arm_baudrate=10000in/boot/firmware/config.txtand reboot. 10 kHz tolerates extra capacitance. The sub-Hz signal does not care. - The diagnostic that isolates it: direct-connect the ADS to the Pi with four M-F jumpers, no breadboard. If 0x48 appears, the fault is in the breadboard path. If not, it is the config or the board.
Whole bus dies when the AD620 ground is connected
Symptom: bus is fine until the AD620 is fully powered, then both I2C devices vanish. Rail-to-rail continuity checks are all open, so it is not a short.
Cause: the AD620 and its charge pump draw current in pulses. When its ground return shared the same wire/rail the ADS used as its reference, those pulses shifted the ADC's ground and knocked the bus over.
Fix: give the AD620 its own ground wire to a separate Pi ground pin (the Pi has several: 6, 9, 14, 20, 25, 30, 34, 39). Star grounding, each board returning to the Pi on its own path, stopped the disturbance.
AD620 output railed at 3.3 V, trimpots do nothing
Symptom: read_test.py reads a flat ~3.3 V no matter how far the offset and gain pots are turned.
Cause: the charge pump was not generating its negative rail, so the amplifier could not swing its output down. Measured V- relative to GND and got ~0 V instead of a negative voltage.
Root cause: VIN was only reaching 1 V instead of 5 V. A bad connection in the 5 V path starved the board. The source (Pi 5 V pin) measured 5.13 V, so the loss was in the wire between there and VIN.
Fix: run a single fresh wire from the Pi 5 V pin straight to VIN. VIN then read 5.13 V, V- swung to -4 V, and the output came off the rail. The offset pot then moved the baseline normally. Keep VIN on a solid single wire, not a flaky breadboard hop.
Note: "V- reads 0 V" with V- correctly open means check VIN first. The board was not dead, it was underpowered.
MCP4725 destabilizes the bus
Symptom: adding the MCP causes the same intermittent dropouts and I/O errors.
Likely causes:
- Cold or cracked solder joint on an MCP header pin. Reflow all four.
- Double pull-up resistors. Both the ADS and MCP carry pull-ups on SDA/SCL. Two in parallel can be too strong. Measure SDA-to-VCC resistance on each board; if both read low, remove one board's pull-ups or rely on the slow 10 kHz bus.
In this build, reflowing and firming the wiring was enough. After that the bus held 0x48 and 0x60 across repeated i2cdetect runs.
P0 import error
Symptom: ImportError: cannot import name 'P0' or AttributeError: type object 'ADS1115' has no attribute 'P0'.
Cause: the channel constant moved between library versions.
Fix: use the raw channel number instead. AnalogIn(ads, 0) works regardless of version. All scripts in this repo already use it.
Signal looks real but matches the wet control
Symptom: electrodes in the live plate read much higher than the shorted noise floor, but a damp paper towel reads almost the same.
Cause: wet electrodes in any ionic medium produce drift and junction potentials. Most of the raw jump from dry-short to wet is "wet electrodes," not biology.
Fix: the control is the measurement. Compare the live plate to a dead-but-wet control under identical conditions. Only the difference is biology. Use longer runs and event counting rather than raw std dev, because fungal activity is slow and bursty.
Huge spikes after repositioning electrodes
Symptom: a burst of events, some hundreds of millivolts, right after moving a needle mid-recording.
Cause: disturbing the electrode creates a large settling transient as the metal re-equilibrates with the substrate. The 530 mV "events" in one run were this, not the mushroom.
Fix: place electrodes, then leave them untouched for the whole run. Reject anything above a sane biological amplitude (~80 mV) as an artifact. Real fungal events are in the tens of millivolts.
SSH drops kill a long run
Symptom: client_loop: send disconnect: Connection reset ends a recording.
Fix: run long jobs inside tmux. Start with tmux, run the script, detach with Ctrl-b then d. Reattach with tmux attach. The job keeps running if the laptop sleeps or the connection drops.
Thermal throttling during inference
Check with vcgencmd measure_temp and vcgencmd get_throttled (0x0 means no throttle). Heatsinks alone held up for the bursty read-then-generate workload. Add an active cooler if get_throttled returns nonzero.
Recorded Results
All values measured on the rig described in docs/materials.md. Raw per-sample CSVs (noise_floor.csv, session_live.csv, session_wet.csv) are produced by the scripts and are not committed here.
Noise floor
Amplifier inputs shorted, no mushroom, 5 minutes.
samples : 6869
mean : 1.610182 V
std dev : 0.002789 V (2.79 mV)
pk-pk : 0.033500 V (33.5 mV)
Passive signal, short runs (context)
Early 5-minute runs showed that wet substrate alone reads far above the dry noise floor:
shorted floor std dev 2.79 mV pk-pk 33.5 mV
live mushroom std dev 11.69 mV pk-pk 68.4 mV
wet paper towel std dev 9.99 mV pk-pk 67.1 mV
The wet towel reading close to the live plate is why the long controlled runs below were needed. Raw std dev over a few minutes does not separate biology from wet electrodes.
Passive signal, 1-hour untouched runs
Event = sustained deviation over a 5-minute rolling baseline, held 2 s or more, in the 7-80 mV range.
events std dev pk-pk biggest event
wet towel 0 7.2 mV 54 mV n/a
live mushroom 60 41.7 mV 151 mV 18.3 mV
Zero events on the dead control, sixty on the live plate, all biologically plausible in size, arriving in bursts with quiet gaps. This is the primary result.
Stimulation
0.82 V pulses, 3 s, through a 5.1 kOhm resistor into a stim electrode spaced from the measurement pair.
Live plate, early pulses showed large positive spike changes that faded over the session:
+12, +16, +38, +49, then falling to -8, -16, -14, with a late +30
The rising baseline over the session is consistent with electrode polarization from repeated DC pulses, so the early responses are the strongest evidence.
Dead control, same pulses: baseline stayed flat, spike change never cleared +2, mostly negative. The living network responds to stimulation in a way dead wet substrate does not.
Reading of the results
The hardware cleanly measures real voltages. The living plate produces electrical activity that a dead-but-wet control does not, both passively and in response to stimulation. The language model's text is produced entirely by the model; the mushroom contributes the numbers that set temperature and mood.