Internal Lighting

In this section I'll show several different ways to place and control lights behind the canvas. I'll use the parts shown below as well as some more parts from the nylon screw and standoff kit.

1 x NeoTrellis M4 Mainboard
NeoTrellis M4 Mainboard with 32 NeoPixels in a 4x8 grid
1 x USB cable - 6" A/MicroB
short (6 inch) USB cable

The parts list above includes 2 different USB cables.  I'll first show how to use the short USB cable and some of the nylon screw parts to attach an Adafruit NeoTrellis M4 board directly to the Raspberry Pi.

Later, I'll use the longer USB cable to show how you could instead attach the NeoTrellis M4 to foam board placed behind the canvas.  This configuration will allow for more variability on positioning of the NeoTrellis M4.

From the nylon screw kit, pull out one of the medium size screws, a shorter size standoff and the longest of the straight spacer pieces. Read on to see how these will be attached to the Raspberry Pi.

Here I am screwing the spacer part into the upper left of the 4 nylon screw assemblies holding the Raspberry Pi.

Now screw the standoff on top of the spacer as shown in these pictures.

In these pictures, you can see how I've connected the NeoTrellis M4 to the short USB cable and then plugged that into one of the USB ports in the Raspberry Pi.

At this point, the NeoTrellis M4 is hanging freely, but in the next step I'll show how I oriented it over the Raspberry Pi and then attached it with the nylon screw.

You'll probably need to massage this USB cable a bit to get these parts to hang well together.

Notice in these pictures how I've placed the nylon screw through the hole near the SDA and SCL markings on the board. But if your cable is a little longer or shorter, you may find that another mounting hole works better.

At this point we can boot up the Raspberry Pi system and use the screen utility to connect to the CircuitPython REPL on the NeoTrellis M4.

Usually the first connected CircuitPython device will be represented as /dev/ttyACM0 on the Raspberry Pi, and you can connect and talk to the REPL with this shell command:

screen /dev/ttyACM0

If this REPL connection is working, you should be able to press Enter (or use Control-D to reset the board), and see a >>> prompt allowing Python commands to be entered. If there is a Python program running, you can use Control-C to stop it. To end the screen command session, type Control-A followed by the Kand Y keys.

I used the adafruit_trellism4 library to control the lights on the NeoTrellis M4 through the REPL.  This required copying several libraries from the Adafruit library bundle. I downloaded the library bundle from the CircuitPython site and unzipped it, and from the lib directory in there I copied 3 of the .mpy files to the NeoTrellis M4 drive as shown below:

cp adafruit_trellism4.mpy /media/pi/CIRCUITPY/lib ; sync

cp neopixel.mpy /media/pi/CIRCUITPY/lib ; sync

cp adafruit_matrixkeypad.mpy /media/pi/CIRCUITPY/lib ; sync

... now with that all ready, use screen to connect to the REPL. In the REPL, first do Control-D and then press Enter a few times and look for the >>> prompt.  Then issue these commands:

import adafruit_trellism4

trellis = adafruit_trellism4.TrellisM4Express()


After doing this, my CompuCanvas looks like the picture below.

In the picture here, I have just one of the NeoPixels emitting green light and the rest are off.  To get to this state, I first used this command in the REPL to turn all the NeoPixels off:


Then, I set a single NeoPixel like this:


Note that this NeoTrellis M4 board has 32 NeoPixels in an 8x4 grid. So one corner can be addressed by trellis.pixels[0,0]and the far corner is trellis.pixels[7,3].

To get the picture here, I turned the lower left NeoPixel blue with this command in the REPL:


For this picture, I have illuminated the other 2 corner NeoPixels with the following commands:



I've found that a lot of interesting things happen when the lights are just behind the edges of the other parts. For these pictures, I first cleared all the NeoPixels:


Then I set 4 of them that seem to be aligned just behind the Raspberry Pi with the following:





I like the how the spikey shadows from the expansion pins are visible on the right side of the Raspberry Pi with this illumination pattern.

Ok, now let's try something completely different! What if we move the NeoTrellis M4 off of the Raspberry Pi and instead attach it to the foam board?

Before we get to that, I'll first go over this series of pictures that show how I fine-tuned the foam board to fit with the other parts behind the canvas.

The Ethernet cable is just deep enough that it blocks the foam board from fitting in place. 

The quick and easy solution to this kind of problem is to just cut away a bit of the foam board. The pictures here show how I - with a bit of trial and error - cut enough to allow the foam board to rest squarely against the offset clips attached to the bottom of the canvas.

In these picture,s I'm sizing up how to position the NeoTrellis M4 on the foam board. I used the mechanical pencil to mark spots aligned with 2 of the mounting holes on the NeoTrellis M4. Then I used the awl to cut holes through these marked spots to fit the nylon screws.

From the nylon screw set, pull out 2 of the hex nuts, 2 of the longest screws and 2 of the shorter standoffs. The pictures here show how I attached the standoffs at the points I marked on the foam board in the previous steps.

Note that the last picture shows how the standoffs can end up very close to some of the electronic parts. Be careful not to twist the standoffs too much against these surface mounted parts!

In these pictures I threaded the nylon screws through the holes in the foam board. Then I mounted the NeoTrellis M4 on the foam board as shown.

Now the foam board can be fit into the offset clips behind the canvas. It's a snug fit, but everything has a place.

In these pictures I am testing the look of this new positioning of the NeoTrellis M4. As in the earlier examples above, I am using the screen command to connect to the REPL and issuing commands like shown below to light all the NeoPixels with one color:

import adafruit_trellism4

trellis = adafruit_trellism4.TrellisM4Express()


Here are some more lighting tests with the new NeoTrellis M4 positioning. In this orientation the NeoPixel at coordinate [0,0]is on the lower left, and [7,3]is in the upper right corner.

Continue to the next page to see an alternative approach to placing light behind the canvas.

This guide was first published on Dec 11, 2019. It was last updated on Dec 11, 2019.
This page (Internal Lighting) was last updated on Jan 09, 2020.