For the last few months, I’ve been working freelance on a project called Pixel Mosaic by Michael Black. The goal of the project is to create a wall of light up tiles, which react to human presence. Each tile is to be individually programmed with a unique color sequence created by students. The color sequences are created with the online app, linked above. The goal is to have the tile color change to white when a human presence is detected in front of it. When assembled into a large grid affixed to a wall, the tiles will essentially create a white shadow on a rainbow background of anyone passing by.

The Initial Design

When first presented with the project idea, it looked like this:PixelMosaic First Design

The left shows the desired circuit board layout. It consists of an ATTiny85 (8-pin AVR Microcontroller IC), a single WS2811 RGB LED (addressable color-changing LED), a resistor, and a PCB trace antenna.

The right shows the schematic equivalent of the PCB layout. The idea here was to use the PCB trace as an antenna to sense human presence near the board through capacitance. This sensing would then trigger an interrupt in the microcontroller, changing the color of the LED to white.

Creating the PCB layout in EagleCAD was simple, and complete in a few hours. But when asked by the employer, if it would work as he desired, reasonably, I had to say no. He was hoping to use a PCB trace to reliably sense human presence through capacitance at a minimum of 6 inches from the board. That just isn’t possible with a trace only, as far as I know.

That’s when the real work started.

The Second Design

Since the PCB trace antenna would not work, another sensor was needed. Some of the more common proximity sensors include ultrasonic and infrared. These sensors emit sound and light respectively and measure the time it takes for the signal to reflect off an object, and back into the sensor. These types of sensors are referred to as Time-of-Flight (ToF) sensors. These sensors work for any physical object though, not just people. They are also fairly pricey and large, relatively.

This is where a passive infrared (PIR) sensor comes in. These sensors are designed to detect certain wavelengths of the infrared spectrum. The PIR sensors work by detecting movement in a horizontal plane across the sensors field of view. Containing two pyroelectric sensors, 1 is triggered first, then the other, providing a change in the output signal only when movement is present.

Source: RE200B ManualSource: RE200B Manual

I first tried processing the raw analog data from the PIR sensor with the ATTiny85 directly. Due to the nature of the PIR, the output signal fluctuated minimally in the presence of motion. The voltage of the output signal varied by 0.30 volts at best. This made the detection of motion by the ATTiny85 unreliable at best. In this case, I could only sense motion at a max of about 6 inches.

To process the PIR signal, I used interrupts on the microcontroller. An interrupt is when some external signal affects one of the pins of the microcontroller, and the program sequence is altered based on the interrupt condition. In the case of most digital control circuitry, HIGH and LOW signals are used. These equate to a logic 1 and 0, respectively, or 5 volts and 0 volts, respectively.

I originally focused on using Pin Change Interrupts in the ATTiny85 Microcontroller. These interrupts allow any pin (except VCC and GND) to act as a software interrupt. They can be configured to trigger on a digital rising edge, falling edge, or both. Because I was using the raw analog data from the PIR sensor, I had to process the data stream into digital first.

This brought about the second system design. We considered, for a time, using 2 ATTiny85 processors. The first being specifically for reading the analog value of the PIR and outputting an interrupt signal when motion is detected, essentially converting from Analog to Digital. The second being for controlling the LED based on the interrupt signal from the first chip.

My employer also asked me to create an additional functionality that would allow him to override the color sequence code of the ATTiny85 and input his own Master Control Signal into the LEDs. To do this, I needed 2 signals from an external Master Control board. One to tell the ATTiny85 chips to sleep, and the other to transmit the color sequence data stream. The Enable Signal is detected with a pin change interrupt also.

Here’s the basic layout at this point:

Pixel Mosaic ThomasTesla Mike Thomas System Layout 2

Since the ATTiny85 and Master Control both need to send data to the LEDs, they needed to share the Data_In pin of the LED. This is why I needed to put the ATTiny85 chips to sleep when Master Control takes over; so the color sequence signals wouldn’t be trying to send data to the same place simultaneously.

But putting the chip to sleep wasn’t enough. This is where I learned a cool trick with microcontrollers. I needed the LED Control Signal pin connected to the ATTiny85 to be floating to allow the Master Control Signal to take over the line. Fortunately, this was pretty easy. All I had to do was change the pinMode of the ATTiny85 LED pin from an Output to an Input while the Master Control Signal is active. When a microcontroller pin is set to an output, it holds at some arbitrary voltage level, if not specified . When set as an input, the pin floats, allowing it to be influenced by an outside source.

This design was attractive for a while, until I delved deeper into the ATTiny85 datasheet.

The Third Design

To have some comparison, I ordered a Sparkfun PIR Module to test. This module is an open-collector output, requiring a pull-up resistor on the output signal. This makes the output signal of the module digital, as opposed to the analog of the raw PIR. This made triggering MUCH easier in the ATTiny85. Additionally, the module came with a Fresnel lens installed.

Source: RE200B Manual Source: RE200B Manual

With a Fresnel lens, the wavelengths of heat emitted by the human body are singled out. These wavelengths are in the range of 8 to 14 micrometers in length. When testing, I found the Fresnel lens essential in sensing human presence at longer distances. The increased sensitivity provided by the Fresnel allowed the PIR to sense up to at least 9 feet. It is possible to sense at further distances with these sensors though. It depends mostly on the lens used and the signal processing circuit. I did away with the stock fresnel lens on the Sparkfun PIR module and attached a smaller one sampled from Alibaba. The replacement lens gave similar performance with a smaller footprint, and a narrower detection angle.

It was around this time, I started looking deeper into ATTiny85 interrupt methods. I had originally thought only 1 interrupt was possible, but the datasheet informed me otherwise. While pin change interrupts are available on any pin (except 4/GND and 8/VCC), an interrupt on any of the pins will call the same Interrupt Service Routine (ISR) in the software. An ISR is just a fancy term for a function called by an interrupt specifically. BUT, according to the datasheet, there is an external interrupt available only on pin 7. What’s more, this interrupt calls a separate Interrupt Service Routine. Eureka!

This was huge. Two interrupts in combination with a digital output PIR sensor module meant the entire system could indeed be operated by 1 ATTiny85 microprocessor. This led to the third system layout, below.

Pixel Mosaic ThomasTesla Mike Thomas System Layout 3

Since this is a “sponsored project” as I’ll call it, I am unable and unwilling to post the full schematic. If this were a personal project, it would be no issue, but since it is paid work for a third party, it remains protected intellectual property. If you have specific questions about the circuit, please comment or email me here.

Building the Prototype

When it came time to build the prototype, I decided to build my circuit on top of the Sparkfun PIR sensor module. For this I used standard protoboard, cutting out a hole in the center for the PIR sensor to fit through. I soldered the power and ground headers for the PIR module directly to the prototype board.

Pixel Mosaic Prototype by Mike Thomas of ThomasTesla Top view of my prototype.

From the prototype board, I broke out several signals using jumpers with female connectors. These signals are Vcc (Red), Ground (Black), Master Control Enable (Green), Master Control Data (Blue), and PIR Signal In (Yellow). I didn’t solder the Alarm signal from the Sparkfun PIR Module directly to the input of my prototype because I was still having trouble processing the signal stably and wanted to test it separately.

Pixel Mosaic Prototype by Mike Thomas of ThomasTesla Sparkfun PIR Module side of my prototype.

This is my test rig used to test light diffusion and sensor distance. There is a piece of low-density polyethylene on the front surface of the square. This both diffuses the LED light but allows the passage of IR spectrum light.

Pixel Mosaic ThomasTesla Mike Thomas Cube Rig Test Cube Rig

Here’s a video of what this prototype looks like inside one of the cubes.


The Final PCB

The employer provided the graphic below as a design guide for the PCB layout. At this stage, the circuit changed from a simple control module to a complete development board for the ATTiny85. The 8 pins of the micro-controller are broken out to female headers, and there are now headers for a PIR module and a servo, making the board a lot more versatile. One of the cool things about this board is that multiple can be chained together, passing VCC, Ground, and a color sequence signal through them. This means that when many are chained together, only 1 data signal is needed on the first board, and all boards are controllable! It functions much like the stock Neopixel strip.

Pixel Mosaic Thomas Tesla Mike Thomas PCB CAD Layout Pixel Mosaic PCB CAD Layout, designed by Michael Black

I used the EagleCAD PCB design software to turn that into the circuit board below. These are the samples built to test the functionality before mass producing the boards. Always build samples first. As stated before, I can’t/won’t post the cad layout screenshot as it is IP. Which kinda sucks because it’s wicked cool.

Pixel Mosaic PCB by Mike Thomas of ThomasTesla


And they worked! Not that I was surprised by that…cough…cough. Although, when doing PCB layout, there are a lot of design variables to overlook. There is always the chance that things will not work as they should, or are expected to. The problem source can ranged anywhere from poor design to poor layout to poor manufacture. There are some details here that Michael and I overlooked and didn’t even consider, but would have changed.


Pixel Mosaic Prototype by Mike Thomas of ThomasTeslaPretty cool huh? Those lights are the 5 LEDs being controlled by the micro-controller.



This post is only documenting my contribution to the bigger project Pixel Mosaic. While the circuit boards have been designed, tested, and manufactured, they are currently being programmed and installed into the final fixture by the employer, Michael Black, and his numerous helping hands. I emplore you to follow the Pixel Mosaic Facebook posts to see the culmination. I’ll add a final picture and/or video of the project when it has been completed, which should be this or next week.

Leave comments if you have any questions! Thanks for reading!

Mike Thomas


ATTiny85 Datasheet

RE200B Manual

Adafruit Neopixel Library

WS2812 Datasheet

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: