
This is an ultra-low-power sensor node: a finite state machine (FSM) with an SPI master (mode 0) that, every 10 minutes, reads a BME680 sensor and transmits the data over LoRa using an RFM95 radio module.
The design runs from an external 32.768 kHz clock. On each cycle the FSM:
CS_BM_N).CS_RF_N) and starts the transmission.ACTIVE output is 1 while the node is awake and 0 while it sleeps.The SPI bus is shared: SCK, MOSI and MISO go to both devices, and each device has its own chip select.
In simulation: from the test/ folder, run make -B to run the cocotb testbench, which uses behavioral models of the SPI slaves (BME680 and RFM95). The test checks that the transmitted packet has the expected ID, sequence number and data, that the radio ends up in sleep mode, and that ACTIVE goes low.
On hardware:
clk.rst_n low for a few cycles, then release it.ACTIVE with an oscilloscope: it goes high during the measurement and transmission, and returns to 0 when the node goes to sleep.rst_n).| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | MISO | SCK | |
| 1 | MOSI | ||
| 2 | CS_RF_N | ||
| 3 | CS_BM_N | ||
| 4 | |||
| 5 | ACTIVE | ||
| 6 | |||
| 7 |