Pocket E-Book Reader

Stefanica Matei-Costin, 331CB

Introduction

Brief presentation of the project:

What I want to achieve with this project is a device that is small enough to fit into a pocket, costs less than 50 euro (the average ebook reader price is ~150 euro) and allows the user to read any book, as long as it can be stored on an SD card. The target is to create a MVP, but if all goes well I will also try using a battery and I hope to have at least 12 hours autonomy.

General Description

In the middle of the project it the ATmega328P Xplained mini, which will be the brain of everything. Using SPI, it will communicate with a MicroSD Card Adapter to extract from the MicroSD card the book in byte chunks. Also using SPI it will send the information to the Display for the user to see. On the other hand, I want the device to be as easy to be used as possible, so the Display will also have an autorotate feature, for which I will use a gyroscope that will communicate with the uC using I2C. For the user experience side of the project I will also use a few buttons that will be used to navigate the book and a some other options and settings, as well as a buzzer, used to make a sound similar to the one of pages turned.

Block Diagram

After I encountered the Hardware issues described down below, I am now using Arduino Uno R3 instead of ATmega328P Xplained mini and ST7735 instead of the original ILI one

Hardware Design

Details regarding the hardware implementation:

  • Bill of Materials: ATmega328P Xplained mini, MicroSD Card Adapter, microSD, Display, MPU-6050, buttons, buzzer.

A diagram of all the HW involved can be seen in the following diagram:

Block Diagram

Brief Functionality Description

The user will turn on the device and will see the current page of the current book. He will be able to press one of the Next or Prev buttons to turn pages and will hear an audio feedback (one for valid and one for invalid page turns). The user will also be able to press the Menu button, that will save his progress and take him to the menu screen, where he will be able to navigate through books and choose the one he wants to read. Thanks to the MPU6050 sensor and its accelerometer, the device will be able to detect its spatial orientation and autorotate if being held in different positions.

Pins Layout

TFT ILI9341 Display with Touch
Module Pin Connected To Notes
VCC 5V Power supply
GND GND Common ground
CS D9 Chip Select
RST D8 Display reset
D/C D7 Data / Command
MOSI D11 SPI MOSI
MISO D12 SPI MISO
SCK D13 SPI Clock
LED 3.3V Backlight
Next Button
Button Pin Connected To
1.r D6
2.l GND
Previous Button
Button Pin Connected To
1.r D2
2.l GND
Button Pin Connected To
1.r D4
2.l GND
microSD Module
Module Pin Connected To Notes
CS D10 Chip Select
SCK D13 SPI Clock
DO D12 SPI MISO
DI D11 SPI MOSI
VCC 5V Power supply
GND GND Common ground
MPU6050 Sensor
Sensor Pin Connected To Notes
VCC 5V Power supply
GND GND Common ground
SDA A4 I2C Data
SCL A5 I2C Clock
AD0 GND I2C address configuration
Buzzer
Buzzer Pin Connected To
1 GND
2 D3

Details

  • The SPI MOSI, MISO and SCK are on their default pins (D11, D12, D13) and are common busses for both the LCD and the MicroSD card module
  • The I2C SDA and SCL are on their default pins A4 and A5
  • the pin AD0(Address bit 0) of MPU6050 can be connected to either GND, wither to 5V, resulting in a value of 0 or 1 for the 7th bit of the sensors I2C address (the first 6 bits are set by the producer). Because the default address is with AD0=0, I stuck with that

Important Mentions

  • Wokwi does not have a MicroSD Card Module, only the microSD card by itself, but the pins will be similar;
  • In the physical implementation a resistor will be placed between the board and the buzzer, but Wokwi does not require that, therefore I chose not to include it, in order not to make the schematic too crowded;
  • The actual implementation might not actually include this specific display (ILI9341), but a smaller one (ST7735) that does not exist in Wokwi. Initially I bought a ILI9341, but the component was delivered to me broken. While waiting for a replacement, I will implement the project with the ST7735 and, if possible, migrate towards ILI9341.
  • A very brief demo of the functionality of the project (it is still at the prototype stage) can be found in mp4 format on the github repo

Final Hardware Implementation

For the most part, the project is similar to the schematic. The only different piece is the lcd, which is not an ST7735. I have also soldered the buttons to a protoboard, as can be seen in the following image

soldered buttons

Software Design

In the beginning, I used PlatformIO, but as I mentioned in the Journal, that caused some issues with the SPI of the MicroSD card (not sure why), so I switched over to ArduinoIDE. In my project, as can be seen, I have implemented functionalities from those labs: L0(GPIO), L1(USART), L4(ADC), L5(SPI) and L6(I2C). Initially, I planned to also implement some of the functionalities using registers, not higher level libraries, but as my project would be what I could called 'Software oriented', this task would have made the code almost impossible to debug and understand(Neither was this a requirement for the final grade). I used the following libraries:

  • <SPI.h>
    • used for communicating with ST7735 and the SD module via SPI using the pins D11(MOSI), D12(MISO) and D13(SCK), as well ad D8 and D9, the Chip Select pins
  • <SD.h>
    • allows me to use already implemented functions for writing and reading the SD card
  • <Wire.h>
    • used for communicating with the MPU6050 sensor via I2C using the A4(SDA) and A5(SCL) pins
  • <MPU6050.h>
    • a high level library that abstracts the registers of the sensors and allows me to only call the function `mpu.getMotion6()` to read the data
  • <Adafruit_GFX.h>
    • generic (independent from the specific display) library used for drawing on the screen, without it I would have had to draw the pixels one by one
  • <Adafruit_ST7735.h>
    • translates the generic library functions for this display's driver. I initialized it using `INITR_144GREENTAB`

One issue I encountered multiple times was the lack of RAM, as Atmega328P only has 2KB of it, so you can fill it out quite easily. The first time I encountered this issue was while prototyping the project on Wokwi. That's where I also found out that an easy way to move strings from RAM to the Flash memory is by using the `F` prefix before them, so you will see that a lot in my code.

Brief of the Software Implementation

The device has 2 operating modes: reading mode and menu mode. It uses the SD card to store the books (in .txt format) and store the progress of the reading. It stores the current page for all the books the user has stored on the SD card.

GitHub

YouTube

Power Consumption

It is worth mentioning that most of (if not all) of the components I used are chinese fakes, not original components, therefore the values I have extracted from the datasheets may not be really accurate.

LCD
  • controller: 1.2 mA (page 10, section 2. DC Electrical Characteristics from the datasheet)
  • backlight: 40 mA (page 11, section 3. LED Backlight Characteristics)

total 41.2mA

Arduino Nano
  • because the project is quite complex and I lack the resources to actually be able to measure how much does the board consume while executing my code, I will assume an average of 20mA, which includes both the idle times and the computing times.
Micro SD card module
  • maximum specified current = 200mA
  • idle current is not specified, but I will assume it to be 1mA
  • assuming a reading speed of one page per 30 seconds, therefore an SD read(0.1 seconds) every 30 seconds, I can compute the average:

I_avg = (100mA * 0.1s + 1mA * 29.9s) / 30s = 1.33mA

MPU6050
  • 5mA (specified in the product description)

I will consider that the buzzer consumes too little current to be taken into consideration

Total = 41.2mA + 20mA + 1.33mA + 5mA = 67.53mA

Even though I did not have enough time to also implement a battery, the one I would have used would have been a Li-Po 1000 mAh type battery. The one i intended to use is 2.5 x 62 x 58 mm, so it is also small enough for the purpose of this project.

Autononomy = 14.8 hours

Increasing the Autonomy

Despite the fact I don't even have a battery, I want to specify some of the improvements I believe would have been useful for achieving a longer battery life:

  • lowering the intensity of the backlight (the display is the main consumer)
  • sleep mode for the board, which would allow the Arduino to enter a low power mode to reduce the consumption

Journal

I encountered numerous Hardware issues:

  • ILI9341 came out of the box not working, and unfortunately I did not have enough time to order a new one, so I switched to ST7735 (128×128) a much smaller display.
  • I believed for 2 days that the ST7735 was also broken, but it seems that the issue was my breadboard
  • Just when I was trying to assemble the final version of the project, the ATmega328P Xplained mini stopped working… the main issue was the 'delay' function, that was just indefinitely freezing my execution, instead of suspending it. I suspect something went wrong with its internal clock, but I did not have the time to further investigate it, so I just bought 2 Arduino Nano R3
  • When working on PLATFORMIO, the SD Card Module did not work as expected. It seemed that it did not answer to the SPI initialization. The only way to solve this was to re-insert the MicroSd card into the module at the beginning of the execution, just after the upload. However, after switching to Arduino IDE and uploading from there, the issue did not appear.

Therefore, I lost a lot of time trying to understand why things did not go as expected, so I lost precious time. Because of this, I will not be able to also integrate a power supply or 3D model the case, as I have planned a few weeks back

  • in order to avoid other issues, I have also bought another ST7735 display (with a different resolution) in case anything goes wrong

13.05.2026

  • something did go wrong and somehow the ST7735 display also stopped working, but I fortunately had a second one(with a different resolution), so I managed to replace it. Just when the project seemed to be done, the SD card broke….so I had to buy another one. Fortunately now everything works, but I have no explanation for how many of the components broke. What makes me believe that the components might be the issue, not the way I used them is the fact that when something stopped working I just replaced it and everything worked perfectly well, so the code was correct
  • today I also glued to components in their box (which is a huge one, not really a pocket sized one, in order for me to be able to replace anything might break), soldered the buttons and calibrated the MPU6050 sensor.
pm/prj2026/jan.vaduva/matei.stefanica.txt · Last modified: 2026/05/24 11:36 by matei.stefanica
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0