Fab Academy 第十三周:輸出設備

這周學習輸出設備.

課堂筆記

RGB LED

LED 點陣

Charlieplexing

LCD

44780

視頻:arduino-tvout,Thinner-Client

揚聲器

MOSFET 場效應晶體管- The metal–oxide–semiconductor field-effect transistor

  • floating gates
  • gate resistors 門電阻
  • low-pass filters 低通濾波器
  • class D amplifiers

馬達

brush DC motor

brushless DC motor (BLDC)

servo motor

stepper motor: unipolar, bipolar

實踐作業:給微控制器電路板增加輸出元件

電路板設計

用 ERC 和 DRC 工具檢查錯誤。確保沒有錯誤後,導出黑白 png 文件。

電路設計源文件

電路板製作

依舊是用 Roland SMR-20 雕刻電路板。

1/64 刀頭刻線路, 1/32 刀頭切邊緣。

焊元件

然後燒程序

make -f hello.RGB.45.make

sudo make -f hello.RGB.45.make program-usbtiny

avr-objcopy -O ihex hello.RGB.45.out hello.RGB.45.c.hex;n avr-size --mcu=attiny45 --format=avr hello.RGB.45.outnAVR Memory Usagen----------------nDevice: attiny45nnProgram: 338 bytes (8.3% Full)n(.text + .data + .bootloader)nnData: 0 bytes (0.0% Full)n(.data + .bss + .noinit)nnnavrdude -p t45 -P usb -c usbtiny -U flash:w:hello.RGB.45.c.hexnnavrdude: AVR device initialized and ready to accept instructionsnnReading | ################################################## | 100% 0.01snnavrdude: Device signature = 0x1e9206navrdude: NOTE: "flash" memory has been specified, an erase cycle will be performedn To disable this feature, specify the -D option.navrdude: erasing chipnavrdude: reading input file "hello.RGB.45.c.hex"navrdude: input file hello.RGB.45.c.hex auto detected as Intel Hexnavrdude: writing flash (338 bytes):nnWriting | ################################################## | 100% 0.49snnavrdude: 338 bytes of flash writtennavrdude: verifying flash memory against hello.RGB.45.c.hex:navrdude: load data flash data from input file hello.RGB.45.c.hex:navrdude: input file hello.RGB.45.c.hex auto detected as Intel Hexnavrdude: input file hello.RGB.45.c.hex contains 338 bytesnavrdude: reading on-chip flash data:nnReading | ################################################## | 100% 0.72snnavrdude: verifying ...navrdude: 338 bytes of flash verifiednnavrdude: safemode: Fuses OK (H:FF, E:DF, L:62)nnavrdude done. Thank you.n

編程

在 Arduino 裡面寫程序。要先選好 ATtiny 板子,ATtiny45 晶元和 8 MHz internal clock。

int led1 = 1; // the PWM pin the LED is attached tonint led2 = 2;nint led3 = 0;nint brightness = 0; // how bright the LED isnint fadeAmount = 5; // how many points to fade the LED bynn// the setup routine runs once when you press reset:nvoid setup() {n // declare pin 1,2,3 to be an output:n pinMode(led1, OUTPUT);n pinMode(led2, OUTPUT);n pinMode(led3, OUTPUT);n}nn// the loop routine runs over and over again forever:nvoid loop() {n // set the brightness of pin 1,2,3:n analogWrite(led1, brightness);n analogWrite(led2, brightness);n analogWrite(led3, brightness);nn // change the brightness for next time through the loop:n brightness = brightness + fadeAmount;nn // reverse the direction of the fading at the ends of the fade:n if (brightness == 0 || brightness == 255) {n fadeAmount = -fadeAmount ;n }n // wait for 30 milliseconds to see the dimming effectn delay(30);n}n

代碼下載.

程序寫好之後, Burn Bootloader 上傳到電路板上。LED 開始工作:

Video

課程資源

  • Fab Academy 2016 課表
  • Week13 課程視頻
  • Week13 課程大綱
  • 我的英文筆記 Gitbook
  • 公眾號文章列表

專欄文章

  • Fab Academy 第一周:怎樣在一周內建好自己的網站

  • Fab Academy 第二周:CAD 三維設計

  • Fab Academy 第三周:機器切割

  • Fab Academy 第四周:製作電路板

  • Fab Academy 第五周:3D 掃描和列印

  • Fab Academy 第六周:電路設計基礎
  • Fab Academy 第七周:數控機器
  • Fab Academy 第八周:嵌入式編程
  • Fab Academy 第九周:機械設計
  • Fab Academy 第十周:機器設計

  • Fab Academy 第十一周:輸入設備

  • Fab Academy 第十二周:模具和鑄件


推薦閱讀:

愛你,跟蹤你,不捨得你受累
單反新玩法——茄子智能無線快門
MIT 黑科技,要幫你識別女人的情緒
隨身攜帶一個電影院,隨時享受第6排正中最佳觀影效果
王健林的小目標是一個億,我們的是意念控制

TAG:创客 | 智能硬件 | 电子 |