36
Mitch Altman Chief Scientist, Cornfield Electronics, San Francisco, CA USA Author of The Brain Machine in MAKE Magazine #10 Inventor of TV-B-Gone universal remote control email: [email protected] site: www.CornfieldElectronics.com Codebits November 14, 2008 Hacking Cool things With Microcontrollers!

Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

  • Upload
    codebits

  • View
    10.157

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Mitch Altman Chief Scientist, Cornfield Electronics, San Francisco, CA USA Author of The Brain Machine in MAKE Magazine #10 Inventor of TV-B-Gone universal remote control

email: [email protected] site: www.CornfieldElectronics.com

Codebits November 14, 2008

Hacking Cool things With

Microcontrollers!

Page 2: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

I Love My Job!

Page 3: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Why make cool things with Microcontrollers?

Page 4: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

And anyone can learn…

Microcontrollers are fun to play with

Why make cool things with Microcontrollers?

Page 5: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Examples of Cool Microcontroller Projects (in my opinion)

TV-B-Gone TV-B-Gone Pro

TV-B-Gone Kit

Page 6: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Examples of Cool Microcontroller Projects (in my opinion)

MiniPOV3 kit

The Brain Machine

Trippy RGB Light LED Cube

Solar BugBot

Page 7: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Examples of Cool Microcontroller Projects (in my opinion)

Mignonnette Game kit

Page 8: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Examples of Cool Microcontroller Projects (in my opinion)

Trippy RGB Waves kit

Page 9: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

What is a Microcontroller?

Page 10: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

What is a Microcontroller?

A complete computer on a chip (with a little extra stuff)

Processor Program Memory

RAM

Input/Output

Timers

Inputs

Outputs

Page 11: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

What Does a Microcontroller Do?

Like all computers:

Fetch Instruction

Execute Instruction

Repeat forever (till power goes off)

Page 12: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

How to Make Cool Things with Microcontrollers

•  Idea

•  Hardware

•  Firmware

•  Coolness!

Page 13: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hello World

Make an LED blink

Page 14: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hello World – Hardware Battery +

Battery -

Battery - Resistor LED Microcontroller

Page 15: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hello World – Digression:

(Very) Basic Electronics Lesson

Electronics: electrons flowing through wires and parts (sorta like water flowing through pipes)

Current -- speed of electrons flowing

Battery -- like a pump pushing electrons

Resistor -- like a kink in a pipe, slows down electrons

Diode -- one-way valve for current

LED -- special diode: emit photons when current flows

Transistor -- remotely controlled switch

Microcontroller -- zillions of transistors!

Page 16: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hello World – Firmware

Software: X = 00000001

Firmware: X = 00000001

Assign a value to a variable:

Page 17: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hello World – Firmware

PortA = 00000001

PortA = 00000000

Changing an output pin:

Page 18: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hello World – Firmware

PortA = 00000001

Call Delay

PortA = 00000000

Changing an output pin (using manual delay):

Delay: Count = 0

Wait: Count = Count + 1 If Count < 10,000 goto wait Return

-----------

Page 19: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hello World – Firmware

Main: Call Init

PortA = 00000001 Call Delay

PortA = 00000000 Sleep

Changing an output pin (using hardware timer):

Delay: Timer0 = 60,000

Wait: If Timer0flag = 0 goto wait Return

-----------

Page 20: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hello World – Firmware

Main: Call Init

PortA = 00000001 Call Delay

PortA = 00000000 Sleep

Changing an output pin (using interrupts):

Delay: Timer0 = 60,000

Wait: If TimeFlag = 0 goto wait Return

-----------

Advanced topic:

ISR: TimeFlag=1

Return

Page 21: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hello World – programming your chip

Use software on your computer Text Editor Compiler Programmer

Specific software Depends on your microcontroller PIC, AVR, etc.

Need hardware programmer (often very cheap)

Page 22: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Real Project: Ladyada’s MiniPOV3

Just like “Hello World”, but 8 LEDs and different timing

Etc…

Page 23: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hacking! :

The easy way to make your cool microcontroller projects

Page 24: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hacking!

TV-B-Gone from MiniPOV3 kit

Page 25: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hacking!

TV-B-Gone Kit from MiniPOV3 hack

Page 26: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hacking!

TV-B-Gone Pro from TV-B-Gone Kit

Page 27: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hacking!

Trippy RGB Light from MiniPOV3 kit

Pulse Width

Modulation (PWM)

. . . . . . 1/2 brightness

. . . . . . 1/4 brightness

. . . . . . min brightness

Page 28: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hacking!

Trippy RGB Waves kit from Trippy RGB Light

IR detector causes interrupt when it sees IR reflecting from your hand

Page 29: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hacking!

Solar BugBot from MiniPOV3 kit

Page 30: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hacking!

LED Cube from MiniPOV3 kit

(First NYC Resistor Project)

Page 31: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Hacking!

Brain Machine from MiniPOV3 kit

Synchronizes your brain to a desired brainwave sequence (and hallucinate along the way!)

WARNING: Blinking lights are not good for people with epilepsy

Page 32: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Brain Machine

Page 33: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

What’s It Like?

Video by Bre P

ettis

Page 34: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Microcontrollers are fun to play with

Come by the Workshop Hardware Hacking Area

And anyone can learn!

Page 35: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Q & A

Page 36: Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to solder)

Mitch Altman Chief Scientist, Cornfield Electronics, San Francisco, CA USA Author of The Brain Machine in MAKE Magazine #10 Inventor of TV-B-Gone universal remote control

email: [email protected] site: www.CornfieldElectronics.com

Codebits November 14, 2008

Hacking Cool things With

Microcontrollers!