millwood0 发表于 2011-5-6 21:55:17

mcu-based device tester

I decided to build a tester for myself that will help identify 3-terminal devices and then based on the device type identified, perform some rudimentary tests on the device.

what I am going to post below is my development process. As the project is still a work-in-process, it will be messy and change from time to time.

millwood0 发表于 2011-5-6 22:01:08

the hardware design is in part based on the elektor design. the code is entirely new.

the basic requirement for the mcu is that 1) it has to have adc capabilities; and 2) it drives a display device (a 16x2 device here). the code is designed to be entirely portable so the user can plug in their own adc / display routines and the code should then work on their specific hardware.

millwood0 发表于 2011-5-6 22:02:25

the first difficulty is testing an unknown device is that you have to identify the device.

how do we do that?

simple: we are going to connect the device to various power sources and see if there is a current float.

millwood0 发表于 2011-5-6 22:09:25

here is how we are going to do it.

Q2 is our DUT - in this case, it is a npn transistor.

for each terminal, we have three lines into it.

ADCP0/1/2: where we perform an ADC, or to pull that pin to GND;
CHG0/1/2_LOW: a low-resistance power source that we use to either connect to Vcc, GND, or float.
CHG0/1/2_HI: notyet used - see later.


http://cache.amobbs.com/bbs_upload782111/files_39/ourdev_637713ICHGE5.PNG
(原文件名:tester 1.PNG)

at the beginning of any test, all pins are reset to input mode.

for any given test, I will power up one terminal to Vcc (via CHGx_LO). we will then connect one of the ADCPx pins to GND, and the 3rd terminal will be left float (hiz), connect to Vcc/GND via CHGx_LO.

so we have three sets of tests -

0: the 3rd pin float;
1: the 3rd pin to Vcc;
2: the 3rd pin to GND.

millwood0 发表于 2011-5-6 23:00:38

let's take the first test for example - the 3rd pin is float.

in this case, we need to power up simply one pin and see if there is current flow.

let's say that we power up CHG0_LOW, and ground ADCP2, and float CHG1_LO. we will then perform an adc on ADCP0.

if ADCP0 is somewhere between Vcc and GND, we know that current is flowing through CHG0_LOW.

I decided to use a threshold voltage of 200mv. thus if ADCP0's voltage is above 200mv and less than 5000mv-200mv, we consider there is a current flow.

200mv was chosen so that we can test schottky diodes too.

the figure is user-configurable in the code.

millwood0 发表于 2011-5-6 23:04:18

here is the application code:


点击此处下载 ourdev_637725IYMHC4.rar(文件大小:22K) (原文件名:usb1286_device_tester.rar)


the application code is entirely in main.c. we then have to modules, adc.c and lcd_4bit.c to handle adc and lcd related routines.

millwood0 发表于 2011-5-6 23:11:00

here is the schematic:

http://cache.amobbs.com/bbs_upload782111/files_39/ourdev_637727V7B551.PNG
(原文件名:tester 2.PNG)


developing the device database is really simple: you put the device on the tester. the first time it is on, the system will say that it is an unknown device and give you a device ID.

you then go to main.c, modify device_str[] to include the correct device name - in this case, I call it "1-Diode:-a-k", indicating that the 1st connector isn't connected, and anode is connected to the 2nd connector, and cathode to the 3rd connector.

you then add the device id to the switch-case statement and recompile the code and the device will be correctly identified.

http://cache.amobbs.com/bbs_upload782111/files_39/ourdev_637731DS5ZQM.PNG
(原文件名:tester 3.PNG)

iamseer 发表于 2011-5-6 23:18:28

mark

millwood0 发表于 2011-5-6 23:22:18

here is the tester recognizing a dual-diode:


http://cache.amobbs.com/bbs_upload782111/files_39/ourdev_637733AR5UE8.PNG
(原文件名:tester 4.PNG)


basically, you just use the tester itself is able to learn from its own results and expands its database. kind like using a C compiler to add C libraries to expand the C compiler.

JQ_Lin 发表于 2011-5-8 21:18:17

顶楼主 millwood !
顶 mcu-based device tester !
页: [1]
查看完整版本: mcu-based device tester