ESP32 and ILI9341 ISP mode

After trying several options that I found on the web, I chose this one as the better to connect an ESP32 to an ILI9341 TFT display.

ESP32 ILI9341
3V3 VCC
GND GND
D15 CS
D2 RESET
D4 D/C
D23 MOSI
D18 SCK
Not connected MISO
3V3 (***or D19) LED

The code:

/**
 * ILI9341 TFT libraries and resources
 */
const int TFT_CS = 15;
const int TFT_DC = 4;
const int TFT_MOSI = 23;
const int TFT_SLK = 18;
const int TFT_RST = 2;
const int TFT_LED = 19;     

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_SLK, TFT_RST);

void setup() {
  tft.begin();
  tft.setRotation(3); //Landscape orientation
}

The reason for the two possibilities for the LED pin is the next:

If you connect LED pin directly to 3V3 you will get maximum brightness in your screen. LED pin controls the backlight of your TFT display.

In my case, I didn’t want to have max brightness but I wanted to control the intensity based on ambient light, so I decided to connect LED pin to any of the IO pins of the ESP32 (#19 in the showed example).

The code to control backlight intensity (once you have connected LED to pin D19) is as follows:

.
const int TFT_LED = 19; 
.
/**
 * PWM Constants
 */
const int freq = 5000;
const int tftledChannel = 0;
const int resolution = 8;
.
.
.
void setup() {
.
.
.
  /**
   * TFT DISPLAY
   */
  //Background light PWM
  ledcSetup(tftledChannel, freq, resolution);
  ledcAttachPin(19, tftledChannel);
.
.
}

/**
 * Sets TFT background luminosity (0-255)
 */
void setBGLuminosity(int level){
  ledcWrite(tftledChannel, level);
}

Inserting the code above allows you to set the backlight intensity at any point just invoking setBGLuminosity() function passing a value between 0 and 255.

 

//Examples:
setBGLuminosity(0);   //Switch off screen backlight
setBGLuminosity(128); //Medium intensity (theoretically)
setBGLuminosity(255); //Full intensity

Claudio, available resources

Before going into detail of coding or wiring, I will publish here the links to the existing project resources (videos and code repositories).

Sorry about the video language, but I prefer writing in Spanish in places like youtube where automatic translation is good enough.

Youtube channel: 

https://www.youtube.com/channel/UCR5-nrKV7iJBCj24QehHoNA

Github repositories:

https://github.com/pangodream/Claudio

Inside Hardware folder, you may find some hardware pictures and a wiring diagram (though this one will have its own post) and inside Box folder are the .obj files to 3d Print the box.

https://github.com/pangodream/ClaudioRemote

 

Claudio, a wake-up alarm not so simple

New blog and to tell you the truth, my first blog. No personal introduction, no sensitive content… 🙂

I made some basic tests with an ESP8266 a couple of years ago and I was very pleased with the board capabilities, the freshness of NODEMCU, the quick schema uploading… everything. But I didn’t like one aspect, in the same way, I didn’t like some years before about Arduino boards: connectivity.

The ESP32 arrived, WiFi and BLE connectivity, a bunch of IO pins, a lot of different pin working modes… and for someone with limited knowledge of electronic theory… a marvelous tiny thing.

Lately, I am having much more spare time that I used to have, so I decided to start doing things I always wanted to do but I never had the time to. I don’t like using my cellular for all purpose. I like WakeUp alarm clocks, but not the ones they sell. My last WakeUp alarm was a Sony, very nice, spectacular design but “who the hell designs an alarm clock supposed to be stopped while you are sleeping by pressing a tiny switch in the middle of a lot of more tiny switches? Yes, Sony” And what if I design my own Alarm Clock with that ESP32 Developer board I have? And that’s what I did.

The requirements:

  1. Time visible in the dark, but not like a red UFO. Light intensity has to accommodate to room light.
  2. No need for time adjustment. No need to change the hour every spring or autumn.
  3. Minimal use of buttons, tiny buttons, micro switches… :S
  4. If there’s enough room on the screen… some other indicators like temperature and relative humidity (these are enough important in the dry & hot Madrid nights)
  5. If possible, some communication capabilities: remote configuration, remote alarm stopping, …
  6. Easy to wire components between

The prototype:

I needed a box to fit all the components in. Perfect reason to buy my first 3D printer, and that’s what I did.

This is the screen design today… it’s evolving and probably will not be the same in a couple of days.

Claudio WakeUp Alarm Screen

The box is 11cm x 65mm x 65mm and though is a bit bigger than I expected it to be I think of it as a prototype and time will bring smaller designs.

Claudio Wake Up alarma box
Claudio Box

This has been only the introduction. Check out the rest of the posts to know more about the design, the code and the possibilities of ‘the creature’.