#garfield Logs
Jan 18 2023
#garfield Calendar
01:04 PM aandrew: so weird. I built a stupid/shitty mohm meter using an arduino and ads1115 quad differential adc
01:14 PM aandrew: basically I use four port pins with current limit resistors to drive one end, and another four with resistors on the other end
01:14 PM aandrew: A ---/\/\/--- X ---/\/\/--- B
01:14 PM aandrew: AX = my 10.0, 0.1%, 15ppm reference resistor and BX is my unknown resistor. ADC channel 0-1 connected to AX through 1k resistors, and 2-3 connected to BX the same way
01:14 PM aandrew: so I set the pins so that A = +, B = - and measure the voltage across AX and BX 64 times, then flip polarity so A is - and B is + and do the same thing
01:14 PM aandrew: (basically chopper stabilized amp)
01:30 PM polprog: rue_mohr: good call, it makes sense for a 741
01:30 PM polprog: tho isnt a 741 smaller?
01:30 PM polprog: Anyway, rue_mohr do you have the original cooley-tukey paper somewhere? Or some copy of the fortran code?
01:32 PM polprog: I cruised the library today and took some more books that were liquidated, including a book about doing physical calculations on a polish microcomputer in a BASIC variant
01:32 PM polprog: the book lists a lot of numerical method algorhithms and one is "Finding a fourier series of a function" which is DFT
01:32 PM polprog: they do not use the word fourier transform
01:53 PM aandrew: hah
01:53 PM aandrew: Vr = ADS1115read(ADS1115_CH01, PGAr);
01:53 PM aandrew: Vx = ADS1115read(ADS1115_CH23, PGAx);
01:53 PM aandrew: Rn = fabsf(Vx/Vr);
01:53 PM aandrew: printf("%hhd.%hhd: + Vr/Vx: %ld/%ld, Rn: %ld\n", i, j, lroundf(fabsf(Vr * 1000.0f)), lroundf(fabsf(Vx * 1000.0f)), lroundf(Rn * 1000.0f));
01:54 PM aandrew: 1.42: - Vr/Vx: 627/1500, Rn: 2391
01:54 PM aandrew: 1500/627 is *not* 2391
01:58 PM polprog: huh
02:04 PM aandrew: er wait, maybe it's just my formatting
02:04 PM aandrew: 1500/627 is 2.391
02:05 PM aandrew: yeah I think that's all it is, fuck
02:05 PM aandrew: the ADC value is wrong, is it because the PGA is wrong then
03:01 PM rue_mohr: polprog, they liked to do 14 pin versions of chips, I do recall a 14pin layout for a lm741
03:01 PM polprog: ohh
03:01 PM rue_mohr: polprog, http://ruemohr.org/~ircjunk/programming/FOUR1.txt
03:02 PM rue_mohr: I think the typo was origional so I kept it
03:02 PM polprog: good
03:02 PM polprog: i will compare it with the book code but the book code is already shorter
03:03 PM rue_mohr: the other alg they mention, is MUCH longer
03:04 PM rue_mohr: aandrew, what processor?
03:05 PM aandrew: atmega328p
03:05 PM aandrew: found the bug
03:05 PM aandrew: it was hardware
03:05 PM rue_mohr: so what was the math error then?
03:05 PM aandrew: I guess one of hte connections on the ads1115 module side (not my board side) wasn't great. reflowed it and now it's working exactly as expected
03:06 PM rue_mohr: ah
03:06 PM aandrew: my good 100W, 10Gbps USB C cable is roughly 50mOhms (the little USBC connector boards I have each have about 15mOhm from the connector to the headers)
03:07 PM aandrew: this shitty little 0.3m C-A cable is 200mOhm by comparison
03:07 PM aandrew: oh that 100W cable is 2m as well
03:07 PM aandrew: the usb-c connectors state 30mohm/contact and there are four VBUS and four GND, so 15mOhm from cable to header isn't bad
03:08 PM rue_mohr: you know you could use my in circuit cap tester for that right?
03:08 PM rue_mohr: oh you had that one melt!
03:08 PM aandrew: gotta insert a cable a hundred times and see what real world use falls to
03:08 PM aandrew: yeah
03:08 PM rue_mohr: right
03:08 PM aandrew: yes an ESR meter would work pretty good for this
03:09 PM rue_mohr: haha
03:09 PM rue_mohr: I had the mirror tilt all the way back during the rain storms
03:09 PM rue_mohr: its all cleaned off
03:09 PM rue_mohr: but still no light to reflect
03:10 PM rue_mohr: I'm quite impressed its still working so well
03:11 PM aandrew: nice
03:11 PM aandrew: I'm pretty impressed with this circuit even if it does feel like cheating
03:11 PM aandrew: oh there was another issue
03:11 PM rue_mohr: :]
03:12 PM aandrew: I used 30 ohm series resistors on each of the GPIOs to limit current and share
03:12 PM aandrew: the 328p can drive 40mA/pin up to 200mA total
03:13 PM aandrew: 5/30 is not less than 0.04
03:13 PM aandrew: er 5/60 I mean
03:13 PM rue_mohr: its diving the current direct?
03:13 PM aandrew: yes
03:13 PM rue_mohr: I have to go pack away from hydraulic cylinders I got from the hospital, biab
03:13 PM aandrew: I drive one direction, measure Rref/Runk 64 times, flip polarity and do it again, and do that 4 times
03:14 PM aandrew: so I was driving it too hard and likely causing the voltage/current to sag like crazy, throwing everything off
03:15 PM aandrew: so after fixing that, the readings stabilized but the unknown resistance was always 20R minimum
03:15 PM aandrew: if I put a 10R as Runk, then Runk was measured as 30R
03:15 PM aandrew: makes a lot of sense that a bad poor could do that
03:15 PM aandrew: once I reflowed the pins on the ads1115 module, everything started making a lot more sense
03:16 PM rue_mohr: hmnm
03:16 PM rue_mohr: H9110 I think
03:16 PM rue_mohr: maybe L9110
03:17 PM rue_mohr: 8 pin, H driver
03:22 PM polprog: The algorhitm is not identical
03:23 PM polprog: the CT is faster but bound that N=2**k
03:36 PM polprog: https://dl.acm.org/doi/pdf/10.1145/41579.41589
03:37 PM polprog: the one in the book is O(n**2)
03:46 PM rue_shop3: the loop doeesn't execute like it looks
03:46 PM rue_shop3: they are modifying variables and stuff like crazy
03:47 PM polprog: Yes, they found a way to calculate them in a crazy way
03:47 PM rue_shop3: well, I rewrote it
03:47 PM rue_shop3: same alg, cleaned up
03:47 PM rue_shop3: so
03:47 PM rue_shop3: a lot of the funny stuff they did was due to fortran limitations
03:48 PM rue_shop3: I sat down and untanged it from the origional source into C
03:48 PM rue_shop3: everything you see today was ported via basic
03:49 PM rue_shop3: just a sec...
03:49 PM rue_shop3: so, in fourth, there are no binary operators
03:49 PM rue_shop3: lots of the soruce there is to do amazing math to do bitwise operatins
03:50 PM rue_shop3: https://github.com/ruenahcmohr/max7219fft/blob/master/main.c
03:50 PM rue_shop3: this is the 'fixed' port to C
03:50 PM rue_shop3: in this case, specifically coded up for 8 bit
03:50 PM rue_shop3: notice the variable names
03:50 PM rue_shop3: its the same thing, but with binary operators and stuff
03:51 PM polprog: gotta run
03:51 PM polprog: bbl
03:51 PM rue_shop3: *sigh*
06:45 PM aandrew: now I kind of want to make a USB C connector torture device. some kind of sled where I can use a linear stepper and insert, measure, remove, over and over again and see how the connection resistance changes over hundreds or thousands of cycles
06:46 PM aandrew: and then take the connectors used and see if the plug or jack wore more
07:10 PM rue_mohr: just find an old cable and device
10:40 PM aandrew: rue_mohr: I'm testing one specific connector which is why that's important
10:57 PM rue_shop2: drat ISE 14.7 is too new for these
11:07 PM rue_mohr: dfp-ynB5sQTghmawLiov
11:17 PM rue_shop2: ok 6G download to get 14.3
11:21 PM rue_shop2: I'm starting to intentionally make one mistake each captcha to see if it calls me on it