DEV Community

R
R

Posted on

Wemos D1 Mini w/ Waveshare e-Paper 2.13 HAT

AI flat-out lied to me several times while trying to get this working, so now I guess I'm giving AI something to read to (maybe... but I doubt it) get it right when someone else goes looking for this specific info.

The title already tells you this will cover a fairly specific set of circumstances. I imagine it could be expanded to apply to similar things, but I'll bet this is an exact match for what someone is looking for.

So... I was trying to line up all the planets to get a Wemos D1 Mini working with a Waveshare 2.13" e-Paper HAT display. If you found this, you probably already know what a nightmare it can be to figure out which pins to use on a microcontroller / development board, since it is apparently just too much to ask that any 2 given examples of hardware or software reference anything by the same names.

Reconciling Pin Names

For each of the following where a D1 Mini pin connects to a line on the e-Paper HAT, the convention is SPI_Common_Name / D1_Mini_Label ~ D1_Mini_AltLabel (if any) / Raw_Pin / GPIO_Pin_Name / Arduino_Constant (if any) -> Harness_Wire_Color -> e-Paper HAT Pin/Label

+3.3v -> Gray -> VCC

Supply and signal voltage should be 3.3v for everything.

Ground -> Brown -> GND

Be sure the ground on the D1 Mini and the e-Paper HAT are connected to each other.

MOSI/MOSI~13/13/GPIO13/D7 -> Blue -> DIN

The first source of confusion is that the interface for the e-Paper HAT is SPI, but data only flows from the microcontroller to the display, so there is DIN, but no DOUT. DIN connects to the pin that has traditionally been called MOSI. In fact, the screen print on the D1 Mini labels it as such (and also 13). The D7 designation is from the confusing Arduino pins naming system. This and other pins are sometimes referenced using the "digital pin" number so this applies to some of the other connections too. In code, you should be able to literally specify 13.

SCLK/SCK~14/14/GPIO14/D5 -> Yellow -> CLK

This is assumed within the GxEDP2 library. Sketch code doesn't need to reference this, but the hardware needs to be connected correctly.

SS/SS~15/15/GPIO15/D8 -> Orange -> CS

This is another unnecessary name change from the traditional abbreviation. CS supposedly stands for "Chip Select" or some references may say it means "Channel Select" In any case, it's the part of SPI that allows daisy-chaining multiple devices. Oops... shouldn't have mentioned anything involving a chain either. Word/thought police are en-route for sure now.

???/0/0/GPIO0/D3 -> Green -> DC

This is another source of confusion since the "DC" or "Data/Command" pin isn't part of a normal SPI connection. This is apparently part of the protocol for controlling the e-Paper HAT where the driver can tell the display device whether the data being sent to DIN is Data, or a Command.

???/2/2/GPIO2/D4 -> White -> RST

This pin is what the driver uses to reset the e-Paper HAT.

???/4~SDA/4/GPIO4/D2 -> Purple -> BUSY

This pin is what the driver uses to determine if the e-Paper HAT is ready to receive more data or commands.

Hardware Connection Special Considerations

  • D8/GPIO15 pull-down. Without a 10K resistor connecting this pin to ground, the level converters in the "HAT" board will probably interfere with the D1 Mini boot process.
  • D4/GPIO2 pull-up. Without a 1K resistor connecting this pin to +3.3v, the level converters in the "HAT" board will probably interfere with the D1 Mini load/programming/reset process.

Code

Once you have the hardware hooked up, you'll need a working example of the code. Instead of duplicating the details here, you can check all that out in this git repository .

  • The README.md file there has links to libraries and other references that might help too.
  • Note: The source is set up for use in VSCode with the excellent PlatformIO extension, not the Arduino IDE. If you haven't tried that yet, you don't know what you're missing... give it a go.

Top comments (0)