Round display – the guide

Running a circular display on a Raspberry Pi

This page is the hands on guide for getting the display running, for the background you can find this in the blog post.

This page describes setting up a C library to do low level I/O on a Raspberry Pi and then writing a control application in Python to use the functions. In particular this is for the Round SPI display.

Steps involved:

  • Install BCM low level library
  • Create a custom C library with the functions needed
  • Write a Python control application to use the C library

I will go through the basics first so you can see if it works for you, then will go over the details of the code.

Installing the BCM low level library

Note: You only need this stage if you are planning to (re)compile the custom C Library yourself.

Download the BCM package from here but if you want to find out more about this package, the main page is here. It’s well written and has decent documentation, so if you want to do something new, this is a good place to start.

With the code downloaded as .gz file, extract this to the underlying .tar file (I did this in windows after downloading). The .tar file can then be extracted with:

tar -xf bcm2835-1.68.tar
cd bcm2835-1.68
sudo ./configure
sudo make install

This has the library installed and the relevant header files.

Create a custom C library with the functions needed

Here is where the majority of my time was spent as I had to write and debug the various functions needed. Outcome however are the 3 files:

If you are just going to use the code as it is, then you just need the .h and .so files.

If you want to re-compile and possible edit the code yourself, then get the .c and .h files.

To recompile the line needed is:

gcc -shared -o bcm_direct_c2py.so -fPIC bcm_direct_c2py.c -l bcm2835

This will create you the new .so file.

Write a Python control application to use the C library

For reference I have 2 sample Python applications, one doing a few screen updates and some basic line drawing called test.py and a simple clock.py application. There is also 2 support files a book image for the test.py application and the watch face for the clock.py application.

Before you run this, you will need to connect the Pi to the display, for the code as written, wiring needed is:

Display Connection NameRaspberry Pi pin numberRaspberry Pi pin name
GND25 (original 9)GND
VCC17 (original 1)3.3V
SCL23GPIO 11 / SPIO SCLK
SDA19GPIO 10 / SPIO MOSI
RES22GPIO 25
DC18GPIO 24
CS24GPIO 8 / SPIO CE0
Raspberry Pi to Circular display wiring

Note I have updated the pin numbers above as these new values keep all the wiring in one area of the Pi’s connector, and hence makes for a tidier connection.

Now we can copy these files to the relevant directory on your Pi and run them with:

sudo python3 test.py

or

sudo python3 clock.py

Note you do need to run as root (sudo) as these rely on the low level driver and that doesn’t seem to initialise unless run as root.

That’s it for the basic setup guide.

In depth

Ongoing:

Next steps, adding better line and graphics primitives to the C code and then tidying the code for general use.

Details of my exploration into 2D line drawing can be found here:

As ever, any questions or think of any specific functions that would be helpful then drop me a line or add a comment below and I will try to help.

More Colours

After yesterdays post, I had a bit of feedback asking if there would be other vendors colours (not just the Vallejo Game Colour range). The original post with how I got these charts can be found here. As I was able to get the RGB values from a few other ranges, I have now generated…

Investigations into colour theory and painting

One of my hobbies is miniature painting, it’s something I did a long time ago and found myself getting back into a year or so back. Now I am nowhere near an expert on this, but do like to work on techniques and ideas I see online and on the dreaded Youtube. That’s where I…

Formatting in WordPress

This page is a test, but might help. I originally was using this page to help me to try out new layout styles and techniques. But it ended up having information which might be useful to others, so it’s published rather than being internal only. I would like to use the various plug-ins and in…

ESP8266 – A small WiFi enabled microprocessor

This blog page is a bit of a waffle on how I found out about the ESP8266 and my process for getting it working for me. If you want a technical description on connecting one up and getting code running, then the ESP8266 Getting Started Guide should help. My introduction to ESP8266’s Some time ago,…

Loading…

Something went wrong. Please refresh the page and/or try again.

Get new content delivered directly to your inbox.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: