Tuesday, September 3, 2013

USB Sound Card based on PCM2706 chip

Updated(16/02/2021): Added a PCB image file and Eagle CAD file.
 
    ในยุคที่คอมพิวเตอร์โน็ตบุ๊คเข้ามาแทนที่คอมพิวเตอร์แบบตั้งโต๊ะ  การจะต่อ DAC เข้ากับเครื่องเพื่อมเพิ่มคุณภาพเสียงก็คงต้องอาศัย DAC ที่สามารถรองรับ USB ได้เท่านั้น ในวันนี้เราจะทำ Sound Card USB ที่สามารถส่งสัญญาณแบบ S/PDIF ได้ และสามารถใช้เป็น Sound Card เสียบหูฟังได้ในตัวได้ด้วย โดย Chip Burr-Brown PCM2706 ที่เลือกใช้ในวันนี้เป็น Chip ที่สามารถใช้งานได้ง่ายเนื่องจากใช้อุปกรณ์ภายนอกน้อย และไม่ต้องใช้ Driver ในการติดตั้งอีกด้วย

     Nowadays Portable computers are increasing in popularity over a Desktop Computer. So to connect a higher quality audio DAC we would be left with the only choice the USB interface.
     This project is simple to make a USB Sound Card with adequate quality for Laptop use. While also provide S/PDIF Coaxial Output for connection to a higher quality External DAC. The Burr-Brown PCM2706 was selected because of a minimal external component and not requiring drivers.

วงจรที่ใช้ในโปรเจ็กนี้เป็นวงจรที่ดัดแปลงมาจากวงจรใน Datasheet.

Circuit use in this project is derivative from a Datasheet Circuit with only a few minor changes.   


สำหรับแผ่น PCB ในโปรเจ็กนี้ออกแบบด้วยโปรแกรม Eagle โดยเป็นแผ่น PCB แบบด้านเดียว เพื่อให้ง่ายต่อการสร้าง

I use Eagle for my PCB designing. This is a single-sided PCB since we gonna use a home-made laser toner-transfer method.

ไฟล์ PCB ความละเอียด 1200 dpi.

This PCB image is 1200 dpi.

Download PCB and EagleCAD files.



ทำการพิมพ์ลายปริ้นลงบนแผ่นฟิล์มแล้วรีดติดลงบนแผ่นทองแดงที่เตรียมไว้

The Laser Toner has been printed to a waxed paper and then heat-transferred to a copper PCB.



สำหรับน้ำยากัดปริ้นในรูปเป็นน้ำยาสูตรทำเอง ซึ่งเป็นส่วนผสมระหว่าง เป็ดม่วง กับ ไฮโดรเจนเพอออกไซด์ ซึ่งในสูตรนี้ยังไม่สมบูรณ์แบบเท่าใหร่เนื่องจากมีอัตราการกัดที่เร็วเกินไปทำให้ควบคุมได้ยาก อาจจะต้องลดปริมาณไฮโดรเจนลงซักหน่อย

Etching in a home-brew etching solution made of bathroom cleaner (HCl) and Hydrogen Peroxide (H2O2). Not a very perfect etching formula since it eating copper too fast to be controlled. May have too much H2O2.



แผ่นปริ้นที่เสร็จแล้ว  -  The finished PCB.


ตัว Sound Card ที่เสร็จแล้ว  -  Completed Sound Card.

 ด้านหลัง  -  Backside.





การทดสอบ  -  Testing

บน Windows 7 ใช้ได้   -   On Windows7 Passed.



บน Mac OSX (Mountain Lion) ใช้ได้  -  On Mac OSX (Mountain Lion) Passed.


ทดสอบการเล่นแบบ Bit-perfect โดยใช้ไฟล์ dts_the_other_side_44khz บนโปรแกรม foobar แบบ WASAPI ผ่านพอร์ต S/PDIF ผ่าน

 Bit-perfect test using dts_the_other_side_44khz played on foobar via WASAPI through S/PDIF Passed.


ทดสอบประสิทธิภาพ  -  Performance Testing.

    ในขั้นตอนนี้เราจะทดสอบ Sound Card ที่ทำเสร็จด้วยโปรแกรม RMAA เพื่อ วัดคุณสมบัติทางเทคนิกต่างๆ เช่น การตอบสนองความถี่, ความเพี้ยน, สัญญาณรบกวน เป็นต้น โดยการทดสอบนี้อาจไม่แม่นยำนักเนื่องจากการทดสอบทำบน Sound Card ธรรมดา(X-Fi Xtreme Music) ส่วนผลการทดสอบในส่วนของ Sound Bluster Play มีใว้เพื่อการอ้างอิงเท่านั้น โดย Sound Card ทั้งสองรองรับสัญญาณได้ถึง 48 KHz 16 bit แต่ในการทดสอบนี้จะทำที่ 44.1 KHz

    We will test our home-brew sound card with RMAA measurement software to evaluate its Frequency Response,  THD, Noise level through the noise-related measurement may not be very accurate since I use a computer sound card for measurement (Testing hardware: X-Fi Xtreme Music). The Sound Bluster Play result is for reference only. Both sound cards support up to 48 kHz 16 bit. But in this test, I will use 44.1 kHz.



  ผลการตอบสนองความถี่ ที่ 44.1 kHz 16 bit.  -  Frequency response at 44.1 kHz 16 bit.



ผลการทดสอบ  -  RMAA Result.



สรุป  -  Conclusion
    จากผลการทดสอบ Sound Card นี้ถึอว่ามีคุณภาพที่ใช้ได้ดีในระดับหนึ่ง แต่แน่นอนว่าด้วยงบประมาณและความเรียบง่ายของระบบแล้วคงไม่ต้องเทียบกับ Card ระดับ audiophile แน่นอน  นอกจากนี้ยังสามารถใช้เป็นพอร์ต S/PDIF เพื่อใช้เชื่อมต่อกับ DAC ที่มีคุณภาพดีกว่าได้อีกด้วย
    และด้วยอุปกรณ์เสริม Camera Connection Kit เครื่องนี้สามารถต่อเข้ากับอุปกรณ์ IOS Device ได้อีกด้วย (ทดสอบกับ IPAD2)
    ข้อจำกัดของเครื่องนี้คือสามารถรอบรับ Sampling Rate ได้ไม่เกิน 48 KHz ที่ 16 bit เท่านั้น เนื่องจากเป็นข้อจำกัดของตัว Chip ที่ใช้

    This USB Sound Card sound quality is a good performer with decent sound quality. It still definitely not an audiophile kind of card. But consider that It simplistic construction and a driver-free cross-platform operation. It is nice to have a portable sound card. With a S/PDIF output for connection to a higher quality, dedicated external DAC.
    With the addition of the Camera Connection Kit, this unit can also connect the IOS Device (tested on IPAD2).
     A current limitation of this unit is the maximum sampling rate is limited to 48 kHz at 16 bit only due to the the chip limitation.











Monday, July 15, 2013

Turbocharging an old Air Conditioner Mod (Quick fix)


    แอร์เก่าเป็นน้ำแข็ง, กินไฟ, ไม่เย็น ล้างแอร์แล้วก็ยังไม่หาย ถ้ายังไม่อยากเปลี่ยนแอร์ใหม่ และมีพัดลมคอมพิวเตอร์ขนาด 12 V เหลือๆอยู่เป็นจำนวนมากแล้ว นี้อาจเป็นทางแก้ (ชั่วคราว) ที่ทำให้แอร์เก่ากลับมาเย็นได้
    โดยการนำพัดลม 12V ขนาด 8 cm ผูกติดกันด้วยลวดรัดสายไฟ ประมาณ 6 ตัวขึ้นไป นำสายไฟมาต่อขนานกันแล้วต่อเข้ากับแหล่งจ่ายไฟขนาด 12V ใกล้เคียง (เช่น PC) ที่มีกระแสเหลือเพียงพอ (ขึ้นอยู่กับพัดลมที่ใช้)  แต่จำไว้ว่าวิธีการนี้ไม่ใช้การแก้ปัญหา แต่เป็นแค่การแก้ชั่วคราวเพื่อให้แอร์เก่ากลับมาทำการได้ดีขึ้นเท่านั้น ถ้าเครื่องแอร์เก่ามากหรือมีปัญหาอื่นๆอยู่ วิธีนี้ก็อาจจะช่วยอะไรไม่ได้มากนัก เพราะเราแค่ทำให้การไหลเวียนอากาศภายในเครื่องดีขึ้นเท่านั้น

    Air Conditioner frosting problem? With some of the old 12v PC Fan laying around
you could mod them into a turbo for your old air conditioner.  By packing around
6 or more 8 cm 12v fan salvaged from the old PSU and tired them together with a
cable tie, wire them in parallel, and connect it to any available 12v power source with an adequate current.
    But remember this is just a temporary quick relief. If your air conditioner is very old or has any underlying problem this unit will not fix it. It just pushes air through it faster.



    การติดตั้งสามารถทำได้โดยการแขวนไว้กับหน้ากากแอร์ โดยใช้ลวดมัดสายไฟอีกเช่นเคย

    Installation can be made by a cable tiring it to an AC fin. 



    ระบบนี้มีพัดลม 8 ตัว ใช้กระแสประมาณ 1.5 A   

    This circuit consumes about 1.5 amps while operating.


    นี้เป็นเครื่องจ่ายไฟที่ใช้ในการทดสอบ เป็นเครื่องขนาด 12V 5A (เกินไปหน่อยนึง)
    12v Power supply used in this experiment. This is a 5 Amp supply (a little bit too large)

     ก่อนการทดลองปัญหาของแอร์เครื่องนี้คือเป็นน้ำแข็งเกาะตลอด แม้ว่าจะล้างแล้วก็ตาม เนื่องจากแอร์เครื่องนี้ค่อนข้างเก่า (20 ปี) ทำให้การทำความเย็นไม่มีประสิทธิภาพเท่าที่ควร หลังจากติดตั้งระบบนี้ ปัญหาเรื่องน้ำแข็งเกาะก็หายไปทำให้เครื่องทำความเย็นได้ดีขึ้น และน่าจะประหยัดไฟขึ้น(หรือเปล่า) อย่างน้อยก็เป็นการแก้ปัญหาชั่วคราวจนกว่าจะเปลี่ยนเครื่องใหม่แล้วกัน

Result:

    Before installing this unit the air conditioner in question was very old (around 20 years aged) and always suffered from frosting on the cooling coil even after cleaning. And because of the restricted airflow. Doesn't cool the room right.  After installing this unit the frosting was gone away and the air conditioner was working as it was meant to be. Pretty cool? isn't it. At least we got a cool room before a replacement. 

Thursday, June 13, 2013

USB Cat5e Extension Cable Mod

     ใครที่เคยใช้สายต่อ USB หรือ USB Extension Cable เป็นประจำ โดยเฉพาะสายราคาถูกคงเคยเจอปัญหาสายขาดใน หรือสัญญาณติดๆ หลูดๆ กันบ้าง  สำหรับในวันนี้เราจะแสดงเปลี่ยนสาย USB เดิมเป็นสาย Cat5e ที่ใช้เดินสาย LAN แทน  เนื่องจากเป็นสาย Twisted Pair ที่มีคุณภาพดีและมีความคงทนอีกด้วย หรือใครจะลองใช้แบบ STP ที่มี Shield ด้วยก็น่าจะดียิ่งขึ้น

อุปกรณ์ที่ต้องใช้
  • หัวแร้ง + ตะกั่ว
  • คัตเตอร์ปากกา หรีอคัตเตอร์คมๆ
  • ไขควงแบน
  • สว่านไฟฟ้า และดอกสว่าน
  • สาย Lan Cat5e ความยาวตามต้องการ

    USB Extension Cable is a very useful cable for many places like Home Theater PC or while working on-site. But such cable (especially the cheapest one) suffered from the major problem - They frequently broken because of the very thin copper wiring inside are prone to be broken.  First, it causes a spontaneous disconnection. Then it may not work at all.  This mod will replace it with a more durable Cat5e Ethernet Cable.  I use UTP(Unshielded) version but a Shield STP Cable would be better at interference resistance.

Tool and Material Required
  • Soldering Iron + Soldering Wire
  • Pen-style cutter or a sharp ordinary cutter.
  • Flat-head screwdriver.
  • Electric Drill and a Drillbit.
  • A Cat5e Ethernet Cable of the desired length.

   ขั้นตอนแรกให้ใช้คัตเตอร์ปากกา เสียบเข้าไปตามตำแหน่งดังรูป เพื่อตัดสายไฟด้านในที่ต่อเข้ากับหัว USB ให้ขาดออก  เพื่อเราจะได้ถอดหัว USB ออกได้


  To remove a metallic USB connector from a plastic boot. First, we have to cut the internal wiring by pushing a pen-style cutter through a USB head at the red line position in the above picture.

     เสียบคัตเตอร์ปากกาเข้าไปให้สุด

     Push the cutter all the way through.


     จากนั้นใช้ไขควงแบบแซกเข้าไปรอบๆ หัว USB ที่เป็นโลหะเพื่อให้หลวมพอที่จะงัดออกมาได้


     Then use a flat-head screwdriver to loosen the plastic boot around the metallic connector.


    ดึงหัว USB ที่เป็นโลหะออกมา

    Pull the metallic USB connector out.


    จะเห็นว่าด้านในของหัวจะมีพลาสติกอุดอยู่  เราจะต้องเจาะมันออกเพื่อให้มีที่พอสำหรับสายใหม่


    You will found that an internal cavity is also plugged with plastic. We have to drill this plastic out to make a room for a new cable.


    ให้ตัดสายด้านหลังของหัว USB ให้ชิด แล้วใช้สว่านทะลวงผ่านดังรูป

    Cut the old cable as close as possible to the plastic boot. Then use an electric drill to drill out the remaining.


     อันนี้คือสายเดิม  จะสังเกดได้ว่าตัวนำ(ทองแดง?) มีขนาดเล็กและเปราะบางมาก  และไม่มีการ Shield ใดๆเลย

    This is the old problematic cable. You can see that it has no shielding at all. And the wiring has a very thin copper.

   
    นี้คือสายที่เราจะใช้เปลี่ยน

    This is our new cable.


    รอยสายผ่านปลอกที่เราทะลวงเรียบร้อยแล้ว และทำการบักกรีเข้ากับหัว USB

    Route the new cable through the drilled plastic boot and solder it to a USB Connector.


     ลำดับการเชื่อมสายจะเป็นดังนี้
  • USB +5V  ->  ส้ม + ขาวส้ม
  • USB Data(-)  ->  ขาวเขียว
  • USB Data(+) ->  เขียว
  • USB Ground ->  ฟ้า + ขาวฟ้า
  • ปลอก -> น้ำตาล + ขาวน้ำตาล (หรือ Shield ของสาย STP)
     จากนนั้นทำการประกอบปลอกพลาสติกกลับเข้าที่  และทำซ้ำกับหัวอีกด้านหนึ่งก็เป็นอันเสร็จสิ้น  หากต้องการความเรียบร้อยสามารถใช้กาวหรือหัวแร้งเชื่อมรอยเจาะให้ปิดสนิดได้.

     Soldering diagram
  • USB +5V  ->  Orange + Orange stripped White.
  • USB Data(-)  ->  Green stripped White.
  • USB Data(+)  ->  Green
  • USB Ground  ->  Blue + Blue stripped White.
  • Metallic Connector  ->  Brown + Brown stripped White. (Or cable shield for STP Cable)
     Put the plastic boot back in place.  Then repeat the procedure for the other end and that's it.
     For decorative you can glue or weld(with soldering iron) the incision together.  


ผลการทดสอบ
Result




     หลังจากที่ได้ทดลองใช้สายนี้ดูแล้วก็พบว่าสามารถใช้งานได้ดี  รองรับ USB 2.0 ได้  หลังจากผ่านมาแล้วกว่า 1 ปี สายเส้นนี้ก็ยังสามารถใช้งานได้ดีอยู่เหมือนเดิมครับ

    The result was very impressive. The cable works the way it should. I've been using this cable for over a year and it still remains the same. And yes it's USB 2.0 support.





Tuesday, May 7, 2013

ESR Meter (Capacitor Tester)




     เครื่องวัด ESR Meter นี้เป็นเครื่องมือที่ใช้ในการทดสอบ ตัวเก็บประจุ (Capacitor) ว่าเสียหรือไม่ โดยการวัดค่าความต้านทานภายในของ C นั้นๆ มีหน่วยเป็น Ohm ซึ่งจะแตกต่างกับ Ohm Meter ปกติที่จะวัดความต้านทานด้วยไฟกระแสตรง (DC) แต่เครื่องนี้จะวัดความต้านทานโดยใช้ไฟกระแสสลับ (AC) ความถี่ประมาณ 50 KHz ที่มีแรงดันต่ำ ทำให้สามารถใช้ตรวจสอบ C บนอุปกรณ์เช่น Main board และ Power Supply ได้โดยไม่ต้องถอด C ออกมาทดสอบ
     C ปกติจะอ่านค่า ESR ได้ต่ำมาก (ใกล้เคียง 0) โดยการเทียบค่าความต้านทานที่อ่านได้กับค่าในตาราง  ถ้าค่าที่อ่านได้สูงกว่าก็แสดงว่า C ตัวนั้นเสียนั้นเองครับ

     ESR Meter is an essential tool for testing a Capacitor in the circuit when debugging a circuit with a large number of capacitors like a Computer Mainboard, Power Supply, and more.
     ESR Meter measures a series impedance of a capacitor reading in Ohm similar to an Ohm meter. But an Ohm meter is measuring a resistance in DC which is unsuitable for capacitor measurement. An ESR Meter is using a low-voltage ~ 50 kHz AC for measurement.
      The normal Capacitor ESR reading is near the shorted circuit. By comparing a measured value with the value on a table we can identify a failed capacitor easily.

 

Update(16/02/2021): Added PCB and DesignSpark PCB downloads.

Download PCB and DesignSpark PCB CAD files

Note: In this PCB the IC 78L05 needs to be install flipped like the photo below.



วงจรของ ESR Meter (ดัดแปลงจากที่นี้)
Circuit Diagram of ESR Meter (Modified version of this circuit)


วงจรในขั้นทดลอง
The testing circuit on the Breadboard.


รูปคลื่นที่ใช้ในการวัดค่า ESR
The waveform of ESR Measuring signal.


ลิ้งดาวโหลด

Download PCB and DesignSpark PCB CAD files

แผ่น PCB ที่ทำด้วยวิธี Toner Transfer ครับ
ลายวงจรนี้มีข้อผิดอยู่นิดนึงคือ IC 78L05 ต้องใส่กลับด้าน ตามรูปด้านล่างนะครับ

Homemade PCB using a Toner Transfer Technique.
This PCB has some library flaw that the IC 78L05 needs to be install flipped like the photo below.


 สำหรับหม้อแปลงที่ใช้นั้นเป็นหม้อแปลงจาก Power Supply เก่าครับ

The transformer used in this circuit came from an old ATX computer power supply.


     ทำการทดสอบเครื่องโดยต่อสายวัดทั้งสองเส้นเข้าด้วยกันแล้วปรับปุ่ม Zero Adjust ให้เข็มอ่านได้เต็มหน้าปัด (100 uA) แล้วทดสอบกับ R ค่าต่างๆ จากนั้นจดค่าที่อ่านได้บนหน้าปัดและค่า R ที่วัดไว้เป็นตารางเพื่อใช้ในการออกแบบหน้าปัดต่อไป

     Test the meter by connecting the test lead together and adjusting the Zero Adjust Knob till the meter reading full scale (100 uA) and test measuring a resistor of various value and note the uA reading in a table for scale plotting.



  
    แกะหน้าปัดของ Amp Meter มา Scan เพื่อเป็นแบบในการวาดหน้าปัดใหม่ แล้วทำการวาด Scale ตามที่ได้จดไว้ โดยถ้าต้องการความละเอียดอาจจะต้องนำค่าไป Interpolated เพื่อให้ได้ค่าที่ละเอียดขึ้น ในตัวอย่านี้ใช้ MS Excel ทำ Interpolation ครับ

     Remove the Amp Meter scale and scan as a pattern for drawing a new ESR Meter scale by using the plotted data.  If a high resolution is required then use an Interpolation. In this prototype, I use MS Excel Interpolation.


หน้าปัดที่ใช้ในเครื่องต้นแบบ
Example of the completed meter scale.
(ซ้าย) หน้าปัดที่เพิ่งทำเสร็จ  (ขวา) หน้าปัดเดิม

(Left) New ESR Meter scale vs  (Right) Original Amp Meter scale.



  
ทำการติดตั้งหน้าปัดใหม่เข้าไปแทนที่หน้าปัดเดิม

Installing a new meter scale.



 ตารางอ้างอิงค่า ESR ที่ควรจะเป็นสำหรับ C ค่าต่างๆ

Table of ESR Value for a normal capacitor.


 

หน้าตาของเครื่องต้นแบบที่เสร็จสมบูรณ์

Finished prototype ESR Meter.


อ้างอิง
Reference
http://www.ludens.cl/Electron/esr/esr.html