Programming the application

A project log for konijntje-thermo-humi

Gadget that shows room temperature & humidity on a LED-bar

Christoph TackChristoph Tack 06/19/2018 at 19:250 Comments

Charlieplexing LEDs

The Sparkfun library was taken as a start.  The memory footprint has been reduced.  Functionality has been added to operate the LED array in single LED mode.

Temperature/humidity sensor

The sensor powerline has been connected to a GPIO.  Experience with the Aiakos project learned me that it's the easiest way to save power when the sensor is not in use.

The 100ohm series resistors in the SCL & SDA lines are needed to make in-circuit-programming possible.

R7 together with C2 forms an RC-filter to stabilize the supply voltage for the temperature sensor.

Supply voltage sensor

The internal bandgap reference of the ATTINY is used here to measure the supply voltage.  If it's lower than 2.5V, the temperature & humidity LEDs will be on for a short time.  

Sleep mode

As it's a battery powered device that should have a long lifetime, most of the time is spent in sleep mode.  The deepest sleep mode is used, which results in a sleep current of close to 100nA for this device.

Operating mode

Showing temperature & humidity isn't very complicated.  A simple state machine takes care of the program flow.