Sensors and how they connect
A sensor is only useful if the controller can read it — and how it connects depends on the sensor. Knowing the handful of patterns lets you predict what any product needs.
The main ways a sensor talks to the brain:
- Analog — the sensor outputs a varying voltage the controller reads on an ADC pin. Examples in the library: the capacitive soil-moisture probe, and current sensing with an ACS712.
- Digital single-wire — the sensor sends a digital reading over one data line. The DHT22 (temp + humidity) and the DS18B20 (temperature, on a "1-Wire" bus) work this way.
- Timing / echo — the controller sends a pulse and times the return. The HC-SR04 ultrasonic distance sensor does this.
- Interrupt — the sensor just yanks a pin high when something happens, waking the controller. The PIR motion sensor is the classic.
- Amplified / bridge — tiny signals need a dedicated amplifier chip first. A load cell uses the HX711 to turn a faint strain signal into a clean digital reading.
You don't wire these by hand — but recognising the pattern tells you why Forge picks a particular block, and whether your idea is a one-wire job or needs an amplifier.
Reading the real subcircuits
Let's match a few real products to the sensing block they need — the kind of call you'll make constantly:
| You want to… | Reach for |
|---|---|
| Measure temperature + humidity | DHT22 (one digital wire) |
| Measure temperature precisely, maybe several points | DS18B20 (1-Wire, chainable) |
| Detect movement in a room | PIR motion sensor (interrupt) |
| Measure distance to something | HC-SR04 ultrasonic |
| Know how wet the soil is | capacitive soil-moisture probe (analog) |
| Weigh something / measure force | HX711 load-cell amplifier |
| Measure how much current a load draws | INA219 (over I2C) or ACS712 (analog) |
Notice the pattern: the thing you want to sense points straight at a block. When you describe a product to Forge, naming the quantity ("soil moisture," "weight," "distance") is usually enough for it to pick the right sensing subcircuit.
You need to add weight or force sensing to a product. Which library block fits?
Try it — a plant soil-moisture alarm
Time to compose one. A soil-moisture alarm is a clean input → brain → output product: sense how dry the soil is, and warn when it crosses a line.
Send the prompt and watch Forge pick a capacitive soil-moisture probe (an analog sensing block), read it on an ADC pin, and drive a buzzer + LED as the output.
As you read, notice it's just blocks from the shelf you learned this lesson — connected correctly for you.
Watch which sensing block Forge reaches for (a capacitive soil-moisture probe) and how it reads an analog signal, then drives a buzzer + LED as the output.
A plant care gadget that beeps and lights an LED when the soil gets too dry, using a soil-moisture sensor, USB-powered, around 8,000 NGN.
Opens in a new tab so you keep this lesson open. Nothing to buy — this is just to see how Forge reasons. This step isn't graded.