E-Ink Wireless Badge - feat PiicoDev Transcevier and Badger 2040

The goal for this project was to make an easy-to-use display that doesn’t need power all of the time!

Parts

Instructions

  1. Plug the transceivers into the Pico and Badger boards

  2. Plug both boards into your computer

  3. Set Thonny up, making sure that more than 1 window is enabled (Tools > Options > General > Allow only a single Instance - ensure this is unticked)

  4. Upload the code below:

For the Badger:

# Listen for LED control messages
# Valid messages set the state of the on-board LED

from PiicoDev_Transceiver import PiicoDev_Transceiver
from PiicoDev_Unified import sleep_ms
from machine import Pin

import badger2040

radio = PiicoDev_Transceiver(bus=0,sda=Pin(4),scl=Pin(5),freq=100000)


display = badger2040.Badger2040()
display.led(128)
display.update_speed(badger2040.UPDATE_FAST)

display.font("bitmap8")
display.thickness(1)
display.pen(0)

#name, size, thickness
font = ("sans", 2, 3)

# Font constants
display.font(font[0]) #name
display.thickness(font[2]) #thickness

# Max length should be handled by the sending device
str_lst = ['','','']


def draw_text_handler():
    display.pen(0)
    display.text(str_lst[0], 0, 24, font[1])
    display.text(str_lst[1], 0, 72, font[1])
    display.text(str_lst[2], 0, 108, font[1]/2)
    display.update()

def rcv_str_handle(str_inp):
    if str_inp.find(':') is not -1:
        multi_ln_str = str_inp.split(':')
        for split_line_strs in multi_ln_str:
            str_line_handle(split_line_strs)
    else:
        str_line_handle(str_inp)
        
def str_line_handle(strs):
    global str_lst
    strs = strs.split(',')
    #print(strs)
    str_lst[int(strs[0])] = strs[1]

print('Running')
while True:
    if radio.receive():
        message = radio.message
        # print(message)
        display.pen(15)
        display.clear()
        sleep_ms(1500)
        rcv_str_handle(message)
        draw_text_handler()
        
    sleep_ms(50)

For the Pico

from PiicoDev_Transceiver import PiicoDev_Transceiver
from PiicoDev_Unified import sleep_ms

radio = PiicoDev_Transceiver()

radio.send("0,Wireless:1,Updating:2,Name Badge")
  1. Customise the text you want to display!

The line that you want to update is specified by the number, a comma then the text
Line one and two use a larger font and can display 7ish characters whereas the third uses a smaller font holding around 14

Any questions or queries lemme know!

7 Likes

Hi Liam,

Awesome project! Cheers for sharing. Awesome to see what people are doing with the PiicoDev Transceiver :slight_smile:

3 Likes