Skip to content

Instantly share code, notes, and snippets.

How we tricked sand to think

From decisions to electronic logic

1. Computation as rule-following

Computers do not think. They follow instructions step by step to change information.

computation = applying rules reliably at scale

/*
ESP32-WROOM + HC-SR04 (x6) + Relays (x6) + Web UI + Persistent config + Debug logger
Additions in this version:
- Sensor->Relay mapping is configurable (one-to-one, one-to-many, many-to-one)
- Mapping editor in Web UI (checkbox matrix), persisted in NVS (Preferences)
- AUTO mode uses mapping: relayTarget[r] = OR( sensorState[s] for all mapped sensors->r )
- /status includes sensors + relays + heartbeat (millis), UI refresh is 0.5s
IMPORTANT ELECTRICAL NOTE:
@pral2a
pral2a / diagram.txt
Created January 20, 2026 15:02
LLUM BARCELONA
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ LLUM BARCELONA ยท SYSTEM MAP โ•‘
โ•‘ (robot ยท vision ยท sensing ยท light) โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ HANDHELD REMOTE โ”‚
โ”‚ ESP32 โ”‚
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pral2a
pral2a / mdef-experimental-dispatch-vol-I.md
Last active September 15, 2024 07:32
Experimental Dispatch Vol I is an informal collection of readings, tools, and platforms curated regularly by the Fab Lab Barcelona team. ๐Ÿ“š

Hello,

The following is an informal collection of readings, tools, and platforms curated during the last two months by the Fab Lab Barcelona team. ๐Ÿ“š

We plan to send a thought-provoking collection every 2-3 months. ๐Ÿ”„ The summary and clustering of the articles are automatically done by GPT using the Bing extension; errors are expected.

We hope you like it, and remember to check out our blog. ๐ŸŒ

Articles and Studies ๐Ÿ“–

@pral2a
pral2a / MicroBiomeMAP.geojson
Last active July 12, 2021 16:26
Microbioma Barcelona
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pral2a
pral2a / I2CAnalogRead.ino
Created October 3, 2019 10:47
I2CADCforPi
#include <Wire.h>
/*
* Set I2C Slave address
*/
#define I2C_SLAVE_ADDRESS 0x7
#define SENSOR A0
ID Name Unit RAW?
10 Battery SCK 1.1 (%) N
14 BH1730FVC (Lux) N
15 MiCS-4514-NO2 (kOhm) Y
16 MiCS-4514-CO (kOhm) Y
53 ICS43432 - Noise (dBA) N
55 SHT31 - Temperature (ยบC) N
56 SHT31 - Humidity (%) N
58 MPL3115A2 - Barometric Pressure (kPa) N
int const PIRpin = 2;
unsigned long previousMillis = 0;
const long interval = 2000;
int prevPinStatus = 0;
long presenceCounter = 0;
void setup() {
Serial.begin(9600);
pinMode(PIRpin, INPUT);
/*
ESP8266 example for tone via timer1
Hardware: NodeMCU
2018
tone using Timer
*/
//define ITONE_CYCLE 2500000 // 1 second cycle in 1/16 CPU clock (1/5 ยตs) for 80 MHz
#define ITONE_CYCLE 5000000 // 1 second cycle in 1/16 CPU clock (1/5 ยตs) for 160 MHz