├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── examples └── MicroWakeupperDemo │ └── MicroWakeupperDemo.ino ├── keywords.txt ├── library.properties ├── pcb ├── Gerber_R6_3 │ ├── BOM_MicroWakeupper_WemosShield_R6_3_2022-01-18.csv │ ├── Gerber_MicroWakeupper_WemosShield_R6_3.zip │ └── PickAndPlace_MicroWakeupper_WemosShield_R6_3_2022-01-18.csv ├── Schematic_MicroWakeupper_R6_3.pdf └── Schematic_MicroWakeupper_R6_5.pdf ├── pics ├── 6.2 │ ├── P1.JPG │ ├── P2.JPG │ ├── P3.JPG │ └── P4.JPG └── 6.3 │ ├── P1.JPG │ ├── P2.JPG │ └── P3.JPG └── src ├── MicroWakeupper.cpp └── MicroWakeupper.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2021 Tobias Stöger 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MicroWakeupper (Wemos D1 Mini Battery Shield) 2 | ![MicroWakeupper Wemos D1 Mini Battery Shield Front](./pics/6.3/P1.JPG "The MicroWakeupper Wemos D1 Mini Battery Shield Front") 3 | ![MicroWakeupper Wemos D1 Mini Battery Shield Back](./pics/6.3/P2.JPG "The MicroWakeupper Wemos D1 Mini Battery Shield Back") 4 | **What is it?** 5 | 6 | You need the MicroWakeupper Battery Shield if you want to wakeup or power on your ESP/Wemos due to an external event (e.g. a switch, button or PIR-sensor). As soon as there is an external event the MicroWakeupper wakes up your ESP/Wemos from deep sleep or just turns it on. Pin A0 is connected - can be disconnected - to V-Batt for measuring the current battery voltage. 7 | 8 | The MicroWakeupper (see XH-Header) can be powered by a 2.5V - 6V battery source, e.g. 4xAA eneloop or a 3.7V LiPo . The internal LDO (AP2112K) will take care about the internal 3.3V voltage regulation - required by the Wemos D1 Mini. 9 | 10 | **Why did I make it?** 11 | 12 | The MicroWakeupper will run your projects on battery for years. Your ESP/Wemos will only wakeup or turn on (and consume current) if the connected switch, button or PIR sensor was toggled/triggered. During the rest of the time the ESP is in deep sleep mode or (optionally - J1 cut for completely off). 13 | 14 | **Current consumption** 15 | 16 | Default - uncut Jumper J1 (Wemos in DeepSleep): ~254uA (0,254mA) 17 | 18 | Cut Jumper J1 (Wemos turned off - no DeepSleep): ~55uA (0,055mA) 19 | 20 | If you don't need VBatt measurement (J2 cut) you can reduce current: ~7uA (0,007mA) 21 | 22 | (Measurement done at VBatt 3,7V) 23 | 24 | Feel free to desolder the on board LED ;-) 25 | 26 | **What makes it special?** 27 | 28 | The MicroWakeupper is the plug and play solution if you want to add a button, switch or PIR sensor to your project. The board supports two switching modes for normally open or normally closed behaviour. It also takes care about retriggering and button debouncing. 29 | 30 | For more information and the microWakeupper-Arduino Library please check: https://github.com/tstoegi/MicroWakeupper 31 | (...and follow me on twitter @tstoegi) 32 | 33 | The MicroWakeupper board comes fully assembled (without headers and Wemos D1 Mini). 34 | 35 | Looking forward to get feedback about your awesome MicroWakeupper projects, e.g. a Gasmeter https://github.com/tstoegi/MyMeter 36 | 37 | Tobias 38 | 39 | 40 | # The latest board revision is available on tindie: 41 | https://www.tindie.com/stores/moreiolabs/ 42 | 43 | --- 44 | # You'll always find the latest schematic, BOM and Gerber files on GitHub: 45 | 46 | [./pcb](./pcb) 47 | 48 | --- 49 | 50 | That's it! 51 | 52 | Have fun and hopefully your project will run for years now ;-) 53 | 54 | #Special thanks to @davedarko! 55 | + Created on December 13th 2018 by Tobias Stöger (@tstoegi) 56 | + Updated to Rev.3 on January 7th 2019 by Tobias Stöger 57 | + Updated to Rev.6 on May 20th 2021 by Tobias Stöger 58 | + Updated to Rev.6.2 on May 28th 2021 by Tobias Stöger 59 | + Updated to Rev.6.3 on Feb 3rd 2022 by Tobias Stöger 60 | -------------------------------------------------------------------------------- /examples/MicroWakeupperDemo/MicroWakeupperDemo.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Example programm for the MicroWakeupper Wemos D1 Mini Shield 3 | 4 | Place the shield on your Wemos D1 Mini (Battery Connector and USB Connector on one side - Battery Connector on top side and USB at the bottom side) 5 | If you connect a battery take care about Plus (+ left) and Minus (- right). Do not use a unprotected Lipo - the board has no discharge protection. 6 | 7 | Important: Press FLASH (on the MicroWakeupper board) for uploading new sketches! ('cause RST and D0 are connected by default for DeepSleep support) 8 | 9 | (c)2021 by @tstoegi 10 | 11 | */ 12 | 13 | #include 14 | 15 | //MicroWakeupper instance (only one is supported!) 16 | MicroWakeupper microWakeupper; 17 | 18 | #define secondsToSleep 10 // Timeperiod in seconds sleeping - max 4294967295 (around 71 minutes) 19 | 20 | void setup() { 21 | Serial.begin(115200); 22 | 23 | microWakeupper.begin(); // For correct initialisation 24 | 25 | if (microWakeupper.resetedBySwitch()) { 26 | Serial.println("Looks like ESP was reseted by reset/switch"); 27 | } else { 28 | Serial.println("Looks like ESP woke up by internal timer"); 29 | } 30 | } 31 | 32 | void loop() 33 | { 34 | Serial.print("Current Battery Voltage:"); 35 | Serial.println(microWakeupper.readVBatt()); 36 | 37 | microWakeupper.reenable(); // Re-enable MicroWakeupper for new triggering 38 | 39 | ESP.deepSleep(secondsToSleep * 1000000); // ESP.deepSleep expects microseconds 40 | 41 | delay(200); 42 | } 43 | -------------------------------------------------------------------------------- /keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For MicroWakeupper 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | MicroWakeupper KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | speedInKMH KEYWORD2 16 | speedInMPH KEYWORD2 17 | reenable KEYWORD2 18 | disable KEYWORD2 19 | isEnabled KEYWORD2 20 | isActive KEYWORD2 21 | resetedBySwitch KEYWORD2 22 | setVoltageDivider KEYWORD2 23 | readVBatt KEYWORD2 24 | 25 | ####################################### 26 | # Instances (KEYWORD2) 27 | ####################################### 28 | 29 | 30 | ####################################### 31 | # Constants (LITERAL1) 32 | ####################################### 33 | 34 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=MicroWakeupper Wemos D1 Mini Battery Shield 2 | version=6.3.1 3 | author=Tobias 4 | maintainer=Tobias 5 | sentence=Library for the MicroWakeupper Wemos D1 Mini Battery Shield (with deepsleep) 6 | paragraph= 7 | category=Sensors 8 | url=https://github.com/tstoegi/MicroWakeupper 9 | architectures=esp8266 10 | -------------------------------------------------------------------------------- /pcb/Gerber_R6_3/BOM_MicroWakeupper_WemosShield_R6_3_2022-01-18.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tstoegi/MicroWakeupper/12e084950110589b63864cc0695bfa22148ab513/pcb/Gerber_R6_3/BOM_MicroWakeupper_WemosShield_R6_3_2022-01-18.csv -------------------------------------------------------------------------------- /pcb/Gerber_R6_3/Gerber_MicroWakeupper_WemosShield_R6_3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tstoegi/MicroWakeupper/12e084950110589b63864cc0695bfa22148ab513/pcb/Gerber_R6_3/Gerber_MicroWakeupper_WemosShield_R6_3.zip -------------------------------------------------------------------------------- /pcb/Gerber_R6_3/PickAndPlace_MicroWakeupper_WemosShield_R6_3_2022-01-18.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tstoegi/MicroWakeupper/12e084950110589b63864cc0695bfa22148ab513/pcb/Gerber_R6_3/PickAndPlace_MicroWakeupper_WemosShield_R6_3_2022-01-18.csv -------------------------------------------------------------------------------- /pcb/Schematic_MicroWakeupper_R6_3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tstoegi/MicroWakeupper/12e084950110589b63864cc0695bfa22148ab513/pcb/Schematic_MicroWakeupper_R6_3.pdf -------------------------------------------------------------------------------- /pcb/Schematic_MicroWakeupper_R6_5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tstoegi/MicroWakeupper/12e084950110589b63864cc0695bfa22148ab513/pcb/Schematic_MicroWakeupper_R6_5.pdf -------------------------------------------------------------------------------- /pics/6.2/P1.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tstoegi/MicroWakeupper/12e084950110589b63864cc0695bfa22148ab513/pics/6.2/P1.JPG -------------------------------------------------------------------------------- /pics/6.2/P2.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tstoegi/MicroWakeupper/12e084950110589b63864cc0695bfa22148ab513/pics/6.2/P2.JPG -------------------------------------------------------------------------------- /pics/6.2/P3.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tstoegi/MicroWakeupper/12e084950110589b63864cc0695bfa22148ab513/pics/6.2/P3.JPG -------------------------------------------------------------------------------- /pics/6.2/P4.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tstoegi/MicroWakeupper/12e084950110589b63864cc0695bfa22148ab513/pics/6.2/P4.JPG -------------------------------------------------------------------------------- /pics/6.3/P1.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tstoegi/MicroWakeupper/12e084950110589b63864cc0695bfa22148ab513/pics/6.3/P1.JPG -------------------------------------------------------------------------------- /pics/6.3/P2.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tstoegi/MicroWakeupper/12e084950110589b63864cc0695bfa22148ab513/pics/6.3/P2.JPG -------------------------------------------------------------------------------- /pics/6.3/P3.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tstoegi/MicroWakeupper/12e084950110589b63864cc0695bfa22148ab513/pics/6.3/P3.JPG -------------------------------------------------------------------------------- /src/MicroWakeupper.cpp: -------------------------------------------------------------------------------- 1 | #include "MicroWakeupper.h" 2 | 3 | MicroWakeupper::MicroWakeupper(bool disableAtStartup, int staPin, int disPin) 4 | : _disableAtStartup(disableAtStartup), 5 | _sta_pin(staPin), 6 | _dis_pin(disPin) 7 | { 8 | } 9 | 10 | void MicroWakeupper::begin() 11 | { 12 | pinMode(_sta_pin, INPUT); // Initialize the status pin as input 13 | 14 | _switchReset = digitalRead(_sta_pin) == HIGH; //If the status pin is already HIGH, it was _no_ internal ESP timer reset 15 | 16 | pinMode(_dis_pin, OUTPUT); // Initialize the disable pin as output 17 | digitalWrite(_dis_pin, _disableAtStartup ? HIGH : LOW); 18 | } 19 | 20 | bool MicroWakeupper::resetedBySwitch() 21 | { 22 | return _switchReset; 23 | } 24 | 25 | void MicroWakeupper::reenable() 26 | { 27 | digitalWrite(_dis_pin, LOW); 28 | } 29 | 30 | void MicroWakeupper::disable() 31 | { 32 | digitalWrite(_dis_pin, HIGH); 33 | } 34 | 35 | bool MicroWakeupper::isEnabled() 36 | { 37 | return !isActive(); 38 | } 39 | 40 | bool MicroWakeupper::isActive() 41 | { 42 | return digitalRead(_sta_pin) == HIGH; // We have been triggereed (LED is on) 43 | } 44 | 45 | void MicroWakeupper::setVoltageDivider(float voltageDivider) 46 | { 47 | _voltageDivider = voltageDivider; 48 | } 49 | 50 | float MicroWakeupper::readVBatt() 51 | { 52 | int sensorValue = analogRead(A0); 53 | return sensorValue / _voltageDivider; 54 | } 55 | -------------------------------------------------------------------------------- /src/MicroWakeupper.h: -------------------------------------------------------------------------------- 1 | #ifndef MicroWakeupper_h 2 | #define MicroWakeupper_h 3 | 4 | #include 5 | 6 | /* MicroWakeupper Library for Arduino (ESP8266, Wemos D1 Mini Shield) 7 | * 8 | * (C) 2021 Tobias Stöger (@tstoegi) 9 | * 10 | */ 11 | 12 | #define STA_PIN_DEFAULT D6 // D6 connected to STA pin (Wemos D1 Mini Shield) 13 | #define DIS_PIN_DEFAULT D7 // D7 connected to DIS pin (Wemos D1 Mini Shield) 14 | #define VOLTAGEDIVIDER_DEFAULT 187 // VBatt-220K-A0-220K-ADC-100K-GND (see setVoltageDivider) 15 | 16 | class MicroWakeupper 17 | { 18 | public: 19 | MicroWakeupper( 20 | bool disableAtStartup = true, // Prevent triggering during ESP runtime 21 | int staPin = STA_PIN_DEFAULT, // Override status PIN (D6) 22 | int disPin = DIS_PIN_DEFAULT // Override disable PIN (D7) 23 | ); 24 | void begin(); // Initialisation 25 | 26 | void reenable(); // Reenabling with a 2-3 seconds delay (hardware based) 27 | void disable(); // Preventing new triggering/resets 28 | bool isEnabled(); // Ready for new triggering/resets 29 | bool isActive(); // MicroWakeupper is active (LED) - there was a trigger/reset 30 | bool resetedBySwitch(); // false -> it was a internal timer reset 31 | 32 | void setVoltageDivider(float voltageDivider); // A0 read (ADO max 1024) - check VOLTAGEDIVIDER_DEFAULT 33 | float readVBatt(); // calculated battery voltage (based on A0 divided by _voltageDivider) 34 | 35 | private: 36 | bool _disableAtStartup; 37 | int _sta_pin; 38 | int _dis_pin; 39 | int _switchReset; 40 | float _voltageDivider = VOLTAGEDIVIDER_DEFAULT; 41 | 42 | }; 43 | 44 | #endif 45 | --------------------------------------------------------------------------------