35
Arduino and Machine Science Development Boards: Programming Microcontrollers- the AtMega 168 and 328 MPSM337 Electronic Projects for Artists FA14

Arduino and Machine Science Development Boards: Programming

  • Upload
    lynga

  • View
    232

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Arduino and Machine Science Development Boards: Programming

Arduino and Machine ScienceDevelopment Boards:

Programming Microcontrollers- the AtMega 168 and 328

MPSM337Electronic Projects for Artists FA14

Page 2: Arduino and Machine Science Development Boards: Programming

The Arduino(or actually, the AtMega Microcontroller)

Page 3: Arduino and Machine Science Development Boards: Programming

Arduino's kind of revolutionary potential:

“ If we take a piece of technology considered, rightly or wrongly,complex, and we make it simple by working not on the technology itself

but on the experience that comes from using it, then everything getssimpler and we discover new possibilities that were not there before.

“If I were a chicken farmer, I could think of an idea to increase theefficiency or the safety of my farm. With Arduino, even those -who knowabout chickens but not about electronics and programming- are able to

achieve, by themselves and in a very short time, the kludge they need tosolve their practical problem.

All this is about moving technology towards what we might call a domainexpert. In the end, the one who raises chickens is certainly much more

expert about chickens than an engineer.”

- Massimo Banzi

Page 4: Arduino and Machine Science Development Boards: Programming

Photo: Randi Silberman Klett

Five of the core Arduino developer team: David Cuartielles, Gianluca Martino, Tom Igoe, David Mellis and Massimo Banzi.

Page 5: Arduino and Machine Science Development Boards: Programming

What's the difference between a microprocessorand a microcontroller?

Page 6: Arduino and Machine Science Development Boards: Programming

A microprocessor: • an IC with only the Central Processing Unit (CPU) • No RAM, ROM, or peripheral I/O on the chip. (System designers must add these externally to make these function in Desktop PC’s, Laptops, notepads, tablets, etc.• (Manufacturers include: Intel's Pentium, core 2 duo, i3, i5, ARM, PowerPC, AMD, etc. )

A microcontroller: • an IC with CPU, I/O pins, a fixed amount of RAM, ROM, all embedded on a single, 'all in one' chip. • (Manufacturers include: Microchip, ATMEL, TI, Freescale, Philips, Motorola)

Page 7: Arduino and Machine Science Development Boards: Programming

There are many different microcontroller ICs...

Page 8: Arduino and Machine Science Development Boards: Programming

Many are available on handy “development boards”.

Page 9: Arduino and Machine Science Development Boards: Programming

Parallax “Basic Stamp” :

Page 10: Arduino and Machine Science Development Boards: Programming

Arduino boards...

Leah Beuchley

Page 11: Arduino and Machine Science Development Boards: Programming

The UNO for example, uses the ATmega 328:

• 28 pin, 8 bit IC

• Runs at 16 MHz (but chip can run at 20 MHz).

• 32K Bytes of flash memory, 2K SRAM

• 20 I/O pins: 14 digital, 6 analog (10 bit ADC)

• regulated at 5 and 3.3 volts

The Arduino is a development platform using microcontrollers from Atmel's ATmega series.

Page 12: Arduino and Machine Science Development Boards: Programming
Page 13: Arduino and Machine Science Development Boards: Programming

• Open Source hardware and software

• Cross platform (Mac, Windows and Linux)

• Support from huge non-condescending community

Over one million Arduinos sold in 7 years.

Some key reasons given for its success:

Page 14: Arduino and Machine Science Development Boards: Programming

Arduino is open source hardware: the Arduino hardware reference designsare distributed under a Creative Commons Attribution Share-Alike 2.5 license,

available on the Arduino Web site.

Layout and production files for some versions are also available.

The source code for the IDE is available and released under the GNU General Public License, version 2.

What is Open Source Hardware?

• License

• Schematics

• PCB layout data

• Bills of Sale (component distributors...)

Page 15: Arduino and Machine Science Development Boards: Programming

– Limor Fried (Lady Ada) AdaFruit Industries

– Hernando Barragán: “Wiring” Arduino Libraries

– Karsten Schmidt “Toxi” Processing libs

– Daniel Shiffman -”Physical Computing” with Tom Igoe @ NYU's ITP

– Leah Beuchley -designed “Lilypad” Arduino

– Dr. Rafael Hernandez pd tutorials “cheetomoskeeto” YouTube channel

Some Heroes in the Creative Free Hard/Software movement:

Limor Fried Photo: Inc com

Page 16: Arduino and Machine Science Development Boards: Programming

Fortunately, popularity invites copying and competition...

Apparition.

Page 17: Arduino and Machine Science Development Boards: Programming

...on the higher end: Odroid-X

$130 – $200.00

• Quad core ARM processor w/ 3D graphics accel.• 1 Gig DDR2 RAM • 50 pin IO pin I/O• SD card storage• Runs Android OS

(or Shivaplug, PandaBoard...)

Page 18: Arduino and Machine Science Development Boards: Programming

...on the lower end: DigiSpark (http://digistump.com):

$8.95

• 8 pin IC• 8K Bytes of flash memory• 6 digital I/O pins• 3 also do PWM, 4 with ADC

Page 19: Arduino and Machine Science Development Boards: Programming

...and head-to-head: BeagleBone Black $45.00

• 1GHz ARM processor w/ 3D graphics accel.• 512 MB DDR3 RAM • 2 x 46 pin header• on Board 2 Gigs of flash storage (exp. W/ SD card)

Page 20: Arduino and Machine Science Development Boards: Programming

The Raspberry Pi

Page 21: Arduino and Machine Science Development Boards: Programming

• price $25-$35 USD

• Broadcom BCM2835 System on a Chip (CPU + GPU)

• 700 MHz ARM11.

• 256 MB RAM (Model A) 512 MB RAM (Model B) -not expandable

• Storage = SD Card “Hard Drive”

• 26 I/O pins total: 3 power supply 3V3 (3.3V) 5V0 (5V) and GND; 6 DNC (Do Not Connect); and 17 GPIO

• HD video (1080p30) plus audio over HDMI

Raspberry Pi specs:

Page 22: Arduino and Machine Science Development Boards: Programming

Flickr.com/Poptech/CC BY SA 2.0

Eben Upton, Executive Director, Paspberry Pi Foundation

Page 23: Arduino and Machine Science Development Boards: Programming

Requirements for the microcontroller:

1. Power- It's an electrical component, so of course you have to give it power. But like many ICs, the voltage used to operate it needs to be controlled relatively precisely.

2. I/O- Input and output, some way to communicate with the chip. This is generally done through some kind of connection to the chip's pins. Breadboards are handy.

3. Programming Interface- Some way to write programs and download them to the chip and run them.

Page 24: Arduino and Machine Science Development Boards: Programming

Requirements for the microcontroller:

1. Power:

There are three commonly used ways for controllingthe voltage supplied to microcontrollers:

I. A voltage regulator

II. A regulated power supply

III. Battery power

Page 25: Arduino and Machine Science Development Boards: Programming

Requirements for the microcontroller:

Voltage regulator

Page 26: Arduino and Machine Science Development Boards: Programming

Requirements for the microcontroller:

Regulated power supply

Page 27: Arduino and Machine Science Development Boards: Programming

Requirements for the microcontroller:

Battery pack

Page 28: Arduino and Machine Science Development Boards: Programming

Requirements for the microcontroller:

2. I/O: I. Limited

II. “shields”

III. Roll your own.

Page 29: Arduino and Machine Science Development Boards: Programming

Requirements for the microcontroller:

3. Programming Interface (computer connection):

Page 30: Arduino and Machine Science Development Boards: Programming

Requirements for the microcontroller:

3. Programming Interface (computer connection):

We will be using the same microcontroller used on the Arduino board, apopular chip made by the Atmel corporation -the “Atmega” 168 or 328.

(These are 28 pin ICs with identical pin designations, but the 328 has morememory.) The hardware interface we'll be using is perhaps the simplest (andcheapest): connecting to it on a standard breadboard.

Page 31: Arduino and Machine Science Development Boards: Programming

Requirements for the microcontroller:

3. Programming Interface (computer connection):

The USB serial communication with the chip is negotiated by an on-boardchip made by a company called FTDI. There are free FTDI drivers that canbe downloaded for almost every computer platform. Once installed, thecomputer will be able to send/receive serial communication via USBconnection to an FTDI chip.

Page 32: Arduino and Machine Science Development Boards: Programming

The Arduino Programming interface (IDE).

Page 33: Arduino and Machine Science Development Boards: Programming

If there is an error in the code (usually something simple likeleaving out a semicolon) the compiler will complain with anerror message and highlight the first line of the problem.

Page 34: Arduino and Machine Science Development Boards: Programming

Once the errors in the code have beencorrected, the compiled, machineexecutable program will download tothe chip and run. If the behavior of theprogram isn't what you want, just goback and edit the code.

… and then you just keep doing thatover and over again until you get whatyou want.

Page 35: Arduino and Machine Science Development Boards: Programming

Let's set things up andhave fun coding!