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.
- ATTiny84a
- ATMega328p: started on branch
feat/328p_hal, not merged
- 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 v3 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) whose build_flags select protocol, sensors and calibration. See docs/environments.md to calibrate or add a board.
pio test -e native_debug # encoder and library unit tests, on the host
pio test -e native_cycle_oregon # one measurement cycle (runCycle) per build variant;
# also native_cycle_oregon_vcc, _lacrosse, _x10
pio run -e S_02 # firmware for one board
pio run -e S_02 -t upload # flash itCI runs the native tests, compile-fail checks for invalid flag combinations (test/compile_fail/), sensor-variant checks (test/build_variants/), clang-format and a build of every board.
- Architecture: docs/architecture.md
- Step debugging over debugWIRE: docs/debugging.md
- Requirements:
requirements/*.md(requirement-based development, seeCLAUDE.md)
- KiCad board (v3.0) in
hardware/tinysensor/, with its backlog and a rework guide for v2.2 boards. - OpenSCAD enclosures (wall box, radiation shield, mushroom) in
openscad/, see openscad/README.md.
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.