ESP32 Based ePub Reader

Overview

ESP32 Based ePub Reader

You can watch a video of the build here

Demo Video

What is it? It's a DIY ePub reader for the ESP32.

It will parse ePub files that can be downloaded from places such as Project Gutenberg.

It has limited support for formating - the CSS content of the ePub file is not parsed, so we just use the standard HTML tags such as

,

etc.. and and .

I've only included 4 font styles - regular, bold, italic and bold-italic. I've also only generated glyphs for Latin characters and punctuation.

Why did you build it?

It seemed like a nice challenge - ePub files are not the most friendly format to process on an embedded device. Making it work in a constrained environment is good fun.

Can you contribute/help?

Yes - please try the project out on any e-paper boards that you have and open up pull requests if you get it working with any fixes.

And if you find bugs, feel free to report (or better yet, fix!) them :)

How to get it?

Make sure you clone recursively - the code uses git submodules.

git clone --recursive [email protected]:atomic14/esp32-ereader.git

What boards does it work on?

I've tested it on the LilyGo EPD47, but it should work on any eInk display provided it has:

  • PSRAM - parsing the ePub files needs a fair amount of memory
  • 3 Buttons - these buttons can be active high or low
    • UP - moves up in the list of ePubs or to the previous page when reading
    • DOWN - moves down in the list of ePubs or to the next page when reading
    • SELECT - opens the ePub currently selected ePub file or goes back to the ePub list from reading mode
  • An SD Card - you can jury rig an SPI sd card using the instructions here:
  • [Optional] A battery if you want it to be portable

Porting to other boards

All the configuration is in platformio.ini using pre-processor directives. If you do add a new board then please create a new section in platofmrio.ini with the appropriate pre-processor directives for your board and open a pull request to add it to the project - I'm happy to answer any questions on this.

The important settings are the following:

The first two settings come from the vroland/epdiy library and defined the ePaper display that is being used.

; Setup display format and model via build flags
-DCONFIG_EPD_DISPLAY_TYPE_ED047TC1
-DCONFIG_EPD_BOARD_REVISION_LILYGO_T5_47

The second three settings are the pins that are used for the buttons. Change these to match your board.

; setup the pins to use for navigation
-DBUTTON_UP_GPIO_NUM=GPIO_NUM_34
-DBUTTON_DOWN_GPIO_NUM=GPIO_NUM_39
-DBUTTON_SELECT_GPIO_NUM=GPIO_NUM_35

There is also a setting to tell the code if the buttons are active high or low.

; buttons are low when pressed
-DBUTONS_ACTIVE_LEVEL=0

We have the pins for the SD card. I've got a video on how to hack an SD Card and connect it as a SPI device here

; setup the pins for the SDCard
-DSD_CARD_PIN_NUM_MISO=GPIO_NUM_14
-DSD_CARD_PIN_NUM_MOSI=GPIO_NUM_13
-DSD_CARD_PIN_NUM_CLK=GPIO_NUM_15
-DSD_CARD_PIN_NUM_CS=GPIO_NUM_12

And finally we have the ADC channel that the battery voltage divider is connected to:

; the adc channel that is connected to the battery voltage divider - this is GPIO_NUM_35
-DBATTERY_ADC_CHANNEL=ADC1_CHANNEL_0

How does it work?

Epub files are a bit of a pain to parse. Despite the file extension epub, they are actually zip archives containing multiple files. To read the file I'm using a nice zip library from here: lbernstrone/miniz. This library has been modified to work on the ESP32 with PSRAM. Miniz is actually built into the ESP32 ROM, but support for multifile archives is disabled.

Parsing the ePub file

I've encapsulated the needed ZIP function in a small wrapper class which can be found here: ZipFile

The most interesting file in the epub archive is the OEBPS/content.opf file. This file contains the list of files in the epub archive. The OEBPS/content.opf file is a simple XML file so we need an XML parser to parse it.

To do the heavy lifting of parsing the XML we're using TinyXML2. This library is a very small and simple XML parser. The content.opf contains three sections, metadata, manifest and spine. The metadata section contains the title of the book, the author and the cover image. The manifest section contains the list of files in the epub archive. The spine section tells you what order to read the files in.

The parsing of the epub file and reading in the contents is done by the Epub class. This uses the ZipFile class and the TinyXML2 library to parse the epub file and read the contents.

Parsing the ePub contents

Each logical section of the book (typically chapters) is one HTML file in the zip archive.

These are all XHTML files - this means that once again we can parse them using the TinyXML2 library.

I've limited our parsing to a set of minimum tags that are enough to give us the basic structure of the book without making things too complicated.

  • Block tags
    ,

    ,

    ,

    etc...

  • Inline tags ,
  • Images
  • Line breaks
  • You can see the details in the RubbishHtmlParser code.

    For each block tag we extract the text and add the block to a list of blocks. For inline tags we add these to the current block along with any style information (e.g. bold, italic).

    Whenever we hit a new block tag we start a new block.

    Image tags are also treated as blocks.

    After parsing the HTML we end up with a list of blocks containing either text or an image. For header tags, we just set the style of the block to bold. You could get more sophisticated here with multiple fonts and different sizes if you wanted to.

    Laying out a section of the book

    With the blocks extracted, we can now layout the blocks of the section onto individual pages.

    Image blocks are easy - we just need to read the width and height of the image and scale it to fit on the screen. This gives us the height the image will be when it is rendered.

    For text blocks we need to calculate the height of the text once it has been split over multiple lines. To do this we measure the width of each word in the block and then use some dynamic programming to break the words up into lines - you can watch a great video from MIT here on how this algorithm works: 20. Dynamic Programming II: Text Justification, Blackjack.

    I copied the solution for this problem from here with minor modifications. This implementation will work for most cases but could be improved considerably.

    With the heights of the blocks all computed and the text blocks broken up into lines, we can now assign the content to pages.

    We create a page and then start adding content to it - either images or lines of text. Everytime we run out of space we create a new page.

    Rendering

    Rendering each page is trivial - we know the y position of each element on the page.

    Images are simply drawn at the correct y position centred on the screen.

    Text is drawn word by word and a side effect of the text justification and line-breaking is that we have already computed the x position of each word on a line.

    Deep sleep

    The code will go to sleep after 30 seconds of inactivity. The current state of the ePaper display is saved to the SD Card - this is needed so that the display updates correctly. Other state is held in RTC memory.

    For wake up there are two options, ULP for buttons that are active low and EXT1 for buttons that are active high. I've got a good video on deep sleep here if you are interested in this kind of thing: ESP32 Deep Dive into Deep Sleep

    How well does it work?

    Surprisingly, it works pretty well. Layout is reasonable, but there are a lot of improvements that could be made. The code makes no attempt to break pages at suitable places - there are hints that can be extracted from the XHTML files and there are also CSS files that could be used.

    Depending on the images that have been used for the book covers displaying the list of ePub files on the SD Card can take a few sections and moving through the pages of ePub files can be a bit slow. Rendering the actual pages is pretty reasonable, even when they have images on them.

    Improvements:

    There's a lot of room for improvement. This is a very basic e-reader and I'm more than happy for people to contribute to this project.

    Comments
    • Help in adding a language.

      Help in adding a language.

      Hello. Help please. I'm from Russia. And it turned out that this program does not support Cyrillic. Please add a language. Or please tell me how to add. I attach the book to the attachment for the test 80072670.zip .

      help wanted 
      opened by shojkeee 26
    • m5paper compile error

      m5paper compile error

      Hi, I was trying to compile and test your project on my m5paper, but I can't get it to work. After cloning it, I selected the correct env task for m5paper, but it gave me a lot of compilation errors:

      In file included from src/boards/Lilygo_t5_47.cpp:2:
      lib/Fonts/regular_font.h:2:10: fatal error: epd_driver.h: No such file or directory
      
      ********************************************************************
      * Looking for epd_driver.h dependency? Check our library registry!
      *
      * CLI  > platformio lib search "header:epd_driver.h"
      * Web  > https://platformio.org/lib/search?query=header:epd_driver.h
      *
      ********************************************************************
      
       #include "epd_driver.h"
                ^~~~~~~~~~~~~~
      compilation terminated.
      Compiling .pio/build/m5_paper/src/boards/controls/EpdiyV6ButtonControls.o
      *** [.pio/build/m5_paper/src/boards/Lilygo_t5_47.o] Error 1
      Compiling .pio/build/m5_paper/src/boards/controls/GPIOButtonControls.o
      In file included from src/boards/controls/EpdiyV6ButtonControls.cpp:1:
      src/boards/controls/EpdiyV6ButtonControls.h:2:10: fatal error: pca9555.h: No such file or directory
      
      *****************************************************************
      * Looking for pca9555.h dependency? Check our library registry!
      *
      * CLI  > platformio lib search "header:pca9555.h"
      * Web  > https://platformio.org/lib/search?query=header:pca9555.h
      *
      *****************************************************************
      
       #include "pca9555.h"
                ^~~~~~~~~~~
      compilation terminated.
      *** [.pio/build/m5_paper/src/boards/controls/EpdiyV6ButtonControls.o] Error 1
      In file included from lib/Epub/Renderer/M5PaperRenderer.h:6,
                       from src/boards/M5Paper.cpp:2:
      lib/Epub/Renderer/EpdiyFrameBufferRenderer.h:3:10: fatal error: epd_driver.h: No such file or directory
      
      ********************************************************************
      * Looking for epd_driver.h dependency? Check our library registry!
      *
      * CLI  > platformio lib search "header:epd_driver.h"
      * Web  > https://platformio.org/lib/search?query=header:epd_driver.h
      *
      ********************************************************************
      
       #include <epd_driver.h>
                ^~~~~~~~~~~~~~
      compilation terminated.
      *** [.pio/build/m5_paper/src/boards/M5Paper.o] Error 1
      In file included from lib/Epub/EpubList/EpubIndex.h:13,
                       from src/main.cpp:9:
      /Users/sn0wst0rm/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/dirent.h:53:6: error: conflicting declaration of 'DIR* opendir(const char*)' with 'C' linkage
       DIR *opendir(const char *);
            ^~~~~~~
      In file included from /Users/sn0wst0rm/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/dirent.h:39,
                       from lib/Epub/EpubList/EpubIndex.h:13,
                       from src/main.cpp:9:
      /Users/sn0wst0rm/.platformio/packages/framework-espidf/components/newlib/platform_include/sys/dirent.h:53:6: note: previous declaration with 'C++' linkage
       DIR* opendir(const char* name);
            ^~~~~~~
      In file included from lib/Epub/EpubList/EpubIndex.h:13,
                       from src/main.cpp:9:
      /Users/sn0wst0rm/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/dirent.h:56:3: error: conflicting declaration of 'dirent* readdir(DIR*)' with 'C' linkage
         readdir(DIR *);
         ^~~~~~~
      In file included from /Users/sn0wst0rm/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/dirent.h:39,
                       from lib/Epub/EpubList/EpubIndex.h:13,
                       from src/main.cpp:9:
      /Users/sn0wst0rm/.platformio/packages/framework-espidf/components/newlib/platform_include/sys/dirent.h:54:16: note: previous declaration with 'C++' linkage
       struct dirent* readdir(DIR* pdir);
                      ^~~~~~~
      In file included from lib/Epub/EpubList/EpubIndex.h:13,
                       from src/main.cpp:9:
      /Users/sn0wst0rm/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/dirent.h:58:6: error: conflicting declaration of 'int readdir_r(DIR*, dirent*, dirent**)' with 'C' linkage
       int  readdir_r(DIR *__restrict, struct dirent *__restrict,
            ^~~~~~~~~
      In file included from /Users/sn0wst0rm/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/dirent.h:39,
                       from lib/Epub/EpubList/EpubIndex.h:13,
                       from src/main.cpp:9:
      /Users/sn0wst0rm/.platformio/packages/framework-espidf/components/newlib/platform_include/sys/dirent.h:59:5: note: previous declaration with 'C++' linkage
       int readdir_r(DIR* pdir, struct dirent* entry, struct dirent** out_dirent);
           ^~~~~~~~~
      In file included from lib/Epub/EpubList/EpubIndex.h:13,
                       from src/main.cpp:9:
      /Users/sn0wst0rm/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/dirent.h:61:7: error: conflicting declaration of 'void rewinddir(DIR*)' with 'C' linkage
       void  rewinddir(DIR *);
             ^~~~~~~~~
      In file included from /Users/sn0wst0rm/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/dirent.h:39,
                       from lib/Epub/EpubList/EpubIndex.h:13,
                       from src/main.cpp:9:
      /Users/sn0wst0rm/.platformio/packages/framework-espidf/components/newlib/platform_include/sys/dirent.h:57:6: note: previous declaration with 'C++' linkage
       void rewinddir(DIR* pdir);
            ^~~~~~~~~
      In file included from lib/Epub/EpubList/EpubIndex.h:13,
                       from src/main.cpp:9:
      /Users/sn0wst0rm/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/dirent.h:72:7: error: conflicting declaration of 'void seekdir(DIR*, long int)' with 'C' linkage
       void  seekdir(DIR *, long);
             ^~~~~~~
      In file included from /Users/sn0wst0rm/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/dirent.h:39,
                       from lib/Epub/EpubList/EpubIndex.h:13,
                       from src/main.cpp:9:
      /Users/sn0wst0rm/.platformio/packages/framework-espidf/components/newlib/platform_include/sys/dirent.h:56:6: note: previous declaration with 'C++' linkage
       void seekdir(DIR* pdir, long loc);
            ^~~~~~~
      In file included from lib/Epub/EpubList/EpubIndex.h:13,
                       from src/main.cpp:9:
      /Users/sn0wst0rm/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/dirent.h:73:7: error: conflicting declaration of 'long int telldir(DIR*)' with 'C' linkage
       long  telldir(DIR *);
             ^~~~~~~
      In file included from /Users/sn0wst0rm/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/dirent.h:39,
                       from lib/Epub/EpubList/EpubIndex.h:13,
                       from src/main.cpp:9:
      /Users/sn0wst0rm/.platformio/packages/framework-espidf/components/newlib/platform_include/sys/dirent.h:55:6: note: previous declaration with 'C++' linkage
       long telldir(DIR* pdir);
            ^~~~~~~
      In file included from lib/Epub/EpubList/EpubIndex.h:13,
                       from src/main.cpp:9:
      /Users/sn0wst0rm/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/dirent.h:76:6: error: conflicting declaration of 'int closedir(DIR*)' with 'C' linkage
       int  closedir(DIR *);
            ^~~~~~~~
      In file included from /Users/sn0wst0rm/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/dirent.h:39,
                       from lib/Epub/EpubList/EpubIndex.h:13,
                       from src/main.cpp:9:
      /Users/sn0wst0rm/.platformio/packages/framework-espidf/components/newlib/platform_include/sys/dirent.h:58:5: note: previous declaration with 'C++' linkage
       int closedir(DIR* pdir);
           ^~~~~~~~
      *** [.pio/build/m5_paper/src/main.o] Error 1
      ================================================================================== [FAILED] Took 6.32 seconds ==================================================================================
      
      Environment    Status    Duration
      -------------  --------  ------------
      m5_paper       FAILED    00:00:06.320
      

      I noticed that in platform.ini config file, in the m5paper env section, there was not specified anywhere the m5stack/M5EPD library. I tried adding it as a dependency but as I thought it did not work because it is written to be built against the Arduino framework, while you use espidf.

      Can you please tell me how you did get it to compile? It would be really appreciated!

      opened by sn0wst0rm 23
    • Continuous hour glass

      Continuous hour glass

      I loaded the project via M5Burner and put the recommended epub file on the micro SD card. However, despite restarts/etc all I get is the hour glass, even after waiting a while. Is this user error, in which case can you provide a pointer? Thanks.

      opened by pcmdx 16
    • Build instructions and first issues

      Build instructions and first issues

      Hi Chris, trying to compile this using PlatformIO and wanted to report first problems, so we can build proper build instructions.

      1. First found, in order to hit the Build button and start with the right environment this should be added to platformio.ini
      [platformio]
      default_envs = lilygo_t5_47 
      

      So it selects that env by default.

      1. got this error when building after the default_envs setting
      1/7] Generating esp32.ulp.ld
      [2/7] Generating main.ulp.S
      [3/7] Building ASM object CMakeFiles/ulp_main.dir/main.ulp.S.obj
      [4/7] Linking ASM executable ulp_main
      FAILED: ulp_main 
      : && esp32ulp-elf-ld                                   -A elf32-esp32ulp -nostdlib CMakeFiles/ulp_main.dir/main.ulp.S.obj -o ulp_main  -T/home/martin/esp/projects/diy-esp32-epub-reader/.pio/build/lilygo_t5_47/esp-idf/src/ulp_main/esp32.ulp.ld  -Map=/home/martin/esp/projects/diy-esp32-epub-reader/.pio/build/lilygo_t5_47/esp-idf/src/ulp_main/ulp_main.map && :
      esp32ulp-elf-ld: ulp_main section `.text' will not fit in region `ram'
      esp32ulp-elf-ld: region `ram' overflowed by 140 bytes
      ninja: build stopped: subcommand failed.
      Compiling .pio/build/lilygo_t5_47/bootloader_support/src/bootloader_clock.o
      Compiling .pio/build/lilygo_t5_47/bootloader_support/src/bootloader_common.o
      Compiling .pio/build/lilygo_t5_47/bootloader_support/src/bootloader_flash.o
      Compiling .pio/build/lilygo_t5_47/bootloader_support/src/bootloader_mem.o
      Compiling .pio/build/lilygo_t5_47/bootloader_support/src/bootloader_random.o
      Compiling .pio/build/lilygo_t5_47/bootloader_support/src/bootloader_random_esp32.o
      Compiling .pio/build/lilygo_t5_47/bootloader_support/src/bootloader_utility.o
      *** [.pio/build/lilygo_t5_47/esp-idf/src/ulp_main/ulp_main.h] Error 1
      

      Additional Info:

      PACKAGES: 
       - framework-espidf 3.40200.210118 (4.2.0) 
       - tool-cmake 3.16.4 
       - tool-esptoolpy 1.30000.201119 (3.0.0) 
       - tool-ninja 1.7.1 
       - toolchain-esp32ulp 1.22851.191205 (2.28.51) 
       - toolchain-xtensa32 2.80400.210211 (8.4.0)
      

      @cgreening can you understand where is the problem with the missing ULP here? According to this post it should be already solved in this IDF version.

      Additionally I would like to know what will be the minimum ESP-IDF framework version required and if it will be possible to compile this on command line using idf.py build (I guess no, since some lib dependences are managed by platformio)

      UPDATE: Using esp-idf 4.3.0 it compiles further ( It requires then version >= 4.3? )

      Next error hit is:

      *** [.pio/build/lilygo_t5_47/bootloader/soc/src/cpu_util.o] 
      Source `/home/martin/.platformio/packages/framework-espidf/components/soc/src/cpu_util.c' not found, needed by target `.pio/build/lilygo_t5_47/bootloader/soc/src/cpu_util.o'.
      

      That is strange, there is no such a file in the .platformio/packages directory

      martin@martin-IdeaPad:~$ ls /home/martin/.platformio/packages/framework-espidf/components/soc/
      CMakeLists.txt  esp32c3  include    memory_layout_utils.c
      component.mk    esp32s2  linker.lf  README.md
      esp32           esp32s3  lldesc.c   soc_include_legacy_warn.c
      

      Second error hit, seems related to this issue:

      Library Manager: tinyxml2 @ 0.0.0+20211002104647.sha.a977397 has been installed!
      Generating assembly for certificate bundle...
      CMake Error at /home/martin/.platformio/packages/framework-espidf/tools/cmake/scripts/data_file_embed_asm.cmake:26 (file):
        file failed to open for reading (No such file or directory):
      
          /home/martin/esp/projects/diy-esp32-epub-reader/.pio/build/lilygo_t5_47/x509_crt_bundle
      
      opened by martinberlin 13
    • Feature/46 index

      Feature/46 index

      First draft to parse the content's index. @cgreening I will need some help with this one since I don't understand completely the whole structure yet. Started only with the parsing the toc.ncx file This is what it outputs via Serial for the ww2 book:

      ncx in line:4
      I (17758) EPUB: title Cubierta src Text/cubierta.xhtml
      I (17758) EPUB: title Pequeñas grandes historias de la Segunda Guerra Mundial src Text/titulo.xhtml
      I (17768) EPUB: title Introducción src Text/Introduccion.xhtml
      I (17768) EPUB: title 1. Los primeros src Text/Capitulo1.xhtml
      I (17778) EPUB: title 2. En la retaguardia src Text/Capitulo2.xhtml
      I (17788) EPUB: title 3. El esfuerzo de guerra src Text/Capitulo3.xhtml
      I (17788) EPUB: title 4. En el aire src Text/Capitulo4.xhtml
      I (17798) EPUB: title 5. En el mar src Text/Capitulo5.xhtml
      I (17808) EPUB: title 6. La tragedia de la guerra src Text/Capitulo6.xhtml
      I (17808) EPUB: title 7. En la línea de fuego src Text/Capitulo7.xhtml
      I (17818) EPUB: title 8. Los otros protagonistas src Text/Capitulo8.xhtml
      I (17828) EPUB: title 9. Historias de ingenio src Text/Capitulo9.xhtml
      I (17838) EPUB: title 10. Hechos insólitos src Text/Capitulo10.xhtml
      I (17838) EPUB: title 11. Los últimos src Text/Capitulo11.xhtml
      I (17848) EPUB: title Apéndice src Text/Apendice.xhtml
      I (17858) EPUB: title Bibliografía src Text/Bibliografia.xhtml
      I (17858) EPUB: title Autor src Text/autor.xhtml
      I (17868) EPUB: title Notas src Text/notas.xhtm
      

      Question do we need to take this *.ncx name from the manifest or it will be faster just to open the first OEBPS filename.ncx (So far all have the ncx extension sometimes with different filename) I would go for the fastest option if possible.

      opened by martinberlin 10
    • Top margin lost and touch becomes irresponsive

      Top margin lost and touch becomes irresponsive

      This happened to me after the nice refactoring from controls and touch. No idea if it’s something related or not but could not experience it before. Also no clues from Serial. Touch events sometimes after browsing many pages disappears and touching the screen I can see any output in Serial. After that keeps on working with the buttons but top margin is kind of lost (see photo) UPDATE: This bug is already solved! The freeze one is still under research and hard to reproduce. EB8C55B3-A291-4063-8E09-43B408D9F722

      after some more pagination it works again. This happened to me browsing Section0028 of the following poetry book: piedra_Pizarnik.EPub

      Second glitch: Same as before after navigating many pages doing a button SELECT, just displays the hourglass (Half printed) and hangs there. Will try to catch the Serial output for this one.

      Third glitch: Even with the new Waveform that it works much better as before, we should do a full refresh every 3 or 4 pages read. Reading the book added in last commit: data/el_aleph.epub After some pages the old text mixes with the new one making further lecture almost impossible (See additional picture) 8FEE485B-0DA5-445A-BF50-A7D3114880C0

      Note this is hard to reproduce and I still can read many pages clearly before hitting this issue. It does not come always and I'm not sure if it's a bug of EPDiy or it's because we need to just make a full epd_fullclear and refresh every now and then or there is something more.

      bug 
      opened by martinberlin 10
    • EPDiy reading SPI microSD

      EPDiy reading SPI microSD

      • [x] Set the right IOs for SD card SPI
      • [x] Correct ADC channel:to reflect GPIO 34

      Updated the ADC channel: ; Adc channel that is connected to the battery voltage divider - this is GPIO_NUM_34 in EPDiy V6 -D BATTERY_ADC_CHANNEL=ADC1_CHANNEL_6

      But still shows the battery empty. I was told the voltage divider was connected to IO 34. Got it there is a bridge I need to close in the PCB, will document it later in the Wiki. schematic-v6.pdf

      Related to #60

      documentation doing epdiy v6 
      opened by martinberlin 9
    • LilyGo_T5_47 upload the code enter reboot cycle

      LilyGo_T5_47 upload the code enter reboot cycle

      After upload the code lilygo enter reboot cycle. The log is below.

      Rebooting... ets Jul 29 2019 12:21:46

      rst:0xc (SW_CPU_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0030,len:4996 load:0x40078000,len:14436 load:0x40080400,len:3240 entry 0x40080610 I (481) psram: This chip is ESP32-D0WD I (482) spiram: Found 64MBit SPI RAM device I (482) spiram: SPI RAM mode: flash 80m sram 80m I (484) spiram: PSRAM initialized, cache is in low/high (2-core) mode. I (492) cpu_start: Pro cpu up. I (495) cpu_start: Starting app cpu, entry point is 0x400840c0 I (489) cpu_start: App cpu up. I (517) cpu_start: Pro cpu start user code I (517) cpu_start: cpu freq: 240000000 I (517) cpu_start: Application information: I (522) cpu_start: Project name: epub-reader I (527) cpu_start: App version: e849c1e-dirty I (533) cpu_start: Compile time: Jan 3 2022 18:07:48 I (539) cpu_start: ELF file SHA256: bf1bf981faa088a8... I (545) cpu_start: ESP-IDF: 4.3.1 I (550) heap_init: Initializing. RAM available for dynamic allocation: I (557) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM I (563) heap_init: At 3FFB80E0 len 00027F20 (159 KiB): DRAM I (569) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM I (575) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM I (582) heap_init: At 40095C2C len 0000A3D4 (40 KiB): IRAM I (588) spiram: Adding pool of 4096K of external SPI memory to heap allocator I (596) spi_flash: detected chip: generic I (600) spi_flash: flash io: dio I (610) cpu_start: Starting scheduler on PRO CPU. I (0) cpu_start: Starting scheduler on APP CPU. I (615) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations I (625) main: epub list state num_epubs=0 I (625) main: epub list state is_loaded=0 I (635) main: epub list state selected_item=0 I (635) main: Memory before main task start 4413491 I (645) main: Powering up the board I (645) main: Creating renderer I (715) main: Starting file system I (715) main: Using SPIFFS I (715) SPIFFS: Initializing SPIFFS I (935) main: Starting battery monitor I (935) main: Setting up controls i2c_driver started correctly I (935) gpio: GPIO[13]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:1 E (945) gpio: gpio_install_isr_service(460): GPIO isr service already installed ISR trigger install response: 0x103 I (955) main: Controls configured I (955) EPD: Full clear

      abort() was called at PC 0x400851c7 on core 0

      Backtrace:0x4008ed8e:0x3ffbe860 0x4008f509:0x3ffbe880 0x40094862:0x3ffbe8a0 0x400851c7:0x3ffbe910 0x40085325:0x3ffbe940 0x400853c1:0x3ffbe960 0x4012eaed:0x3ffbe990 0x40125f13:0x3ffbec50 0x40125d36:0x3ffbeca0 0x40092307:0x3ffbecd0 0x4008fdcf:0x3ffbed00 0x4008307d:0x3ffbed40 0x4009213d:0x3ffbf170 #0 0x4008ed8e:0x3ffbe860 in panic_abort at C:\Users\ddj1.platformio\packages\framework-espidf\components\esp_system/panic.c:368
      #1 0x4008f509:0x3ffbe880 in esp_system_abort at C:\Users\ddj1.platformio\packages\framework-espidf\components\esp_system/system_api.c:112 #2 0x40094862:0x3ffbe8a0 in abort at C:\Users\ddj1.platformio\packages\framework-espidf\components\newlib/abort.c:46 #3 0x400851c7:0x3ffbe910 in lock_acquire_generic at C:\Users\ddj1.platformio\packages\framework-espidf\components\newlib/locks.c:139
      #4 0x40085325:0x3ffbe940 in _lock_acquire_recursive at C:\Users\ddj1.platformio\packages\framework-espidf\components\newlib/locks.c:167 #5 0x400853c1:0x3ffbe960 in __retarget_lock_acquire_recursive at C:\Users\ddj1.platformio\packages\framework-espidf\components\newlib/locks.c:323 #6 0x4012eaed:0x3ffbe990 in _vfiprintf_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vfprintf.c:853 (discriminator 2) #7 0x40125f13:0x3ffbec50 in fiprintf at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/fiprintf.c:48 #8 0x40125d36:0x3ffbeca0 in __assert_func at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdlib/assert.c:58 (discriminator 8) #9 0x40092307:0x3ffbecd0 in spinlock_acquire at C:\Users\ddj1.platformio\packages\framework-espidf\components\esp_hw_support\include/soc/spinlock.h:122 (inlined by) vPortCPUAcquireMutex at C:\Users\ddj1.platformio\packages\framework-espidf\components\freertos\port\xtensa\include/freertos/portmacro.h:158 (inlined by) vPortEnterCritical at C:\Users\ddj1.platformio\packages\framework-espidf\components\freertos\port\xtensa/port.c:448
      #10 0x4008fdcf:0x3ffbed00 in xQueueGenericSend at C:\Users\ddj1.platformio\packages\framework-espidf\components\freertos/queue.c:790
      #11 0x4008307d:0x3ffbed40 in provide_out at lib/epdiy/lut.c:427 #12 0x4009213d:0x3ffbf170 in vPortTaskWrapper at C:\Users\ddj1.platformio\packages\framework-espidf\components\freertos\port\xtensa/port.c:168

      ELF file SHA256: bf1bf981faa088a8

      opened by trumeen 6
    • Intermitent error after many deepsleep and wakeup

      Intermitent error after many deepsleep and wakeup

      I'm experiencing this restart while debugging and waking up with the buttons:

      I (279) main: Using SPIFFS
      I (279) SPIFFS: Initializing SPIFFS
      I (519) main: Memory after sdcard init: 3250087
      I (519) Controls: ULP Wakeup
      I (519) EPD: Hydrating EPD
      I (519) EPD: Front buffer compressed size: 0
      E (519) EPD: Failed to allocate memory for front buffer
      I (629) EPD: Back buffer compressed size: 44237
      

      Any idea why it fails allocating the Front buffer?

      opened by martinberlin 6
    • Adding experimental touch

      Adding experimental touch

      Hi Chris, started a fork here: https://github.com/martinberlin/diy-esp32-epub-reader-touch

      with the mission to add touch (If I can, really experimental) And I wanted to leave this topic to ask you about building an ESP-IDF project with Platformio since it's my first time and for sure I will make lot's of mistakes. For example in this commit just added my touch component in lib folder. But I'm still trying to guess how I tell Platformio to include this in the build process. In IDF I do that using CMakeLists in the component folder but here I'm a bit lost. Can you share your knowledge with me? Thanks in advance

      opened by martinberlin 6
    • Make this Firmware also EPDiy V6 compatible

      Make this Firmware also EPDiy V6 compatible

      So we can expand the use also to EPDiy supported epapers instead of only LilyGo EPD47

      Linked to #52

      @cgreening the core of the problem is that EPDiy cannot install I2C driver when using this repository. It does work perfectly when using EPDiy standalone examples. So there must e something in our side that is interfering with EPDiy. I suspected it was touch since it also uses I2C but there is something more than that, basically it fails instantiating the I2C driver.

      bug difficult 
      opened by martinberlin 5
    • EPD47 not booting with microSD connected

      EPD47 not booting with microSD connected

      Hello,

      I have successfully used the official LILYGO TF-Card adapter on my EPD47 to get access to the Files on my microSD card. But if I power on the device while the adapter is inserted the device doesn't boot (even if the card is not in the adapter). I only got it to work if I connect the adapter after the device is booted, at the next auto reboot the books are loaded. To narrow down the problem I flashed the LilyGo demo via Arduino IDE. After flashing the demo the device starts fine with the adapter and card inserted, the card is recognized and the size of the card is displayed.

      Any help fixing the problem is greatly appreciated.

      Thanks in advance.

      opened by TheBattleWolf 2
    • #Include

      #Include "L58touch.h" Error

      I get this error when i try to build on LILYGO_t5_47

      #include "L58Touch.h" ^~~~~~~~~~~~ compilation terminated. *** [.pio\build\lilygo_t5_47\src\boards\controls\L58TouchControls.o] Error 1

      This file is inside the src/borads/controls, so i don't know why he can't find it

      image

      opened by 51m00 1
    • Weird graphical glitch in the display of content.

      Weird graphical glitch in the display of content.

      I'm having a weird text issue, but it happens on the battery icon and the book selection screen as well. Everything had this weird shift in the display. Any idea what it might be? 20220403_013148 20220403_013549

      opened by rttgnck 6
    • low battery on M5Paper causes reboot cycle

      low battery on M5Paper causes reboot cycle

      I'm guessing that below a certain level the SDCard stops working causing a crash.

      Maybe related to https://github.com/atomic14/diy-esp32-epub-reader/issues/62

      opened by cgreening 1
    • Add support for sup and sub html tags

      Add support for sup and sub html tags

      We'll need to check how much room we have for more fonts - I'm wondering if the epdiy library could be modified to support scaling of existing fonts. That might give us an easy way of drawing fonts at half size for the super and subscript text.

      enhancement prio: low 
      opened by cgreening 1
    • Wake up periodically to refresh the battery display

      Wake up periodically to refresh the battery display

      At the moment, you could go to sleep and never wake up as the battery would have died.

      We should probably wake up every hour or so to refresh the battery display - maybe could get fancy and show a needs charging icon if the battery is very low.

      enhancement prio: low 
      opened by cgreening 1
    Owner
    atomic14
    atomic14
    An unofficial Realtek PCIe-based card reader driver for macOS

    Realtek PCIe Card Reader Driver for macOS Unleash the full potential of your SDXC UHS-I cards Introduction An unofficial macOS kernel extension for Re

    FireWolf 143 Jan 7, 2023
    An unofficial Realtek PCIe/USB-based SD card reader driver for macOS

    Realtek Card Reader Driver for macOS Unleash the full potential of your SDXC UHS-I cards Introduction An unofficial macOS kernel extension for Realtek

    FireWolf 144 Dec 28, 2022
    A Lilu plugin that makes System Information recognize your Realtek card reader as a native one

    Realtek Card Reader Driver Friend Introduction A Lilu plugin that makes System Information recognize your Realtek card reader as a native one. Support

    FireWolf 57 Nov 30, 2022
    Schedule Reader but it's written by C++

    Schedule Reader 2.0 Automatically convert your excel schedule from your teacher to an iCalendar file that you can import into services like Google Cal

    Asiimoviet 6 Oct 26, 2022
    gu, Gefertean Union reader

    gu gu, Gefertean Union reader based on Freud and Totem external requirements: libcurl (for curl4cpp) elite (for build) c++ compiler (c++17 or higher

    Ferhat Geçdoğan 3 Apr 27, 2022
    Buffer reader/builder for C

    ubuf ubuf is a simple interface for reading/writing binary data. It handles automatically expanding the buffer and byte order for you, but that's abou

    adrian 2 Jan 10, 2022
    null 313 Dec 31, 2022
    Allows for multiple SwitchBot buttons and curtains to be controlled via MQTT sent to ESP32. ESP32 will send BLE commands to switchbots and return MQTT responses to the broker. Also supports Meter/Temp Sensor

    SwitchBot-MQTT-BLE-ESP32 Switchbot local control using ESP32. no switchbot hub used/required. works with any smarthub that supports MQTT https://githu

    null 343 Dec 27, 2022
    AnalogWrite for ESP32 and ESP32-S2 with LEDC PWM. Includes PWM Phase Control, DAC and Smart GPIO resource management.

    analogWrite() ESP32 Installation Instructions This library was tested using using the ESP32 Arduino IDE Boards Manager installation method. Stable rel

    null 36 Jan 5, 2023
    ESP32 + GitHub Actions + Husarnet. A boilerplate project for ESP32 allowing in-field firmware update using GitHub Actions workflow.

    esp32-internet-ota ESP32 + GitHub Actions + Husarnet. A boilerplate project for ESP32 allowing in-field firmware update using GitHub Actions workflow.

    Husarnet 31 Sep 22, 2022
    ESP32 based DIY word clock project

    Wordclock ESP32 based DIY wordclock project TL;DR: check out this ✨ demo video ✨ Another take on the classic DIY word clock. This one requires a laser

    null 41 Dec 26, 2022
    A Walkie-Talkie based around the ESP32 using UDP broadcast or ESP-NOW

    Overview We've made a Walkie-Talkie using the ESP32. Explanatory video Audio data is transmitted over either UDP broadcast or ESP-NOW. So the Walkie-T

    atomic14 259 Dec 31, 2022
    ESP32 Audio Kit based multitrack looper

    esp32_multitrack_looper ESP32 Audio Kit based multitrack looper The project can be seen in my video https://youtu.be/PKQmOsJ-g1I The project has been

    Marcel 44 Dec 10, 2022
    Tiny weather station based on TTGO T5 V2.3.1 (ESP32 with 2.13

    Tiny weather station based on TTGO T5 V2.3.1 (ESP32 with 2.13" e-ink display) Features wireless and rechargable weather description including temperat

    Piotr Kubica 18 Dec 5, 2022
    DUHOME AIOT platform based on du1906 and esp32

    1. Example of ESP32-Korvo-DU1906 board This example shows how to use ESP32-Korvo-DU1906 board working with DuHome AIOT Voice Platform (度家-AIOT语音平台).Th

    Baidu 15 Jan 4, 2023
    ESP32 based USB C Programmable Power Supply

    ESP32 USB-C Power Supply The idea for this ESP32 usb-c power supply project came to me when I discovered that components exist that communicate to par

    Mike Rankin 146 Dec 29, 2022
    3D printer control board based on ESP32,support 8 Driver motors.

    PandaZHU use ESP32 as the mcu for 3D printer motherboard. Zhu is Chinese for bamboo it has larger memory and more powerful than normal 32bit 3D printe

    Mark 48 Dec 31, 2022
    ESP32 based Desktop Clock

    ESP32_Desktop_Clock ESP32 based Desktop Clock This ESP32 internet of things desktop clock is a project created for my home. School has started and fal

    Mike Rankin 77 Jan 4, 2023
    Bluetooth Gateway for Phantom Remote Control based on ESP32

    Phantom remote control Bluetooth gateway An ESP3232 firmware for the gateway of Phantom remote control, which can push the temperature and humidity data of Phantom remote control through LAN, and also support to control Phantom remote control to send and receive IR data through LAN.

    George Zhao 14 Nov 3, 2022