Arduino UNO 开发板是基于 ATmega328 的单片机。(点我查看官方说明

那么我们能否直接使用 ATmega 来驱动 LED 灯闪烁呢?也就是直接做到 Blink 例子中的效果,即灯亮一秒、灭一秒。答案是可以的。

怎么做呢?

首先把 Arduino 与 PC 接好,然后把 Blink 程序下载到 Arduino 中,程序已经烧录进去。我们知道,该例子是让 Arduino 的 D13 号进行高低电平的切换,从而让接到该引脚的 LED 灯闪烁。

知道了这个,接下来我们把 ATmega328 芯片从 Arduino 上拿下,插在面包板上,一会要用。(记得插到中缝处跨过两边,这样才有针脚啊。)

那么下来该接线了,包括电源线和 LED 灯线。接到哪里呢?

我们先看看ATmega328的引脚标注:

AVR ATmega328 引脚标识

上面的图来自于这个文件:AVR ATmega365p 技术手册,点我在线阅读

我们查看这个文件(Arduino 官方给出的 Arduino UNO 板的电路图):http://arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf,在其中找到D13接到了 ATmega328 的哪个引脚上,同样的查看 GND 、电源部分的引脚。记下来。

观察后发现,D13 接到了 PB5 ,GND 是22号引脚。电源正极 VCC 为7号引脚,输入电压为5V,负极为8号引脚( GND 接地)。

看清楚后,我们就可以动手了。

但是 Arduino 要运行必须得有一个最基本的运行环境,需要什么环境呢?我从 http://www.seeedstudio.com/ 找来了这个资料:

(本处引用自:http://www.seeedstudio.com/wish/diy-arduino-parts-kit-p1991

A kit that contains of the basic parts to build a circuit with a pre-programmed Arduino on e.g. breadboards, hole matrix board/printed circuit breadboard

Includes:

1 x DIL ATMega328P-PU with ARDUINO UNO bootloader
1 x DIP 28 pin Socket
2 x 22 pF Ceramic Capacitor
1 x 16 MHz (or 8 MHz )Crystal Low Profile
1 x LM7805 1.5A 5V Regulator or similar (e.g. LM2940 or maybe LM317)
2 x Electrolytic Capacitor 10uF 35V or 50V
1 x 330 Ohm 0.25W Resistor
1 x 10k Ohm 0.25W Resistor
1 x Green or Red Power LED
1 x Reset Switch
1x 2.1mm DC-power jack

And if possible even a printed circuit breadboard (hole matrix or stripes) of according size (e.g. 100x50mm or 70x90mm FR2 or better)

因此,我们需要在面包板上搭建上述最小零件下的电路图。这下的任务就是按照这个说明图和上面的针脚说明图来搭建 Arduino 环境。

在上述引用页面的评论中我们找到了这样一条评论:

hi, thanks for your very kindly suggestion, actually, a kit called “BBAC”is about to release . it was designed by oomlout.com, has a detailed guidance of how to implement a UNO board with a breadboard and some other components. and, as you say, it also has a printed circuit breadboard to show the details.

看到这个评论说 http://www.oomlout.comd 的“BBAC”项目完成了这一工作,里面有具体的细节。我们打开网页,主页中没找到,在其blog中找到了所说的BBAC,里面还有别的最简Arduino环境,很有趣。这是BBAC的链接:http://oomlout.co.uk/collections/arduino/products/breadboard-arduino-compatible-bbac

这里抄上其介绍:

Description

A kit with all the components you need to produce your very own Arduino compatible on a breadboard. Simply place the included layout sheet on the breadboard then follow the fun Lego style assembly instructions in the included printed manual.

Features:

  • Easy to assemble with printed guide and breadboard layout sheet.
  • If you run into any problems we’re only an e-mail away (help@oomlout.com).
  • Fully compatible with the Arduino IDE.

Includes:

  • Printed Colour Assembly Guide
  • Printed Colour Breadboard Layout Sheet (to make component placement easy)
  • 400 Contact Breadboard
  • ATMega328 (with Arduino bootloader preloaded (Uno))
  • 16 MHz Crystal
  • Capacitors (2x100uf, 2x100nf, 2x22pf)
  • Resistors (2x560ohm, 2x10k ohm, 12x 0 ohm)
  • LEDs (Red power, green pin 13)
  • Jumper Wires
  • Pushbutton (for reset)
  • 6 Pin Header (for programming with a USB-Serial adapter)
  • 7805 Voltage Regulator
  • 9v Battery Clip

Resources:

如果你打不开它们的PDF,我提供了PDF文件:

Assembly and Programming Guide (pdf):http://yunpan.cn/Qb6bqCGp2LyH2

Breadboard Layout Sheet (pdf):http://yunpan.cn/Qb6buJ696QFdh

你在这里能看到所有可以DIY的Arduino环境制作信息:http://oomlout.co.uk/collections/arduino/diy

手册里说的很详细,按照其说明图,我们可以搭建出简单的 Arduino 环境。最最基本的配件就如 Seeed 的清单一样,oomlout.com 也给出了其清单,安装方式请参照上面的 pdf 文档。

(本处引用自:http://oomlout.co.uk/collections/arduino/products/arduino-component-bundle-arcb)

Description

Looking to move an Arduino project from the prototyping stage to something a bit more permanent? Here are all the components you need to make your own, Arduino compatible (MCu, crystal, power supply & neccesary passive components).

Includes:

  • ATMega328 (pre-programmed with Arduino bootloader (Uno)) (x1)
  • IC Socket (28 Pin) (x1)
  • Crystal (16 MHz) (x1)
  • Voltage Regulator (5 Volt 7805) (x1)
  • Pushbutton (x1)
  • LEDs (5mm Green)(x1) (5mm Red)(x1)
  • Resistors (10k Ohm) (x2) (560 Ohm) (x2)
  • Capacitors (100 nf) (x2) (100 uf) (x2) (22pF) (x2)

Resources:

一切都已就绪,Good Luck!

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注