nRF52840 Dongle Library for Proteus simulation: the busy light at BUSY, the RGB LED red and the phone connected

nRF52840 Dongle Library for Proteus: Bluetooth LE USB Simulation

3 Views
40
700
60
25
60
PCBWay

Hello friends, I hope you all are doing great. Today, I am going to share the nRF52840 Dongle Library for Proteus, so you can run a Bluetooth LE simulation of Nordic Semiconductor's smallest nRF52840 board: a USB stick about the size of a thumb drive. The nRF52840 inside is an Arm Cortex-M4F with 1 MB of flash, 256 KB of RAM, Bluetooth LE, 802.15.4 for Thread and native USB. With this library the dongle runs your Arduino sketch in Proteus 8.5, lights its green and RGB LEDs, reads its button and talks to a phone over Bluetooth LE.

nRF52840 Dongle Library for Proteus simulation: SW1 steps the RGB LED through the statuses and the phone follows
Figure: The busy light in the Proteus simulation: free, busy, away, do not disturb and off.
Updates

nRF52840 Dongle Library for Proteus

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

Helping Tools

For the demo we built a Bluetooth busy light for an office door. The RGB LED shows FREE, BUSY, AWAY or DO NOT DISTURB, one click on the dongle's button moves to the next status, and a phone shows the status and how long it has lasted.

NOTICE: Proteus has no nRF52840 model, so our team has put a lot of effort into building this board ourselves: the LEDs, the button and Bluetooth LE 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 nRF52840 Dongle Library for Proteus:

nRF52840 Dongle Library for Proteus simulation: the busy light at BUSY, the RGB LED red and the phone connected
Figure: The nRF52840 Dongle Library for Proteus: the busy light at BUSY.

What is the nRF52840 Dongle?

The nRF52840 Dongle (PCA10059) is Nordic Semiconductor's low-cost USB stick for the nRF52840. The PCB itself forms the USB-A plug, so it goes straight into a laptop without a cable. On the board are the nRF52840 with its crystal, a printed antenna at the far end, a green LED (LED0), an RGB LED (LED1), a user button (SW1), a small reset button on the side and castellated pads along the edges, so the stick can also be soldered onto another board.

The real nRF52840 Dongle and the library
PartThe real nRF52840 DongleIn the library
SoCnRF52840: Cortex-M4F, 1 MB flash, 256 KB RAMyour Arduino sketch
RadioBluetooth LE, 802.15.4 (Thread, Zigbee)ArduinoBLE
LED0green, P0.06, active LOWLED0
LED1RGB: red P0.08, green P1.09, blue P0.12, active LOWLEDR, LEDG, LEDB
ButtonsSW1 on P1.06; RESETSW1 (clickable), RESET
USBthe PCB plug, native USB on the chipthe serial monitor

A Development Kit on a USB Stick

Nordic's big nRF52840 DK has a debugger, four buttons, four LEDs and Arduino headers; the dongle keeps only what fits on a stick. There is no debugger on board: the dongle comes with a USB bootloader, and you program it from the PC through its own USB plug. That makes it popular as a cheap second board next to the DK, as a Bluetooth sniffer, as a Thread or Zigbee radio for a gateway, or as the radio of a small product. For the full kit with its header, see our nRF52840 DK Library for Proteus.

One RGB LED, Many Statuses

The RGB LED1 is really three LEDs in one package - red, green and blue - each on its own pin. Turning on two of them mixes a new colour: red and green make yellow, red and blue make purple, all three make white. On the dongle all of them light when the pin is LOW, so digitalWrite(LEDR, LOW) switches the red one on. Our demo uses five combinations for five statuses.

Bluetooth LE in a Few Words

The dongle is a Bluetooth LE peripheral: it advertises its name, a phone - the central - connects, and the dongle offers its data as characteristics grouped in services. Our busy light has three: the status, the seconds it has lasted and the number of changes. With notifications the phone sees every change at once, without asking again and again.

Where Is It Used?

Developers use the dongle as a Bluetooth LE sniffer with Wireshark, as the radio of a Thread border router, as a Zigbee coordinator, as a test central for their own products and as a tiny Bluetooth device in its own right - a presence beacon, a status light or a USB keyboard. Because it is so cheap, many labs keep a drawer of them.

A simulation lets you try the logic before the stick is in your laptop: the statuses, the colours, the button and the phone. When the sketch works in the Proteus simulation, the real dongle only has to confirm it.

Features of the nRF52840 Dongle Library for Proteus

  • The board as it looks: the small blue stick with its USB-A plug, the nRF52840 and its crystal, the printed antenna, LED0, the RGB LED1, SW1, RESET and the edge pads, drawn compact, with our small TEP signature.
  • Your sketch: a .hex for "Nordic nRF52840 Dongle (TEP Proteus)" with LED0, LEDR, LEDG, LEDB and SW1.
  • Animated LEDs: the green LED0 and the RGB LED1 glow in the colour your sketch mixes.
  • A button you click: SW1 works with the mouse while the simulation runs.
  • Bluetooth LE: ArduinoBLE, with our phone as the central.
  • A complete package: about 3.4 MB with the part, the add-on, the phone and the demo, without the source code of the models.

The nRF52840 Dongle in Proteus Simulation

nRF52840 Dongle in Proteus simulation: the USB plug, the nRF52840, LED0, the RGB LED1 and SW1
Figure: The part as the library draws it, with our small TEP signature.

Search NRF52840 in Pick Devices; the device NRF52840 DONGLE is in TEPDONGLE52.LIB (Microprocessor ICs, Bluetooth Boards), with the prefix U. The dongle has no pin header, so there is nothing to wire: drop it on the sheet, set its PROGRAM and press Run. A click on the USB plug opens the serial monitor.

nRF52840 Dongle in the Proteus simulation demo before Run
Figure: U1 in the demo, before Run.

The LEDs and the Button

The pins in the library
NameNumberThe real dongleWhat it does
LED00P0.06the green LED, lit when LOW; LED_BUILTIN
LEDR1P0.08the red part of LED1, lit when LOW
LEDG2P1.09the green part of LED1, lit when LOW
LEDB3P0.12the blue part of LED1, lit when LOW
SW14P1.06the user button, LOW when pressed; BTN_BUILTIN
RESET-P0.18restarts the sketch

The numbers come from Zephyr's board files for the dongle, which list the LEDs and the button. Serial is the USB plug: the dongle's built-in monitor.

Download nRF52840 Dongle Library for Proteus

Click the button below to download nRF52840-Dongle-Library-for-Proteus-v1.0.zip (about 3.4 MB, without the source code of the models):

nRF52840 Dongle Library for Proteus V1.0
  • README.txt: installation, the demo, the pins, the properties, troubleshooting and the limits.
  • Proteus Library Files: TEPDONGLE52.LIB and the phone and laptop (TEPMOBILE.LIB, TEPLAPTOP.LIB).
  • Proteus Model Files: TEPNET.DLL.
  • Arduino Code: the demo sketch and the TEP Boards for Proteus add-on 1.83.0, with ArduinoBLE.
  • Proteus Simulation: the demo project, its HEX file 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 nRF52840 Dongle 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 TEPDONGLE52.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) and restart the Arduino IDE; the board is Nordic nRF52840 Dongle (TEP Proteus).
  6. Start Proteus, press P and search for NRF52840.

Demo: a Bluetooth Busy Light in Simulation

A busy light tells colleagues at a glance whether you can be disturbed. Many are USB devices that sit on the monitor or hang on the door. Ours uses the dongle's RGB LED for the status and its button to change it, and Bluetooth LE lets a phone check the status from anywhere in the room.

Open nRF52840-Dongle-BLE-Busy-Light.pdsprj. U1 runs Dongle_Busy_Light.hex; MOB1 is our Mobile WiFi Monitor, the phone.

nRF52840 Dongle Proteus simulation: the busy light and the phone on an A4 sheet
Figure: The whole demo: the nRF52840 Dongle and the phone.
The statuses
StatusLED1Red, green, blue
FREEgreenoff, on, off
BUSYredon, off, off
AWAYyellowon, on, off
DO NOT DISTURBpurpleon, off, on
OFFdarkoff, off, off

The Status Table

Each status is a name and three flags for the red, green and blue LEDs. Keeping them in one table means a new status is one more line, and the rest of the sketch does not change:

struct Status { const char *name; bool r, g, b; };
const Status STATUSES[] = {{"FREE", 0, 1, 0}, {"BUSY", 1, 0, 0}, {"AWAY", 1, 1, 0}, {"DO NOT DISTURB", 1, 0, 1}, {"OFF", 0, 0, 0}};
const byte N_STATUSES = sizeof(STATUSES) / sizeof(STATUSES[0]);

Mixing the Colour

showStatus() writes the three LEDs. Because they light when LOW, a flag of 1 becomes LOW:

void showStatus() {
  const Status &s = STATUSES[status];
  digitalWrite(LEDR, s.r ? LOW : HIGH);                     // LOW = on
  digitalWrite(LEDG, s.g ? LOW : HIGH);
  digitalWrite(LEDB, s.b ? LOW : HIGH);
}

Changing the Status

setStatus() remembers how long the last status lasted, switches to the new one, updates the three characteristics and prints the change:

void setStatus(byte k) {
  const unsigned long held = (millis() - since) / 1000;
  status = k;
  since = millis();
  changes++;
  showStatus();
  statusChar.writeValue(STATUSES[k].name);
  sinceChar.writeValue(0);
  changesChar.writeValue(changes);
  Serial.print(F(">> ")); Serial.print(STATUSES[k].name); Serial.print(F(" (the last status lasted "));
  Serial.print(held); Serial.println(F(" s)"));
}

The Loop

The loop keeps Bluetooth running, lights LED0 while a phone is connected, steps to the next status on each press of SW1 and sends the seconds of the current status once a second:

void loop() {
  BLE.poll();
  const bool connected = BLE.connected();
  if (connected != wasConnected) {
    wasConnected = connected;
    digitalWrite(LED0, connected ? LOW : HIGH);             // LED0: the phone is connected
    Serial.println(connected ? F("Phone connected") : F("Phone disconnected"));
  }
  const bool now = digitalRead(SW1);
  if (now != lastSw1) {
    lastSw1 = now;
    if (now == LOW) setStatus((status + 1) % N_STATUSES);   // act on the press
  }
  if (millis() >= nextSecond) { nextSecond = millis() + 1000; sinceChar.writeValue((int)((millis() - since) / 1000)); }
}

The Bluetooth Service

Three characteristics carry the status, the seconds and the changes, each with a readable 0x2901 name for the phone:

BLEService lightService("19B10090-E8F2-537E-4F6C-D104768A1214");
BLEStringCharacteristic statusChar("19B10091-E8F2-537E-4F6C-D104768A1214", BLERead | BLENotify, 16);
BLEIntCharacteristic sinceChar("19B10092-E8F2-537E-4F6C-D104768A1214", BLERead | BLENotify);
BLEIntCharacteristic changesChar("19B10093-E8F2-537E-4F6C-D104768A1214", BLERead | BLENotify);

Run the Simulation

Press Run. The serial monitor - the same window as our TEP Serial Monitor Advance for Proteus - shows the name the dongle advertises and the first status, and LED1 turns green:

nRF52840 Dongle Bluetooth Busy Light - The Engineering Projects
Advertising as "Dongle Busy Light"   SW1 = the next status
>> FREE
Phone connected
nRF52840 Dongle serial monitor in the Proteus simulation: advertising, FREE
Figure: The serial monitor at the start.
nRF52840 Dongle in the Proteus simulation: FREE, the RGB LED1 green
Figure: FREE: LED1 green.

Connect the Phone

On the phone open the Bluetooth app and press SCAN; "Dongle Busy Light" appears in the list. Connect to it: the green LED0 lights and the phone shows the status, the seconds and the changes:

Mobile WiFi Monitor in the Proteus simulation: the scan finds Dongle Busy Light
Figure: The phone's scan.
nRF52840 Dongle in the Proteus simulation: the phone connected, LED0 on
Figure: Connected: LED0 lights.
Mobile WiFi Monitor in the Proteus simulation: the busy light FREE
Figure: The phone: FREE.

Busy

Click SW1 on the dongle: BUSY, LED1 turns red, and the phone gets the change at once. Here is the complete circuit while the simulation runs:

nRF52840 Dongle in the Proteus simulation: BUSY, the RGB LED1 red
Figure: BUSY: LED1 red.
The complete nRF52840 Dongle busy light running in the Proteus simulation workspace
Figure: The complete circuit running in the Proteus workspace.
Mobile WiFi Monitor in the Proteus simulation: BUSY, one change
Figure: The phone: BUSY.

Away and Do Not Disturb

Click SW1 again: AWAY, red and green together make yellow. Once more: DO NOT DISTURB, red and blue make purple:

nRF52840 Dongle in the Proteus simulation: AWAY, the RGB LED1 yellow
Figure: AWAY: LED1 yellow.
nRF52840 Dongle in the Proteus simulation: DO NOT DISTURB, the RGB LED1 purple
Figure: DO NOT DISTURB: LED1 purple.
Mobile WiFi Monitor in the Proteus simulation: DO NOT DISTURB, three changes
Figure: The phone: DO NOT DISTURB.

Off

One more click switches the light OFF, and the next one starts again at FREE. Every change is printed with how long the last status lasted:

>> BUSY (the last status lasted 22 s)
>> AWAY (the last status lasted 3 s)
>> DO NOT DISTURB (the last status lasted 1 s)
>> OFF (the last status lasted 3 s)
nRF52840 Dongle serial monitor in the Proteus simulation: the statuses and their times
Figure: The serial monitor after the run.

Why Act on the Press?

The loop compares the button with its last reading and acts only when it changes from HIGH to LOW - the moment of the press. If the sketch acted while the button was LOW, one long press would race through all five statuses. Real buttons also bounce: the contact opens and closes a few times in the first milliseconds. In the simulation the button is clean, but on the real dongle a short delay of 20 to 50 ms after a change, or a check that the reading is stable, keeps one press from counting twice.

Counting Seconds Without delay()

The sketch never calls delay(): Bluetooth needs BLE.poll() often, and a long delay would make the phone wait. Instead it compares millis() with the time of the next update. The same pattern runs any number of jobs side by side - here the button, the Bluetooth connection and the once-a-second counter.

Colours for People

Red, yellow and green are understood by everyone, but about one man in twelve sees red and green poorly. A good status light adds a second clue: a blinking pattern, a different brightness or a short text on the phone. That is why the phone in our demo shows the status as a word, not only as a colour.

Notifications Instead of Polling

The phone could ask the dongle for the status every second, but that wastes radio time and battery. With BLENotify the dongle tells the phone when something changes. The seconds counter sends one small notification a second; the status and the number of changes are sent only when they change.

Softer Colours with analogWrite

digitalWrite() gives each LED only on or off, so LED1 can show seven colours. With analogWrite() on LEDR, LEDG and LEDB every channel gets 256 steps, and LED1 can mix orange, pink or a calm white, or fade slowly between two statuses. Remember that the LEDs light when LOW: analogWrite(LEDR, 0) is full red and 255 is off. The library shows the mixed colour on the drawn LED while the simulation runs.

Why a USB Stick?

A device that lives in a USB port needs no battery and no extra cable: the laptop powers it and talks to it at the same time. That is why the dongle form is popular for status lights, Bluetooth adapters, presentation clickers and test tools. On the real dongle the sketch could also show up as a USB device of its own; in our simulation the USB plug is the serial monitor.

The USB Bootloader

The real dongle has no debugger. Hold the reset button sideways and it starts its bootloader, the red LED pulses, and Nordic's tools load a new program over the USB plug. In our simulation the PROGRAM property takes the place of that: set it to the .hex and press Run. The RESET button on the drawn stick restarts the sketch.

Try It Yourself

  • Blink LED1 slowly at DO NOT DISTURB so it is noticed from far away.
  • Use analogWrite to dim the LEDs at night.
  • Add a long press of SW1 that jumps straight back to FREE.
  • Switch to AWAY by itself when the phone disconnects.

Ideas to Extend the Busy Light

  • Let the phone write the status with a writable characteristic.
  • Add a "back in 10 minutes" status with a countdown.
  • Count how many minutes a day were BUSY.
  • Use several dongles, one per desk, with the same service.

Your Own Sketches

Write the sketch in the Arduino IDE with the board Nordic nRF52840 Dongle (TEP Proteus), use Sketch > Export Compiled Binary and set the part's PROGRAM property to the .hex.

Moving to a Real nRF52840 Dongle

  1. Install Nordic's nRF Connect SDK, or Zephyr with the board nrf52840dongle/nrf52840.
  2. Start from Nordic's Bluetooth peripheral samples and the LED and button samples.
  3. Move the logic of the demo across: the status table, the colours, the button and the service.
  4. Put the dongle in its bootloader with the reset button and program it over USB.
  5. Test with a phone app such as nRF Connect for Mobile.

The statuses, the colours and the Bluetooth service stay the same; on the real dongle Nordic's SDK takes the place of the Arduino calls. For a kit with more LEDs, four buttons and an Arduino header, see our nRF52833 DK Library for Proteus.

Things to Know Before Using a Real nRF52840 Dongle

  • No debugger: programs go in through the USB bootloader; a mistake in the USB code can need the reset button.
  • 3.3 V or lower: the edge pads run at the chip's voltage; 5 V signals need a level shifter.
  • Power: the dongle runs from the USB plug, or from a supply on its edge pads when it is soldered onto a board.
  • Thread and Zigbee: the 802.15.4 radio works with Nordic's SDK, not in the simulation.

Properties of the nRF52840 Dongle

Double-click the dongle to change them
PropertyWhat it does
PROGRAMthe sketch: a .hex from TEP Boards for Proteus (board "Nordic nRF52840 Dongle")
MONITOR, BAUD, AUTOOPENthe built-in serial monitor: on, its baud rate (115200), open at Run

Troubleshooting

  • The phone finds nothing: call BLE.begin(), set a local name and BLE.advertise(); call BLE.poll() in loop().
  • SW1 does nothing: use pinMode(SW1, INPUT_PULLUP) and act when digitalRead() is LOW.
  • The LEDs look inverted: they light when the pin is LOW, as on the real dongle.
  • A colour looks wrong: yellow is red plus green, purple is red plus blue.
  • A number goes wrong above 32767: int is 16 bits in the simulation - use long.

Limitations of the Simulation

  • Bluetooth LE: the dongle is a peripheral only, with one phone as the central.
  • The edge pads, 802.15.4 / Thread, USB device classes and the bootloader are drawn, not modelled.
  • Your sketch gets 8 KB of RAM in the simulation, and int is 16 bits there.
  • nRF52840 and Nordic Semiconductor are names of Nordic Semiconductor ASA and Arduino of Arduino, and the Bluetooth word mark belongs to Bluetooth SIG; 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 33 s of simulation). Proteus 7 is not supported.

So, that was all about the nRF52840 Dongle Library for Proteus. I hope it helps you try your Bluetooth ideas in a simulation before the stick goes into your laptop - the RGB LED, the button and the phone, all on one sheet. 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