WIP: DIY nRF82540 NiceRF 868 4.2 Inch ePaper

This is my WIP DIY nRF82540 4.2inch version:

4 Likes

This is howto use PlatformIO to debug your code running on nRF82540 via ST-LINK/V2 (mini)

Connect your ST-LINK/V2 (mini) to the SWDIO pins and fire up (leave this running, to be used by PIO later)

openocd -f interface/stlink.cfg -f target/nrf52.cfg

This is the connection to the PCA10059 Dongle (WaveShare ST-LINK/V2 (mini))

https://www.waveshare.com/wiki/ST-LINK/V2_(mini)

Modify the existing Meshtastic .vscode/launch.json

{
            "type": "platformio-debug",
            "request": "launch",
            "name": "PIO Debug",
            "executable": "/home/user/build/ms/test/Meshtastic-device/.pio/build/pca10059_diy_eink/firmware.elf",
            "projectEnvName": "pca10059_diy_eink",
            "toolchainBinDir": "/home/user/.platformio/packages/toolchain-gccarmnoneeabi/bin",
            "internalConsoleOptions": "openOnSessionStart",
            "preLaunchTask": {
                "type": "PlatformIO",
                "task": "Pre-Debug"
            }

Modify your variant platformio.ini with debug_tool and debug_init changes below

[env:pca10059_diy_eink]
extends = nrf52840_base
board = nordic_pca10059
build_flags = ${nrf52840_base.build_flags} -Ivariants/Dongle_nRF52840-pca10059-v1 -D NORDIC_PCA10059
src_filter = ${nrf52_base.src_filter} +<../variants/Dongle_nRF52840-pca10059-v1>
lib_deps = 
  ${nrf52840_base.lib_deps}
  https://github.com/ZinggJM/GxEPD2.git
debug_tool = custom
debug_init_cmds =
  target extended-remote localhost:3333
  $INIT_BREAK
  monitor reset halt
  $LOAD_CMDS
  monitor init
  monitor reset halt

Open “main.cpp” and press F5 to step into your code

1 Like

This DIY nRF82540 PCA10059 4.2inch NiceRF 868 variant has been merged and I will soon post guides for the Adafruit bootloader flash

1 Like

That’s cool. Any plans for running it on battery?

Yes, ideas and suggestions are welcome, I used parts that I currently have

Since this is a Raspberry Pi HAT
I already use these for such projects (the prices have increased on these if you try and buy them now)

and

For Portability

These Adafruit options listed could work (I am not able to get these easilty)

PowerBoost 1000 Charger - Rechargeable 5V Lipo USB Boost @ 1A - 1000C

PowerBoost 1000 Basic - 5V USB Boost @ 1000mA from 1.8V+]

PowerBoost 500 Basic - 5V USB Boost @ 500mA from 1.8V+

Or by using this cheap TP4056 LiPo board
image

This would be the simplest way to add a battery (currently)

9V battery connected to the OPEN-SMART

image

Ya, wondering how long it would last. I suppose it could last a bit on a larger lithium battery, but the raspberry pi is going to be fairly power-hungry,right? I ask because I’m interested in getting or making a stand-along lorawan communication device (preferably something no bigger than a phone) that’s cheap and pretty rugged, but most lorawan applications are bluetooth-to-phone requiring two devices (and not cheap).

That Waveshare Power Management HAT will shutdown when low battery voltage is detected
Refer to this wiki link below
https://www.waveshare.com/wiki/Power_Management_HAT

How long it will last will depend on your power draw and size of battery backup

I do not have equipment to test power usage other than a Watt Meter at the moment

I used the WaveShare Power Management HAT with my 9.7 inch Serial E-Paper Terminal (got a couple hours usage on Pi3A and Pi Zero)

The nRF82540 is very low power and the e-paper is turned-off after updates so it will depend on actual usage, but you can expect long usage even with a single LiPo

You may DIY a power meter using TI INA226 power monitor IC, as this:
https://uniteng.com/wiki/doku.php?id=esp32:flashdownloader2

2 Likes

Oh coool, thank you for sharing, i just remembered i have a stand-alone USB device

The non-color version

Should be able to use it to make some basic measurements

2 Likes

Here is a reading after 7H 13M 30S

Peak current used at 12V was about 150mA

Another reading

After almost 24 hours

Updating the PCA10059 with Adafruit NRF52 Bootloader

In order to flash Meshtastic we must replace the stock open bootloader with Adafruit NRF52 Bootloader that support UF2.

The module comes without pin headers soldered, so you need either add the SWDIO, SWDCLK, GND and VDD Out pins or 3d print a holder that uses pogo-pins

SWDCLK and SWDIO Pins (these are connected to either J-Link or ST-LINK2)

Connect the J-Link or STLink (Debugger to Dongle)

3.3V - VDD Out
GND - GND
SWDIO - SWDIO
SWDCLK - SWDCLK

Here is a ST-LINK/V2 (mini) Connection

image

3D Clip flash with Pogo Pins

nRF82540 Dongle (User Guide)

https://infocenter.nordicsemi.com/pdf/nRF52840_Dongle_User_Guide_v1.0.pdf

Download a copy of OpenOCD-ESP32 and extract it

Get a copy of the latest PCA100059 bootloader here

https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/download/0.6.3/pca10059_bootloader-0.6.3_s140_6.1.1.hex

Flash ,erase and program the bootloader

Open a terminal and run

Command-line for ST-LINK

sudo ./openocd -f ../share/openocd/scripts/interface/stlink.cfg -f ../share/openocd/scripts/target/nrf52.cfg -c init -c "reset init" -c halt -c "nrf5 mass_erase" -c "program pca10059_bootloader-0.6.3_s140_6.1.1.hex verify" -c reset -c exit

Command-line for J-Link

sudo ./openocd -f ../share/openocd/scripts/interface/jlink.cfg -f ../share/openocd/scripts/target/nrf52.cfg -c init -c "reset init" -c halt -c "nrf5 mass_erase" -c "program pca10059_bootloader-0.6.3_s140_6.1.1.hex verify" -c reset -c exit

Now you can connect the dongle to the USB port to access the UF2 storage volume or program it via the USB CDC port

1 Like

To enable the use of external power source via Open-Smart DC Jack power

I have received rechargeable 9V 800 mAh batteries that I will test soon

This is the current connection diagram

Hi mark,

For the low power screen, I was attracted by this one:

The power consumption is 25uA @3.3V and it is much cheaper than eink.

1 Like

Thank you for sharing, i also saw this other Sharp memory display used here 400x240

There is some driver support

Will look more into these, sourcing and connection might be issue for me

Then actuality using them in Meshtastic is another

1 Like

The 9v batteries i tested only lasted just over 14 hours and stopped working as the voltage dropped down to 6v. 1V over 5V for the 2 stage 5v, 3.3v Open Smart module voltage regulators

Then i used a 3.3v low dropout voltage regulator directly and it also lasted just over 14 hours

So i could not get to use the rated 800mAh life of these batteries (possibly wrongly rated)

Next i will use 2 x LiPo18650 batteries in series

Just waiting for some battery holder’s