jscrane / TinySensors

Environmental sensors with ATtiny84, nrf24l01+ and Raspberry Pi
8 stars 5 forks source link

Clock ATtiny at 1MHz #13

Closed jscrane closed 8 months ago

jscrane commented 3 years ago

This will require a new patched optiboot. The current patch assumes the frequency is 8MHz.

See optiboot/bootloaders/optiboot/Makefile.extras.

jscrane commented 3 years ago

Have added infrastructure for this; however DHT doesn't work at 1MHz, using the default library. The reason is that the pulse-width is too narrow for that clock speed. See this thread.

jscrane commented 3 years ago

From the datasheet, the sensor sends 40 bits of data in which 0s are encoded as a pulse-high 26-28uS wide, while a 1 is encoded as a pulse-high 70uS wide. From the thread, the resolution of micros() is 64uS at 1MHz so polling is out.

Could use pin-change interrupts and direct reading of a higher-resolution timer (e.g., timer1).

jscrane commented 8 months ago

Not worth doing this.