JavaScript is required to view this page.
Skip to content
Get 50% OFF 2x Smart Devices with your HA Yellow Kit + CM4
Get 50% OFF 2x Smart Devices with your HA Yellow Kit + CM4
How-To: Outputting Text to VoDisplay via USB

How-To: Outputting Text to VoDisplay via USB

Because the VoDisplay's driver, vodisp, can only display raw bitmap images at present, we cannot simply display text to it. However, with help from the tools we installed in the earlier article about the VoDisplay, we can make it happen. If you haven't already, you should install those tools to be ready for this tutorial.

To display current information on the storage volumes connected to your computer along with the SoC temperature, you can enter the following commands at the command line (this works on Ubuntu on the ODROID-XU4 - it may need modifications to work on other systems). But first, we need to change the permissions on GraphicsMagick so it allows the "label" functionality. Edit the /etc/ImageMagick-6/policy.xml file and add the following line before the </policymap> line:

<policy domain="coder" rights="read|write" pattern="LABEL" />

Save it.

The next 3 lines create a text file which we will convert into an image and display starting at the 4th line. You can create any text file, or use an existing text file instead of performing the next 3 lines. For our example, enter the following lines at the command prompt:

df -h >test.txt

(df -h outputs storage volume information, and this is sent via redirection to the file text.txt)

printf "\nSoC Temp: " >> test.txt

(printf is a command that allows special characters - like \n for newline. The redirection >> means to append to an existing file instead of overwriting it)

sudo echo | cat /sys/devices/virtual/thermal/thermal_zone0/temp >> test.txt

(cat outputs the contents of a file - in this case, it is the value of temperature sensor 0. This completes the portion of this example that creates the text file. The next lines take any text file and convert them into an image suitable for the VoDisplay.)

convert -background black -fill white -font Ubuntu-Mono -size 800x480 label:@test.txt label_file.png

(convert is a part of GraphicsMagick/ImageMagick, which was shown how to be installed in a previous blog post about the VoDisplay - This sets the background color to black and the font color to white, and the font name to "Ubuntu-Mono". It uses the "label" functionality of GraphicsMagick which resizes the text to the specified output size, in this case, 800x480, the resolution of the VoDisplay. It then outputs this as label_file.png.)

gm convert label_file.png -flip -rotate 90 PNG24:label_file.png

(This uses GraphicsMagick to flip and rotate the image and save it as a 24-bit PNG - vodisp doesn't work with 32-bit images which seem to be the default in many cases.)

gm convert label_file.png label_file.bmp

(Convert the PNG file from above into a raw BMP file for vodisp to display)

sudo vodisp bitmap label_file.bmp

(Send the output file to the VoDisplay)

After a few seconds, you should see the text on your VoDisplay!

If you want to experiment with different fonts, use the following command to list the available fonts on your system:

identify -list font | more

Again, identify is a feature of ImageMagick. You should be able to use any font name listed after "Font:" in this output.

If you do something cool with your VoDisplay, let us know about it! We'd love to share it with the community!

In an upcoming article, we will show how to program a real-time graphical system status monitor and display it on the VoDisplay!

Previous article New Shelly Kits

Leave a comment

Comments must be approved before appearing

* Required fields

x