Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - nattapong.sr

#1
พอดีพึ่งลง AtmelStudio v.7 ครับ แล้วจะลอง burn ลงชิป โปรแกรมมันแจ้งให้อัพเวอร์ชัน firmware


ลองกด upgrade แล้วไม่ได้ ลองหาข้อมูลในเน็ตก็บอกว่าให้อัพแบบ manual ซึ่งตอนนี้เครื่องมือมีพร้อมหมดแล้วครับ
แต่ติดที่ว่าไม่มีไฟล์ hex ของ เวอร์ชัน 1.18 หาในโปรแกรมติดตั้งก็ไม่มี ไม่รู้ว่าต้องหาที่ไหน หรือใครมีวิธีอื่นบ้าง
รบกวนผู้รู้ช่วยหน่อยครับ
#2
โหลดไม่ได้แล้วครับ  :'( :'(
#3
EDA Software / EAGLE 3D: Custom POV-Ray 3D Component
November 29, 2016, 09:17:49 PM


สวัสดีทุกท่านครับ วันนี้ผมจะมาแนะนำขั้นตอนวิธีการทำอุปกรณ์ 3D ด้วยโปรแกรม SketchUp + su2pov
เพื่อนำไปใช้กับโปรแกรม POV-Ray ในการ Render ภาพออกมาเป็นรูป 3D
โดยจะอ้างอิงจาก
http://blog.strobotics.com.au/tutorials/eagle3d-tutorials/using-google-sketchup-to-create-components/


ขั้นตอนที่ 1
- ก่อนอื่นจำเป็นต้องมี Google SketchUp พร้อมกับติดตั้ง plugin ที่มีชื่อว่า su2pov ให้พร้อมก่อน
- จากนั้นให้ไปหาโหลด 3d ที่มีคนทำไว้ก่อนแล้วจาก https://3dwarehouse.sketchup.com/index.html
โดยเลือกตามเวอร์ชันที่ใช้ (ถ้าหากไม่มีให้โหลด ก็ต้องลงมือวาดใน SketchUp เอง)



- เปิดไฟล์ที่โหลดมาบน SketchUp จากนั้นใช้ Plugin su2pov generate ออกมาเป็นไฟล์ *.pov


- ทดสอบ Render ไฟล์ *.pov ที่ได้ จากโปรแกรม POV-Ray




ขั้นตอนที่ 2
- ทำการแปลงไฟล์จาก *.pov ไปเป็น library *.inc โดยการ save as.. ตั้งชื่อใหม่ตามต้องการ
- ลบส่วนหัวของ code ดังนี้ ออกไป

// Persistence Of Vision raytracer version 3.6 (or higher) file.
// Exported from Sketchup 8.0.4811 (en-US) through SU2POV 3.5. by D. Bur.
// 29/11/2016, 17:08
//-------------------------------------------


// Pov-Ray includes
#include "C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/su2pov/rad_def.inc"
#include "colors.inc"
#include "textures.inc"
#include "golds.inc"
#include "metals.inc"
#include "woods.inc"
#include "stones.inc"
#include "stars.inc"
#include "finish.inc"
#include "sunpos.inc"
#include "math.inc"
#include "transforms.inc"
//-------------------------------------------


// Declare section
//Gamma
#declare GAMMA=1.8;
// Finishes
//Default finish
#declare DefaultFinish = finish { }
#declare Default = finish { }
//Default transparent materials finish
#declare Standard = finish { ambient 0 specular 0.3 roughness 0.001 diffuse 0.25 phong 2 phong_size 60 reflection 0.25 ior 1.5 }
#declare I_Glass = interior { ior 1.5 }
// Generic Finishes
#declare F_None = finish { }
#declare F_Matt = finish { diffuse 0.5 phong 0.2 phong_size 1 }
#declare F_Sattiny = finish { diffuse 0.65 phong 0.45 phong_size 1.8 reflection 0.02 }
#declare F_Shiny = finish {ambient 0 specular 0.8 roughness 0.003}
#declare F_Glossy = finish {ambient 0 specular 1 roughness 0.0003 reflection 0.1}
#declare F_Luminous = finish {ambient 0 diffuse 3.5 }
// Metals Finishes
#declare F_Steel = finish { metallic reflection 0.07 roughness 0.6 crand 0.005 }//specular 0.03 roughness 0.8 }//brilliance 10 }
// Glass Finishes
#declare F_Glass_Default = finish { diffuse 0.5 ambient 0.7 reflection 0.1 specular 0.5 roughness 0.0002 phong 2 phong_size 200 }
#declare F_Glass_Translucent = finish { ior 1.5 ambient 0.2 diffuse 0.4 reflection 0.005 specular 0.4 ior 1.8 roughness 0.4 }
#declare F_Glass_Crystal = finish  { ior 1.5 ambient 0.07 diffuse 0 reflection { 0.2 0.4 } phong 40 phong_size 200 ior 3 }
#declare F_Glass_Dark = finish { ior 1.5 ambient 0 diffuse 0 reflection 0.01 specular 0.01 }
#declare F_Glass_Mirror = finish { ior 1.5 specular 0.7 roughness 0.001 ambient 0 diffuse 0.1 reflection 0.7 conserve_energy }
#declare F_Glass_Dark_Reflexive = finish { ior 1.5 specular 0.9 roughness 0.002 ambient 0 diffuse 0 brilliance 5 reflection { 0.05, 0.1 fresnel on } conserve_energy }
#declare F_Glass_Translucent_Reflexive = finish { ior 1.5 ambient 0.12 diffuse 0.45 reflection { 0.4, 0.7 fresnel on } conserve_energy ior 1.8 roughness 0.4 }
#declare F_Glass_Clear_Half_Reflexive = finish { ior 1.5 specular 0.9 roughness 0.001 ambient 0 diffuse 0.75 brilliance 0 reflection { 0.2, 1.0 fresnel on } conserve_energy }
// Other finishes
#declare F_Plastic = finish { ambient 0 brilliance 3 phong 0.4 phong_size 20 roughness 0.0003 reflection { 0.1, 0.4 } crand 0 }
#declare F_Altuglass = finish { ambient 0 brilliance 4 phong 0.6 phong_size 30 roughness 0.0003 reflection { 0.2, 0.5 } crand 0 }
#declare F_Mirror = finish { reflection 1.0 ambient 0 diffuse 0 specular 1 }
#declare F_Bakelite = finish { metallic reflection { 0.05 0.6 } roughness 0.8 crand 0.04 }
// Metal Normals
#declare N_galvanized = normal { spotted 0.4 scale 1.6 turbulence 1 }
#declare N_hammered = normal { bozo 0.4 scale 1.4 } // needs finish { F_MetalB }
#declare N_molted = normal { marble -1 scale -33 turbulence 1 }
#declare N_punched = normal { leopard 11 scale 0.1 }// needs finish { F_MetalB }
#declare N_stamped = normal { leopard -18 scale 0.1 octaves 0.01 }
#declare N_square_fencing = normal { quilted -1 scale 1 }
#declare N_tiled = normal { cells 3 scale 5 }
// Minerals Normals
#declare N_cast_concrete = normal { dents 0.4 scale 2 }
#declare N_wax_concrete = normal { granite 0.1 scale 200 } // needs finish { reflection 0.05 }
#declare N_rough_concrete = normal { dents 0.4 scale 0.7 }
#declare N_block_concrete = normal { agate 0.2 scale <4,1,1> }
#declare N_rough_coating = normal { agate 0.2 scale 2 turbulence 0.4 }
#declare N_blob_coating = normal { spotted 0.5 scale 2 turbulence 0.1 omega 1 }
#declare N_fine_coating = normal { agate 0.1 scale 1 turbulence 0.2 }
#declare N_full_holes = normal { crackle 8 scale 0.7 form 0.6 }
#declare N_flocking = normal { crackle 5 scale 0.9 form 0.2 }
#declare N_dirty = normal { wrinkles 0.25 scale 40 turbulence 0.12 }
#declare N_mud = normal { granite 0.2  scale 35  }
#declare N_pebbles = normal { wrinkles 2  scale 1.5 turbulence 4 }
#declare N_rock = normal { marble 0.7 scale 17 turbulence 1.2 }
#declare N_paving_pebbles = normal { dents 13 scale 0.2 turbulence 0.4 }
#declare N_dry_clay = normal { crackle 6 scale 7 solid turbulence 0.2 }
// Vegetals Normals
#declare N_raw_wood = normal { ripples 0.1 scale 1 turbulence 0.3 lambda 8 frequency 1 } //octaves 10 }
// Water Normals
#declare N_water_calm = normal { leopard 0.8 scale 5 turbulence 0.2 }
#declare N_water_riddles = normal { ripples 0.5 scale 4 turbulence 0.6 }
#declare N_water_wavy = normal { waves 0.7 scale 11 turbulence 0.8 }
#declare N_water_rough = normal { bumps 0.4 scale 8 turbulence 0.2 }
// Misc Normal
#declare N_emery = normal { spotted 1 scale 0.2 }
#declare N_oil_stain = normal { agate 0.25 scale 55 turbulence 2 }
#declare N_rust = normal { crackle 0.8 scale 11 turbulence 0.15 omega 1.2 }
#declare N_polystyrene = normal { spotted 1.2 scale 0.4 turbulence 0.06 omega 1 }
#declare N_snow = normal { marble -0.08 scale 88 turbulence 1.6 }
#declare N_cork = normal { dents 5 scale 3 turbulence 6 }
#declare N_lizard_skin = normal { wrinkles 1 scale 0.7 turbulence 0.05 octaves 18 }
#declare N_leather = normal { crackle 0.5 scale 0.3 }
#declare N_None = normal { }
// Lights colors
#declare Candle = rgb <255/255.0, 147/255.0, 41/255.0>;
#declare Incandescence = rgb <1, 0.9, 0.6>;
#declare Halogen = rgb <255/255.0, 241/255.0, 224/255.0>;
#declare Tungsten_Halogen = rgb <255/255.0, 214/255.0, 170/255.0>;
#declare Sodium_HighPressure = rgb <255/255.0, 183/255.0, 76/255.0>;
#declare Sodium_Vapor = rgb <255/255.0, 209/255.0, 178/255.0>;
#declare Fluorescent = rgb <244/255.0, 255/255.0, 250/255.0>;
#declare Fluorescent_Warm = rgb <255/255.0, 244/255.0, 229/255.0>;
#declare Fluorescent_Cold = rgb <212/255.0, 235/255.0, 255/255.0>;
#declare Mercury = rgb <216/255.0, 247/255.0, 255/255.0>;
#declare Metal_Halide = rgb <242/255.0, 252/255.0, 255/255.0>;

#declare Lightbulb = sphere {
    <0,0,0>,1.5
    scale <0.7,1.1,0.7>
    texture { pigment {color rgb <1, 1, 0.5>}}
    finish { Luminous }
    }

//-------------------------------------------


//Radiosity settings
global_settings {
      charset utf8
      assumed_gamma GAMMA
      max_trace_level 10
      adc_bailout 0.03
      radiosity { Rad_Settings(Radiosity_OutdoorLQ, on, off) }
      radiosity { brightness 1.0 }
      ambient_light 1
}
//-------------------------------------------


// Day Gradient Background or SkyBox map
sky_sphere {
    pigment {
    gradient y
   color_map {
    [(1-cos(radians(0)))/2 color White]
    [(1-cos(radians(50)))/2 color rgb <0.776470588235294,0.803921568627451,0.815686274509804>]
    }
    scale 1
    translate -1
    }
}
//-------------------------------------------


//-------------------------------------------


//-------------------------------------------


// Camera
camera {
    perspective
    location <1.7365631362309,6.1093063823797,-0.0704915628577871>
    look_at <1.09782652311548,-56.387228969039,6.53245351642796>
    right <2.08355091383812,0,0>
    up <-0.0957477684004298,0.105553191724808,0.98979335649571>
    angle 66.605111670305
}
//-------------------------------------------


// Sun
light_source {
<-3.21973101290679,3.08456207816523,-5.38224123297149>, rgb <1.0,0.914095510507758,0.788975334741007>*0.9375
    parallel
    point_at <0,0,0>
}
//-------------------------------------------


// Default material
#declare Default = texture {
    pigment { color rgb <1.0,1.0,1.0>}
    finish {
    ambient 0.1 diffuse 0.6
    brilliance 0.1
    phong 0 phong_size 40
    specular 0.0
    roughness 0.005
    crand 0.0
    reflection { 0.0 }
    }
}
//-------------------------------------------


- Copy ตามนี้แล้ววางบนสุดของ code

#ifndef(inc_NAME)
#declare inc_NAME=true;

#ifndef(inc_testmode)
#declare inc_testmode=true;
#undef inc_testmode
#end

#declare I_Glass = interior { ior 1.5 }
#declare F_None = finish { }
#declare Default = finish { }

    จากนั้นแก้ชื่อตรง "inc_NAME" ให้เป็นชื่ออะไรก็ได้ตามต้องการ เช่น "inc_LCD16X2"


- เลื่อน code ลงมา มองหา
[/list]
// LEVEL 0 #<Sketchup::ComponentDefinition:0xe83ad48> Grupo#1
#declare Grupob = union {
mesh2 {
    vertex_vectors {
      484,
<0.0,1.1296519275561e-013,1.41732283464567>,
<0.0452755905511815,1.04971586978309e-013,1.31889763779528>,
<0.0,0.0,5.33333220107086e-015>,
<0.0470866194688885,1.06081810002934e-013,1.33265376814522>,
<0.0523962875941345,1.07081010725096e-013,1.34547244094489>,
<0.0608427498188255,1.07969189144796e-013,1.35648008482685>,
<0.0718503937007877,1.08635322959572e-013,1.36492654705154>,
<0.0846690665004569,1.09079412169422e-013,1.37023621517679>,
<0.0984251968503941,1.09245945623115e-013,1.37204724409449>,
......................
......................

จากนั้นเพิ่ม "#macro MACRO_NAME()" เข้าไปก่อนบรรทัดนี้ ตรง MACRO_NAME ให้ตั้งชื่อตามต้องการ
เช่น "#macro LCD16X2()"


- เลื่อนลงมาส่วนล่างสุดของ Code ลบ 3 บรรทัดนี้ไป


- เพิ่ม Code นี้ต่อท้ายล่างสุดของไฟล์

#end //end of macro 

/**********************************************************************
Testing
**********************************************************************/
#ifndef(inc_testmode)
#include "colors.inc"

//Size of the Grid Plane (+/- span)
#local XYZ_span=20;

//Orientation axes
cylinder{<-XYZ_span,0,0><XYZ_span,0,0>0.1 pigment{Blue}}    //X
cylinder{<0,-XYZ_span,0><0,XYZ_span,0>0.1 pigment{Red}}        //Y
cylinder{<0,0,-XYZ_span><0,0,XYZ_span>0.1 pigment{Yellow}}    //Z

// Useful GRIDS:
#local XYZ_step= 1 ;          // axis increment
#local XYZ_cnt = 0;           //  loop counter
#local xyz_thick = 0.05;     // grid line thickness

// GRID PLANES: Remove comment begin/end to activate & select PLANES:
#while (XYZ_cnt <= XYZ_span)

    cylinder{<-XYZ_span,0,XYZ_cnt><XYZ_span,0,XYZ_cnt>xyz_thick pigment{Blue}}        // Positive Z-Lines
    cylinder{<-XYZ_span,0,-XYZ_cnt><XYZ_span,0,-XYZ_cnt>xyz_thick pigment{Blue}}    // Negative Z-Lines

    //cylinder{<0,XYZ_cnt,-XYZ_span><0,XYZ_cnt,XYZ_span>xyz_thick pigment{Red}}        // Positive Y-Z Plane Lines
    //cylinder{<0,-XYZ_cnt,-XYZ_span><0,-XYZ_cnt,XYZ_span>xyz_thick pigment{Red}}    // Negative Y-Z Plane Lines

    //cylinder{<-XYZ_span,XYZ_cnt,0><XYZ_span,XYZ_cnt,0>xyz_thick pigment{Red}}        // Positive Y-X Plane Lines
    //cylinder{<-XYZ_span,-XYZ_cnt,0><XYZ_span,-XYZ_cnt,0>xyz_thick pigment{Red}}    // Negative Y-X Plane Lines

    cylinder{<XYZ_cnt,0,-XYZ_span><XYZ_cnt,0,XYZ_span>xyz_thick pigment{Yellow}}    // Positive X-Lines
    cylinder{<-XYZ_cnt,0,-XYZ_span><-XYZ_cnt,0,XYZ_span>xyz_thick pigment{Yellow}}    // Negative X-Lines

    #local XYZ_cnt = XYZ_cnt+XYZ_step;
#end

camera
{
    #local tt = 50;                //let's you change the distance easily
    location <-tt,tt,-tt>
    //location<0,5,-50>            //alternate location
    look_at <0,0,0>                //best to select the approximate centre of the object
    angle 30
}

light_source { <100, 100, -100> White}
light_source { <-100, 100, -100> White }
light_source { <-100, 100, 100> White }
light_source { <100, 100, 100> White }
//light_source { <-tt,tt,-tt> White }
//light_source { <-tt,tt,-tt> White }
//light_source { <-tt,tt,-tt> White }
background{Grey}
      MACRO_NAME()
#end

#end
//End of Macros

แก้ชื่อตรง "MACRO_NAME" ให้ตรงกับ #macro ก่อนหน้านี้


- ลองกด Run เพื่อ Render ภาพออกมา ถ้าไม่ error แสดงว่าผ่าน


- Copy ไฟล์ที่ได้ไปเก็บไว้ที่โฟลเดอร์ที่ติดตั้ง eagle3d ดั้งนี้ <eagle3d>/povray/




ขั้นตอนที่ 3
- สร้างไฟล์ e3d_user.inc ในโฟลเดอร์ <eagle3d>/povray/ จากนั้นวาง code นี้ลงไป

#declare e3d_environment = off;

#ifndef(__user_inc)
#declare __user_inc = true;

    // #include files here
#end

ตรงบรรทัด // #include files here ให้ include ชื่อไฟล์ที่เราได้สร้างตอนแรกเข้าไป ถ้ามีหลายไฟล์ก็ include ไปตามนั้น


- จากนั้นเปิดไฟล์ "3dpack.dat" จากโฟลเดอร์ <eagle3d>/ulp/ ด้วย text editor อาจเป็น notepad ก็ได้ แล้วจากนั้นเพิ่ม code นี้ไว้ส่วนล่างสุดของไฟล์

PACKAGE_NAME:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:MACRO_NAME(::

จากนั้นให้เปิดโปรแกรม EAGLE pcb ขึ้นมา แล้วเข้าไปดูชื่อ Package ของตัวอุปกรณ์ที่ขาดไป เช่น
ตัว LCD

copy ชื่อ package แล้วนำไปใส่ตรง "PACKAGE_NAME"
ส่วน MACRO_NAME ให้ใส่ชื่อให้ตรงตามที่เราทำ #macro ในตอนแรก แล้ว save ไฟล์ จะได้ประมาณนี้


- ต่อไปให้รัน ulp ของ EAGLE เพื่อสร้างไฟล์ *.pov ออกมา ถ้าทำถูกต้อง EAGLE จะไม่มีการแจ้งเตือนว่าอุปกรณ์ 3D ไม่ครบ
- ทดสอบ Render ภาพออกมา ถ้าสังเกตุดีๆ ตัว 3D มันจะโผล่มา แต่มีขนาดเล็กมาก แต่ถ้าขนาดและตำแหน่งการวางถูกต้อง ให้ข้ามขั้นตอนที่ 4 ไปเลย



ขั้นตอนที่ 4
- โดยเปิดไฟล์ *.pov คู่กับ Library *.inc บนโปรแกรม POV-Ray
- จัดการปรับแต่ง Size ของ 3D ให้ถูกต้องก่อน โดยไปที่ไฟล์ *.inc เลื่อนลงมาล่างสุด มองหา code นี้

#object {Grupob
matrix < -1.0,0.0,-4.83502127224256e-014,
0.0,1.0,0.0,
4.83502127224256e-014,0.0,-1.0,
3.14960629921256,0.0,1.41732283464575>
interior { I_Glass }
}

ปรับค่า parameter 3 ตัว โดยให้เป็นค่าเดียวกัน ลองเปลี่ยนเป็น "25.4" จากนั้นลอง Render อีกที

จะเห็นว่าตำแหน่งยังไม่ถูกต้อง เนื่องมาจากจุด Origin ของตัว 3D กับ Footprint lib ไม่ตรงกัน จึงจำเป็นต้องจัดวางตำแหน่งใหม่

- การปรับตำแหน่งและการหมุนให้ปรับในไฟล์ *.pov โดยหาบรรทัดที่เกี่ยวข้องกับ lib ให้เจอก่อน หลักๆ แล้วมันจะมีชื่อของ macro อยู่ ให้ search จากชื่อ macro ได้เลย

การเลื่อนตำแหน่งให้ปรับจาก translate<x,y,z> ส่วนการหมุนปรับจาก rotation<x,y,z> ให้ทดลองปรับไปแล้ว Reder ไปจนกว่าจะตรงกับตำแหน่งที่ต้องการ

- ก็จะได้ 3D ที่สมบูรณ์แบบครับ

เสร็จเรียบร้อยครับ สำหรับขั้นตอนการทำ 3D Component ของ EAGLE


Link ที่เกี่ยวข้อง
http://www.juergentreml.de/archives/846
http://perso.numericable.fr/pboucheny/eagle3d/e_creatconv.htm
http://www.te1.com.br/2011/03/tutorial-instalando-configurando-usando-eagle3d/#axzz2sfHLrnhB
http://pa-elektronika.hu/hu/cikkek/74-sajat-eagle3d-alkatreszeim.html
#4
ผลงานแรกหลังจากที่ได้ลองใช้ KiCad ครับ..  :) :)


#5


     KiCad เป็นโปรแกรม Open Source สามารถรันได้หลาย OS ใช้สำหรับเขียนแบบวงจรอิเล็กทรอนิกส์ และออกแบบ PCB
ภายในโปแกรมมีเครื่องมือพื้นฐานที่จำเป็นต่อการใช้งานอยู่แล้ว ภายนอกดูเรียบง่ายไม่มีปุ่มให้กดเยอะ จะใช้ Hotkeys เป็นหลัก
ความสามารถในการทำงานถือว่าค่อนข้างดี ใช้ทดแทนโปรแกรมออกแบบ PCB ใหญ่ๆ ได้ดีไม่แพ้กัน การใช้งานก็ไม่ได้ยุ่งยากมากมายนัก
KiCad จะแยกออกเป็นโปรแกรมย่อยที่ใช้ทำงานในแต่ละส่วนหลักๆ ดังนี้

- Eeschema, สำหรับเขียนแบบวงจรอิเล็กทรอนิกส์ (Schematic)
- Schematic library editor, สำหรับเขียน library ตัวอุปกรณ์ เพื่อใช้กับ Eeschema
- Pcbnew, สำหรับเขียนลายวงจร PCB
- PCB footprint editor, สำหรับสร้าง footprint เพื่อใช้กับ Pcbnew/Schematic library editor
- GerbView, สำหรับตรวจสอบ Gerber ก่อนส่งผลิต

ตัวซอฟแวร์สามารถโหลดได้ฟรีจากเว็บไซต์ http://kicad-pcb.org/download/


เวอร์ชันล่าสุดตอนนี้ (25/11/2016) อยู่ที่ v4.0.4

     จะเห็นว่ารองรับ OS หลายตัวเลยทีเดียวครับ ก็เลือกตาม OS ที่ใช้เลย
ทำการ download มาแล้วติดตั้งได้เลยครับ สำหรับขั้นตอนติดตั้งขอข้ามไปก่อนนะครับ


เริ่มต้นใช้งาน KiCad
     เมื่อติดตั้งตัวโปรแกรมเสร็จแล้ว ก็สามารถเปิดโปรแกรมขึ้นมาได้เลย จะปรากฎหน้าต่างหลักขึ้นมาตามภาพ (Project manager)
โดยจะมีโปรแกรมย่อยให้เลือกใช้อยู่หลักๆ 5 ตัว (ในกรอบสีแดง) ตามที่ได้กล่าวไว้ข้างต้น เรียงจากซ้ายไปขวาตามลำดับ


เริ่มต้นจะยังไม่สามารถ ใช้งานได้ ให้เริ่มทำการสร้าง Project ขึ้นมาใหม่ก่อน โดยไปที่
File -> New Project -> New Project เลือก Path และตั้งชื่อไฟล์ให้เรียบร้อย ไฟล์จะมีนามสกุลเป็น *.pro



เสร็จแล้ว โปรแกรมจะสร้างไฟล์ *.sch และ *.kicad_pcb มาให้เลย ตามด้านซ้ายมือ พร้อมกันนี้โปรแกรมย่อยก็จะสามารถใช้งานได้แล้ว



ค้างไว้ตรงนี้ก่อน เรามาดู Workflow ของโปรแกรมกันซักนิดนึง


ภายใน Project นึงจะมีไฟล์ต่างๆ อยู่หลายไฟล์ด้วยกัน ซึ่งก็จะแบ่งกันไปทำงานในแต่ละโปรแกรมย่อยอีกทีนึงตามรูป
เป้าหมายของการออกแบบ PCB ด้วย KiCad คือการ Generate ไฟล์ออกมาเป็น Gerber เพื่อที่จะส่งให้โรงงานทำการผลิต PCB ต่อไป

1. เขียน Schematic โดยใช้โปรแกรมย่อย Eeschema
2. สร้าง Netlist เพื่อใช้ในการ Routing PCB
3. วาดลายวงจรหรือทำการ Route ผ่านโปรแกรม Pcbnew
4. Generate Gerber ไฟล์ที่จะใช้ในการผลิต
5. ตรวจสอบ Gerber ไฟล์ที่ได้ โดยใช้ GerbView ก่อนส่งให้โรงงานผลิต


กลับมาที่หน้าต่าง Project manager กันต่อครับ

อันดับแรกเลยเราต้องเขียน Schematic กันขึ้นมาก่อน
คลิกเข้าไปที่ไอคอนของ Eeschema
หรือเข้าได้จากเมนู Tools -> Run Eeschema หรือกด "Ctrl+E"


ก็จะได้หน้าต่างของโปรแกรม Eeschema ขึ้นมา ตามรูป



การใช้งาน Eeschema ของ KiCad

เมื่อเราเปิดโปรแกรมมาครั้งแรก ก็จะได้ WorkSheet เปล่าๆ มา หน้านึง หน้าตาก็คล้ายๆ กับโปรแกรมออกแบบทั่วๆ ไป เริ่มต้นด้วยการกำหนดขนาด Sheet ก่อน โดยเข้าไปที่ File -> Page Setting หรือกดที่ไอคอน Page settings


กำหนดขนาดของ Sheet size ที่ต้องการ ถ้าต้องการใส่ข้อมูลเพิ่มเติมก็ให้ใส่ในช่อง Parameter ได้ตามต้องการเลยครับ


เมื่อกำหนด Sheet เสร็จแล้ว ต่อไปจะแนะนำวิธีการใช้งานด้วยเมาส์และคีบอร์ดครับ
เนื่องจาก KiCad เป็นโปรแกรมที่ใช้เมาส์ในการควบคุมไม่เหมือนโปรแกรมอื่นๆ ทั่วไป การใช้เมาส์ในการลากวาง หรือเคลื่อนย้าย Object ใดๆ ต้องใช้คีย์ลัดช่วยในการทำงาน หรือแม้กระทั่งการ Copy และ Paste Object ผู้ที่เริ่มใช้ใหม่ๆ อาจจะงงๆ รวมถึงตัวผมเองด้วย ดังนั้นลองเข้าไปดูรายการของคีย์ลัดกันก่อนครับ โดยเข้าไปที่ Preferences -> Hotkeys -> List Current Keys


ก็จะมีรายการบอกว่าปุ่มไหนใช้ทำอะไร ส่วนการใช้งานคือเราจะต้องนำ Cursor ของเมาส์ ไปชี้ที่ Object หรืออุปกรณ์ก่อน จากนั้นกด hotkey ก็จะเป็นการกระทำคำสั่งนั้นๆ ทันทีโดยที่เราไม่ต้องคลิกเมาส์เลย
ตอนแรกอาจจะเปิดไปควบคู่กับการใช้งานก็ได้ครับ พอหลังจากเริ่มจำได้ค่อยปิดไป

ส่วนการ Pan สามารถใช้ปุ่มกดตรงกลางลูกกลิ้งของเมาส์ค้างไว้แล้วเคลื่อนที่ตำแหน่งของเมาส์
ร่วมกับการซูมเข้า-ออก ก็จะสะดวกกว่าการใช้ hotkey ครับ


- แถบซ้ายมือ เป็นเครื่องมือตั้งค่าการใช้งานของ WorkSheet
ก็จะเป็นการตั้งค่า Grid, หน่วยที่ใช้ mm/inch, ลักษณะของเคอเซอร์, เปิดปิดการแสดงผลของขาที่ซ่อนไว้ ส่วนใหญ่เป็นขาของพวก Logic Gate และ Op-Amp และสุดท้ายจะเป็นการตั้งค่ามุมการเดินของการวาดที่ใช้ Wire / Bus ในส่วนนี้ใช้การตั้งค่าเหมือนเดิมไปก่อน
- แถบขวามือ เป็นเครื่องมือที่ใช้ในการเขียนแบบวงจร เดียวจะอธิบายตามการใช้งานครับ
- แถบล่าง เป็นแถบแสดงสถานะของการทำงาน

ก่อนอื่นผมจะอธิบายการใช้งานแต่ละส่วนเบื้องต้นกันก่อนนะครับ แล้วค่อยไปทดสอบการเขียน Schematic กันต่อไปครับ

การค้นหา Library
เริ่มจากเอาอุปกรณ์ที่ต้องการมาวางก่อน โดยคลิกที่ Place component หรือกด "Shift + A" จากนั้นคลิกที่พื้นที่ว่างของ Sheet หรือกดปุ่ม "A" จะประกฏหน้าต่างให้เลือกอุปกรณ์จาก Library ที่ติดมากับโปรแกรม


เราสามารถคลิกเลือกอุปกรณ์ได้จาก
- หน้าต่างนี้โดยตรงจากการคลิกเลือกเองหรือพิมพ์ในช่อง filter เพื่อทำการค้นหาจากทุก Library
- เข้าไปเลือกกับ Library browser โดยการคลิกที่ช่องสี่เหลี่ยมล่างซ้ายของหน้าต่าง Choose Component (พื้นที่กรอบเขียว)

ของหน้าต่าง Library Browser จะประกอบด้วย 3 ส่วนคือ ช่องซ้ายมือจะเป็นชื่อของ Library ช่องที่สองถัดไปคือรายรายอุปกรณ์ของ Library นั้น ส่วนช่องสุดท้ายก็คือสัญลักษณ์หรือ Symbol เราสามารถใช้ filter เพื่อค้นหาจากหน้านี้ได้เหมือนกัน แต่ว่าจะเป็นการค้นหาภายในของแต่ละ Library

เมื่อเลือกอุปกรณ์ได้แล้ว ให้กดปุ่ม Insert component in schematic ตัวอุปกรณ์ก็จะติดมากับเมาส์ เราสามารถทำการคลิกเลือกตำแหน่งวางได้เลย จากนั้นก็วางอุปกรณ์ให้ครบตามต้องการ

การเคลื่อนย้ายตำแหน่งอุปกรณ์
KiCad ไม่สามารถลากแล้ววางแบบ Drag and drop เหมือนโปรแกรมทั่วๆ ไปได้ครับ วิธีการคือ
- ใช้ Hotkey ด้วยการนำเคอร์เซอร์ไปชี้ที่บริเวณตัวอุปกรณ์ แล้วกดปุ่ม "M" ตัวอุปกรณ์ก็จะขยับติดกับเคอร์เซอร์ จากนั้นค่อยนำไปวางที่ตำแหน่งใหม่ แบบนี้จะย้ายได้ทีละตัว (ใช้ไม่ได้กับ Wire และ Bus)
- ใช้การลากเคอร์เซอร์คลุมอุปกรณ์ที่จะย้าย จากนั้น Object ที่อยู่ภายในกรอบ จะขยับติดกับเมาส์มาโดยอัตโนมัติ จากนั้นค่อยคลิกวางที่ตำแหน่งใหม่ แบบนี้จะย้ายได้ทีละหลายตัว

การคัดลอกตัวอุปกรณ์หรือการ Copy
ไม่สามารถทำการกดปุ่ม "Ctrl+C" แล้ว "Ctrl+V" ได้ แต่จะใช้ Hotkey เหมือนกับการย้ายตำแหน่งอุปกรณ์ ดังนี้
- Copy ทีละตัว ให้เคอร์เซอร์ชี้ไปที่บริเวณตัวอุปกรณ์จากนั้นกดปุ่ม "C" จะเห็นว่าตัวอุปกรณ์จะติดตามเคอร์เซอร์เพิ่มมา และสามารถคลิกวางตามต้องการได้
- Block copy ทำได้โดยกดปุ่ม "Shift" ค้างไว้ แล้วทำการลากคลุมบริเวณที่ต้องการจะ copy จากนั้นอุปกรณ์ทั้งหมดที่อยู่ในกรอบก็จะถูก copy ขึ้นมา และสามารถคลิกวางตามตำแหน่งที่ต้องการได้

การลบตัวอุปกรณ์ออก
ก็จะทำคล้ายๆ กับการย้ายและการ copy ดังนี้
- ลบทีละตัว นำเคอร์เซอร์ไปชี้ที่บริเวณตัวอุปกรณ์จากนั้นกดปุ่ม "Delete"
- ลบทั้งบล็อค โดยการกด "Ctrl+Shift" ค้างไว้ แล้วลากคลุมบริเวณที่ต้องการลบ

การเชื่อมต่อสัญญาณไฟฟ้าหรือ Wiring
การต่อ Connection ระหว่างขาของอุปกรณ์ ทำได้โดยคลิกที่ Place wire หรือกดปุ่ม "Shift+W" แล้วค่อยทำการเชื่อมต่อทีขา หรือว่าจะกดปุ่ม "W" เพื่อเริ่มวาง Connection จุดแรกตามตำแหน่งที่เคอร์เซอร์ชี้ในขณะนั้นด้เลยทันที


ข้อควรระวัง ถ้าจุดไหนที่ wire ต่อกันอยู่ แต่ไม่มีจุด junction ขึ้นมา ให้ทำการเพิ่มจุดต่อ Junction เอง ซึ่งบางทีโปรแกรมอาจจะเข้าใจได้ว่ามันไม่ได้เชื่อมต่อกันจริงๆ ทำให้เกิดการผิดพลาดได้ โดยกดที่ Place junction หรือกดปุ่ม "Shift+J" เพื่อเลือกวางเอง หรือกดปุ่ม "J" เพื่อวางทันทีตามตำแหน่งของเคอร์เซอร์


การย้ายอุปกรณ์ที่ต่อ Wire อยู่
ถ้าต้องการย้ายตัวอุปกรณ์ที่ได้ต่อ Connection หรือ Net ไว้เรียบร้อยแล้วและต้องการให้ net ติดตามขาอุปกรณ์มาด้วย ทำได้โดย
- ย้ายทีละตัว โดยใช้ Hotkey "G" วิธีนี้สามารถใช้ย้าย Wire และ Bus ได้
- ย้ายทีละหลายตัว กด "Ctrl" ค้างไว้ แล้วคลุมรอบอุปกรณ์ที่จะย้าย จากนั้นวางที่ตำแหน่งใหม่ หรือจะเลือกคลุมก่อนก็ได้ จากนั้นค่อยกด "Tab" เพื่อย้าย ก็ได้เช่นกัน



การเพิ่ม sheet / hierarchical
การออกแบบหลาย Sheet
ถ้าหากว่าวงจรมีความซับซ้อนมากๆ เขียนภายใน Sheet เดียวได้ไม่หมด หรือต้องการแยกวงจรเป็นส่วนๆ ในแต่ละ Sheet เพื่อความเป็นระเบียบ ให้คลิกที่ Create hierarchical sheet หรือกด "Shift+S" หรือ "S" จากนั้นให้ตีกรอบวาด Sheet ใหม่ ภายใน Sheet ปัจจุบัน จากนั้นตั้งชื่อ File name, Sheet name ตามต้องการ


เนื่องจากว่า Eeshema ไม่รองรับการทำงานหลาย Sheet พร้อมๆ กันได้ การเขียนวงจรหรือเขียน Schematic จึงทำได้เพียงทีละ Sheet โดยจะเป็นลักษณะการวาง sheet เล็กไว้บน sheet หลัก สามารถวางซ้อนกันไปได้เรื่อยๆ คล้ายกับการวางโฟลเดอร์บน Windows โดยจะมี Sheet หลักที่โปรแกรมสร้างให้ตอนเปิดครั้งแรก หรือ Sheet ที่อยู่ในชั้นบนสุด เรียกว่า "Root" การจะดูว่าเราทำงานที่ Sheet ไหนอยู่ให้สังเกตุตรงช่อง Sheet: ตรงมุมขวาล่าง ถ้าเป็น Root sheet จะเป็นเครื่องหมาย "/" ส่วน sheet อื่นก็จะเป็นไปตามที่เราตั้งชื่อไว้ เราสามารถกด Navigate schematic hierarchical เพื่อดูภาพรวมของ Sheet ทั้งหมด หรือดับเบิ้ลคลิกเพื่อเข้าไปทำงานกับ Sheet นั้นได้เลย



การสร้าง Connection ของ hierarchical sheet
ภายใน sheet ย่อย ให้กด Place a hierarchical label หรือกด "Shift+H" หรือ "H" จากนั้นตั้งชื่อ เพื่อสร้างจุดต่อออกไปนอก sheet


กลับไปที่ sheet ก่อนหน้า โดยกดที่ Leave sheet หรือกด "Alt+BackSpace"
คลิกที่ Import hierarchical label จากนั้นไปคลิกที่บริเวณในกรอบ hierarchical sheet ก็จะปรากฎชื่อของ hierarchical label ที่เราตั้งไวใน sheet โผล่มา เราสามารถนำไปวางได้เฉพาะขอบซ้ายและขวาเท่านั้น จุดต่อนี้เราสามารถใช้ Wire ไปต่อกับส่วนอื่นๆ ได้เหมือนขาอุปกรณ์ทั่วไป


การต่อ connection โดยการใช้ label
- การใช้ Net name-local label จะใช้ต่อเฉพาะภายใน sheet เดียวกันเท่านั้น ไม่สามารถใช้ต่อข้าม sheet ได้
- Global label สามารถเชื่อมต่อถึงกันได้หมดทุก sheet

หัวข้อต่อไปครับ >>
/ schematic
/ erc
/ power flag
/ netlist


ขอบคุณทุกท่านที่เข้ามาอ่านครับ กระทู้แรกในชีวิต อยากแชร์วิธีการใช้โปรแกรมดีๆ ตัวนึงครับ
ผิดพลาดประการใด ก็ขออภัยครับ