TinySensor aims to provide a customisable firmware and a hardware design for low-power environment sensors using wireless communication.
In the complete system, data is processed by a Domoticz/RFlink couple. Data decoding is also tested using RTL_433 decoder. Large part of the code, especially wireless encoders, are unit-tested.
| TinySensor v3.0 board (cuttable) | Mushroom casing | Wall box | tinyDecoders receiver |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
TinySensor v3.0 schematic (click to enlarge; PDF with title block). The board can be cut along the dotted line at x = 147 to drop the CR2032 area, as in the mushroom.
- ATTiny84a
- I2C sensors (eg. Bosch BME/BMP280)
- Analog sensors (eg. LM35)
- OneWire sensors (eg. Dallas DS18S20)
- Luminosity sensor (ROHM BH1750, I2C)
- "one pin" emitters. Tested with low-cost 433 MHz emitters.
- Environment frame (temperature, humidity, pressure): Oregon Scientific v2.1 (class
OregonV3) or Lacrosse WS7000, at most one per build. A build without either sends no environment frame. - Luminosity: always a dedicated Lacrosse WS7000 frame (Oregon has no light frame), so
LACROSSE_IDis required whenever the BH1750 is fitted. - Battery level and analog input: optional X10 RFXmeter frames, not sent when the battery is low.
Various libraries are used here, and some where tweaked to remove any Arduino dependencies, making the whole firmware more compact:
- Sparkfun BME280 sensor library with all SPI related code removed
- Tiny I2C of David Johnson-Davies
- Unity test harness from Throw The Switch, for all testing code
- DS18B20 library of Jacek Wieczorek
The firmware is built with PlatformIO and configured entirely at build time: each physical sensor is one PlatformIO environment (S_02…S_05, robot, devmodule, SOLAR_TEST, mushroom) whose build_flags select protocol, sensors and calibration. See docs/environments.md to calibrate or add a board.
pio test -d emitter -e native_debug # encoder and library unit tests, on the host
pio test -d emitter -e native_cycle_oregon # one measurement cycle (runCycle) per build variant;
# also native_cycle_oregon_vcc, _oregon_divider,
# _lacrosse, _x10
pio run -d emitter -e S_02 # firmware for one board
pio run -d emitter -e S_02 -t upload # flash itFlashing with a BME280 plugged in. ISP and I2C share the ATtiny84A pins PA4 (SCK / SCL) and PA6 (MOSI / SDA). On v3.0, R9 and R10 (330 Ω) sit in series between the MCU and the sensor connectors J3/J14, so the programmer drives SCK and MOSI without the sensor holding them: the board should flash with the BME280 in place (not yet checked on a built board). On v2.2 and earlier, unplug the BME280 before flashing, otherwise flashing fails; always wire it through its JST connector, never solder it to the board.
CI runs the native tests (native_debug and every native_cycle_*), compile-fail checks for invalid flag combinations (emitter/test/compile_fail/), sensor-variant checks (emitter/test/build_variants/), clang-format and a build of every board (including mushroom).
- Architecture: docs/architecture.md
- Step debugging over debugWIRE: docs/debugging.md
- Requirements: see Requirement-based development below
This project follows requirement-based development (RBD): every behaviour of the firmware, the receiver and the boards is written down as a requirement before it is tested and coded. Each requirement, its tests and the commits that implement it can therefore be traced to each other.
The cycle for each change:
- Requirement. The change is first written as a requirement with an ID such as
FUNC-OREGON-001(category, domain, number), a status (validatedordraft) and its dependencies. - Tests. Tests are written next. Each Unity test function carries the ID it verifies on the line above it:
// @req FUNC-OREGON-001. Requirements that no host test can observe (AVR registers, wiring, bench measurements) say instead how they are verified: by inspection, by a build, or on the bench. - Code. The code then makes the tests pass. The linter (
clang-format18.1.8) and the full native test suite must pass before each commit. - Commit. Each commit names what it serves:
req(ID):,test(ID):,feat(ID):,tech(ID):,perf(ID):,ui(ID):,conf(ID):orarch(ID):;plan:for workflow files;hw:,docs:,fix:,chore:,style:orrefactor:outside the code cycle (hw:is added in.rbd/config.yml,extra_commit_prefixes). The rbd plugin's pre-push hook rejects any other prefix, and a code commit whose ID is missing or notvalidated.
git log --grep FUNC-MAIN-001 and grep -rn FUNC-MAIN-001 emitter/test show where a requirement was written, tested and implemented.
| Document | Contents |
|---|---|
| requirements/functional.md | FUNC: observable behaviour: radio frames, measurements, battery, receiver decoding, RFLink lines |
| requirements/ui.md | UI: what the receiver OLED shows |
| requirements/configuration.md | CONF: build flags, PlatformIO environments, CI |
| requirements/platform.md | PLAT: hardware use: pins, registers, timers, sleep, board pull-ups |
| requirements/technical.md | TECH: classes, interfaces, memory layout, test doubles |
| requirements/performance.md | PERF: none yet |
| docs/architecture.md | Component diagram, dependency injection map, and a requirement → component traceability table |
| audits/ | Audit and review reports. Each one starts with the commit it audited, so git diff <hash>..HEAD shows what changed since |
| audits/exclusions.yml | Audit findings accepted on purpose, with their justification |
| .rbd/config.yml | ID format, test tag convention and linter command |
Non-technical requirements (FUNC, UI, CONF, PLAT) describe what can be observed, without class or function names. Those details live in TECH. Requirement IDs cited in these documents link to their heading. The workflow is driven by the rbd Claude Code plugin (/rbd, /rbd-audit, /rbd-review); see CLAUDE.md.
- KiCad board (v3.0) in
hardware/tinysensor/: schematic (PDF), regenerated withkicad-cli sch export pdf -o hardware/tinysensor/tinysensor_schematic.pdf hardware/tinysensor/tinysensor.kicad_sch; with its backlog and a rework guide for v2.2 boards. - OpenSCAD enclosures (wall box, radiation shield, mushroom, receiver) in
enclosing/, see enclosing/README.md. - Header renders:
kicad-cli pcb render --rotate '-45,0,45' --quality high --width 1400 --height 800 --zoom 1.22 -o docs/img/tinysensor_v3_iso.png hardware/tinysensor/tinysensor.kicad_pcband, fromenclosing/receiver/,openscad --preview -D 'part="assembly"' --camera=0,0,0,55,0,25,0 --viewall --autocenter --projection=o --imgsize=1400,1000 -o ../../docs/img/receiver_iso.png receiver.scad; fromenclosing/basic/,openscad --preview -D 'part="exploded"' --camera=0,0,0,55,0,25,0 --viewall --autocenter --projection=o --imgsize=1400,1000 -o ../../docs/img/wallbox_exploded_iso.png tinysensor_box.scad. Schematic image:kicad-cli sch export svg --exclude-drawing-sheet -o <dir> hardware/tinysensor/tinysensor.kicad_sch, then a white background rectangle is added so it stays readable in dark mode.
TinySensor can use combination of sensors, the limit comes from amount of flash memory on the ATTiny.
OneWire sensor, cheap and efficient.
The BMP280 and the BME280 share the same library, but the BME provide humidity sensing, and thus use more memory.
Analog sensor can be used for LM35 temperature sensor, or LDR.
On v2.2 and v3.0 boards running from 2×AA/AAA, the LM35 can be powered by an off-board 5 V boost module switched on PB2 only during measurements (USE_SWITCHED_5V), see VARIANTE_LM35.md. The instructions below are for v2.1.
A 0v ground reference is needed. Solder pads 2 and 3 of J4, (rear side) as well JP3.
In the case of a -CAZ version, temperature below 0 can be measured. To allow this, two 1N914 diodes must be placed to put the sensor reference below 0v. This setup is documented in the LM35 datasheet. On TinySensor board v2.1 and up, this can be implemented by:
- solding D2 and D3 diodes
- solding R4 with a value of 18k
- solding JP3 to bypass C3 capacitor
- solding pads 1 and 2 of J4 (rear side) to set ground reference.
You can add a filter capacitor C3 to avoid swing if the wire is long. In this case, do not solder JP3. See datasheet for details.
Use the right value for R4 (should match the used LDR) and solder JP3 and, on JP4, middle and 3 pads. This way, there will be no RC filter (no cap because of J3) and Vss analog reference thanks of JP4.



