LilyGO T-Echo Library for Proteus simulation: two T-Echos showing the distance to each other on their e-paper

LilyGO T-Echo Library for Proteus: LoRa e-Paper Simulation

40
700
60
25
60
PCBWay

Hello friends, I hope you all are doing great. Today, I am going to share the LilyGO T-Echo Library for Proteus, so you can run a LoRa, GPS and e-paper simulation of LilyGO's T-Echo. The T-Echo is a pocket-sized handheld with an nRF52840 for Bluetooth, a Semtech SX1262 LoRa radio, an L76K GPS and a 1.54" e-paper screen that keeps its picture without power - a favourite device for off-grid messaging. Our part has its real size and a working e-paper, and it runs your Arduino sketch in Proteus 8.5.

LilyGO T-Echo Library for Proteus simulation: two T-Echos finding each other by LoRa and GPS, the distance on their e-paper
Figure: The LilyGO T-Echo friend finder working in the Proteus simulation.
Updates

LilyGO T-Echo Library for Proteus

Latest version: V1.0 (November 2026, this tutorial)

Helping Tools

For the demo we built a LoRa friend finder with two T-Echos: each one reads its GPS and sends its position by LoRa, and the other one shows on its e-paper how far away its friend is and in which direction - no phone network needed.

NOTICE: Proteus has no nRF52840, SX1262 or e-paper model, so our team has put a lot of effort into building this board ourselves: the e-paper, the LoRa radio, the GPS, the LEDs and the keys are all our own model, and your sketch compiles with our free TEP Boards for Proteus add-on. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below. And if our free libraries help you, you can buy us a coffee. So, let's get started with the LilyGO T-Echo Library for Proteus:

LilyGO T-Echo Library for Proteus simulation: two T-Echos showing the distance to each other on their e-paper
Figure: The LilyGO T-Echo Library for Proteus: two friends, 1.88 km apart.

What is the LilyGO T-Echo?

The T-Echo is LilyGO's compact LoRa device in a white case. Inside are Nordic's nRF52840 (an Arm Cortex-M4F with Bluetooth LE), Semtech's SX1262 LoRa transceiver, a Quectel L76K GPS, a PCF8563 real-time clock and an 850 mAh battery; on the front sits a 1.54" 200 x 200 black and white e-paper. It is very popular as a Meshtastic node and with SoftRF, and LilyGO also sells it for 433 / 470 MHz and 868 / 915 MHz.

The real T-Echo and the library
PartThe real T-EchoIn the library
ProcessornRF52840, Bluetooth LE 5your Arduino sketch, ArduinoBLE
RadioSX1262 LoRa, up to 22 dBmLoRa between TEP boards (SX126x-Arduino)
GPSQuectel L76K on Serial1NMEA on SerialGPS from the GPSLAT / GPSLON properties
Display1.54" 200 x 200 e-paper GDEH0154D67 (SSD1681)GxEPD2_154_D67, full and partial updates
Keys and LEDsRST, the user button, a touch key, a tricolour LEDall of them; the LED lit when LOW
OthersPCF8563 RTC, NFC antenna, 2 MB flash, batterydrawn or not modelled

E-paper in a Few Words

An e-paper (electronic paper) holds tiny charged black and white particles. A voltage moves them, and once moved they stay - so the screen keeps its picture with no power at all and is easy to read in sunlight. The price is speed: a full update takes about two seconds and flashes the screen, and a partial update changes only the pixels that differ in a fraction of a second.

LoRa and GPS Together

LoRa sends small packets a long way on very little power, and a GPS knows where the device is. Together they make the classic off-grid tracker: every device broadcasts its position, and every other one can work out the distance and direction. That is the idea behind Meshtastic's position sharing, and the idea of our demo.

A simulation lets you try the whole thing before two devices are on your desk: the GPS sentences, the LoRa packets and the e-paper drawing. When the sketch works in the Proteus simulation, the real T-Echos only have to confirm it.

Features of the LilyGO T-Echo Library for Proteus

  • The T-Echo at real size: the white case, the e-paper, the LILYGO window, the antenna, RST and the user button on the side, the touch key, the tricolour and charge LEDs and the USB-C, with our small TEP signature.
  • A real e-paper: GxEPD2 draws on the part with full updates (the flashing waveform) and partial updates, BUSY while it works, and the picture stays when the simulation stops.
  • LoRa: SX126x-Arduino packets between all TEP LoRa boards in a design, with RSSI and SNR from the LORADIST property.
  • A GPS: NMEA sentences on Serial1 from the GPSLAT / GPSLON properties - a moving position too.
  • A complete package: about 3.5 MB with the part, the add-on and the two-board demo, without the source code of the models.

The T-Echo in Proteus Simulation

LilyGO T-Echo in Proteus simulation: the e-paper, the LILYGO window, the antenna and the keys
Figure: The part as the library draws it, with our small TEP signature.

Search T-ECHO in Pick Devices; the device LILYGO T-ECHO is in TEPTECHO.LIB (Microprocessor ICs, LoRa Boards), with the prefix U. The USB-C opens the serial monitor. The T-Echo has no pins on its case: the e-paper, the radio and the GPS are all inside.

LilyGO T-Echo in the Proteus simulation demo before Run
Figure: U1 in the demo, before Run.

The Lines Inside

The lines in the library (LilyGO's and Meshtastic's numbers)
PartPins (the nRF52840 GPIO numbers)
the e-paperSCK 31, MOSI 29, CS 30, DC 28, RST 2, BUSY 3
the SX1262NSS 24, RESET 25, BUSY 17, DIO1 20
the GPSSerial1 = SerialGPS, RX 41 / TX 40, 9600 baud
the LEDsred 35, green 33, blue 14 - lit when LOW
the keysuser button 42 (LOW when pressed), touch key 11 (HIGH when touched), RST

Download LilyGO T-Echo Library for Proteus

Click the button below to download LilyGO-T-Echo-Library-for-Proteus-v1.0.zip (about 3.5 MB, without the source code of the models):

LilyGO T-Echo Library for Proteus V1.0
  • README.txt: installation, the demo, the lines, the properties, troubleshooting and the limits.
  • Proteus Library Files: TEPTECHO.LIB and the phone and laptop libraries.
  • Proteus Model Files: TEPNET.DLL.
  • Arduino Code: both demo sketches and the TEP Boards for Proteus add-on 1.99.0.
  • Proteus Simulation: the demo project, its two HEX files and a copy of the DLL.

No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.

How to Install LilyGO T-Echo Library for Proteus

  1. Close Proteus and extract the whole zip file, for example to your Desktop.
  2. Copy the files from Proteus Library Files into the LIBRARY folder of Proteus.
  3. Copy TEPNET.DLL from Proteus Model Files into the MODELS folder, replacing an older one.
  4. Delete TEPTECHO.IDX from the LIBRARY folder if it is there.
  5. For your own sketches, copy Arduino Code\TEP Boards for Proteus\hardware into your Arduino sketchbook (Documents\Arduino), install GxEPD2 and Adafruit GFX Library from the Library Manager and restart the Arduino IDE; the board is LilyGO T-Echo (TEP Proteus).
  6. Start Proteus, press P and search for T-ECHO.

Demo: a LoRa Friend Finder in Simulation

Hikers, cyclists and search teams often split up where phones have no signal. With two LoRa devices and GPS each one can still see where the other is - how far away and in which direction - and walk towards it. Our demo does exactly that with two T-Echos.

Open T-Echo-LoRa-Friend-Finder.pdsprj. U1, "ALPHA", runs TEcho_Finder_Alpha.hex; U2, "BRAVO", runs TEcho_Finder_Bravo.hex. Their GPSLAT / GPSLON properties put BRAVO about 1.4 km north and 1.3 km east of ALPHA, and LORADIST is 2 km. There is no wire between them - only LoRa.

LilyGO T-Echo Proteus simulation: the two T-Echos ALPHA and BRAVO on an A4 sheet
Figure: The whole demo: ALPHA and BRAVO.
The friend finder
WhatWhat the T-Echo does
every 10 ssends "A,lat,lon,sats" by LoRa (the two nodes 5 s apart)
a packet from the friendthe distance, the direction, the time since it was heard and the signal on the e-paper
the touch keythe positions page, and back
the user buttonits position at once
the tricolour LEDblue = a packet sent, green = a packet heard
every 8th updatea full update of the e-paper (it flashes) to clear any ghosting

Reading the GPS

The GPS sends NMEA sentences at 9600 baud. gpsLine() takes $GPGGA, the fix sentence: the fix quality, the number of satellites and the position in degrees and minutes. The first fix also sets the time of the first LoRa packet, so the two nodes never transmit at the same moment:

void gpsLine(const char *s) {
  if (strncmp(s, "$GPGGA", 6) && strncmp(s, "$GNGGA", 6)) return;
  const bool fix = field(s, 6).toInt() > 0;
  mySats = field(s, 7).toInt();
  if (!fix) return;
  myLat = nmeaDeg(field(s, 2), field(s, 3));
  myLon = nmeaDeg(field(s, 4), field(s, 5));
  if (!myFix) {
    myFix = true;
    nextSend = millis() + FIRST_SEND_MS;                    // (counted from the fix: the two nodes never send at the same moment)
    Serial.print(F(">> ")); Serial.print(ME_NAME); Serial.print(F(": GPS fix ")); Serial.print(myLat, 5); Serial.print(F(", "));
    Serial.print(myLon, 5); Serial.print(F(", ")); Serial.print(mySats); Serial.println(F(" satellites"));
    needDraw = true;
  }
}

How Far Is the Friend?

distanceM() uses the haversine formula, which measures the distance along the curve of the Earth between two latitudes and longitudes:

float distanceM() {                                         // the haversine formula on a 6371 km Earth
  const float r = 6371000.0, k = PI / 180.0;
  const float dLat = (frLat - myLat) * k, dLon = (frLon - myLon) * k;
  const float a = sin(dLat / 2) * sin(dLat / 2) + cos(myLat * k) * cos(frLat * k) * sin(dLon / 2) * sin(dLon / 2);
  return 2 * r * atan2(sqrt(a), sqrt(1 - a));
}

In Which Direction?

bearingDeg() gives the initial direction from this node to the friend, 0 degrees for north and turning clockwise; compass() turns it into one of the eight compass points:

int bearingDeg() {                                          // the direction to the friend, 0 = north, clockwise
  const float k = PI / 180.0;
  const float y = sin((frLon - myLon) * k) * cos(frLat * k);
  const float x = cos(myLat * k) * sin(frLat * k) - sin(myLat * k) * cos(frLat * k) * cos((frLon - myLon) * k);
  return ((int)(atan2(y, x) / k) + 360) % 360;
}

Sending the Position

The position goes out as a short text packet; the blue LED flashes, and the radio's TxDone callback frees it again:

void sendPosition() {
  if (txBusy || !myFix) return;
  char lat[12], lon[12], msg[40];
  dtostrf(myLat, 0, 5, lat); dtostrf(myLon, 0, 5, lon);
  snprintf(msg, sizeof msg, "%c,%s,%s,%u", ME, lat, lon, mySats);
  txBusy = true;
  Radio.Send((uint8_t *)msg, strlen(msg));
  led(LED_BLUE);
  Serial.print(F(">> ")); Serial.print(ME_NAME); Serial.print(F(": sent ")); Serial.println(msg);
}

A Packet from the Friend

handlePacket() checks that the packet comes from the friend, reads its position, flashes the green LED, works out the distance and asks for a new screen:

void handlePacket() {                                       // "B,31.53300,74.37200,8" from the friend
  rxNew = false;
  if (rxBuf[0] != FRIEND || rxBuf[1] != ',') return;
  char *p = rxBuf + 2;
  frLat = atof(p); p = strchr(p, ','); if (!p) return;
  frLon = atof(++p); p = strchr(p, ','); if (p) frSats = atoi(++p);
  frKnown = true; frHeardAt = millis();
  led(LED_GREEN);
  char d[16]; distanceText(d);
  Serial.print(F("<< ")); Serial.print(ME_NAME); Serial.print(F(": ")); Serial.print(FRIEND_NAME); Serial.print(F(" at ")); Serial.print(d);
  Serial.print(' '); Serial.print(compass(bearingDeg())); Serial.print(F(" (RSSI ")); Serial.print(frRssi); Serial.print(F(", SNR "));
  Serial.print(frSnr); Serial.println(F(")"));
  needDraw = true;
}

Updating the E-paper

GxEPD2 draws the screen in pages of 32 rows, so it needs only 800 bytes of RAM. updateScreen() makes a partial update - no flashing - and a full one every 8th time, which clears the faint traces partial updates leave behind:

void updateScreen() {                                       // a partial update, or a full one every FULL_EVERY
  if (frKnown) { itoa((int)((millis() - frHeardAt) / 1000), shownAge, 10); strcat(shownAge, " s ago"); }
  const bool full = updates % FULL_EVERY == 0;
  if (full) display.setFullWindow(); else display.setPartialWindow(0, 0, 200, 200);
  display.firstPage();
  do { drawScreen(); } while (display.nextPage());
  updates++;
  lastDraw = millis(); needDraw = false;
  Serial.print(F("   ")); Serial.print(ME_NAME); Serial.println(full ? F(": the e-paper - a full update") : F(": the e-paper - a partial update"));
}

The Keys

An e-paper update keeps the sketch busy for a moment, so the keys use interrupts: a press is never lost, and the loop acts on it when it is free:

volatile bool userHit = false, touchHit = false;
void onUser() { userHit = true; }                           // USER: LOW when pressed (a falling edge)
void onTouch() { touchHit = true; }                         // TOUCH: HIGH when touched (a rising edge)

Run the Simulation

Press Run. Both T-Echos start with a full update of the e-paper, get their GPS fix and begin to send. The serial monitors - the same window as our TEP Serial Monitor Advance for Proteus - show both nodes:

T-Echo LoRa Friend Finder - The Engineering Projects: ALPHA
T-Echo LoRa Friend Finder - The Engineering Projects: BRAVO
   ALPHA: the e-paper - a full update
   BRAVO: the e-paper - a full update
>> ALPHA: GPS fix 31.52040, 74.35870, 8 satellites
>> BRAVO: GPS fix 31.53300, 74.37200, 8 satellites
>> ALPHA: sent A,31.52040,74.35870,8
<< BRAVO: ALPHA at 1.88 km SW (RSSI -108, SNR 8)
>> BRAVO: sent B,31.53300,74.37199,8
<< ALPHA: BRAVO at 1.88 km NE (RSSI -108, SNR 8)
LilyGO T-Echo ALPHA serial monitor in the Proteus simulation: the fix and the first packets
Figure: ALPHA's monitor.
LilyGO T-Echo BRAVO serial monitor in the Proteus simulation: ALPHA at 1.88 km SW
Figure: BRAVO's monitor.

Two Friends on the Map

A few seconds later each e-paper shows the other node: 1.88 km, north-east for ALPHA and south-west for BRAVO, with the time since the last packet and its signal:

LilyGO T-Echo ALPHA in the Proteus simulation: BRAVO is 1.88 km NE on the e-paper
Figure: ALPHA: BRAVO is 1.88 km NE.
LilyGO T-Echo BRAVO in the Proteus simulation: ALPHA is 1.88 km SW on the e-paper
Figure: BRAVO: ALPHA is 1.88 km SW.

The Positions Page

Touch ALPHA's touch key: the e-paper changes to both positions, in a partial update without flashing:

LilyGO T-Echo ALPHA in the Proteus simulation: both positions on the e-paper
Figure: ALPHA: the positions page.

Here are both T-Echos while the simulation runs:

The complete LilyGO T-Echo friend finder running in the Proteus simulation workspace
Figure: The complete circuit running in the Proteus workspace.

Send Now

Click BRAVO's user button: it sends its position at once, and ALPHA - back on the finder page with another touch - shows the fresh packet:

LilyGO T-Echo ALPHA in the Proteus simulation: back on the finder page after BRAVO's packet
Figure: ALPHA: the finder page again.
LilyGO T-Echo BRAVO in the Proteus simulation: the finder page after its own packet
Figure: BRAVO after its user button.

A Full Update

After seven partial updates the next one is full: the screen flashes black and white once and comes back perfectly clean:

LilyGO T-Echo ALPHA in the Proteus simulation: the e-paper after a full update
Figure: ALPHA after a full update.
>> ALPHA: TOUCH - the positions page
   ALPHA: the e-paper - a partial update
>> BRAVO: USER - the position now
>> BRAVO: sent B,31.53300,74.37199,8
<< ALPHA: BRAVO at 1.88 km NE (RSSI -108, SNR 8)
>> ALPHA: TOUCH - the finder page
   ALPHA: the e-paper - a partial update
<< ALPHA: BRAVO at 1.88 km NE (RSSI -108, SNR 8)
   ALPHA: the e-paper - a full update
LilyGO T-Echo ALPHA serial monitor in the Proteus simulation: the whole run
Figure: ALPHA's monitor after the run.
LilyGO T-Echo BRAVO serial monitor in the Proteus simulation: the whole run
Figure: BRAVO's monitor after the run.

Why Partial and Full Updates?

A partial update drives only the pixels that change, so it is fast and calm - perfect for a number that changes every few seconds. Each one leaves a very faint trace of the old pixels, called ghosting; after many of them a full update, which drives every pixel through black and white, cleans the screen. The model shows both, including the slow build-up of ghosting if you never make a full update.

Ghosting You Can See

Look closely at the positions page above: behind the new text the old finder page is still faintly visible. That is ghosting, exactly as on a real panel after partial updates. It grows a little with every partial update, and the full update the sketch makes every eighth time wipes it away - the picture after the full update is clean again.

NMEA in a Few Words

A GPS module talks in NMEA sentences: lines of text that start with a dollar sign and end with a checksum. $GPGGA carries the time, the latitude and longitude as degrees and minutes with N / S and E / W, the fix quality (0 = no fix), the number of satellites, the precision and the altitude. $GPRMC adds the date, the speed and the heading. The sketch only needs GGA, so it skips every other sentence.

The Tricolour LED

The T-Echo's tricolour LED is three LEDs in one package - red, green and blue - each on its own pin and each lit when its pin is LOW. The demo flashes blue for a packet sent and green for a packet heard; red is free for your own alarms, and mixing the pins gives yellow, cyan or white.

The Touch Key

Above the screen the T-Echo has a touch key that works through the case: the pin reads HIGH while a finger is on it. Because it has no moving parts it suits a device that lives in a pocket or a bag. In the simulation you click it on the part, and the sketch catches the rising edge with an interrupt.

Airtime at SF9

The demo uses spreading factor 9 for more range: a position packet of about 22 bytes is on the air for roughly 0.2 s at 125 kHz. With a packet every 10 s each node uses about 2 % of the time - inside the 868 MHz duty-cycle rules only if you send less often, so a real tracker would send every 30 s or only when it moved.

Two Nodes, One Channel

LoRa has no carrier sense in this simple sketch: if both nodes sent at the same moment, both packets would be lost. That is why ALPHA sends 3 s and BRAVO 8 s after their GPS fix - 5 s apart every cycle. Larger groups use random delays or a mesh protocol such as Meshtastic, which waits for a free channel.

The Haversine Formula

On a sphere the shortest way between two points is an arc of a great circle. The haversine formula finds its length from the two latitudes and the difference in longitude, and it stays accurate for short distances like ours, where simpler formulas lose precision. With the Earth's mean radius of 6371 km the error is under half a percent - plenty for walking to a friend.

Battery Life of an E-paper Device

The e-paper draws power only while it updates, and the nRF52840 and the SX1262 can sleep between packets. That is why a T-Echo with its 850 mAh battery can run a mesh node for days. A battery sketch would update the screen only when something changes, put the GPS in standby and keep the radio listening in short windows.

Try It Yourself

  • Draw an arrow on the e-paper that points to the friend.
  • Add a third T-Echo "CHARLIE" and show the nearest friend.
  • Send an SOS with the user button and show it in big letters.
  • Give the GPS a speed and a heading and watch the distance change.

Ideas to Extend the Finder

  • Log the friend's track and show the last few positions.
  • Send only when the position changed by more than 20 m.
  • Show the battery voltage of both nodes.
  • Use Bluetooth LE to send the friend's position to a phone map.

Your Own Sketches

Write the sketch in the Arduino IDE with the board LilyGO T-Echo (TEP Proteus), use Sketch > Export Compiled Binary and set the part's PROGRAM property to the .hex. Give each T-Echo in the design its own sketch and its own GPS position.

Moving to a Real T-Echo

  1. Install the Adafruit nRF52 core and LilyGO's library folder, as LilyGO's T-Echo guide describes.
  2. Keep GxEPD2 with GxEPD2_154_D67 and the same pins; on the real board switch on the peripherals' power (pin 12) first.
  3. Keep the LoRa calls of SX126x-Arduino; fill hw_config with the T-Echo's pins as the demo does.
  4. Read the L76K on Serial1 at 9600 baud.
  5. Always connect the LoRa antenna before sending, and use a frequency that is legal where you are.

The positions, the formulas and the screen stay the same; on the real T-Echo the Adafruit core takes the place of ours.

Properties of the T-Echo

Double-click the T-Echo to change them
PropertyWhat it does
PROGRAMthe sketch: a .hex from TEP Boards for Proteus (the LilyGO T-Echo board)
MONITOR, BAUD, AUTOOPENthe built-in serial monitor: on, its baud rate (115200), open at Run
LORADISTthe distance to the other LoRa boards: 10 m to 20 km (the demo: 2 km)
GPSLAT, GPSLON, GPSALTthe GPS position and altitude
GPSSPEED, GPSHEADING, GPSSATS, GPSFIXa moving GPS, the satellites in use, the seconds to the first fix

Troubleshooting

  • The e-paper stays blank: call display.init() and draw between firstPage() and nextPage(); every page pass must draw the same picture.
  • A busy timeout: BUSY is pin 3 - use GxEPD2_154_D67(30, 28, 2, 3).
  • Nothing arrives by LoRa: the same frequency, spreading factor, bandwidth and coding rate on both nodes; call Radio.Rx(0) after every packet; do not let both nodes send at the same moment.
  • No GPS fix: read SerialGPS at 9600 baud and look for $GPGGA with a fix quality above 0.
  • A number goes wrong above 32767: int is 16 bits in the simulation - use long.

Limitations of the Simulation

  • LoRa is point-to-point between TEP LoRa boards; LoRaWAN, Meshtastic and FSK are not modelled.
  • The RTC, the BME280, NFC, the QSPI flash, the battery and the e-paper's front light are not modelled.
  • Your sketch gets 8 KB of RAM in the simulation, and int is 16 bits there: draw the e-paper in pages.
  • LilyGO and T-Echo are names of LILYGO, nRF52840 of Nordic Semiconductor ASA, SX1262 and LoRa of Semtech and Arduino of Arduino; this library is not made or endorsed by them or by Labcenter.
  • Tested in Proteus 8.5 in November 2026 (the demo as shipped, about 78 s of simulation). Proteus 7 is not supported.

So, that was all about the LilyGO T-Echo Library for Proteus. I hope it helps you try your LoRa, GPS and e-paper ideas in a simulation before the devices are on your desk. If you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!


Comments

0

Join the conversation