├── Code ├── Hardware_Test_Code.ino ├── Low_Power_Time.ino ├── Rev4_Hardware_Test.ino └── Touch_Wakeup_Time.ino ├── Images ├── Bottom.jpg ├── Bottom_Side.jpg ├── Exposed_GPIO_Pads.jpg ├── Rev4.jpg ├── Top.jpg └── Top_Side.jpg ├── PCB ├── 3D_Step_Rev1.zip ├── Altium_Design_Files_Rev1.zip ├── Altium_Design_Files_Rev4.zip ├── Gerber_Files_Rev1.zip ├── Gerber_Files_Rev4.zip ├── PCB_Library.PcbLib ├── Parts_List_Rev1.xls ├── Parts_List_Rev4.xls ├── Schematic_Library.SCHLIB ├── Schematic_Rev1.pdf └── Schematic_Rev4.pdf └── README.md /Code/Hardware_Test_Code.ino: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | Thanks to Adafruit for the great oled display library. It's the best one for a 96x16 type 3 | Install the GFX, SSD1306 and LIS3DH libraries from the IDE 4 | Install the Adafruit Sensor Library from: https://github.com/adafruit/Adafruit_Sensor 5 | 6 | Using the Arduino IDE choose Tools/Board: ESP32 Dev Module 7 | On Rev1 hardware line 85 = lis.begin(0x18)) 8 | On Rev4 hardware lis.begin(0x19)) 9 | *********************************************************************/ 10 | 11 | 12 | #include 13 | #include 14 | #include "time.h" 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | //I've messed up the led names and see they do not match the schematic 21 | #define BLUE_LED 23 22 | #define RED_LED 5 23 | #define GREEN_LED 18 24 | 25 | #define LOGO_HEIGHT 16 26 | #define LOGO_WIDTH 96 27 | 28 | //Doesnt work 29 | static const unsigned char PROGMEM logo_bmp[] = 30 | { 31 | }; 32 | 33 | 34 | Adafruit_SSD1306 display(96, 16, &Wire, 26); 35 | Adafruit_LIS3DH lis = Adafruit_LIS3DH(); 36 | 37 | const char* ssid = "SSID"; 38 | const char* password = "PASSWORD"; 39 | 40 | const char* ntpServer = "pool.ntp.org"; 41 | const long gmtOffset_sec = -14400; 42 | const int daylightOffset_sec = 3600; 43 | RTC_DATA_ATTR int bootCount = 0; 44 | 45 | struct tm timeinfo; 46 | 47 | void setup() 48 | { 49 | Serial.begin(9600); 50 | delay(1000); 51 | 52 | pinMode(RED_LED, OUTPUT); 53 | pinMode(GREEN_LED, OUTPUT); 54 | pinMode(BLUE_LED, OUTPUT); 55 | 56 | digitalWrite(RED_LED, HIGH); //Keep off 57 | digitalWrite(GREEN_LED, HIGH); //Keep off 58 | digitalWrite(BLUE_LED, HIGH); //Keep off 59 | 60 | Wire.begin(13,14); //ESP32 Pico D4 pins 61 | display.setRotation(2); 62 | 63 | display.begin(SSD1306_SWITCHCAPVCC, 0x3C); 64 | 65 | //connect to WiFi 66 | Serial.printf("Connecting to %s ", ssid); 67 | WiFi.begin(ssid, password); 68 | while (WiFi.status() != WL_CONNECTED) { 69 | delay(500); 70 | Serial.print("."); 71 | } 72 | Serial.println(" CONNECTED"); 73 | digitalWrite(GREEN_LED, LOW); 74 | delay(150); 75 | digitalWrite(GREEN_LED, HIGH); 76 | 77 | display.display(); 78 | delay(2000); 79 | display.clearDisplay(); 80 | 81 | //init and get the time 82 | configTime(gmtOffset_sec, daylightOffset_sec, ntpServer); 83 | 84 | Serial.println("LIS3DH test!"); 85 | 86 | if (! lis.begin(0x18)) { // change this to 0x19 for alternative i2c address 87 | Serial.println("Couldnt start"); 88 | while (1); 89 | } 90 | Serial.println("LIS3DH found!"); 91 | 92 | lis.setRange(LIS3DH_RANGE_4_G); // 2, 4, 8 or 16 G! 93 | Serial.print("Range = "); Serial.print(2 << lis.getRange()); 94 | Serial.println("G"); 95 | 96 | } 97 | 98 | void loop() 99 | { 100 | //testdrawbitmap(); //No worky 101 | 102 | if (touchRead(T0) < 50) 103 | { 104 | digitalWrite(BLUE_LED, LOW); 105 | } 106 | else 107 | { 108 | digitalWrite(BLUE_LED, HIGH); 109 | } 110 | 111 | lis.read(); 112 | sensors_event_t event; 113 | lis.getEvent(&event); 114 | 115 | display.setTextSize(1); 116 | display.setTextColor(WHITE); 117 | display.setCursor(0,8); //over,down 118 | display.print(event.acceleration.x); 119 | display.print(" "); 120 | display.print(event.acceleration.y); 121 | display.print(" "); 122 | display.print(event.acceleration.z); 123 | 124 | if(!getLocalTime(&timeinfo)) 125 | { 126 | Serial.println("Failed to obtain time"); 127 | return; 128 | } 129 | Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S"); 130 | 131 | display.setTextSize(1); 132 | display.setTextColor(WHITE); 133 | display.setCursor(0,0); //over,down 134 | display.print(&timeinfo, "%H:%M:%S"); 135 | display.display(); 136 | display.clearDisplay(); 137 | } 138 | 139 | //Doesnt Work 140 | void testdrawbitmap(void) { 141 | display.clearDisplay(); 142 | 143 | display.drawBitmap( 144 | (display.width() - LOGO_WIDTH ) / 2, 145 | (display.height() - LOGO_HEIGHT) / 2, 146 | logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1); 147 | display.display(); 148 | delay(1000); 149 | } 150 | -------------------------------------------------------------------------------- /Code/Low_Power_Time.ino: -------------------------------------------------------------------------------- 1 | /* 2 | The ESP32 Coin Cell Board uses Tools/Board/ESP32 Dev Module 3 | Simple Deep Sleep with Timer Wake Up Displaying Time every 10 minutes 4 | 5 | Using the Arduino IDE choose Tools/Board: ESP32 Dev Module 6 | ===================================== 7 | 8 | This code is under Public Domain License. 9 | 10 | Original Author: 11 | Pranav Cherukupalli 12 | */ 13 | 14 | #include 15 | #include 16 | #include "time.h" 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds */ 23 | #define TIME_TO_SLEEP 60 /* Time ESP32 will go to sleep (in seconds) 600 = 10 minutes */ 24 | #define OLED_RESET 26 /*ESP32 Pico D4 */ 25 | 26 | #define RED_LED 23 //lights Green 27 | #define GREEN_LED 18 //lights Red 28 | #define BLUE_LED 5 29 | 30 | //#define SCREEN_HEIGHT 16 31 | //#define SCREEN_WIDTH 96 32 | 33 | #define LOGO_HEIGHT 16 34 | #define LOGO_WIDTH 96 35 | 36 | static const unsigned char PROGMEM logo_bmp[] = 37 | { 38 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 39 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 42 | 0x03, 0xf3, 0xff, 0x18, 0xe0, 0x1e, 0x01, 0x80, 0x1e, 0x03, 0xb8, 0x00, 43 | 0x01, 0x94, 0x59, 0xac, 0xb0, 0x32, 0x00, 0x00, 0x32, 0x01, 0x98, 0x00, 44 | 0x01, 0x87, 0x19, 0x8c, 0x30, 0x60, 0x33, 0xb4, 0x60, 0x31, 0x98, 0x00, 45 | 0x01, 0xe3, 0xdf, 0x18, 0x60, 0x60, 0x69, 0x9a, 0x60, 0x69, 0x98, 0x00, 46 | 0x01, 0x80, 0xd8, 0x0c, 0x40, 0x60, 0x69, 0x9a, 0x60, 0x79, 0x98, 0x00, 47 | 0x01, 0x94, 0x58, 0x2c, 0x90, 0x26, 0x69, 0x9a, 0x26, 0x61, 0x98, 0x00, 48 | 0x03, 0xf7, 0xbc, 0x18, 0xf0, 0x1c, 0x33, 0xfb, 0x1c, 0x3b, 0xfc, 0x00, 49 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 50 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 51 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 52 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 53 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 54 | 55 | }; 56 | 57 | Adafruit_SSD1306 display(96, 16, &Wire, 26); 58 | 59 | const char* ssid = "SSID"; 60 | const char* password = "PASSWORD"; 61 | 62 | const char* ntpServer = "pool.ntp.org"; 63 | const long gmtOffset_sec = -14400; 64 | const int daylightOffset_sec = 3600; 65 | 66 | RTC_DATA_ATTR int bootCount = 0; 67 | 68 | 69 | struct tm timeinfo; 70 | 71 | void setup() 72 | { 73 | Serial.begin(9600); 74 | delay(1000); 75 | 76 | pinMode(OLED_RESET, OUTPUT); 77 | 78 | pinMode(RED_LED, OUTPUT); 79 | pinMode(GREEN_LED, OUTPUT); 80 | pinMode(BLUE_LED, OUTPUT); 81 | 82 | digitalWrite(OLED_RESET, HIGH); //Keep Oled High = 0.21mA, OLED_RESET LOW draws lots of current 83 | 84 | digitalWrite(RED_LED, HIGH); //Keep Led off 85 | digitalWrite(GREEN_LED, HIGH); //Keep Led off 86 | digitalWrite(BLUE_LED, HIGH); //Keep Led off 87 | 88 | Wire.begin(13,14); //ESP32 Pico D4 pins 89 | display.setRotation(2); 90 | display.begin(SSD1306_SWITCHCAPVCC, 0x3C); 91 | 92 | //connect to WiFi 93 | Serial.printf("Connecting to %s ", ssid); 94 | WiFi.begin(ssid, password); 95 | while (WiFi.status() != WL_CONNECTED) { 96 | delay(500); 97 | Serial.print("."); 98 | } 99 | Serial.println(" CONNECTED"); 100 | digitalWrite(GREEN_LED, LOW); 101 | delay(150); 102 | digitalWrite(GREEN_LED, HIGH); 103 | 104 | testdrawbitmap(); 105 | //display.display(); 106 | delay(2000); 107 | display.clearDisplay(); 108 | 109 | //init and get the time 110 | configTime(gmtOffset_sec, daylightOffset_sec, ntpServer); 111 | 112 | esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR); 113 | Serial.println("Setup ESP32 to sleep for every " + String(TIME_TO_SLEEP) + 114 | " Seconds"); 115 | } 116 | 117 | void loop() 118 | { 119 | struct tm timeinfo; 120 | if(!getLocalTime(&timeinfo)) 121 | { 122 | Serial.println("Failed to obtain time"); 123 | return; 124 | } 125 | 126 | digitalWrite(RED_LED, LOW); //LED on 127 | delay(100); 128 | digitalWrite(RED_LED, HIGH); 129 | delay(100); 130 | 131 | digitalWrite(GREEN_LED, LOW); //LED on 132 | delay(100); 133 | digitalWrite(GREEN_LED, HIGH); 134 | delay(100); 135 | 136 | digitalWrite(BLUE_LED, LOW); 137 | delay(100); 138 | digitalWrite(BLUE_LED, HIGH); 139 | delay(100); 140 | 141 | display.ssd1306_command(SSD1306_DISPLAYON); 142 | 143 | display.setTextSize(1); 144 | display.setTextColor(WHITE); 145 | display.setCursor(0,0); //over,down 146 | Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S"); 147 | display.println("NTP Time:"); 148 | display.println(&timeinfo, "%H:%M:%S"); 149 | display.display(); 150 | delay(2000); 151 | display.clearDisplay(); 152 | 153 | display.ssd1306_command(SSD1306_DISPLAYOFF); 154 | 155 | Serial.println("Going to sleep now"); 156 | esp_deep_sleep_start(); 157 | } 158 | 159 | void testdrawbitmap(void) 160 | { 161 | display.clearDisplay(); 162 | 163 | display.drawBitmap( 164 | (display.width() - LOGO_WIDTH ) / 2, 165 | (display.height() - LOGO_HEIGHT) / 2, 166 | logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1); 167 | display.display(); 168 | delay(2000); 169 | display.clearDisplay(); 170 | } 171 | -------------------------------------------------------------------------------- /Code/Rev4_Hardware_Test.ino: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | The ESP32 Coin Cell Board uses Tools/Board/ESP32 Dev Module 3 | 4 | Thanks to Adafruit for the great oled display library. It's the best one for a 96x16 type 5 | Install the GFX, SSD1306, LIS3DH and ClosedCube HDC1080, libraries from the IDE 6 | Install the Adafruit Sensor Library from: https://github.com/adafruit/Adafruit_Sensor 7 | *********************************************************************/ 8 | 9 | #include 10 | #include 11 | #include "time.h" 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include "ClosedCube_HDC1080.h" 17 | 18 | Adafruit_SSD1306 display(96, 16, &Wire, 26); 19 | Adafruit_LIS3DH lis = Adafruit_LIS3DH(); 20 | ClosedCube_HDC1080 hdc1080; 21 | 22 | #define ACCEL_PWR 34 23 | #define OLED_RESET 26 24 | #define BLUE_LED 23 25 | #define RED_LED 5 26 | #define GREEN_LED 18 27 | #define LOGO16_GLCD_HEIGHT 16 28 | #define LOGO16_GLCD_WIDTH 96 //was 16 29 | 30 | const char* ssid = "SSID"; 31 | const char* password = "PASSWORD"; 32 | 33 | int threshold = 40; 34 | bool touch1detected = false; 35 | bool touch2detected = false; 36 | int wifi_connected; 37 | 38 | void gotTouch1() 39 | { 40 | touch1detected = true; 41 | } 42 | 43 | void gotTouch2(){ 44 | touch2detected = true; 45 | } 46 | 47 | void callback() 48 | { 49 | //placeholder callback function 50 | } 51 | 52 | void setup() 53 | { 54 | Serial.begin(115200); 55 | delay(1000); // give me time to bring up serial monitor 56 | 57 | pinMode(ACCEL_PWR, OUTPUT); 58 | 59 | pinMode(OLED_RESET, OUTPUT); 60 | pinMode(RED_LED, OUTPUT); 61 | pinMode(GREEN_LED, OUTPUT); 62 | pinMode(BLUE_LED, OUTPUT); 63 | 64 | digitalWrite(ACCEL_PWR, HIGH); 65 | digitalWrite(OLED_RESET, HIGH); 66 | digitalWrite(RED_LED, HIGH); //Keep off 67 | digitalWrite(GREEN_LED, HIGH); //Keep off 68 | digitalWrite(BLUE_LED, HIGH); //Keep off 69 | 70 | Wire.begin(13,14); //ESP32 i2c pins 71 | display.setRotation(2); 72 | display.begin(SSD1306_SWITCHCAPVCC, 0x3C); 73 | hdc1080.begin(0x40); 74 | 75 | blinkRGB(); 76 | 77 | display.clearDisplay(); 78 | 79 | //Now connect to WiFi 80 | Serial.printf("Connecting to %s ", ssid); 81 | WiFi.begin(ssid, password); 82 | 83 | display.ssd1306_command(SSD1306_DISPLAYON); 84 | display.setTextSize(1); 85 | display.setTextColor(WHITE); 86 | 87 | int counter = 0; 88 | while (WiFi.status() != WL_CONNECTED) //if not connected to wifi 89 | { 90 | Serial.print("."); 91 | display.clearDisplay(); 92 | display.setCursor(10,0); 93 | display.print("Connecting"); 94 | display.setCursor(10,9); 95 | display.print("to wifi: "); 96 | display.print(counter); 97 | display.display(); 98 | delay(1500); 99 | counter++; 100 | 101 | if (counter > 5) 102 | { 103 | display.clearDisplay(); 104 | display.setCursor(15,0); 105 | display.println("No WiFi"); 106 | Serial.println("No WiFi"); 107 | display.display(); 108 | delay(500); 109 | break; 110 | } 111 | 112 | if (WiFi.status() == WL_CONNECTED) //if it connects to wifi 113 | { 114 | display.clearDisplay(); 115 | display.setCursor(10,0); 116 | display.print("Connected!"); 117 | display.display(); 118 | digitalWrite(GREEN_LED, LOW); 119 | delay(1000); 120 | digitalWrite(GREEN_LED, HIGH); 121 | delay(1500); 122 | display.clearDisplay(); 123 | 124 | display.setCursor(0,0); 125 | IPAddress myIP = WiFi.softAPIP(); 126 | display.println(myIP); 127 | display.print("RSSI:"); 128 | display.print(WiFi.RSSI()); 129 | delay(1000); 130 | } 131 | } 132 | 133 | display.display(); 134 | delay(1000); 135 | 136 | Serial.println("LIS3DH test!"); 137 | 138 | if (! lis.begin(0x19)) 139 | { 140 | Serial.println("Couldnt start"); 141 | while (1); 142 | } 143 | Serial.println("LIS3DH found!"); 144 | 145 | lis.setRange(LIS3DH_RANGE_4_G); // 2, 4, 8 or 16 G! 146 | Serial.print("Range = "); Serial.print(2 << lis.getRange()); 147 | Serial.println("G"); 148 | 149 | touchAttachInterrupt(T0, gotTouch1, threshold); 150 | touchAttachInterrupt(T7, gotTouch2, threshold); 151 | 152 | delay(2000); 153 | display.clearDisplay(); 154 | } 155 | 156 | void loop() 157 | { 158 | lis.read(); 159 | sensors_event_t event; 160 | lis.getEvent(&event); 161 | 162 | display.ssd1306_command(SSD1306_DISPLAYON); 163 | display.setTextSize(1); 164 | display.setTextColor(WHITE); 165 | 166 | display.setCursor(0,0); //over,down 167 | display.print(hdc1080.readTemperature()); 168 | display.print((char)247); // degree symbol 169 | display.print("C "); 170 | display.print(hdc1080.readHumidity()); 171 | display.print("%"); 172 | 173 | display.setCursor(0,9); //over,down 174 | display.print(event.acceleration.x); 175 | display.print(" "); 176 | display.print(event.acceleration.y); 177 | display.print(" "); 178 | display.print(event.acceleration.z); 179 | 180 | while(touch1detected) 181 | { 182 | Serial.println("Touch 0 detected"); 183 | //display.clearDisplay(); 184 | display.setCursor(0,0);; 185 | display.print("Left Touch"); 186 | digitalWrite(RED_LED, LOW); //On 187 | delay(50); 188 | digitalWrite(RED_LED, HIGH); //Off 189 | delay(50); 190 | touch1detected = false; 191 | 192 | display.display(); 193 | delay(50); 194 | display.clearDisplay(); 195 | } 196 | while(touch2detected) 197 | { 198 | Serial.println("Touch 2 detected"); 199 | display.setCursor(0,0);; 200 | display.print("Right Touch"); 201 | digitalWrite(BLUE_LED, LOW); 202 | delay(50); 203 | digitalWrite(BLUE_LED, HIGH); 204 | delay(50); 205 | touch2detected = false; 206 | 207 | display.display(); 208 | delay(50); 209 | display.clearDisplay(); 210 | } 211 | 212 | display.display(); 213 | delay(150); 214 | display.clearDisplay(); 215 | } 216 | 217 | void blinkRGB(void) 218 | { 219 | digitalWrite(RED_LED, LOW); //led on 220 | delay(150); 221 | digitalWrite(RED_LED, HIGH); //led off 222 | delay(150); 223 | digitalWrite(GREEN_LED, LOW); 224 | delay(150); 225 | digitalWrite(GREEN_LED, HIGH); 226 | delay(150); 227 | digitalWrite(BLUE_LED, LOW); 228 | delay(150); 229 | digitalWrite(BLUE_LED, HIGH); 230 | delay(150); 231 | } 232 | -------------------------------------------------------------------------------- /Code/Touch_Wakeup_Time.ino: -------------------------------------------------------------------------------- 1 | /* 2 | The ESP32 Coin Cell Board uses Tools/Board/ESP32 Dev Module 3 | Simple Deep Sleep with Timer Wake Up Displaying Time every 15 minutes 4 | Thanks to Adafruit and Espressif for the library filed 5 | Boards: ESP32 Dev Module 6 | */ 7 | 8 | #include 9 | #include 10 | #include "time.h" 11 | #include 12 | #include 13 | #include 14 | 15 | #define OLED_RESET 26 16 | 17 | #define Threshold 40 18 | 19 | #define BLUE_LED 23 20 | #define RED_LED 5 21 | #define GREEN_LED 18 22 | 23 | #define LOGO_HEIGHT 16 24 | #define LOGO_WIDTH 96 25 | 26 | static const unsigned char PROGMEM logo_bmp[] = 27 | { 28 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 29 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 30 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 31 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 32 | 0x03, 0xf3, 0xff, 0x18, 0xe0, 0x1e, 0x01, 0x80, 0x1e, 0x03, 0xb8, 0x00, 33 | 0x01, 0x94, 0x59, 0xac, 0xb0, 0x32, 0x00, 0x00, 0x32, 0x01, 0x98, 0x00, 34 | 0x01, 0x87, 0x19, 0x8c, 0x30, 0x60, 0x33, 0xb4, 0x60, 0x31, 0x98, 0x00, 35 | 0x01, 0xe3, 0xdf, 0x18, 0x60, 0x60, 0x69, 0x9a, 0x60, 0x69, 0x98, 0x00, 36 | 0x01, 0x80, 0xd8, 0x0c, 0x40, 0x60, 0x69, 0x9a, 0x60, 0x79, 0x98, 0x00, 37 | 0x01, 0x94, 0x58, 0x2c, 0x90, 0x26, 0x69, 0x9a, 0x26, 0x61, 0x98, 0x00, 38 | 0x03, 0xf7, 0xbc, 0x18, 0xf0, 0x1c, 0x33, 0xfb, 0x1c, 0x3b, 0xfc, 0x00, 39 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 42 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 43 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 44 | 45 | }; 46 | 47 | Adafruit_SSD1306 display(96, 16, &Wire, 26); 48 | //touch_pad_t touchPin; 49 | 50 | const char* ssid = "SSID"; 51 | const char* password = "PASSWORD"; 52 | 53 | const char* ntpServer = "pool.ntp.org"; 54 | const long gmtOffset_sec = -14400; 55 | const int daylightOffset_sec = 3600; 56 | 57 | RTC_DATA_ATTR int bootCount = 0; 58 | 59 | struct tm timeinfo; 60 | 61 | void callback() 62 | { 63 | //placeholder callback function 64 | } 65 | 66 | void setup() 67 | { 68 | Serial.begin(9600); 69 | delay(1000); 70 | 71 | pinMode(OLED_RESET, OUTPUT); 72 | pinMode(RED_LED, OUTPUT); 73 | pinMode(GREEN_LED, OUTPUT); 74 | pinMode(BLUE_LED, OUTPUT); 75 | 76 | digitalWrite(OLED_RESET, HIGH); //Keep Oled High = 0.21mA, OLED_RESET LOW draws lots of current 77 | digitalWrite(RED_LED, HIGH); //Keep off 78 | digitalWrite(GREEN_LED, HIGH); //Keep off 79 | digitalWrite(BLUE_LED, HIGH); //Keep off 80 | 81 | blinkRGB(); 82 | 83 | Wire.begin(13,14); 84 | display.setRotation(2); 85 | display.begin(SSD1306_SWITCHCAPVCC, 0x3C); 86 | 87 | //connect to WiFi 88 | Serial.printf("Connecting to %s ", ssid); 89 | WiFi.begin(ssid, password); 90 | while (WiFi.status() != WL_CONNECTED) { 91 | delay(500); 92 | Serial.print("."); 93 | } 94 | Serial.println(" CONNECTED"); 95 | digitalWrite(GREEN_LED, LOW); 96 | delay(150); 97 | digitalWrite(GREEN_LED, HIGH); 98 | 99 | //testdrawbitmap(); 100 | 101 | delay(2000); 102 | display.clearDisplay(); 103 | 104 | configTime(gmtOffset_sec, daylightOffset_sec, ntpServer); //init and get the time 105 | 106 | touchAttachInterrupt(T0, callback, Threshold); 107 | esp_sleep_enable_touchpad_wakeup(); //Configure Touchpad as wakeup source 108 | } 109 | 110 | void loop() 111 | { 112 | if(!getLocalTime(&timeinfo)) 113 | { 114 | Serial.println("Failed to obtain time"); 115 | return; 116 | } 117 | Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S"); 118 | blinkRGB(); 119 | display.ssd1306_command(SSD1306_DISPLAYON); 120 | display.setTextSize(1); 121 | display.setTextColor(WHITE); 122 | display.setCursor(0,0); //over,down 123 | display.print(&timeinfo, "%H:%M:%S"); 124 | display.display(); 125 | //delay(2000); 126 | display.clearDisplay(); 127 | display.ssd1306_command(SSD1306_DISPLAYOFF); 128 | 129 | Serial.println("Going to sleep now"); 130 | esp_deep_sleep_start(); 131 | } 132 | 133 | 134 | void testdrawbitmap(void) 135 | { 136 | display.clearDisplay(); 137 | 138 | display.drawBitmap( 139 | (display.width() - LOGO_WIDTH ) / 2, 140 | (display.height() - LOGO_HEIGHT) / 2, 141 | logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1); 142 | display.display(); 143 | delay(2000); 144 | display.clearDisplay(); 145 | } 146 | 147 | void blinkRGB(void) 148 | { 149 | digitalWrite(RED_LED, LOW); //On 150 | delay(50); 151 | digitalWrite(RED_LED, HIGH); //Off 152 | delay(50); 153 | digitalWrite(GREEN_LED, LOW); 154 | delay(50); 155 | digitalWrite(GREEN_LED, HIGH); 156 | delay(50); 157 | digitalWrite(BLUE_LED, LOW); 158 | delay(50); 159 | digitalWrite(BLUE_LED, HIGH); 160 | } 161 | -------------------------------------------------------------------------------- /Images/Bottom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/Images/Bottom.jpg -------------------------------------------------------------------------------- /Images/Bottom_Side.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/Images/Bottom_Side.jpg -------------------------------------------------------------------------------- /Images/Exposed_GPIO_Pads.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/Images/Exposed_GPIO_Pads.jpg -------------------------------------------------------------------------------- /Images/Rev4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/Images/Rev4.jpg -------------------------------------------------------------------------------- /Images/Top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/Images/Top.jpg -------------------------------------------------------------------------------- /Images/Top_Side.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/Images/Top_Side.jpg -------------------------------------------------------------------------------- /PCB/3D_Step_Rev1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/PCB/3D_Step_Rev1.zip -------------------------------------------------------------------------------- /PCB/Altium_Design_Files_Rev1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/PCB/Altium_Design_Files_Rev1.zip -------------------------------------------------------------------------------- /PCB/Altium_Design_Files_Rev4.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/PCB/Altium_Design_Files_Rev4.zip -------------------------------------------------------------------------------- /PCB/Gerber_Files_Rev1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/PCB/Gerber_Files_Rev1.zip -------------------------------------------------------------------------------- /PCB/Gerber_Files_Rev4.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/PCB/Gerber_Files_Rev4.zip -------------------------------------------------------------------------------- /PCB/PCB_Library.PcbLib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/PCB/PCB_Library.PcbLib -------------------------------------------------------------------------------- /PCB/Parts_List_Rev1.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/PCB/Parts_List_Rev1.xls -------------------------------------------------------------------------------- /PCB/Parts_List_Rev4.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/PCB/Parts_List_Rev4.xls -------------------------------------------------------------------------------- /PCB/Schematic_Library.SCHLIB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/PCB/Schematic_Library.SCHLIB -------------------------------------------------------------------------------- /PCB/Schematic_Rev1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/PCB/Schematic_Rev1.pdf -------------------------------------------------------------------------------- /PCB/Schematic_Rev4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mike-rankin/ESP32_CoinCell/d0ebbc50786f3d1b4903c96e22094a0abdd48d6c/PCB/Schematic_Rev4.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ESP32_CoinCell 2 | 3 | Video of it in action is at: https://youtu.be/IdSCKr7fLYc 4 | 5 | Rev1 soon to be Rev4: https://www.tindie.com/products/miker/esp32-coincell/ 6 | 7 | This is an ESP32 Pico D4 project with an accelerometer and 0.69" oled display powered by a rechargeable LIR2450 coin cell. I was not made for any specific purpose and was really more of a design challenge to try and made it as small as possible and my first attempt at running something at low power. It can be powered off of a battery or USB cable. If a battery is inserted and USB cable is plugged in it will charge the battery and power the board. Current consumption is around 0.30uA when sleeping but up to 85mA running. Runtime testing is still in the works but battery life is only 5 minutes when the display is on and constantly connected to wifi. Connecting to wifi and turning on the display every 10 minutes appears to last 10 hours or so. Revision 1 started off at 200uA in sleep mode. Revisions after that used a switching power supply and setting registers in the accelerometer but they all ended in fail. This revision 4 with a much better LDO and powering the accelerometer off of the ESP32 has finally got the sleep current to 30uA. The design files and parts list is provided if you would like to assemble your own. If you can come up with a specific use for this hardware or have any questions then just let me know at @mikerankin or by email at 0miker0@gmail.com 8 | 9 | Main components used in this desgin are: 10 | 11 | -ESP32 Pico D4 (wifi/bluetooth processor) 12 | 13 | -LIR2450 (3.7V battery) or optional external battery using the microJST connector 14 | 15 | -HT7833 (500mA LDO power supply) 16 | 17 | -SL4054ST25P (LiPo battery charger) 18 | 19 | -LIS3DHTR (accelerometer) now powered off an ESP32 GPIO pin 20 | 21 | -CP2102N (USB interface chip) 22 | 23 | -ER-OLED0.69-1W (96x16 oled dsiplay) 24 | 25 | The full parts list and schematic is in the PCB directory 26 | 27 | The bare PCB was provided by JLCPCB and most of the parts by LCSC. 28 | 29 | ![Rev4](https://user-images.githubusercontent.com/4991664/56325424-85181b80-6148-11e9-81cc-3ab20f2d0517.jpg) 30 | --------------------------------------------------------------------------------