Skip to content

Commit

Permalink
disable SPI between display updates, fix schematic (#24)
Browse files Browse the repository at this point in the history
- fix high power consumption of display in sleep mode by disabling SPI (driving SCK low)
- remove "unconnected" from MCU pin 20 (AREF) as it is connected
- update README and manual
  • Loading branch information
gitdode authored Jul 30, 2023
1 parent c7238f5 commit dd8c8fc
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 12 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ A precision thermistor and precision low-voltage humidity sensor are used:

## Power Consumption

Estimated average power consumption is about 110µA when measuring every 32
Estimated average power consumption is about 90µA when measuring every 32
seconds and updating the display once in about 5 minutes, hopefully giving an
operating time of about 12 months with 3 AAA batteries (1100 mAh, 6%
operating time of at least 12 months with 3 AAA batteries (1100 mAh, 6%
self-discharge).

The consumption of each component at 3.8V and 22°C is about:
Expand Down Expand Up @@ -82,7 +82,15 @@ lifetime and to save more power.

Below the cutoff voltage of 3.0V, the watchdog is disabled to stop measuring and
updating the display, to at least delay total discharge of the batteries.
Consumption of the MCU then is at about 1µA and 24µA of the display.
Consumption of the MCU then is at about 1µA and 19µA of the display.

The clock of unused modules TWI, all three timers and USART is switched off to
reduce power consumption.

Disabling the ADC between measurements and the SPI between display updates both
contributes to a significant reduction of power consumption. With an active SPI,
consumption of the display including its peripheral is extremely unstable and
varies between some tens of microamps and several milliamps. When driving the
enable pin of the display low, consumption is stable at about 60µA. When not
driving the enable pin low and disabling SPI (driving SCK pin low) consumption
is at about 14µA.
18 changes: 17 additions & 1 deletion thermidity-avr/thermidity.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ static void initPins(void) {
static void initSPI(void) {
SPCR |= (1 << SPR0);
SPCR |= (1 << MSTR);
SPCR |= (1 << SPE);
}

/**
Expand Down Expand Up @@ -157,6 +156,21 @@ static void disableADC(void) {
ADCSRA &= ~(1 << ADEN);
}

/**
* Enables SPI.
*/
static void enableSPI(void) {
SPCR |= (1 << SPE);
}

/**
* Disables SPI.
*/
static void disableSPI(void) {
SPCR &= ~(1 << SPE);
PORT_SPI &= ~(1 << PIN_SCK);
}

/**
* Stops the clock of unused modules to reduce power consumption.
*/
Expand Down Expand Up @@ -211,6 +225,7 @@ int main(void) {
if (getMVBat() < BAT_LOW / 5) {
powerDown();
} else {
enableSPI();
if (updates > DISP_MAX_FAST) {
// make a full update after a certain number of fast
// updates to avoid ghosting
Expand All @@ -221,6 +236,7 @@ int main(void) {
updates++;
}
}
disableSPI();
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions thermidity-kicad/thermidity.kicad_pcb
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@
(net 13 "unconnected-(J2-Pad13)")
(net 14 "Net-(J3-Pad2)")
(net 15 "Net-(R2-Pad1)")
(net 16 "unconnected-(U1-Pad20)")
(net 16 "Net-(C2-Pad2)")
(net 17 "unconnected-(U1-Pad1)")
(net 18 "unconnected-(U1-Pad2)")
(net 19 "unconnected-(U1-Pad7)")
(net 20 "unconnected-(U1-Pad8)")
(net 21 "unconnected-(U1-Pad14)")
(net 22 "unconnected-(U1-Pad19)")
(net 23 "unconnected-(U1-Pad22)")
(net 24 "Net-(U1-Pad25)")
(net 24 "Net-(R3-Pad1)")
(net 25 "unconnected-(U1-Pad27)")
(net 26 "unconnected-(U1-Pad28)")
(net 27 "unconnected-(U1-Pad30)")
Expand Down Expand Up @@ -312,7 +312,7 @@
(pad "1" smd roundrect (at -1 0) (size 1.2 1.4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.208333)
(net 15 "Net-(R2-Pad1)") (pintype "passive") (tstamp dbd40c88-e0eb-4219-8afa-7a8ed17c8238))
(pad "2" smd roundrect (at 1 0) (size 1.2 1.4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.208333)
(net 24 "Net-(U1-Pad25)") (pintype "passive") (tstamp ba3313dc-6f43-41a6-9221-c351d7cfd230))
(net 24 "Net-(R3-Pad1)") (pintype "passive") (tstamp ba3313dc-6f43-41a6-9221-c351d7cfd230))
(model "${KICAD6_3DMODEL_DIR}/Resistor_SMD.3dshapes/R_0805_2012Metric.wrl"
(offset (xyz 0 0 0))
(scale (xyz 1 1 1))
Expand Down Expand Up @@ -688,7 +688,7 @@
(pad "19" smd rect (at 4.25 1.2 180) (size 1.6 0.55) (layers "F.Cu" "F.Paste" "F.Mask")
(net 22 "unconnected-(U1-Pad19)") (pinfunction "ADC6") (pintype "input+no_connect") (tstamp 603e2d15-7462-46ce-9abb-d2c0d449cccc))
(pad "20" smd rect (at 4.25 0.4 180) (size 1.6 0.55) (layers "F.Cu" "F.Paste" "F.Mask")
(net 16 "unconnected-(U1-Pad20)") (pinfunction "AREF") (pintype "passive+no_connect") (tstamp b95431fa-abbf-4092-bf8a-60ec5322edd5))
(net 16 "Net-(C2-Pad2)") (pinfunction "AREF") (pintype "passive") (tstamp b95431fa-abbf-4092-bf8a-60ec5322edd5))
(pad "21" smd rect (at 4.25 -0.4 180) (size 1.6 0.55) (layers "F.Cu" "F.Paste" "F.Mask")
(net 1 "GND") (pinfunction "GND") (pintype "passive") (tstamp b3ecc1f1-c79b-410c-a290-31dfcf9a1f91))
(pad "22" smd rect (at 4.25 -1.2 180) (size 1.6 0.55) (layers "F.Cu" "F.Paste" "F.Mask")
Expand All @@ -698,7 +698,7 @@
(pad "24" smd rect (at 4.25 -2.8 180) (size 1.6 0.55) (layers "F.Cu" "F.Paste" "F.Mask")
(net 15 "Net-(R2-Pad1)") (pinfunction "PC1") (pintype "bidirectional") (tstamp a1d0eaf4-2b80-4309-a367-749b4a7ce1b3))
(pad "25" smd rect (at 2.8 -4.25 270) (size 1.6 0.55) (layers "F.Cu" "F.Paste" "F.Mask")
(net 24 "Net-(U1-Pad25)") (pinfunction "PC2") (pintype "bidirectional") (tstamp 51e410c5-bd5a-49a1-aa49-ba743f2b80a6))
(net 24 "Net-(R3-Pad1)") (pinfunction "PC2") (pintype "bidirectional") (tstamp 51e410c5-bd5a-49a1-aa49-ba743f2b80a6))
(pad "26" smd rect (at 2 -4.25 270) (size 1.6 0.55) (layers "F.Cu" "F.Paste" "F.Mask")
(net 32 "Net-(R4-Pad1)") (pinfunction "PC3") (pintype "bidirectional") (tstamp 58c715ff-aae5-4a10-a674-1f34d1fc4446))
(pad "27" smd rect (at 1.2 -4.25 270) (size 1.6 0.55) (layers "F.Cu" "F.Paste" "F.Mask")
Expand Down Expand Up @@ -817,7 +817,7 @@
(fp_line (start -1 0.625) (end -1 -0.625) (layer "F.Fab") (width 0.1) (tstamp e6fafe3d-9f93-4ea1-8d7e-1710cdf87588))
(fp_line (start -1 -0.625) (end 1 -0.625) (layer "F.Fab") (width 0.1) (tstamp ea5574e6-ac7f-411b-bb91-55a5f04942bd))
(pad "1" smd roundrect (at -1 0) (size 1.2 1.4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.208333)
(net 24 "Net-(U1-Pad25)") (pintype "passive") (tstamp 43d0b5da-5dc9-4b4f-8261-609cadfb11d9))
(net 24 "Net-(R3-Pad1)") (pintype "passive") (tstamp 43d0b5da-5dc9-4b4f-8261-609cadfb11d9))
(pad "2" smd roundrect (at 1 0) (size 1.2 1.4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.208333)
(net 1 "GND") (pintype "passive") (tstamp e0ebdbb5-b8d1-40e8-a6ec-a6422bc48f7a))
(model "${KICAD6_3DMODEL_DIR}/Resistor_SMD.3dshapes/R_0805_2012Metric.wrl"
Expand Down Expand Up @@ -861,7 +861,7 @@
(pad "1" smd roundrect (at -1.5625 0) (size 1.325 1.8) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.188679)
(net 1 "GND") (pintype "passive") (tstamp 1ebd1692-c054-4c86-9be2-f5a89376df10))
(pad "2" smd roundrect (at 1.5625 0) (size 1.325 1.8) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.188679)
(net 16 "unconnected-(U1-Pad20)") (pintype "passive+no_connect") (tstamp 5944d779-7015-4d36-81ee-9e8585a6c876))
(net 16 "Net-(C2-Pad2)") (pintype "passive") (tstamp 5944d779-7015-4d36-81ee-9e8585a6c876))
(model "${KICAD6_3DMODEL_DIR}/Capacitor_SMD.3dshapes/C_1206_3216Metric.wrl"
(offset (xyz 0 0 0))
(scale (xyz 1 1 1))
Expand Down
1 change: 0 additions & 1 deletion thermidity-kicad/thermidity.kicad_sch
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,6 @@
(no_connect (at 161.29 71.12) (uuid 35b42f47-b21a-4ba0-8a0a-dda5c4b4b65f))
(no_connect (at 161.29 101.6) (uuid 37cbc4c9-7e49-4442-bb58-edb885e6f9ca))
(no_connect (at 161.29 116.84) (uuid 44ca8a53-cfca-4c16-8719-e64747603dc8))
(no_connect (at 130.81 66.04) (uuid 47c0c60f-5be4-4a98-a26a-24d33245dc91))
(no_connect (at 161.29 114.3) (uuid 5b7c7cfd-369c-4368-8063-c4146e959fc8))
(no_connect (at 161.29 99.06) (uuid 67b09308-2ba7-4b89-87b7-574334aba39e))
(no_connect (at 201.93 68.58) (uuid 67fe53b8-47f6-4fa3-a5ef-197074934bd1))
Expand Down
Binary file modified thermidity-manual/Thermidity-de.odt
Binary file not shown.
Binary file modified thermidity-manual/Thermidity-de.pdf
Binary file not shown.

0 comments on commit dd8c8fc

Please sign in to comment.