Re: Dangerous component/part tester
Reply #79 –
Arup you totally inspired me. I made an inaccurate but highly repeatable cap measurer with the Bus Pirate :) I'll have it in a video tomorrow.
I started to bread board something up, but then decided it was easier to try with the Bus Pirate. You can try it to with the attached firmware.
I used AUX and CLK.
BP AUX->100K resistor->cap + pin
BP CLK->20R resistor->cap + pin
BP GND->cap - pin
Use the attached firmware. The f function has been modified to measure capacitance and report A) clock ticks, and B) estimated value based on X/1480. In reality the divisor is 33% too large due to breadboard capacitance. 1uF-100uF are 33% off. at 100nF it is spot on. What is super amazing is how repeatable it is. Every time the same number of ticks.
What happens:
Setup 32 bit timer
ground the + side of the cap with both pins
flip the 20R pin input
flip the 100K pin high to charge the cap
wait until 20R input is high, then stop timer
The count varies by capacitance.
It seems highly subject to reply on pin thresholds to determine the charge level. ADCs are too slow. I think a comparator with 2.5volt reference would be perfect for most parts. You could them even charge a big cap at high current with a PNP.
The 100uF takes seconds to measure. I think a good part of the autoranging is a timout that moves to a smaller R value charging resistor if the small values take too long.
I wonder how much calibration can be done with a couple precision resistors on board, and a short to measure spare capacitance.
I used a breadboard so there is significant base capacitance. I followed the superprobe model (the source suggest time for spare capacitance). Arup's variable R is probably better for autoranging, but harder to calibrate.
All I did in the source was replace bpFreq(void):
void bpFreq(void){
static unsigned int j,k;
unsigned long l;
if(AUXmode==AUX_PWM){
//bpWline(OUMSG_AUX_FREQ_PWM);
BPMSG1037;
return;
}
//R100K is CLK
//R20 is AUX
//bpWstring(OUMSG_AUX_FREQCOUNT);
BPMSG1038;
//setup timer
T4CON=0; //make sure the counters are off
//timer 4 internal, measures interval
TMR5=0x00;
TMR4=0x00;
T4CON=0b1000; //.T32=1, bit 3
PR5=0xFFFF;//most significant word
PR4=0xFFFF;//least significant word
IFS1bits.T5IF=0;//clear interrupt flag
//setup pins
//R100K=output;
IODIR&=(~CLK);
//R100K=grouind;
IOLAT&=(~CLK);
//R20=output
IODIR&=(~AUX);
//R20=ground;
IOLAT&=(~AUX);
bpDelayMS(500);
//R20=input
IODIR|=(AUX);
//R100K=high;
IOLAT|=(CLK);
//start timer4
T4CONbits.TON=1;
//wait R20
while(BP_AUX==0);
//stop timer
T4CONbits.TON=0;
//spit out 32bit value
j=TMR4;
k=TMR5HLD;
l=k;
l<<=16;
l+=j;
bpWlongdecf(l); // this function uses comma's to seperate thousands.
bpWstring(" ticks");
bpWBR;
l=l/1480;
bpWlongdecf(l); // this function uses comma's to seperate thousands.
bpWstring(" nF");
bpWBR;
//setup pins
//R100K=output;
IODIR&=(~CLK);
//R100K=grouind;
IOLAT&=(~CLK);
//R20=output
IODIR&=(~AUX);
//R20=ground;
IOLAT&=(~AUX);
bpDelayMS(500);
T4CON=0; //make sure the counters are off
}