element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Members
Members
Member's Forum LED Badge
  • Blog
  • Forum
  • Documents
  • Events
  • Leaderboard
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Members requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 9 replies
  • Subscribers 95 subscribers
  • Views 2609 views
  • Users 3 members are here
  • led badge
Related

LED Badge

shabaz
shabaz 2 days ago

Table of Contents

  • Introduction
  • Using the Windows Application
  • Bluetooth Version
  • Using Python
  • Using Linux and Go
  • What's Inside?

Introduction

I purchased this after seeing that Sean colporteur  had found it useful. I got one for a kid, and the other will get taken apart to see if dynamic data can be sent to it somehow!

The display looks better in real life than this video (more contrasty in real life). The unit has a built-in rechargeable battery, a micro USB connector, and two buttons on the side. One button powers it on/off, and the other button chooses between messages, or with a long-press will change the brightness level.

The display multiplexing is easily visible when moving the display or eyes, but isn't too bad at all when viewing it normally. It is very bright (not tried it in sunlight yet).

As an LED badge, I'd say it is near-perfect. The text is bright and clearly visible from a significant distance (I tested the length of a room, not tried further!). I think in a small-medium lecture hall or classroom setting, one would easily be able to read off the names of attendees. 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

Using the Windows Application

Plugged in, I see a HID-compliant vendor-defined device and USB Input Device (VID 0416 PID 5020) appear in the Device Manager.

It's pretty easy to use! (Instructions below). There is a Windows app. I don't think custom symbols can be uploaded, but there are a few icons that can be used. In the example screenshot below, the configuration is such that the message will scroll onto the blank display starting from the right side moving leftward, and then when the display is blank, then it will scroll again from the right side.

image

USB version instructions:

image

Bluetooth Version

Bluetooth version instructions:

image (Image source: scan of supplied fold-out instructions)

Using Python

There is easy-to-use code to program the device using Python, instead of using the ready-made Windows application.

Here is how to do it:

On a Linux box, type:

mkdir -p ~/development/led-badge
cd ~/development/led-badge
git clone https://github.com/jnweiger/led-name-badge-ls32.git
cd led-name-badge-ls32

As root user (or using sudo) create a file in the folder /etc/udev/rules/d called 99-led-badge-44x11.rules and type the following lines into it and save it:

SUBSYSTEM=="usb",  ATTRS{idVendor}=="0416", ATTRS{idProduct}=="5020", MODE="0666"
KERNEL=="hidraw*", ATTRS{idVendor}=="0416", ATTRS{idProduct}=="5020", MODE="0666"

As root user (or prepend each line with sudo) type:

udevadm control --reload-rules && sudo udevadm trigger
apt-get install libhidapi-hidraw0
ln -s /usr/lib/x86_64-linux-gnu/libhidapi-hidraw.so.0 /usr/local/lib/


As normal user, type:

pip install pyhidapi
pip install pillow

Plus the LED badge USB connection to the Linux box, and type the following to program any message : ) 

python3 led-badge-11x44.py "Boo"

Note: if you get an error such as:

Traceback (most recent call last):
  File "/home/shabaz/development/led-badge/led-name-badge-ls32/led-badge-11x44.py", line 460, in <module>
    dev = pyhidapi.hid_open_path(devinfo[0].path)
  File "/home/shabaz/.local/lib/python3.10/site-packages/pyhidapi/pyhidapi.py", line 471, in hid_open_path
    raise RuntimeError('Could not open device.')
RuntimeError: Could not open device.

then you can check the flags for the USB device by typing:

ls -alg /dev/hidraw0

and you should see something like this:

crw-rw-rw- 1 root 239, 0 Mar 20 16:08 /dev/hidraw0

If you don't see crw-rw-rw- then there is a udev issue, perhaps the file was not correct, or the udevadm command was not run.

Worst case, the (not great) workaround is to do the two pip install commands listed earlier as root user, and then run the program as root user too.

The GitHub page can be read to see how to do more with the code.

Using Linux and Go

(Note: Personally I'd recommend using Python as shown in the section above. I'm leaving the Go information here in case it is useful for anyone, but I later discovered the Python code and from my perspective, currently I prefer using that).

I found some code online, with no instructions, and I couldn't get it to work with Windows 11 (see the comments below for screenshots of what I tried) however it works with Linux. It still needs more work, but the information here should be sufficient to at least get going. I tested this with Ubuntu on Intel, but is should theoretically work on ARM too (e.g. Raspberry Pi):

As root user (or prepend with sudo):

apt-get update
apt-get upgrade
apt-get install usbutils

As a normal user:

mkdir -p ~/development/temp
cd ~/development/temp

As root user:

tar -C /usr/local -xzf go1.20.2.linux-amd64.tar.gz
cd /etc/udev/rules.d

Create a file as root user, called 99-hidraw-permissions.rules and place this line in it:

KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev"


As root user:

chmod 755 99-hidraw-permissions.rules
usermod -a -G plugdev shabaz (replace shabaz with your username!)
udevadm control --reload-rules && udevadm trigger

Next, as normal user, edit the ~/.bashrc file and append the following line:

export PATH=$PATH:/usr/local/go/bin

Exit out of the shell and re-log in, to allow the .bashrc file to be re-read.

As normal user:

mkdir -p ~/development/led-badge/app
cd ~/development/led-badge/app
wget https://go.dev/dl/go1.20.2.linux-amd64.tar.gz
wget https://gist.githubusercontent.com/korc/ab70e5011a0d238cd16bc5fd9846e88d/raw/af645f0192b2f02a3bfb0fc56d3df1af118aa976/led-badge-write.go

go mod init led/led-badge-write
go get github.com/golang/freetype
go get github.com/golang/freetype/truetype
go get github.com/karalabe/hid
go get github.com/jet2/hid
go get golang.org/x/image/font
go get golang.org/x/image/math/fixed

You'll need a font file. I went to a fonts website and downloaded the file there. It is not the best font file for the LED badge, as you'll see in the photo further below, so this is "for further study". If you find a better font file, please share the info!

Unzip the file and place the .ttf file in the ~/development/led-badge/app folder. It will be called unicode_8x12.ttf in this example.

Now you'll need to edit the led-badge-write.go file. 

Change the line containing the text  "github.com/karalabe/hid" (it is about line 28) such that the text github.com/jet2/hid is within the speech-marks instead.

Also, search for the line containing the text ttf (about line 244) and change the filename within the speech-marks to unicode_8x12.ttf instead.

Now, in theory, you should be able to execute the program as a normal user, but it didn't work for me. I get this error:

image

I had to run it as root user for now. If anyone has a working solution, please let me know.

As root user, type:

export PATH=$PATH:/usr/local/go/bin

Then to transfer the text 'hello' to the display, type:

go run . hello

As soon as you type that, you'll see the display go blank and then the text hello will scroll from right to left across the display once. After that, the display can be unplugged from the Linux box and powered on to have the message scroll repeatedly.

There are other configuration commands that are possible, and the .go code would need to be inspected because I have not found any documentation on it.

The poor-quality photo below (I didn't have time to grab a better shot) shows the message scrolling off the display. The 'e' in hello is a completely filled circle, because the .ttf font file wasn't ideal as mentioned, but in principle, it works. A better font file should be selected. 

image

What's Inside?

It is fairly easy to unclip the rear panel, to peek inside (click photo to zoom):

image

The CH546 microcontroller has an 8051-based core.

Thanks for reading!

  • Sign in to reply
  • Cancel

Top Replies

  • beacon_dave
    beacon_dave 2 days ago +3
    It will be interesting to see what you can do with it. Pretty sure Sean will be interested as well Does it have a genuine micro USB port ? Some appear to have FTDI type connections disguised as micro…
  • shabaz
    shabaz 2 days ago in reply to beacon_dave +2
    Nice dash! Apparently the badge contains a ST micro clone chip internally according to Google. Apparently some LED badges contain a ST micro clone chip, although this one doesn't. There's also Go code…
  • beacon_dave
    beacon_dave 1 day ago in reply to shabaz +2
    The rest of the bike the LED dash is located in is not too bad either http://media.greenenvyracing.com/2020/05/Green_Envy_Hero_card_May_2020.pdf Pity that Go doesn't 'just work' straight off with the…
  • beacon_dave
    beacon_dave 2 days ago

    It will be interesting to see what you can do with it. Pretty sure Sean will be interested as well Slight smile

    Does it have a genuine micro USB port ? Some appear to have FTDI type connections disguised as micro USB

    This little LED matrix display runs at Lake Gairdner next week. 

    image

    Dashboard of Eva Håkansson's 'Green Envy' electric motorcycle. A bit of a mixture of display technology going on there Slight smile

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz 2 days ago in reply to beacon_dave

    Nice dash!

    Apparently the badge contains a ST micro clone chip internally according to Google.  Apparently some LED badges contain a ST micro clone chip, although this one doesn't. There's also Go code to program the device.

    I've never used Go before but gave it a shot on Windows; when it is run, some packages need to be installed as shown here:

    image

    However when I run the code:

    image

    I'm pretty sure this is because the USB HID package doesn't seem to work for the latest Windows. I've also tried running as Administrator.

    I'll give it a shot on Linux. If this works, then at least the display can be configured from (say) a Pi without needing to do any reverse-engineering!

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • beacon_dave
    beacon_dave 1 day ago in reply to shabaz

    The rest of the bike the LED dash is located in is not too bad either Slight smile
    http://media.greenenvyracing.com/2020/05/Green_Envy_Hero_card_May_2020.pdf

    Pity that Go doesn't 'just work' straight off with the badge. But I guess we are pretty used to that by now.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz 1 day ago

    I got it functioning on Linux finally, although it could do with some more work, I can't dedicate much time to it currently.

    I've placed the information in the main discussion (it should really be a blog now). Anyway, long story short, any message can be uploaded to the LED badge by typing in Linux:

    go run . mymessage

    There are options to control the text animation but I've done zero exploration there...  I might need to actually learn something about "go" to do more with it, but now is not the time unfortunately.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • beacon_dave
    beacon_dave 1 day ago in reply to shabaz

    Looks like some work has been done in creating a Python-based badge writer here:

    https://pypi.org/project/m1-8-writer/

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz 1 day ago in reply to beacon_dave

    Hi Dave,

    Great find! I'll be a lot more comfortable with that instead of Go!

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz 19 hours ago in reply to beacon_dave

    Unfortunately that code is for a different badge which uses a USB serial connection instead of HID, however I might get one of those badges if I can, to compare them. Maybe it's not worth using the badge I bought, if the other one has just as good a display and is controlled by serial.

    I'm really impressed with the display quality, incidentally. The badge is easily readable across a room, and is extremely bright. 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz 18 hours ago in reply to beacon_dave

    Found some code in Python that works! And is easy to use, the code already has the correct fonts and a load of icons. I've updated the main discussion.

    One annoying thing about this particular LED badge is that after programming, it just displays the message once, and then defaults to a battery charging icon until the badge is unplugged from the computer, at which point it displays the message as expected. So, the other badge type might still be the better option if tethered operation as a display is desired.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • colporteur
    colporteur 6 hours ago

    Man do I love this community! Thanks for the shout-out. To be honest Shabaz is giving me credit for the hint he gave me in my post.  Looking for a small display recommendation . The model railroad users have embraced the display for ease of use. They really like that it comes with an application and they don't have listen to me explain Linux command line:)

    Speaking of command line. I see Shabaz has outdone himself again and did a deep dive on the device. Yes I will be dabbling with the python as soon as I get the DFPlayer working. I failed to accurately document the project (thinking it was one of kind) and now I am suffering the pains. Live and learn.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube