Repository: mike-rankin/ESP32_CoinCell
Branch: master
Commit: d0ebbc50786f
Files: 9
Total size: 19.7 KB
Directory structure:
gitextract_zcly4buy/
├── Code/
│ ├── Hardware_Test_Code.ino
│ ├── Low_Power_Time.ino
│ ├── Rev4_Hardware_Test.ino
│ └── Touch_Wakeup_Time.ino
├── PCB/
│ ├── PCB_Library.PcbLib
│ ├── Parts_List_Rev1.xls
│ ├── Parts_List_Rev4.xls
│ └── Schematic_Library.SCHLIB
└── README.md
================================================
FILE CONTENTS
================================================
================================================
FILE: Code/Hardware_Test_Code.ino
================================================
/*********************************************************************
Thanks to Adafruit for the great oled display library. It's the best one for a 96x16 type
Install the GFX, SSD1306 and LIS3DH libraries from the IDE
Install the Adafruit Sensor Library from: https://github.com/adafruit/Adafruit_Sensor
Using the Arduino IDE choose Tools/Board: ESP32 Dev Module
On Rev1 hardware line 85 = lis.begin(0x18))
On Rev4 hardware lis.begin(0x19))
*********************************************************************/
#include <WiFi.h>
#include <Wire.h>
#include "time.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_LIS3DH.h>
#include <Adafruit_Sensor.h>
//I've messed up the led names and see they do not match the schematic
#define BLUE_LED 23
#define RED_LED 5
#define GREEN_LED 18
#define LOGO_HEIGHT 16
#define LOGO_WIDTH 96
//Doesnt work
static const unsigned char PROGMEM logo_bmp[] =
{
};
Adafruit_SSD1306 display(96, 16, &Wire, 26);
Adafruit_LIS3DH lis = Adafruit_LIS3DH();
const char* ssid = "SSID";
const char* password = "PASSWORD";
const char* ntpServer = "pool.ntp.org";
const long gmtOffset_sec = -14400;
const int daylightOffset_sec = 3600;
RTC_DATA_ATTR int bootCount = 0;
struct tm timeinfo;
void setup()
{
Serial.begin(9600);
delay(1000);
pinMode(RED_LED, OUTPUT);
pinMode(GREEN_LED, OUTPUT);
pinMode(BLUE_LED, OUTPUT);
digitalWrite(RED_LED, HIGH); //Keep off
digitalWrite(GREEN_LED, HIGH); //Keep off
digitalWrite(BLUE_LED, HIGH); //Keep off
Wire.begin(13,14); //ESP32 Pico D4 pins
display.setRotation(2);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
//connect to WiFi
Serial.printf("Connecting to %s ", ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println(" CONNECTED");
digitalWrite(GREEN_LED, LOW);
delay(150);
digitalWrite(GREEN_LED, HIGH);
display.display();
delay(2000);
display.clearDisplay();
//init and get the time
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
Serial.println("LIS3DH test!");
if (! lis.begin(0x18)) { // change this to 0x19 for alternative i2c address
Serial.println("Couldnt start");
while (1);
}
Serial.println("LIS3DH found!");
lis.setRange(LIS3DH_RANGE_4_G); // 2, 4, 8 or 16 G!
Serial.print("Range = "); Serial.print(2 << lis.getRange());
Serial.println("G");
}
void loop()
{
//testdrawbitmap(); //No worky
if (touchRead(T0) < 50)
{
digitalWrite(BLUE_LED, LOW);
}
else
{
digitalWrite(BLUE_LED, HIGH);
}
lis.read();
sensors_event_t event;
lis.getEvent(&event);
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,8); //over,down
display.print(event.acceleration.x);
display.print(" ");
display.print(event.acceleration.y);
display.print(" ");
display.print(event.acceleration.z);
if(!getLocalTime(&timeinfo))
{
Serial.println("Failed to obtain time");
return;
}
Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0); //over,down
display.print(&timeinfo, "%H:%M:%S");
display.display();
display.clearDisplay();
}
//Doesnt Work
void testdrawbitmap(void) {
display.clearDisplay();
display.drawBitmap(
(display.width() - LOGO_WIDTH ) / 2,
(display.height() - LOGO_HEIGHT) / 2,
logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1);
display.display();
delay(1000);
}
================================================
FILE: Code/Low_Power_Time.ino
================================================
/*
The ESP32 Coin Cell Board uses Tools/Board/ESP32 Dev Module
Simple Deep Sleep with Timer Wake Up Displaying Time every 10 minutes
Using the Arduino IDE choose Tools/Board: ESP32 Dev Module
=====================================
This code is under Public Domain License.
Original Author:
Pranav Cherukupalli <cherukupallip@gmail.com>
*/
#include <WiFi.h>
#include <Wire.h>
#include "time.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_LIS3DH.h>
#include <Adafruit_Sensor.h>
#define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP 60 /* Time ESP32 will go to sleep (in seconds) 600 = 10 minutes */
#define OLED_RESET 26 /*ESP32 Pico D4 */
#define RED_LED 23 //lights Green
#define GREEN_LED 18 //lights Red
#define BLUE_LED 5
//#define SCREEN_HEIGHT 16
//#define SCREEN_WIDTH 96
#define LOGO_HEIGHT 16
#define LOGO_WIDTH 96
static const unsigned char PROGMEM logo_bmp[] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0xf3, 0xff, 0x18, 0xe0, 0x1e, 0x01, 0x80, 0x1e, 0x03, 0xb8, 0x00,
0x01, 0x94, 0x59, 0xac, 0xb0, 0x32, 0x00, 0x00, 0x32, 0x01, 0x98, 0x00,
0x01, 0x87, 0x19, 0x8c, 0x30, 0x60, 0x33, 0xb4, 0x60, 0x31, 0x98, 0x00,
0x01, 0xe3, 0xdf, 0x18, 0x60, 0x60, 0x69, 0x9a, 0x60, 0x69, 0x98, 0x00,
0x01, 0x80, 0xd8, 0x0c, 0x40, 0x60, 0x69, 0x9a, 0x60, 0x79, 0x98, 0x00,
0x01, 0x94, 0x58, 0x2c, 0x90, 0x26, 0x69, 0x9a, 0x26, 0x61, 0x98, 0x00,
0x03, 0xf7, 0xbc, 0x18, 0xf0, 0x1c, 0x33, 0xfb, 0x1c, 0x3b, 0xfc, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
Adafruit_SSD1306 display(96, 16, &Wire, 26);
const char* ssid = "SSID";
const char* password = "PASSWORD";
const char* ntpServer = "pool.ntp.org";
const long gmtOffset_sec = -14400;
const int daylightOffset_sec = 3600;
RTC_DATA_ATTR int bootCount = 0;
struct tm timeinfo;
void setup()
{
Serial.begin(9600);
delay(1000);
pinMode(OLED_RESET, OUTPUT);
pinMode(RED_LED, OUTPUT);
pinMode(GREEN_LED, OUTPUT);
pinMode(BLUE_LED, OUTPUT);
digitalWrite(OLED_RESET, HIGH); //Keep Oled High = 0.21mA, OLED_RESET LOW draws lots of current
digitalWrite(RED_LED, HIGH); //Keep Led off
digitalWrite(GREEN_LED, HIGH); //Keep Led off
digitalWrite(BLUE_LED, HIGH); //Keep Led off
Wire.begin(13,14); //ESP32 Pico D4 pins
display.setRotation(2);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
//connect to WiFi
Serial.printf("Connecting to %s ", ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println(" CONNECTED");
digitalWrite(GREEN_LED, LOW);
delay(150);
digitalWrite(GREEN_LED, HIGH);
testdrawbitmap();
//display.display();
delay(2000);
display.clearDisplay();
//init and get the time
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
Serial.println("Setup ESP32 to sleep for every " + String(TIME_TO_SLEEP) +
" Seconds");
}
void loop()
{
struct tm timeinfo;
if(!getLocalTime(&timeinfo))
{
Serial.println("Failed to obtain time");
return;
}
digitalWrite(RED_LED, LOW); //LED on
delay(100);
digitalWrite(RED_LED, HIGH);
delay(100);
digitalWrite(GREEN_LED, LOW); //LED on
delay(100);
digitalWrite(GREEN_LED, HIGH);
delay(100);
digitalWrite(BLUE_LED, LOW);
delay(100);
digitalWrite(BLUE_LED, HIGH);
delay(100);
display.ssd1306_command(SSD1306_DISPLAYON);
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0); //over,down
Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
display.println("NTP Time:");
display.println(&timeinfo, "%H:%M:%S");
display.display();
delay(2000);
display.clearDisplay();
display.ssd1306_command(SSD1306_DISPLAYOFF);
Serial.println("Going to sleep now");
esp_deep_sleep_start();
}
void testdrawbitmap(void)
{
display.clearDisplay();
display.drawBitmap(
(display.width() - LOGO_WIDTH ) / 2,
(display.height() - LOGO_HEIGHT) / 2,
logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1);
display.display();
delay(2000);
display.clearDisplay();
}
================================================
FILE: Code/Rev4_Hardware_Test.ino
================================================
/*********************************************************************
The ESP32 Coin Cell Board uses Tools/Board/ESP32 Dev Module
Thanks to Adafruit for the great oled display library. It's the best one for a 96x16 type
Install the GFX, SSD1306, LIS3DH and ClosedCube HDC1080, libraries from the IDE
Install the Adafruit Sensor Library from: https://github.com/adafruit/Adafruit_Sensor
*********************************************************************/
#include <Wire.h>
#include <WiFi.h>
#include "time.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_LIS3DH.h>
#include <Adafruit_Sensor.h>
#include "ClosedCube_HDC1080.h"
Adafruit_SSD1306 display(96, 16, &Wire, 26);
Adafruit_LIS3DH lis = Adafruit_LIS3DH();
ClosedCube_HDC1080 hdc1080;
#define ACCEL_PWR 34
#define OLED_RESET 26
#define BLUE_LED 23
#define RED_LED 5
#define GREEN_LED 18
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH 96 //was 16
const char* ssid = "SSID";
const char* password = "PASSWORD";
int threshold = 40;
bool touch1detected = false;
bool touch2detected = false;
int wifi_connected;
void gotTouch1()
{
touch1detected = true;
}
void gotTouch2(){
touch2detected = true;
}
void callback()
{
//placeholder callback function
}
void setup()
{
Serial.begin(115200);
delay(1000); // give me time to bring up serial monitor
pinMode(ACCEL_PWR, OUTPUT);
pinMode(OLED_RESET, OUTPUT);
pinMode(RED_LED, OUTPUT);
pinMode(GREEN_LED, OUTPUT);
pinMode(BLUE_LED, OUTPUT);
digitalWrite(ACCEL_PWR, HIGH);
digitalWrite(OLED_RESET, HIGH);
digitalWrite(RED_LED, HIGH); //Keep off
digitalWrite(GREEN_LED, HIGH); //Keep off
digitalWrite(BLUE_LED, HIGH); //Keep off
Wire.begin(13,14); //ESP32 i2c pins
display.setRotation(2);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
hdc1080.begin(0x40);
blinkRGB();
display.clearDisplay();
//Now connect to WiFi
Serial.printf("Connecting to %s ", ssid);
WiFi.begin(ssid, password);
display.ssd1306_command(SSD1306_DISPLAYON);
display.setTextSize(1);
display.setTextColor(WHITE);
int counter = 0;
while (WiFi.status() != WL_CONNECTED) //if not connected to wifi
{
Serial.print(".");
display.clearDisplay();
display.setCursor(10,0);
display.print("Connecting");
display.setCursor(10,9);
display.print("to wifi: ");
display.print(counter);
display.display();
delay(1500);
counter++;
if (counter > 5)
{
display.clearDisplay();
display.setCursor(15,0);
display.println("No WiFi");
Serial.println("No WiFi");
display.display();
delay(500);
break;
}
if (WiFi.status() == WL_CONNECTED) //if it connects to wifi
{
display.clearDisplay();
display.setCursor(10,0);
display.print("Connected!");
display.display();
digitalWrite(GREEN_LED, LOW);
delay(1000);
digitalWrite(GREEN_LED, HIGH);
delay(1500);
display.clearDisplay();
display.setCursor(0,0);
IPAddress myIP = WiFi.softAPIP();
display.println(myIP);
display.print("RSSI:");
display.print(WiFi.RSSI());
delay(1000);
}
}
display.display();
delay(1000);
Serial.println("LIS3DH test!");
if (! lis.begin(0x19))
{
Serial.println("Couldnt start");
while (1);
}
Serial.println("LIS3DH found!");
lis.setRange(LIS3DH_RANGE_4_G); // 2, 4, 8 or 16 G!
Serial.print("Range = "); Serial.print(2 << lis.getRange());
Serial.println("G");
touchAttachInterrupt(T0, gotTouch1, threshold);
touchAttachInterrupt(T7, gotTouch2, threshold);
delay(2000);
display.clearDisplay();
}
void loop()
{
lis.read();
sensors_event_t event;
lis.getEvent(&event);
display.ssd1306_command(SSD1306_DISPLAYON);
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0); //over,down
display.print(hdc1080.readTemperature());
display.print((char)247); // degree symbol
display.print("C ");
display.print(hdc1080.readHumidity());
display.print("%");
display.setCursor(0,9); //over,down
display.print(event.acceleration.x);
display.print(" ");
display.print(event.acceleration.y);
display.print(" ");
display.print(event.acceleration.z);
while(touch1detected)
{
Serial.println("Touch 0 detected");
//display.clearDisplay();
display.setCursor(0,0);;
display.print("Left Touch");
digitalWrite(RED_LED, LOW); //On
delay(50);
digitalWrite(RED_LED, HIGH); //Off
delay(50);
touch1detected = false;
display.display();
delay(50);
display.clearDisplay();
}
while(touch2detected)
{
Serial.println("Touch 2 detected");
display.setCursor(0,0);;
display.print("Right Touch");
digitalWrite(BLUE_LED, LOW);
delay(50);
digitalWrite(BLUE_LED, HIGH);
delay(50);
touch2detected = false;
display.display();
delay(50);
display.clearDisplay();
}
display.display();
delay(150);
display.clearDisplay();
}
void blinkRGB(void)
{
digitalWrite(RED_LED, LOW); //led on
delay(150);
digitalWrite(RED_LED, HIGH); //led off
delay(150);
digitalWrite(GREEN_LED, LOW);
delay(150);
digitalWrite(GREEN_LED, HIGH);
delay(150);
digitalWrite(BLUE_LED, LOW);
delay(150);
digitalWrite(BLUE_LED, HIGH);
delay(150);
}
================================================
FILE: Code/Touch_Wakeup_Time.ino
================================================
/*
The ESP32 Coin Cell Board uses Tools/Board/ESP32 Dev Module
Simple Deep Sleep with Timer Wake Up Displaying Time every 15 minutes
Thanks to Adafruit and Espressif for the library filed
Boards: ESP32 Dev Module
*/
#include <WiFi.h>
#include <Wire.h>
#include "time.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_Sensor.h>
#define OLED_RESET 26
#define Threshold 40
#define BLUE_LED 23
#define RED_LED 5
#define GREEN_LED 18
#define LOGO_HEIGHT 16
#define LOGO_WIDTH 96
static const unsigned char PROGMEM logo_bmp[] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0xf3, 0xff, 0x18, 0xe0, 0x1e, 0x01, 0x80, 0x1e, 0x03, 0xb8, 0x00,
0x01, 0x94, 0x59, 0xac, 0xb0, 0x32, 0x00, 0x00, 0x32, 0x01, 0x98, 0x00,
0x01, 0x87, 0x19, 0x8c, 0x30, 0x60, 0x33, 0xb4, 0x60, 0x31, 0x98, 0x00,
0x01, 0xe3, 0xdf, 0x18, 0x60, 0x60, 0x69, 0x9a, 0x60, 0x69, 0x98, 0x00,
0x01, 0x80, 0xd8, 0x0c, 0x40, 0x60, 0x69, 0x9a, 0x60, 0x79, 0x98, 0x00,
0x01, 0x94, 0x58, 0x2c, 0x90, 0x26, 0x69, 0x9a, 0x26, 0x61, 0x98, 0x00,
0x03, 0xf7, 0xbc, 0x18, 0xf0, 0x1c, 0x33, 0xfb, 0x1c, 0x3b, 0xfc, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
Adafruit_SSD1306 display(96, 16, &Wire, 26);
//touch_pad_t touchPin;
const char* ssid = "SSID";
const char* password = "PASSWORD";
const char* ntpServer = "pool.ntp.org";
const long gmtOffset_sec = -14400;
const int daylightOffset_sec = 3600;
RTC_DATA_ATTR int bootCount = 0;
struct tm timeinfo;
void callback()
{
//placeholder callback function
}
void setup()
{
Serial.begin(9600);
delay(1000);
pinMode(OLED_RESET, OUTPUT);
pinMode(RED_LED, OUTPUT);
pinMode(GREEN_LED, OUTPUT);
pinMode(BLUE_LED, OUTPUT);
digitalWrite(OLED_RESET, HIGH); //Keep Oled High = 0.21mA, OLED_RESET LOW draws lots of current
digitalWrite(RED_LED, HIGH); //Keep off
digitalWrite(GREEN_LED, HIGH); //Keep off
digitalWrite(BLUE_LED, HIGH); //Keep off
blinkRGB();
Wire.begin(13,14);
display.setRotation(2);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
//connect to WiFi
Serial.printf("Connecting to %s ", ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println(" CONNECTED");
digitalWrite(GREEN_LED, LOW);
delay(150);
digitalWrite(GREEN_LED, HIGH);
//testdrawbitmap();
delay(2000);
display.clearDisplay();
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer); //init and get the time
touchAttachInterrupt(T0, callback, Threshold);
esp_sleep_enable_touchpad_wakeup(); //Configure Touchpad as wakeup source
}
void loop()
{
if(!getLocalTime(&timeinfo))
{
Serial.println("Failed to obtain time");
return;
}
Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
blinkRGB();
display.ssd1306_command(SSD1306_DISPLAYON);
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0); //over,down
display.print(&timeinfo, "%H:%M:%S");
display.display();
//delay(2000);
display.clearDisplay();
display.ssd1306_command(SSD1306_DISPLAYOFF);
Serial.println("Going to sleep now");
esp_deep_sleep_start();
}
void testdrawbitmap(void)
{
display.clearDisplay();
display.drawBitmap(
(display.width() - LOGO_WIDTH ) / 2,
(display.height() - LOGO_HEIGHT) / 2,
logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1);
display.display();
delay(2000);
display.clearDisplay();
}
void blinkRGB(void)
{
digitalWrite(RED_LED, LOW); //On
delay(50);
digitalWrite(RED_LED, HIGH); //Off
delay(50);
digitalWrite(GREEN_LED, LOW);
delay(50);
digitalWrite(GREEN_LED, HIGH);
delay(50);
digitalWrite(BLUE_LED, LOW);
delay(50);
digitalWrite(BLUE_LED, HIGH);
}
================================================
FILE: README.md
================================================
# ESP32_CoinCell
Video of it in action is at: https://youtu.be/IdSCKr7fLYc
Rev1 soon to be Rev4: https://www.tindie.com/products/miker/esp32-coincell/
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
Main components used in this desgin are:
-ESP32 Pico D4 (wifi/bluetooth processor)
-LIR2450 (3.7V battery) or optional external battery using the microJST connector
-HT7833 (500mA LDO power supply)
-SL4054ST25P (LiPo battery charger)
-LIS3DHTR (accelerometer) now powered off an ESP32 GPIO pin
-CP2102N (USB interface chip)
-ER-OLED0.69-1W (96x16 oled dsiplay)
The full parts list and schematic is in the PCB directory
The bare PCB was provided by JLCPCB and most of the parts by LCSC.

gitextract_zcly4buy/ ├── Code/ │ ├── Hardware_Test_Code.ino │ ├── Low_Power_Time.ino │ ├── Rev4_Hardware_Test.ino │ └── Touch_Wakeup_Time.ino ├── PCB/ │ ├── PCB_Library.PcbLib │ ├── Parts_List_Rev1.xls │ ├── Parts_List_Rev4.xls │ └── Schematic_Library.SCHLIB └── README.md
Condensed preview — 9 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (21K chars).
[
{
"path": "Code/Hardware_Test_Code.ino",
"chars": 3559,
"preview": "/*********************************************************************\n Thanks to Adafruit for the great oled display li"
},
{
"path": "Code/Low_Power_Time.ino",
"chars": 4844,
"preview": "/*\nThe ESP32 Coin Cell Board uses Tools/Board/ESP32 Dev Module\nSimple Deep Sleep with Timer Wake Up Displaying Time ever"
},
{
"path": "Code/Rev4_Hardware_Test.ino",
"chars": 5359,
"preview": " /*********************************************************************\n The ESP32 Coin Cell Board uses Tools/Board/ESP3"
},
{
"path": "Code/Touch_Wakeup_Time.ino",
"chars": 4390,
"preview": "/*\nThe ESP32 Coin Cell Board uses Tools/Board/ESP32 Dev Module\nSimple Deep Sleep with Timer Wake Up Displaying Time ever"
},
{
"path": "README.md",
"chars": 2043,
"preview": "# ESP32_CoinCell\n\nVideo of it in action is at: https://youtu.be/IdSCKr7fLYc\n\nRev1 soon to be Rev4: https://www.tindie.co"
}
]
// ... and 4 more files (download for full content)
About this extraction
This page contains the full source code of the mike-rankin/ESP32_CoinCell GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 9 files (19.7 KB), approximately 7.3k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.