SlideShare a Scribd company logo
Name: _______________________________ Date: ___________
Build your own ATTiny Light Sculpture!
Part II
Introduction
In our first activity, we only used a single LED. The LED was already on the
programmer. In this activity, we will look at hooking up several LEDs (5 of them) to
our ATTiny85.
LEDs are everywhere! They’re wonderful, amazing, semiconductor devices that emit
light without heating a filament or a gas. It’s a very cool invention that uses the
properties of elements, electrons, and a thing called band gaps. LEDs each come in
a variety of colors -- each one very unique. The LED itself is very, very small. Most of
what you’re looking at is just a piece of plastic.
Notice that one leg of the LED is longer than the other? Make sure you remember
which side is positive and which side is negative.
Code Example
Here is a real quick and simple code example to get you blinking all 5 LEDs. This code
should look familiar to the first example. Here we’re just adding code to control the other 4
pins. (Remember: The code requires special punctuation marks and is case-sensitive.)
void​setup​()
{
//The8-pinATTiny85has5usabledigitaloutputpins0-4
pinMode​(​0​,​OUTPUT​);
pinMode​(​1​,​OUTPUT​);
pinMode​(​2​,​OUTPUT​);
pinMode​(​3​,​OUTPUT​);
pinMode​(​4​,​OUTPUT​);
}
learn.​sparkfun​.com
void​loop​()
{
//SettheLEDpinstoHIGH.TurnsLEDson!
digitalWrite​(​0​,​HIGH​);
digitalWrite​(​1​,​HIGH​);
digitalWrite​(​2​,​HIGH​);
digitalWrite​(​3​,​HIGH​);
digitalWrite​(​4​,​HIGH​);
delay​(​500​); ​ //Waitfor1/2asecond
//SettheLEDpinstoLOW.Thisturnsthemoff
digitalWrite​(​0​,​LOW​);
digitalWrite​(​1​,​LOW​);
digitalWrite​(​2​,​LOW​);
digitalWrite​(​3​,​LOW​);
digitalWrite​(​4​,​LOW​);
delay​(​500​); ​ //Waitfor1/2asecond
}
Plug your ATTiny85 chip into your programmer and click upload to compile and upload this
code. Double check to make sure that you have ​ATTiny85 (1 MHz)​selected under Boards
and that you have the Programmer set to ​USBTinyISP.
If you get any syntax errors, double-check your typing. Once you get a message that says
“Done Uploading” -- let’s look at how we will wire up your circuit.
Solderless BreadBoard
To do our wiring, we are going to use a tool called a ​solderless
breadboard​. Notice how there are a set of repeating rows of 5 holes
on the breadboard? Rather than twisting wires together or soldering
them, we can simply plug wires into these holes to connect them
together.
Each ​row ​of 5 holes is connected internally by a metal clip. Pay
attention to which wires need to connect to which pins / components.
​learn.​sparkfun​.com 2
Wiring Diagram
Use the diagram below to guide you through the wiring. Move the ATTiny85 chip to this
board so that it straddles the center of the breadboard. Any wires that you plug into the right
side will connect to the right side pins and any wires connected to the left side will connect
to the left side pins.
Make sure that if you have two wires you intend on connecting that they are both on the
same row.
The chip needs to be powered. Connect the positive of the battery ​(+)​to the upper right
corner pin of the chip and negative side ​(-)​to the lower left corner.
For each LED, there is a long leg and a short leg. Remember that the short leg should always
connect to ​Ground (-)​. Follow the schematic drawing or the pictorial drawing below for
reference.
If your chip is programmed up, and the wiring is correct, you should see all 5 LEDs blinking
ON and OFF. Do you?
If your circuit didn’t work the first time, what did you have to fix? How did you figure this out?
​learn.​sparkfun​.com 3
Challenge B
1) LED Chaser.​Modify the code so that the LEDs turn on one at a time with at least
1/10 of a second before the next LED turns on.
Now, modify it so that the LEDs also turn off one at a time.
2) Ping Pong.​Write a program so that only a single LED is on at a time. Make it look like
the LED is bouncing back and forth from left to right.
3) Maker’s Choice. ​Design your own pattern and then code it up. Make sure that you
spend time “designing” and not just randomly throwing things together. Draw,
explain, or write-out your design idea here before writing any code.
Be Creative!​Use extension wires to move the LEDs off from the breadboard. Add
glue sticks, plastic cups, construction paper, or any other craft materials to build your
very own light sculpture!
​learn.​sparkfun​.com 4

More Related Content

PPTX
Introduction to arduino
PPT
Legroup Ppt
PPTX
Introduction to Arduino with ArduBlock & SparkFun LilyPad
PDF
Arduino Lecture 1 - Introducing the Arduino
PDF
ATTiny Light Sculpture Project - Part I (Setup)
DOCX
Multiplexing With Arduino and the 74HC595
PPTX
Arduino Workshop (3).pptx
PDF
Up and running with Teensy 3.1
Introduction to arduino
Legroup Ppt
Introduction to Arduino with ArduBlock & SparkFun LilyPad
Arduino Lecture 1 - Introducing the Arduino
ATTiny Light Sculpture Project - Part I (Setup)
Multiplexing With Arduino and the 74HC595
Arduino Workshop (3).pptx
Up and running with Teensy 3.1

Similar to ATTiny Light Sculpture Project - Part II (MultiLEDs) (20)

PPTX
Arduino Projects.pptx
PPTX
Arduino Workshop
PDF
Hardware Hacking and Arduinos
PPTX
Fun with Circuitry and Electronics
PPTX
LED Cube Presentation Slides
PDF
Electronics_Tutorial_2022_Slide543404210s.pdf
PPTX
Smart home arduino
PDF
Making things sense - Day 1 (May 2011)
PDF
L6 Visual Output LED_7SEGMEN_LEDMATRIX upate.pdf
PDF
L6 Visual Output LED_7SEGMEN_LEDMATRIX upate.pdf
PDF
IOT WORKSHEET 1.4.pdf
PDF
How to hack electronics
PPTX
Interfacing of a LED display with laptop using Arduino
PPTX
Arduino slides
PPTX
Arduino Workshop Slides
PDF
NSTA 2013 Denver - ArduBlock and Arduino
PDF
02 Sensors and Actuators Understand .pdf
PPTX
Design Engineering Gtu AEIOU gujarat technology university
PDF
Creativity and Computation Lab Notes - Akshansh Chaudhary
PPTX
Arduino Slides With Neopixels
Arduino Projects.pptx
Arduino Workshop
Hardware Hacking and Arduinos
Fun with Circuitry and Electronics
LED Cube Presentation Slides
Electronics_Tutorial_2022_Slide543404210s.pdf
Smart home arduino
Making things sense - Day 1 (May 2011)
L6 Visual Output LED_7SEGMEN_LEDMATRIX upate.pdf
L6 Visual Output LED_7SEGMEN_LEDMATRIX upate.pdf
IOT WORKSHEET 1.4.pdf
How to hack electronics
Interfacing of a LED display with laptop using Arduino
Arduino slides
Arduino Workshop Slides
NSTA 2013 Denver - ArduBlock and Arduino
02 Sensors and Actuators Understand .pdf
Design Engineering Gtu AEIOU gujarat technology university
Creativity and Computation Lab Notes - Akshansh Chaudhary
Arduino Slides With Neopixels
Ad

More from Brian Huang (7)

DOCX
Setting up the Arduino ATTiny
PDF
Open-Source Hardware, Tinkering, and Physics Education
PDF
Strategies for Educators Using Microcontrollers in the Classroom
PPT
Scratch for Data Logging and Graphing
PPT
Maker Science with Arduino and SparkFun Electronics @NSTA14 Boston
PDF
Pop up paper engineering - cu boulder & centaurus
PDF
T21Con 2013 SparkFun Presentation - Arduino and ArduBlock with Protosnap ProMini
Setting up the Arduino ATTiny
Open-Source Hardware, Tinkering, and Physics Education
Strategies for Educators Using Microcontrollers in the Classroom
Scratch for Data Logging and Graphing
Maker Science with Arduino and SparkFun Electronics @NSTA14 Boston
Pop up paper engineering - cu boulder & centaurus
T21Con 2013 SparkFun Presentation - Arduino and ArduBlock with Protosnap ProMini
Ad

Recently uploaded (20)

PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Hybrid model detection and classification of lung cancer
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Getting started with AI Agents and Multi-Agent Systems
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
project resource management chapter-09.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Web App vs Mobile App What Should You Build First.pdf
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
A comparative study of natural language inference in Swahili using monolingua...
cloud_computing_Infrastucture_as_cloud_p
Hindi spoken digit analysis for native and non-native speakers
Hybrid model detection and classification of lung cancer
1 - Historical Antecedents, Social Consideration.pdf
Getting started with AI Agents and Multi-Agent Systems
Module 1.ppt Iot fundamentals and Architecture
A contest of sentiment analysis: k-nearest neighbor versus neural network
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
OMC Textile Division Presentation 2021.pptx
project resource management chapter-09.pdf
Assigned Numbers - 2025 - Bluetooth® Document
Univ-Connecticut-ChatGPT-Presentaion.pdf
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Developing a website for English-speaking practice to English as a foreign la...
Web App vs Mobile App What Should You Build First.pdf

ATTiny Light Sculpture Project - Part II (MultiLEDs)

  • 1. Name: _______________________________ Date: ___________ Build your own ATTiny Light Sculpture! Part II Introduction In our first activity, we only used a single LED. The LED was already on the programmer. In this activity, we will look at hooking up several LEDs (5 of them) to our ATTiny85. LEDs are everywhere! They’re wonderful, amazing, semiconductor devices that emit light without heating a filament or a gas. It’s a very cool invention that uses the properties of elements, electrons, and a thing called band gaps. LEDs each come in a variety of colors -- each one very unique. The LED itself is very, very small. Most of what you’re looking at is just a piece of plastic. Notice that one leg of the LED is longer than the other? Make sure you remember which side is positive and which side is negative. Code Example Here is a real quick and simple code example to get you blinking all 5 LEDs. This code should look familiar to the first example. Here we’re just adding code to control the other 4 pins. (Remember: The code requires special punctuation marks and is case-sensitive.) void​setup​() { //The8-pinATTiny85has5usabledigitaloutputpins0-4 pinMode​(​0​,​OUTPUT​); pinMode​(​1​,​OUTPUT​); pinMode​(​2​,​OUTPUT​); pinMode​(​3​,​OUTPUT​); pinMode​(​4​,​OUTPUT​); } learn.​sparkfun​.com
  • 2. void​loop​() { //SettheLEDpinstoHIGH.TurnsLEDson! digitalWrite​(​0​,​HIGH​); digitalWrite​(​1​,​HIGH​); digitalWrite​(​2​,​HIGH​); digitalWrite​(​3​,​HIGH​); digitalWrite​(​4​,​HIGH​); delay​(​500​); ​ //Waitfor1/2asecond //SettheLEDpinstoLOW.Thisturnsthemoff digitalWrite​(​0​,​LOW​); digitalWrite​(​1​,​LOW​); digitalWrite​(​2​,​LOW​); digitalWrite​(​3​,​LOW​); digitalWrite​(​4​,​LOW​); delay​(​500​); ​ //Waitfor1/2asecond } Plug your ATTiny85 chip into your programmer and click upload to compile and upload this code. Double check to make sure that you have ​ATTiny85 (1 MHz)​selected under Boards and that you have the Programmer set to ​USBTinyISP. If you get any syntax errors, double-check your typing. Once you get a message that says “Done Uploading” -- let’s look at how we will wire up your circuit. Solderless BreadBoard To do our wiring, we are going to use a tool called a ​solderless breadboard​. Notice how there are a set of repeating rows of 5 holes on the breadboard? Rather than twisting wires together or soldering them, we can simply plug wires into these holes to connect them together. Each ​row ​of 5 holes is connected internally by a metal clip. Pay attention to which wires need to connect to which pins / components. ​learn.​sparkfun​.com 2
  • 3. Wiring Diagram Use the diagram below to guide you through the wiring. Move the ATTiny85 chip to this board so that it straddles the center of the breadboard. Any wires that you plug into the right side will connect to the right side pins and any wires connected to the left side will connect to the left side pins. Make sure that if you have two wires you intend on connecting that they are both on the same row. The chip needs to be powered. Connect the positive of the battery ​(+)​to the upper right corner pin of the chip and negative side ​(-)​to the lower left corner. For each LED, there is a long leg and a short leg. Remember that the short leg should always connect to ​Ground (-)​. Follow the schematic drawing or the pictorial drawing below for reference. If your chip is programmed up, and the wiring is correct, you should see all 5 LEDs blinking ON and OFF. Do you? If your circuit didn’t work the first time, what did you have to fix? How did you figure this out? ​learn.​sparkfun​.com 3
  • 4. Challenge B 1) LED Chaser.​Modify the code so that the LEDs turn on one at a time with at least 1/10 of a second before the next LED turns on. Now, modify it so that the LEDs also turn off one at a time. 2) Ping Pong.​Write a program so that only a single LED is on at a time. Make it look like the LED is bouncing back and forth from left to right. 3) Maker’s Choice. ​Design your own pattern and then code it up. Make sure that you spend time “designing” and not just randomly throwing things together. Draw, explain, or write-out your design idea here before writing any code. Be Creative!​Use extension wires to move the LEDs off from the breadboard. Add glue sticks, plastic cups, construction paper, or any other craft materials to build your very own light sculpture! ​learn.​sparkfun​.com 4