By Jeremy Cook
Explore the Capabilities of the Espressif ESP32 With a Dali Clock Project
The ESP32—Espressif System’s follow-up to the incredibly popular and powerful ESP8266 WiFi module—is even more capable than its predecessor. Highlights include a 32-bit, dual core processing unit that runs at up to 240 MHz, and wireless communication via both WiFi and Bluetooth.
It also features capacitive touch sensing, I2S data transfer, audio phase-locked loop (PLL) capabilities, and two digital-to-analog converter (DAC) outputs. Note that these features vary somewhat between different ESP32 variations.
Adafruit Huzzah23 (top) with DFRobot Firebeetle (bottom)
Using ESP32 with a Composite Video Clock
For a concrete example of how to use the ESP32 (that’s both easy to implement, and impressive), consider the Dali Clock build by Marcio L. Teixeira. This setup uses an older TV with a composite input and an ESP dev board to display a morphing onscreen clock.
Like any boundary-pushing project, this stands on the metaphorical shoulders of giants, combining the Dali clock concept (created for the Xerox Alto in 1979) with a scrolling sunset scene styled after 1980s pop art. On a technical level, multiple hardware hacks/hackers are credited. And of course, it wouldn’t be possible without the ESP32. Finally, we can’t neglect to include Salvador Dali himself for his original artistic inspiration.
As impressive as its credentials are, to set up this clock you’ll need only the following:
- • ESP32 dev board
- • RCA plug
- • (2) connector wires
- • USB power source
- • Composite capable TV or monitor
The original project uses an Adafruit Huzzah32 ESP32 Feather board. In theory, you could use it with other ESP32-based devices, and I also attempted the project with a DFRobot FireBeetle ESP32 module. Both have similar features, and nominally worked to display video. However, there was one small difference between the two, expanded on a little later.
Video Display
Set Up: Load Code and Connect
To set things up, download the code from GitHub and transfer it to the ESP32 using the Arduino IDE. More explicit instructions for this process are found here.
You’ll need to add the capability to work with ESP32 boards on the Arduino IDE by bringing up Preferences, and inputting “https://dl.espressif.com/dl/package_esp32_index.json” into the Additional Boards Manager URLs section.
With that done, select your dev board (Adafruit ESP32 Feather or FireBeetle-ESP32 in this case), along with the proper serial port, and load code onto your ESP.
Video Display
Connect the GND pin from the Adafruit Huzzah32 board to the outer barrel of the RCA plug.
Then, connect another wire from the A1 DAC1 pin to the central post of the plug to be input into the TV’s composite video input. You can use alligator clips to connect to a standard male-to-male plug, or screw terminal plugs are available that make this much more secure. Presumably, you could also hack up an RCA cable to expose the wiring.
Insert the RCA jack into the TV/monitor, connect power to the dev board, and turn the TV to the correct input source.
Voila, you have an onscreen melting-digit Dali clock, which at this point is almost certainly displaying the incorrect time. To rectify this situation, log onto the ESP32-generated “ESP32 Dali Clock” WiFi network via a phone or computer to configure the settings via a browser interface. Once properly set up, it can then be accessed via your home network. Time can be set automatically via NTP/time zone, or you can also input it manually if you so prefer.
Device hookup
The clock can also shift to display the date instead of time. Connect wires to A5 4 and A4 36 on the Huzzah board, and touch both with your finger to activate this function (I didn't try this on the FireBeetle, but it should be possible). It can also be set to change colors throughout the day, which looks like a lot of fun.
Features of the ESP32 Used
Besides a quick processing speed (impressive for desktop not that long ago), this build nicely highlights a few features of the ESP32:
- • WiFi Connectivity – used for web interface and time setting
- • RCA plug
- • I2C/DAC/PLL – facilitates voltage level output and precise timing needed for color composite video
- • Capacitive Touch Sensing – senses wire touches to momentarily change to date display
- • Dual Core Processor – graphics processing and video signal output is handled by one core, while WiFi/web interface, which can interfere with timing, runs on the second core.r
Pushing Boundaries
According to this separate video, which goes over how a setup similar to this build, the ESP32 doesn’t actually list composite video capabilities in its specs. However, the fact that it can do digital-to-analog conversion (DAC) and utilize the I2S protocol makes it very powerful and generalized for retro-futuristic video hacking.
More info on how Marcio was able to upgrade this to color output, taking advantage of the ESP32’s PLL capabilities, is found on this GitHub page.
In my extremely limited sample of one board each, on a single TV, display with the Adafruit Huzzah32 worked quite well. The FireBeetle, with the equivalent output pins sorted, also worked, but has some intermittent sync issues.
Diving into the two boards a bit more: the Huzzah32 uses an ESP32-WROOM-32E WiFi module, while the DFRobot board uses an ESP32-WROOM-32D. While largely equivalent, the -32E has a few improvements under the hood, including how it interacts with the crystal oscillator to dictate CPU timing.
It’s possible that some minor difference in design means that the -32D and -32E display differently on my TV. That said, for the vast majority of cases that aren’t pushing the ESPs' limits in a creative manner, either module should do a given job quite well. However, if you have a production application that needs the full power of the ESP-32, it’s a good reminder to consider just what ESP-32 you’re going to use.