星期二, 1月 14, 2014

Arduino 電路板簡介 (Introduction to the Arduino Board)

== Arduino 電路板簡介 (Introduction to the Arduino Board) ==


下圖為由上而下觀察 Arduino 電路板的架構圖


從頂部中心順時針開始說明 (Starting clockwise from the top center):

-- 類比參考腳位 [AREF] (橘色) Analog Reference pin (orange)
-- 數位控制接地 [GND] (淺綠色) Digital Ground (light green)
-- 數位控制腳位 2-13 (綠色) Digital Pins 2-13 (green)
-- 數位控制腳位 0-1/串列數位傳送與數位接收 - TX/RX (暗綠色) Digital Pins 0-1/Serial In/Out - TX/RX (dark green) - 如果同時使用在串列通信上,這些控制腳位不能被使用為數位輸入與輸出(傳送與接收) These pins cannot be used for digital i/o (digitalRead and digitalWrite) if you are also using serial communication (e.g. Serial.begin).
-- 復歸按鈕 [S1] (暗藍色) Reset Button - S1 (dark blue)
-- 電路串列程式器 (藍綠色) In-circuit Serial Programmer (blue-green)
-- 類比輸入控制腳位 (淺藍色) Analog In Pins 0-5 (light blue)
-- 電源和接地腳位 (電源: 橘色, 接地: 淺橘色) Power and Ground Pins (power: orange, grounds: light orange)
-- 外接電源供應輸入 (直流 9-12 V) [X1] (粉紅色) External Power Supply In (9-12VDC) - X1 (pink)
-- 切換外接電源和 USB 電源(跳線位置在兩個引腳互相最接近所需的電源)[SV1](紫色)Toggles External Power and USB Power (place jumper on two pins closest to desired supply) - SV1 (purple)
-- USB 輸入接口 (黃色) USB (used for uploading sketches to the board and for serial communication between the board and the computer; can be used to power the board) (yellow)

=======================================

微控制器 (Micro-controllers)

ATmega328 (used on most recent boards)
Digital I/O Pins14 (of which 6 provide PWM output)
Analog Input Pins6 (DIP) or 8 (SMD)
DC Current per I/O Pin40 mA
Flash Memory32 KB
SRAM2 KB
EEPROM1KB
ATmega168 (used on most Arduino Diecimila and early Duemilanove)
Digital I/O Pins14 (of which 6 provide PWM output)
Analog Input Pins6 (DIP) or 8 (SMD)
DC Current per I/O Pin40 mA
Flash Memory16 KB
SRAM1 KB
EEPROM512 bytes
ATmega8 (used on some older board)
Digital I/O Pins14 (of which 3 provide PWM output)
Analog Input Pins6
DC Current per I/O Pin40 mA
Flash Memory8 KB
SRAM1 KB
EEPROM512 bytes

=========================================

數位控制腳位 (Digital Pins)

In addition to the specific functions listed below, the digital pins on an Arduino board can be used for general purpose input and output via the pinMode()digitalRead(), and digitalWrite() commands. Each pin has an internal pull-up resistor which can be turned on and off using digitalWrite() (w/ a value of HIGH or LOW, respectively) when the pin is configured as an input. The maximum current per pin is 40 mA.

  • Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. On the Arduino Diecimila, these pins are connected to the corresponding pins of the FTDI USB-to-TTL Serial chip. On the Arduino BT, they are connected to the corresponding pins of theWT11 Bluetooth module. On the Arduino Mini and LilyPad Arduino, they are intended for use with an external TTL serial module (e.g. the Mini-USB Adapter).
  • External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.
  • PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function. On boards with an ATmega8, PWM output is available only on pins 9, 10, and 11.
  • BT Reset: 7. (Arduino BT-only) Connected to the reset line of the bluetooth module.
  • SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which, although provided by the underlying hardware, is not currently included in the Arduino language.
  • LED: 13. On the Diecimila and LilyPad, there is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.

====================================

類比控制腳位 (Analog Pins)

In addition to the specific functions listed below, the analog input pins support 10-bit analog-to-digital conversion (ADC) using the analogRead() function. Most of the analog inputs can also be used as digital pins: analog input 0 as digital pin 14 through analog input 5 as digital pin 19. Analog inputs 6 and 7 (present on the Mini and BT) cannot be used as digital pins.
  • I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire library (documentation on the Wiring website).

======================================

電源控制腳位 (Power Pins)

  • VIN (sometimes labelled "9V"). The input voltage to the Arduino board when it's using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin. Note that different boards accept different input voltages ranges, please see thedocumentation for your board. Also note that the LilyPad has no VIN pin and accepts only a regulated input.
  • 5V. The regulated power supply used to power the microcontroller and other components on the board. This can come either from VIN via an on-board regulator, or be supplied by USB or another regulated 5V supply.
  • 3V3. (Diecimila-only) A 3.3 volt supply generated by the on-board FTDI chip.
  • GND. Ground pins.

==================================

其他腳位 (Other Pins)

  • AREF. Reference voltage for the analog inputs. Used with analogReference().
  • Reset. (Diecimila-only) Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board.


資料來源 (Reference):

使用 Proteus 軟體工具來模擬 Arduino

== 利用 Proteus 模擬 Arduino 電路板環境 ==

首先到官方網站下載 proteus 模擬軟體 (PRODEMO.EXE)
http://www.labcenter.com/download/prodemo_download.cfm


  • 安裝 prodemo.exe
  • 開啟 proteus 軟體工具-- open sample project -- 選擇 category [VSM for AVR] -- 選擇擬模擬的類似軟體環境 Results [Application note AVR241] 模擬 ATmega128 電路板模擬環境  



  • Arduino 與 ATMega328P 晶片的腳位對應關係圖

Blink 程式會讓 Arduino pin 13,也就是 ATmega328 的 PB5 這支腳位上的 LED 定時閃爍。

在用 Proteus 模擬 Arduino 的時候,你可能會需要參考底下這張腳位對應圖:
image

▲ 圖片來源: arduino.cc (註: ATmega328 跟 ATmega168 的腳位是相容的)



Reference:

Example- 光敏電阻 (photocell, photoresistor) 控制 LED

== 使用光敏電阻來控制 LED ==

  • 實驗目的
利用光敏電阻來控制 LED 的亮滅,在光線不足時,自動打開 LED 燈,反之,光線充足時便關掉 LED 燈。

  • 材料
  1. 麵包板 x 1
  2. Arduino 主板 x 1
  3. 光敏電阻(photocell) x 1
  4. 220 ohm 電阻 x 1
  5. 10k ohm 電阻 x 1
  6. 單心線 

  • 接線
  1. 光敏電阻一支腳接到 5V,另一支腳接到 analog pin 2 以及串接一顆 10k 電阻, 10k 電阻的另一端接到 GND
  2. LED 長腳(正極)串接一顆 220 ohm 電阻接到 pin 9,LED 短腳(負極)接到 GND
  

  • 程式碼
  1. 實驗過程首先要確認光敏電阻輸出電壓的數值變化,例如,執行程式後打開 Series Monitor 可觀察到 COM port 不斷收到的一串數值即是光敏電阻的變化數值。將手試著遮光,觀察電阻值變化,不遮光約為 85-89,另外遮光約為 5-6 
  2. 利用光敏電阻控制 LED 時要設定最小光線門檻值 int minLight = 50 (一定要小於先前未遮光的最小值 >85)方有效用。

  • 範例影片


Reference:

星期五, 1月 10, 2014

免費 AutoCAD 軟體 DraftSight

== 免費 AutoCAD  軟體 DraftSight ==

用於建立、編輯和查看 DWG 檔的更好方法

1. 建議安裝與使用耀網路連線,方能使用。

Reference:
實威國際 中文官方網站 http://www.swtc.com/cht/actions_show.php?serial=35

3D 免費設計軟體 DesignSpark Mechanical

== 3D 免費設計軟體 DesignSpark Mechanical ==

官網說明:

The Gift Of Invention

Welcome to DesignSpark Mechanical – the home of FREE professional 3D design software.
At DesignSpark we love helping engineers create world-changing products. It's why we've made our new 3D Design Tool available to all engineers and designers as a FREE download.
DesignSpark Mechanical is packed with time-saving features to help you design more easily, quickly and creatively than ever before.
  • Produce highly detailed dimensioned worksheets
  • Remove bottlenecks by making amendments and additions to your design in seconds, rather than waiting for the CAD department to rework in history-based CAD tools
  • Combine your creation with off-the-shelf components from RS Components and the Allied Electronics 3D library
  • Create geometry easily with powerful and intuitive gesture-based modelling, no need to be a CAD expert
  • And best of all, it's completely free! This is not a cut down version of an expensive product or software with a time-limited license.



Reference:
1. 官網 http://www.designspark.com/eng/page/mechanical

PCB 免費設計軟體 DesignSpark PCB, FreePCB

==  DesignSpark PCB ==

【軟體簡介】
DesignSpark PCB是由RS Components提供、功能強勁的免費正版PCB設計工具。
【詳細說明】
它具有兩個主要功能:原理圖製作和印刷電路板佈局,亦可以連接到業界標準的Spice模擬器進行模擬。

DesignSpark PCB具計算線路阻抗值的設計計算器,和產生3D視覺效果,能夠給用家以3D的形式觀看屬於你的PCB設計。


【安裝說明】
1. 首先,下載軟體安裝 (建議需網路連線)
http://www.designspark.com/eng/page/designspark-pcb-home-page

2. 連接到官方網站啟動(activity 活化)軟體
http://www.designspark.com/eng/users/login

Reference:
1. 指導影片 http://www.youtube.com/user/DesignSparkTW?feature=watch
2. 英文官網  http://www.designspark.com/eng/page/designspark-pcb-home-page (中文官網為簡體中文)

==============================================================

== FreePCB ==

FreePCB is a free, open-source PCB editor for Microsoft Windows, released under the GNU General Public License. It was designed to be easy to learn and easy to use, yet capable of professional-quality work. It does not have a built-in autorouter, but it can use the FreeRoute web-based autorouter at www.freerouting.net. Some of its features are:
  • 1 to 16 copper layers
  • Board size up to 60 inches by 60 inches
  • Uses English or metric units (i.e. mils or mm) for most functions.
  • Footprint libraries courtesy of Ivex Design International, PCB Matrix and the IPC.
  • Copper fill areas
  • Footprint Wizard and Footprint Editor for creating or modifying footprints
  • Imports and exports PADS-PCB netlists
  • Exports extended Gerber files (RS274X) and Excellon drill files
  • Design rule checker
  • Autosave
The layout for a small PCB is shown in the screenshot below.






Reference:
1. 官網 http://www.freepcb.com/
2. 教學網站 http://www.mobile01.com/topicdetail.php?f=300&t=533106

Arduino 3*3*3 LED Cube (萬用電路板)

1. 將 LED cube 接角接到萬用電路板中
2. 焊接 LED cube 接觸點於萬用電路板銅點上
3. 布局各電晶體、電阻與母接孔,並且焊接

-- 電路接線圖 --



4. 背面各點焊接


Reference:
1. Arduino - LED Cube 3x3x3 [Full Tutorial], https://www.youtube.com/watch?v=GLx6aA75CZY 

寫日記用 Evernote

== 寫日記 Evernote ==

運用 Evernote (http://evernote.com/intl/zh-tw/) 軟體來寫日記

免費 3D 動畫軟體 Blender

== 3D 動畫軟體 Blender ==

功能與特色:

Photorealistic Rendering

Blender now features a powerful new unbiased rendering engine called Cycles that offers stunning ultra-realistic rendering.
The built-in Cycles rendering engine offers:
  • GPU & CPU rendering
  • Realtime viewport preview
  • HDR lighting support
  • Permissive License for linking with external software
Modelling in Blender

Fast Modelling

Blender’s comprehensive array of modeling tools make creating, transforming and editing your models a breeze.
Blender’s modeling tools include:
  • Keyboard shortcuts for a fast workflow
  • N-Gon support
  • Edge slide, collapse and dissolve
  • Grid and Bridge fill
  • Python scripting for custom tools and addons

Realistic Materials

With Blender’s new rendering engine the possibilities for materials are endless.
Key features are:
  • Complete Node Support for full customization
  • Physically accurate shaders like glass, translucency and SSS
  • Open Shading Language (OSL) support for coding unique shaders
Materials in Blender

Rigging in Blender

Fast Rigging

Transforming a model into a poseable character has never been easier!
Blender offers an impressive set of rigging tools including:
  • Envelope, skeleton and automatic skinning
  • Easy weight painting
  • Mirror functionality
  • Bone layers and colored groups for organization
  • B-spline interpolated bones

Animation toolset

Whether it’s simple keyframing or complex walk-cycles, Blender allows artists to turn their still characters into impressive animations.
Blender’s animation feature set offers:
  • Automated walk-cycles along paths
  • Character animation pose editor
  • Non Linear Animation (NLA) for independent movements
  • IK forward/inverse kinematics for fast poses
  • Sound synchronization

rigging

Sculpting in Blender

Sculpting

Experience the joy of sculpting organic subjects using the built-in sculpting feature set of Blender.
Sculpting in Blender includes:
  • 20 different brush types
  • Multi-res sculpting support
  • Dynamic Topology sculpting
  • Mirrored sculpting

Fast UV Unwrapping

Easily unwrap your mesh right inside Blender, and use image textures or paint your own directly onto the model.
Blender allows for:
  • Fast Cube, Cylinder, Sphere and Camera projections
  • Conformal and Angle Based unwrapping (with edge seams and vertex pinning)
  • Painting directly onto the mesh
  • Multiple UV layers
  • UV layout image exporting

UV Unwrapping in Blender

Compositing in Blender

Full Compositor

Blender comes with a fully fledged compositor built right in. That means no more exporting to third party programs, you can do it all without leaving the program.
The compositor comes with:
  • Impressive library of nodes for creating camera fx, color grading, vignettes and much more
  • Render-layer support
  • Full compositing with images and video files
  • Ability to render to multiLayer OpenEXR files
  • Multi-threaded

Amazing Simulations

Whether you need a crumbling building, rain, fire, smoke, fluid, cloth or full on destruction, Blender delivers great looking results.
Blender’s simulation tools include
  • Fluid – Realistic water and fluid simulations.
  • Smoke – Billowing smoke with flames and scene interaction.
  • Hair – Beautiful wafts of hair that blows in the wind and interacts with collisions.
  • Cloth – Amazingly realistic cloth simulations for clothing and environments
  • Rigid Body Physics – Makes any object destructable and collidable
  • Particles – For creating things like rain, sparks and shrapnel

463e785104

Blender Game Engine Screenshot

Game Creation

Included in Blender is a complete game engine, allowing you to create a fully featured 3d game right inside Blender.
The game engine includes:
  • Ability to port your models to any third-party game engine
  • Create or code your own game logic
  • Full Bullet Physics integration
  • Python scripting API for advanced control and AI
  • Support for all OpenGLTM dynamic lighting, toon shading, animated materials as well as Normal and Parallax Mapping
  • Playback of games inside Blender without compiling or preprocessing
  • 3D spatial audio using OpenAL

Camera and Object tracking

Blender now includes production ready camera and object tracking. Allowing you to import raw footage, track the footage, mask areas and see the camera movements live in your 3d scene. Eliminating the need to switch between programs.
The Camera and Object Tracker includes:
  • Auto and manual tracking
  • Powerful camera reconstruction
  • Real-time preview of your tracked footage and 3d scene
  • Support for Planar tracking and Tripod solvers
Camera tracking in Blender
3057383d1a

Library of Extensions

With a large community of enthusiasts and developers, Blender comes loaded with a vast array of extensions that you can turn on or off easily.
Some existing extensions include:
  • Generators for trees, terrain, ivy and clouds.
  • Fracture Objects.
  • 3D Printing Toolbox.
  • Rigify meta-rigging system.
  • Import and Export format support for AfterEffects, DirectX, Unreal Game Engine and more!
Plus many more that you can download here

Flexible Interface

Novice and advanced users will love the ability to customize their layout completely. From simply splitting their viewport, to fully customizing it with python scripting, blender works for you.
Blender’s interface also offers:
  • Consistency across all platforms
  • No disruptive pop-up windows
  • Crisp text (support for retina on OSX)
Blender's UI

Exporting in Blender

File Formats

Blender comes packed with import/export support for many different programs.
Including:
  • Image
    JPEG, JPEG2000, PNG, TAGA, OpenEXR, DPX, Cineon, Radiance HDR, SGI Iris, TIFF
  • VideoAVI, MPEG and Quicktime (on OSX).
  • 3D
    3D Studio (3DS), COLLADA (DAE), Filmbox (FBX), Autodesk (DXF), Wavefront (OBJ), DirectX (x), Lightwave (LWO), Motion Capture (BVH), SVG, Stanford PLY, STL, VRML, VRML97, X3D.


=========================================================

官方網站 http://www.blender.org/

星期二, 1月 07, 2014

利用 realplayer 下載 youtube

== 利用 realplayer 下載 youtube  ==

  • 安裝 realplayer 
  • 利用 IE 開啟 youtube (http://www.youtube.com/ ),點選你選擇的影片
  • 右上方會出現 [下載此視訊] 的選單,點選該 icon 即可。該影片會下載到預設的電腦 c:\使用者\user\視訊  (每個人的電腦不一樣) 資料匣中
  • 下載的檔案為 .flv 格式,如果要做其他教學使用,請利用 realplayer converter 轉換格式
  • 詳細資料請參考 realplayer 官網說明 (http://tw.real.com/?mode=rp )


星期一, 1月 06, 2014

1-2 Arduino 程式語言與架構

Arduino 程式語言語法主要的三要素:

  1. 變數
  2. 結構
  3. 函式

  • 變數:  宣告程式中會使用到資料或是元件,將其定義其資料型態,已被後續使用。
            例如:    byte  a;                     // 宣告變數 a 為 1 byte 大小

  • 結構: Arduino 語法編寫的結構程式,如: 符號、控制元件、運算子....等
          例如:      setup() {
                           ..................             // 設定程式的初始值
                           }
  • 函式:   控制 Arduino 運作的函式設定,內建許多函式可用,例如:數位訊號輸出(入)、時間函式、伺服馬達控制函式..............等
         例如:    delay(500);                 // 維持狀態 0.5 秒


=====================================================================
Arduino 程式架構

首先,Arduino 語法中最重要也是最基本的兩個控制結構為 setup() 與 loop() 
  • 初始化 setup(): 在主程式開始撰寫前,使 Arduino 控制板妥當的指令。
         例如:  int a=1;                                         // 宣告變數 a =1
                      setup(){                                      // 在開始的時候執行一次
                           pinMode(a, INPUT);            // 設定pin 1 腳為輸入腳
                        }
  • 執行 loop(): 在此函式中放置 Arduino 控制內容。這部分的程式會一直重複執行,直到 Arduino 電路板被關閉。
         例如: loop(){                                          // 程式開始後一直執行本函式內容
                     ..................
                      }

====================================================================
符號說明

; 分號 
Arduino 每一行程序以 ";" 分號為結尾。

{} 大括號
大括號用來將程式函數分成一個又一個的區塊。

// 註釋
程式的註釋利用 "//"來說明註記。
        // 單行註釋: 整行的文字會被處理器忽略

       /* 多行註釋
           ............ 在這範圍內的文字皆被忽略
       */





Reference
1. Arduino 官方網站 http://arduino.cc/en/Reference/HomePage
2. Arduiino 入門學習套件輕鬆上手 18 堂課,飆機器人普特企業有限公司