Circuit Analysis

Before you layout a circuit, it's generally a good idea to understand what is happening in your schematic.  And before you lay out a schematic, it's generally a good idea to understand what is happening in your block diagram.

Hard Way Hughes"This book is a bit technical.  If you are a beginner, it's okay that you don't understand everything that follows -- your first project will still be successful.  Try to pick up as much as you can, and ask questions in the forums!"

3. Data Bus Overview

3.2. SPI


The ATMega328 communicates with the display through the SPI bus.

The Serial Peripheral Interface (SPI) is a bi-directional, synchronous data transfer protocol.  This protocol requires at least three data lines, Master In Slave Out (MISO), Master Out Slave In (MOSI), and Clock (CLK).  An optional data line called Slave Select Not ( SS) is used to enable or disable data transmission on one or many integrated circuits.  The overline indicates that the logic for this digital input is inverted:  slave select is active, and a chip is enabled, when the logic is low.  In many designs, this digital input can be tied to the ground net to permanently enable the data bus.

This image shows the Daisy-Chain configuration where data is passed from one microcontroller to the next.  A multiple-slave select option is also available.  Image courtesy

Data that is stored in a linear shift register is moved over bit by bit with each clock cycle.  SPI is a full-duplex protocol -- the sender and receiver can both transfer data at the same time.

Linear Shift Register Example

This animation shows individual bits moving through registers A and B.  Image courtesy

If you were to watch the signals transition on an oscilloscope -- you would see data on both the MOSI and the MISO lines.

SPI Data transaction

SPI Transaction courtesy

To learn more about SPI -- visit

In Our Circuit

Data lines

The Data Lines and LCD Connector on our Badge Design

We obviously have more than three lines connecting our display to our badge.  And Bob is actively working to replace this display with one that has a simpler connector of 6 or 8 pins.

LCD_FONT_nSELECT:  We ordered displays with additional font-chips soldered to the back of them.  This net allows us to enable that font chip by tieing to logic low.  It might not be a bad idea to tie this net to the 3.3V rail through a 10k resistor.  But we left it off for now since the firmware isn't yet configured to work with the font chip.

SPI_MISO: The master-in-slave-out sends information from the LCD display to the microcontroller.  Currently, that's just some diagnostic information.  But it's certainly possible that someone might get the microSD card slot working, and information would transfer from the data card back to the microcontroller along this line.

SPI_MOSI: The master-out-slave-in data line transfers information from the microcontroller to the LCD panel.  This is how we transfer information to the display.

LCD_DC: This pin is used to change the operating mode of the display between data and command.  One mode transfers the text that will appear on the screen, while the other instructs the LCD on how to behave.

SPI_CLK: The SPI_CLK line is cycled with each bit of information transferred.  The signal lets the LCD display know when to sample the data line to look for logic-high or logic-low.

LCD_nCS: The last element of the SPI data bus, the LCD_nCS is equivalent to SS shown above, it's just another style of writing it. Since overlines are not supported in all graphics / texts programs, it's very common to see the letter "n" prefix instead of the overline. "nCS" is equivalent to CS, in this case, CS stands for Chip Select rather than Slave Select.