SlideShare a Scribd company logo
1 of 4
Download to read offline
Name: _______________________________ Date: ___________
Build your own ATTiny Light Sculpture!
Part I
Introduction
Using a programmable microcontroller, let’s see how you can combine color, shape, form,
and space to create your own works of art!
Traditionally, many have created projects like this using a full-blown Arduino - a
microcontroller capable of handling lots of different inputs or outputs. These are great, but
still somewhat costly (~$20). So instead, we are going to use the ATTiny85, the little sister to
the Arduino Uno.
ATtiny85 vs. Arduino Uno
The ATTiny85 is...well, tiny! It is a single programmable chip
that consists of just 8 pins -- 5 of which are controllable. This
means we can write programs / code that control the
behavior of these pins to turn LEDs ON or OFF, read
sensors, or move motors! What makes it real nice is that it’s
a self contained controller. All we need to do is hook up
power to it.
The Arduino Uno (or the SparkFun RedBoard) uses the ATMega328 microcontroller. This
chip has 32 pins -- 20 of which are controllable! The Arduino Uno also has a lot of extra
supporting hardware on-board including a voltage regulator, oscillator crystal, a
programmer, and a hand-full of other components. While these are nice to have, for most
projects, the ATTiny is perfect!
ATTiny85 Pins
The ATTiny85 has 8 pins in total -- 4 on each side. The pins are designated as
follows. Look at the top of the chip closely. Notice that there is a either a notch
or a small dot near one side? This indicates the “up” direction on the chip.
learn.​sparkfun​.com
For the chip to operate, we need to supply power to it. Connect the positive side of your
power supply to VCC and the negative side to GND. The ATTiny can handle voltages
between 1.8 - 5.5 VDC.
The remaining pins -- labeled 0, 1, 2, 3, & 4 -- are programmable. Using the Arduino
programming environment, we can write code that will control the voltage to these pins. The
last pin, labeled ​Reset​, is for exactly that. When this pin is connected to ground (GND), the
chip resets. For now, we’re just going to leave this one alone.
Let’s get coding!
Open up the Arduino IDE (Integrated
Development Environment). The icon
should looks similar to this symbol here.
Before we write any code, let’s first configure the
programming environment. First, let’s set up the
board type.
Click on the ​Tools Menu → Board → ATtiny85
(internal 1 MHz clock)​.
Next, configure the Programmer. Click on the
Tools Menu → Programmer →
USBtinyISP​. Note: If you are using a
Windows PC, you will need to install a
driver for the programmer. For directions,
visit our hook-up guide at:
http://bit.ly/tinyAVRinstall
Typing in Your First Lines of Code
Carefully, copy this code into your Arduino window. Be very careful with spelling,
capitalization, and punctuation. All characters and punctuation marks are required for this
program to run. Any of the “grey colored” text that is preceded by ​//​can be ignored or left
out.
​learn.​sparkfun​.com 2
Ok, now how do I connect that chip to my computer???
Ah… yes, we will need a programmer to do this. There are a few ways of programming the
ATTiny, but the easiest way is to use the ​Tiny AVR Programming Stick​. Remember that dot
on the chip?
Plug the ATTiny85 chip in so that the dot or
notch lines up with the notch on the stick. You
might need to adjust the legs of the chip so
that it fits.
Now, go ahead and plug it into your computer.
In Arduino, click on the ​Upload
button.
Watch the status messages at the bottom of
the window. It will indicate when it is Done uploading. If you copied the code incorrectly, you
might see error messages. Double-check the code. Remember that spelling, capitalization,
and punctuation must be exactly as it is in the example.
If the code uploads successfully, you should
now see a blinking LED on the corner of the Tiny
Programmer!
OK -- now, let’s look at adapting this and
making our own light patterns!
​learn.​sparkfun​.com 3
Play with Code
Let’s take a more in depth look at the lines of code here. There are two functions that are
required in every Arduino sketch. These are ​voidsetup()​and ​voidloop()​. A function is a
way to group several instructions together. The instructions are grouped together using two
curly braces { }.
void​setup​()
{
pinMode​(​0​,​OUTPUT​);
}
This​first section of the code configures the chip​.​​Any
code that ​is​between the curly braces ​{​​}​after ​void
setup​()​will run exactly one time. The 5 controllable pins
on the ATTiny are all generic -- so, we have to configure
them as either an INPUT or OUTPUT.
voidloop()
{
digitalWrite(0,HIGH);
delay(500);
digitalWrite(0,LOW);
delay(500);
}
The ​voidloop()​function repeats over and over. After
the ​setup()​is run, the four lines of code here repeat
continuously. There are two commands / instructions
here:
digitalWrite(0,HIGH);​sets the voltage on pin 0 to a
HIGH state VCC. ​digitalWrite(0,LOW);​sets the
voltage on pin 0 to a LOW state or 0 Volts.
delay(500);​pauses the program for 500 milliseconds
before going to the next instruction. The ATTiny85
runs at 1 MHz (1 Million instructions per second -- or,
1 µs per instruction).
Challenge A
1) Flash!​Modify the code example so that the LED blinks at a rate of 100 times per
second. What do you see? Is the LED still blinking? Adjust the blink rate until you can
just barely see it blinking. What is time period for the blink?
2) Sweet Heart.​Now, adjust the sequence and timing of the on (HIGH) and off (LOW)
cycle to replicate a heart-beat pattern. (Hint: a heartbeat has two distinct beats).
3) Morse Code Challenge.​Morse code is a method
for transmitting text using a sequence of short (dot)
and long (dash) beeps, blips, or flashes. In the early
1830s, the electric telegraph system was invented.
Morse code was used to transmit text across long
distances.
Encode a short word, your name, or a message.
See if you can communicate a message across the room to another student. In
emergencies, the code SOS is internationally recognized as a distress signal. Hint: Be
sure to have a noticeable pause between letters and between words.
​learn.​sparkfun​.com 4

More Related Content

What's hot

2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshop2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshoptrygvis
 
Arduino comic-latest
Arduino comic-latestArduino comic-latest
Arduino comic-latestjodyhc
 
Getting Started With Arduino How To Build A Twitter Monitoring Alertuino
Getting Started With Arduino   How To Build A Twitter Monitoring AlertuinoGetting Started With Arduino   How To Build A Twitter Monitoring Alertuino
Getting Started With Arduino How To Build A Twitter Monitoring AlertuinoAdrian McEwen
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduinoyeokm1
 
Introduction to arduino!
Introduction to arduino!Introduction to arduino!
Introduction to arduino!Makers of India
 
Introduction to Arduino Programming
Introduction to Arduino ProgrammingIntroduction to Arduino Programming
Introduction to Arduino ProgrammingJames Lewis
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the ArduinoWingston
 
Arduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYArduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYVishnu
 
Arduino slides
Arduino slidesArduino slides
Arduino slidessdcharle
 
IOTC08 The Arduino Platform
IOTC08 The Arduino PlatformIOTC08 The Arduino Platform
IOTC08 The Arduino PlatformEoin Brazil
 
NSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and ArduinoNSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and ArduinoBrian Huang
 
Arduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic ArduinoArduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic ArduinoVishnu
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduinoMakers of India
 
Hello Arduino.
Hello Arduino.Hello Arduino.
Hello Arduino.mkontopo
 
Arduino Intro Guide 2
Arduino Intro Guide 2Arduino Intro Guide 2
Arduino Intro Guide 2elketeaches
 

What's hot (20)

2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshop2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshop
 
Basic Sensors
Basic Sensors Basic Sensors
Basic Sensors
 
Lab2ppt
Lab2pptLab2ppt
Lab2ppt
 
Arduino comic-latest
Arduino comic-latestArduino comic-latest
Arduino comic-latest
 
Getting Started With Arduino How To Build A Twitter Monitoring Alertuino
Getting Started With Arduino   How To Build A Twitter Monitoring AlertuinoGetting Started With Arduino   How To Build A Twitter Monitoring Alertuino
Getting Started With Arduino How To Build A Twitter Monitoring Alertuino
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Introduction to arduino!
Introduction to arduino!Introduction to arduino!
Introduction to arduino!
 
Introduction to Arduino Programming
Introduction to Arduino ProgrammingIntroduction to Arduino Programming
Introduction to Arduino Programming
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
 
Arduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYArduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIY
 
Arduino slides
Arduino slidesArduino slides
Arduino slides
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
IOTC08 The Arduino Platform
IOTC08 The Arduino PlatformIOTC08 The Arduino Platform
IOTC08 The Arduino Platform
 
NSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and ArduinoNSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and Arduino
 
Arduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic ArduinoArduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic Arduino
 
raushan
raushanraushan
raushan
 
Arduino course
Arduino courseArduino course
Arduino course
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduino
 
Hello Arduino.
Hello Arduino.Hello Arduino.
Hello Arduino.
 
Arduino Intro Guide 2
Arduino Intro Guide 2Arduino Intro Guide 2
Arduino Intro Guide 2
 

Similar to Build Your Own Tiny Light Sculpture

Similar to Build Your Own Tiny Light Sculpture (20)

Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
 
Embedded system application
Embedded system applicationEmbedded system application
Embedded system application
 
Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docx
 
Arduino Workshop Slides
Arduino Workshop SlidesArduino Workshop Slides
Arduino Workshop Slides
 
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixels
 
Basics of arduino uno
Basics of arduino unoBasics of arduino uno
Basics of arduino uno
 
Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
 
arduino uno
arduino unoarduino uno
arduino uno
 
Arduino: Arduino starter kit
Arduino: Arduino starter kitArduino: Arduino starter kit
Arduino: Arduino starter kit
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
IoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensorsIoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensors
 
Introduction to Arduino 16822775 (2).ppt
Introduction to Arduino 16822775 (2).pptIntroduction to Arduino 16822775 (2).ppt
Introduction to Arduino 16822775 (2).ppt
 
Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)
 
Ch_2_8,9,10.pptx
Ch_2_8,9,10.pptxCh_2_8,9,10.pptx
Ch_2_8,9,10.pptx
 
Interface stepper motor through Arduino using LABVIEW.
Interface stepper motor through Arduino using LABVIEW.Interface stepper motor through Arduino using LABVIEW.
Interface stepper motor through Arduino using LABVIEW.
 
Arduino Comic-Jody Culkin-2011
Arduino Comic-Jody Culkin-2011Arduino Comic-Jody Culkin-2011
Arduino Comic-Jody Culkin-2011
 
Arduino comic v0004
Arduino comic v0004Arduino comic v0004
Arduino comic v0004
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshop
 
Electronz_Chapter_2.pptx
Electronz_Chapter_2.pptxElectronz_Chapter_2.pptx
Electronz_Chapter_2.pptx
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
 

More from Brian Huang

ATTiny Light Sculpture Project - Part II (MultiLEDs)
ATTiny Light Sculpture Project - Part II (MultiLEDs)ATTiny Light Sculpture Project - Part II (MultiLEDs)
ATTiny Light Sculpture Project - Part II (MultiLEDs)Brian Huang
 
Setting up the Arduino ATTiny
Setting up the Arduino ATTinySetting up the Arduino ATTiny
Setting up the Arduino ATTinyBrian Huang
 
Open-Source Hardware, Tinkering, and Physics Education
Open-Source Hardware, Tinkering, and Physics EducationOpen-Source Hardware, Tinkering, and Physics Education
Open-Source Hardware, Tinkering, and Physics EducationBrian Huang
 
Strategies for Educators Using Microcontrollers in the Classroom
Strategies for Educators Using Microcontrollers in the ClassroomStrategies for Educators Using Microcontrollers in the Classroom
Strategies for Educators Using Microcontrollers in the ClassroomBrian Huang
 
Scratch for Data Logging and Graphing
Scratch for Data Logging and GraphingScratch for Data Logging and Graphing
Scratch for Data Logging and GraphingBrian Huang
 
Maker Science with Arduino and SparkFun Electronics @NSTA14 Boston
Maker Science with Arduino and SparkFun Electronics @NSTA14 BostonMaker Science with Arduino and SparkFun Electronics @NSTA14 Boston
Maker Science with Arduino and SparkFun Electronics @NSTA14 BostonBrian Huang
 
Pop up paper engineering - cu boulder & centaurus
Pop up paper engineering - cu boulder & centaurusPop up paper engineering - cu boulder & centaurus
Pop up paper engineering - cu boulder & centaurusBrian Huang
 
T21Con 2013 SparkFun Presentation - Arduino and ArduBlock with Protosnap ProMini
T21Con 2013 SparkFun Presentation - Arduino and ArduBlock with Protosnap ProMiniT21Con 2013 SparkFun Presentation - Arduino and ArduBlock with Protosnap ProMini
T21Con 2013 SparkFun Presentation - Arduino and ArduBlock with Protosnap ProMiniBrian Huang
 
Introduction to Arduino with ArduBlock & SparkFun LilyPad
Introduction to Arduino with ArduBlock & SparkFun LilyPadIntroduction to Arduino with ArduBlock & SparkFun LilyPad
Introduction to Arduino with ArduBlock & SparkFun LilyPadBrian Huang
 

More from Brian Huang (9)

ATTiny Light Sculpture Project - Part II (MultiLEDs)
ATTiny Light Sculpture Project - Part II (MultiLEDs)ATTiny Light Sculpture Project - Part II (MultiLEDs)
ATTiny Light Sculpture Project - Part II (MultiLEDs)
 
Setting up the Arduino ATTiny
Setting up the Arduino ATTinySetting up the Arduino ATTiny
Setting up the Arduino ATTiny
 
Open-Source Hardware, Tinkering, and Physics Education
Open-Source Hardware, Tinkering, and Physics EducationOpen-Source Hardware, Tinkering, and Physics Education
Open-Source Hardware, Tinkering, and Physics Education
 
Strategies for Educators Using Microcontrollers in the Classroom
Strategies for Educators Using Microcontrollers in the ClassroomStrategies for Educators Using Microcontrollers in the Classroom
Strategies for Educators Using Microcontrollers in the Classroom
 
Scratch for Data Logging and Graphing
Scratch for Data Logging and GraphingScratch for Data Logging and Graphing
Scratch for Data Logging and Graphing
 
Maker Science with Arduino and SparkFun Electronics @NSTA14 Boston
Maker Science with Arduino and SparkFun Electronics @NSTA14 BostonMaker Science with Arduino and SparkFun Electronics @NSTA14 Boston
Maker Science with Arduino and SparkFun Electronics @NSTA14 Boston
 
Pop up paper engineering - cu boulder & centaurus
Pop up paper engineering - cu boulder & centaurusPop up paper engineering - cu boulder & centaurus
Pop up paper engineering - cu boulder & centaurus
 
T21Con 2013 SparkFun Presentation - Arduino and ArduBlock with Protosnap ProMini
T21Con 2013 SparkFun Presentation - Arduino and ArduBlock with Protosnap ProMiniT21Con 2013 SparkFun Presentation - Arduino and ArduBlock with Protosnap ProMini
T21Con 2013 SparkFun Presentation - Arduino and ArduBlock with Protosnap ProMini
 
Introduction to Arduino with ArduBlock & SparkFun LilyPad
Introduction to Arduino with ArduBlock & SparkFun LilyPadIntroduction to Arduino with ArduBlock & SparkFun LilyPad
Introduction to Arduino with ArduBlock & SparkFun LilyPad
 

Recently uploaded

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Recently uploaded (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Build Your Own Tiny Light Sculpture

  • 1. Name: _______________________________ Date: ___________ Build your own ATTiny Light Sculpture! Part I Introduction Using a programmable microcontroller, let’s see how you can combine color, shape, form, and space to create your own works of art! Traditionally, many have created projects like this using a full-blown Arduino - a microcontroller capable of handling lots of different inputs or outputs. These are great, but still somewhat costly (~$20). So instead, we are going to use the ATTiny85, the little sister to the Arduino Uno. ATtiny85 vs. Arduino Uno The ATTiny85 is...well, tiny! It is a single programmable chip that consists of just 8 pins -- 5 of which are controllable. This means we can write programs / code that control the behavior of these pins to turn LEDs ON or OFF, read sensors, or move motors! What makes it real nice is that it’s a self contained controller. All we need to do is hook up power to it. The Arduino Uno (or the SparkFun RedBoard) uses the ATMega328 microcontroller. This chip has 32 pins -- 20 of which are controllable! The Arduino Uno also has a lot of extra supporting hardware on-board including a voltage regulator, oscillator crystal, a programmer, and a hand-full of other components. While these are nice to have, for most projects, the ATTiny is perfect! ATTiny85 Pins The ATTiny85 has 8 pins in total -- 4 on each side. The pins are designated as follows. Look at the top of the chip closely. Notice that there is a either a notch or a small dot near one side? This indicates the “up” direction on the chip. learn.​sparkfun​.com
  • 2. For the chip to operate, we need to supply power to it. Connect the positive side of your power supply to VCC and the negative side to GND. The ATTiny can handle voltages between 1.8 - 5.5 VDC. The remaining pins -- labeled 0, 1, 2, 3, & 4 -- are programmable. Using the Arduino programming environment, we can write code that will control the voltage to these pins. The last pin, labeled ​Reset​, is for exactly that. When this pin is connected to ground (GND), the chip resets. For now, we’re just going to leave this one alone. Let’s get coding! Open up the Arduino IDE (Integrated Development Environment). The icon should looks similar to this symbol here. Before we write any code, let’s first configure the programming environment. First, let’s set up the board type. Click on the ​Tools Menu → Board → ATtiny85 (internal 1 MHz clock)​. Next, configure the Programmer. Click on the Tools Menu → Programmer → USBtinyISP​. Note: If you are using a Windows PC, you will need to install a driver for the programmer. For directions, visit our hook-up guide at: http://bit.ly/tinyAVRinstall Typing in Your First Lines of Code Carefully, copy this code into your Arduino window. Be very careful with spelling, capitalization, and punctuation. All characters and punctuation marks are required for this program to run. Any of the “grey colored” text that is preceded by ​//​can be ignored or left out. ​learn.​sparkfun​.com 2
  • 3. Ok, now how do I connect that chip to my computer??? Ah… yes, we will need a programmer to do this. There are a few ways of programming the ATTiny, but the easiest way is to use the ​Tiny AVR Programming Stick​. Remember that dot on the chip? Plug the ATTiny85 chip in so that the dot or notch lines up with the notch on the stick. You might need to adjust the legs of the chip so that it fits. Now, go ahead and plug it into your computer. In Arduino, click on the ​Upload button. Watch the status messages at the bottom of the window. It will indicate when it is Done uploading. If you copied the code incorrectly, you might see error messages. Double-check the code. Remember that spelling, capitalization, and punctuation must be exactly as it is in the example. If the code uploads successfully, you should now see a blinking LED on the corner of the Tiny Programmer! OK -- now, let’s look at adapting this and making our own light patterns! ​learn.​sparkfun​.com 3
  • 4. Play with Code Let’s take a more in depth look at the lines of code here. There are two functions that are required in every Arduino sketch. These are ​voidsetup()​and ​voidloop()​. A function is a way to group several instructions together. The instructions are grouped together using two curly braces { }. void​setup​() { pinMode​(​0​,​OUTPUT​); } This​first section of the code configures the chip​.​​Any code that ​is​between the curly braces ​{​​}​after ​void setup​()​will run exactly one time. The 5 controllable pins on the ATTiny are all generic -- so, we have to configure them as either an INPUT or OUTPUT. voidloop() { digitalWrite(0,HIGH); delay(500); digitalWrite(0,LOW); delay(500); } The ​voidloop()​function repeats over and over. After the ​setup()​is run, the four lines of code here repeat continuously. There are two commands / instructions here: digitalWrite(0,HIGH);​sets the voltage on pin 0 to a HIGH state VCC. ​digitalWrite(0,LOW);​sets the voltage on pin 0 to a LOW state or 0 Volts. delay(500);​pauses the program for 500 milliseconds before going to the next instruction. The ATTiny85 runs at 1 MHz (1 Million instructions per second -- or, 1 µs per instruction). Challenge A 1) Flash!​Modify the code example so that the LED blinks at a rate of 100 times per second. What do you see? Is the LED still blinking? Adjust the blink rate until you can just barely see it blinking. What is time period for the blink? 2) Sweet Heart.​Now, adjust the sequence and timing of the on (HIGH) and off (LOW) cycle to replicate a heart-beat pattern. (Hint: a heartbeat has two distinct beats). 3) Morse Code Challenge.​Morse code is a method for transmitting text using a sequence of short (dot) and long (dash) beeps, blips, or flashes. In the early 1830s, the electric telegraph system was invented. Morse code was used to transmit text across long distances. Encode a short word, your name, or a message. See if you can communicate a message across the room to another student. In emergencies, the code SOS is internationally recognized as a distress signal. Hint: Be sure to have a noticeable pause between letters and between words. ​learn.​sparkfun​.com 4