#avr Logs

Jan 22 2022

#avr Calendar

02:00 AM rue_mohr: hey yay, I got pwm on timers 0 and 1 synchronized!
02:15 AM exp: rue_mohr: congratulations
02:15 AM exp: rue_mohr: how do you start them simultaneously?
02:16 AM rue_mohr: pause and reset them
02:16 AM exp: are both enables in the same register?
02:16 AM rue_mohr: yes
02:16 AM exp: i think on the xmega i'm using it would be two writes
02:17 AM exp: so i'd have to set timer0 to TOP and then timer1 to BOTTOM and start them sequentially
02:17 AM rue_mohr: yea, dont use xmega, go to arm
02:17 AM exp: tell me the shop to buy them from :-p
02:17 AM rue_mohr: heh
02:17 AM exp: xmega seems a decent intermediary step really, i needed more peripherals
02:17 AM rue_mohr: I bought all mine long before the apocalypse
02:17 AM exp: i'm going to go to an arm next, but it will require greater setup time and i don't want to rely on someone else's RTOS
02:18 AM exp: well i have samples, but i don't have production quantities
02:18 AM exp: so that restricts me
02:18 AM rue_mohr: you dont need an os
02:18 AM exp: i need certain bits of one
02:18 AM rue_mohr: the only diff with arm is that there is a boatload more of init to do
02:18 AM exp: a cooperative multitasking queue is what i need
02:18 AM rue_mohr: if it doesn't work check to see if you turned on the clock for it
02:18 AM exp: yeah and i bet interrupt handling and all sorts is even more complex
02:19 AM rue_mohr: if it still doesn't work, look to see if you turned on the clock for it
02:19 AM rue_mohr: if it still doesn't work, look to see if you turned on the clock for it
02:19 AM exp: i'll get there eventually
02:19 AM exp: but one battle at a time, congrats on your timers :)
02:19 AM rue_mohr: if it still dosn't work, find more clocks to turn on
02:19 AM exp: someone in electronics linked a really nice looking NXP part with 200+ in stock in farnell
02:19 AM exp: i went back the next day to buy some.... 2023
02:19 AM rue_mohr: am I the only person not doing production volumes?
02:20 AM exp: lol, this used to be my hobby
02:20 AM exp: then it unintentionally became my job
02:20 AM exp: it's both awesome and terrifying in equal measure
02:20 AM rue_mohr: well yea
02:21 AM rue_mohr: now I need to make the adc sample 8 times after a timer compare
02:21 AM exp: got an interrupt line?
02:21 AM rue_mohr: timer compare
02:21 AM exp: no i mean, can you set the ADC to continuous
02:22 AM exp: and just increment a counter in an ISR
02:22 AM rue_mohr: I cant use continious
02:22 AM rue_mohr: I need to wait till the timer goes off
02:22 AM exp: oh, you mean the timer must be triggered 8 times and the ADC sample 8 times
02:22 AM exp: sorry i thought you meant 1 trigger -> 8 samples
02:22 AM rue_mohr: https://twitter.com/RueNahcMohr/status/1483378163149275140
02:23 AM rue_mohr: I'm working on doing that, the other person isn't sharing
02:23 AM exp: that's cute as hell
02:23 AM rue_mohr: I dont know why there isn't more drift
02:23 AM rue_mohr: but ok
02:24 AM rue_mohr: everything is looking really good
02:24 AM exp: there'll be plenty of drift i expect
02:24 AM rue_mohr: it'll be tight tho
02:24 AM exp: suffers the usual incremental positioning problems
02:24 AM rue_mohr: it looks pretty good there
02:24 AM rue_mohr: they said its not perfect
02:24 AM exp: i dunno, i haven't taken screenshots
02:25 AM exp: but it looks a few degrees off
02:29 AM rue_mohr: hmm
02:29 AM rue_mohr: you got me thinking
02:29 AM rue_mohr: I wonder if I should leave the adc running and ditch the results I dont want, or actually start and stop it
02:32 AM exp: it depends which is more computationally efficient
02:32 AM rue_mohr: so its complex
02:33 AM rue_mohr: from the start of the pwm pulse, I have a user control channel to read,
02:33 AM rue_mohr: but 400us after the end of the pwm, I need to do alternate readings of two channels
02:33 AM rue_mohr: one of them I can just overwrite the values, but the other I need to sort into a min/max
02:34 AM rue_mohr: you see, when the motor commutates, there is a spike
02:34 AM rue_mohr: I'm dealing with that by doing a min/max, and rejecting anything with a delta of more than 20
02:34 AM exp: oh that's interesting
02:34 AM rue_mohr: casue normally, the backEMF is quite stable
02:34 AM exp: yes i hadn't considered that
02:34 AM exp: you're PWMing the drive i assume
02:34 AM exp: then sampling in the off period
02:35 AM rue_mohr: and I cant think of a way of filtering out the spike from commutation nicely
02:35 AM rue_mohr: yea
02:35 AM rue_mohr: max of 20%
02:35 AM rue_mohr: which is silly, 10% is lots
02:35 AM exp: the easiest algorithm on something not memory limited is to sort the list and discard the top N samples
02:35 AM rue_mohr: and that might be too much
02:36 AM rue_mohr: the spikes dont happen that much
02:36 AM exp: you're probably limited to maintaining a running average, you can square the delta though for more sensitivity to noise
02:36 AM rue_mohr: discarding the samples seems plausable
02:36 AM exp: you can detect the commutation in the forward current too
02:37 AM rue_mohr: I have to wait a bit after the off for the flyback of the motor to settle out, 400us is long enough
02:37 AM exp: is it worth checking if a detectable signal there precedes the spike on the emf sampling?
02:37 AM rue_mohr: I dont think so
02:37 AM exp: if you have a fast multimeter or a differential probe you can check i guess
02:37 AM exp: or just ground one side of your motor
02:38 AM rue_mohr: I have the motor driver and EMF amp working
02:38 AM rue_mohr: been playing with it on the scope
02:38 AM exp: yeah just trying to think of an absolute reference rather than a statistical one
02:38 AM rue_mohr: the speed doesn't change too fast
02:38 AM exp: and there probably should be a corresponding negative spike in current as it passes the commutation
02:39 AM rue_mohr: so, if I miss even every second sample, the error is still quite low
02:39 AM rue_mohr: oddly enough, no
02:39 AM exp: the inductance of the coils is too high i guess
02:39 AM rue_mohr: so, when the pwm is off, one side of the motor is on a 1k/1k divider for 2.5V, the other side to a 35x amp
02:39 AM exp: or coil i guess
02:40 AM rue_mohr: the voltage divider end stays completely stable while the amp end sees the whole commutation spike
02:41 AM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/temp.png
02:41 AM rue_mohr: there is a typical spike
02:41 AM rue_mohr: tho
02:41 AM rue_mohr: thats the amp end for both traces
02:41 AM rue_mohr: white is unamplified, green is amplified
02:44 AM exp: i don't know if i have anything constructive to add really, the spike looks like it should be easily detected by a number of methods but i'd expect your delta method to work too
02:44 AM exp: are you sampling 8 times within this ~1ms period?
02:45 AM rue_mohr: thats the idea
02:45 AM rue_mohr: but
02:45 AM rue_mohr: I have to sample 2 channels
02:45 AM rue_mohr: I have a ref channel, and the value channel
02:45 AM rue_mohr: I have to diff them
02:45 AM exp: your ADC doesn't do that?
02:45 AM rue_mohr: it ensures that if the voltage divider drifts, its all relative
02:45 AM rue_mohr: not on the M328P
02:46 AM rue_mohr: ooo it gets off 11 samples
02:46 AM exp: wow yeah that is quite a limited adc
02:47 AM exp: no differential, no broken out reference option, avcc also limited
02:47 AM rue_mohr: and thats all that demo was using
02:47 AM exp: well if your total samples is 8-11, that's feasible to discard
02:48 AM rue_mohr: I'll go for 5 samples of each
02:48 AM exp: there's a few tricks i can think of to optimise a sorted list but it's still not ideal
02:48 AM rue_mohr: discard if the amplifier channels varries by more than 20 counts
02:48 AM exp: it's interesting there's a small level difference after the spike
02:49 AM rue_mohr: yea
02:49 AM exp: i find it hard to develop an intuitive sense for these things before i actually play with them
02:49 AM rue_mohr: I presume the motor I'm using has a turn mismatch on the armature
02:50 AM rue_mohr: tho it could be varriance of the magnetic field as the armature is turning
02:50 AM rue_mohr: dunno
02:50 AM exp: motors are one of those things that i have a rough understanding of, but most of the understanding is in the minute implementation details
02:51 AM rue_mohr: this is kinda crazy too, this is a time scale I dont think of motors with
02:51 AM exp: indeed, i can't explain the start of that trace and i'd have to think it through thoroughly
02:51 AM exp: doesn't just come to mind, as i say i'm bad at intuiting this stuff
02:51 AM rue_mohr: thats the pwm pulse ;)
02:52 AM rue_mohr: I didn't show the start of it properly
02:52 AM exp: well i understand it's the pulse, but i don't get why there's a gradual taper
02:52 AM rue_mohr: the pwm of course swamps the EMF amplifier
02:52 AM rue_mohr: as its doing 35x on a 5V rail-rail amp
02:52 AM exp: yes but i guess i would have expected the white trace to be equally as sharp
02:53 AM exp: your pwm switch time is clearly quite fast
02:53 AM rue_mohr: :) its like trying to listen to the crickets behind the 747 taking off
02:53 AM exp: so i'm wondering what residual effect is causing that, and there are so many potentials i really don't know
02:53 AM exp: so i'd have to sit down with ltspice and fiddle
02:53 AM rue_mohr: after the pwm pulse, there is an inductive flyback period
02:54 AM rue_mohr: after 400us, its all gone and its just the EMF left
02:54 AM exp: right yes that makes sense i guess i was merging the coil inductance and back emf together
02:54 AM rue_mohr: I'm running at 488Hz pwm, with a max of 20% duty, by 810us from the start of the pwm pulse, I'm clear to listen for EMF
02:55 AM rue_mohr: and, impressivly, the op-amp is fast enough
02:55 AM exp: i'm really not with it this morning, i mixed P=I²R and P=IV up before
02:55 AM rue_mohr: :)
02:55 AM rue_mohr: I made a program called "ohm"
02:55 AM exp: i guess, you see opamps with GBWs of absurdly high numbers now
02:55 AM rue_mohr: zippo:/morfiles/programming/c/avr/atmega328/EMFservo1# ohm -v 14 -p 67
02:55 AM rue_mohr: Power is: 67.000W
02:55 AM rue_mohr: Current is: 4.786A
02:55 AM rue_mohr: Voltage is: 14.000V
02:55 AM rue_mohr: Resistance is: 2.925Ohms
02:56 AM exp: haha nice
02:56 AM rue_mohr: its just a 1.5MHz LMC6842(?)
02:56 AM rue_mohr: exp, want a copy?
02:56 AM rue_mohr: I keep command lines up, so, its not for everyone
02:57 AM exp: haha, i'm no stranger to the terminal
02:57 AM exp: and i don't like the look of that # ;)
02:57 AM exp: and thank you but i am ok, i'll write a bash function if needs be
02:57 AM rue_mohr: heh, their all root
02:57 AM exp: it is a good idea though
02:57 AM rue_mohr: well
02:57 AM exp: i approve of any sort of simple automation that helps prevent key mistakes
02:57 AM rue_mohr: zippo:/morfiles/programming/c/avr/atmega328/EMFservo1# ohm -v 14u -r 527m
02:57 AM rue_mohr: Power is: 371.917pW
02:57 AM rue_mohr: Current is: 26.565uA
02:57 AM rue_mohr: Voltage is: 14.000uV
02:57 AM rue_mohr: Resistance is: 527.000mOhms
02:58 AM rue_mohr: it does multipliers too
02:58 AM rue_mohr: https://github.com/ruenahcmohr/ohm
02:58 AM rue_mohr: oh, thats my old version :/
02:58 AM rue_mohr: it doesn't do the multipliers
02:59 AM rue_mohr: oh wait, it does
02:59 AM rue_mohr: siprint
02:59 AM rue_mohr: ok
02:59 AM rue_mohr: thats up to date
02:59 AM exp: https://github.com/ruenahcmohr/ohm/blob/master/siprint.c
02:59 AM exp: that's both good and horrible simultaneously :D
02:59 AM rue_mohr: I know eh?
03:00 AM exp: good thing to present to an interview candidate
03:00 AM exp: did you compress the if for readability or is it misformatted on github?
03:00 AM rue_mohr: check out the state machine in numcol
03:00 AM rue_mohr: looks right from here
03:00 AM rue_mohr: I had issues with the precision eh?
03:01 AM rue_mohr: get gcc to consider the 1e-34 properly
03:01 AM exp: oh really? ugh that does not sound like fun
03:01 AM exp: with code like this there's many ways a reviewer could comment on it
03:02 AM rue_mohr: when it comes down to it, floating point is really evil
03:02 AM exp: but i find many of the common criticisms to be a little pointless
03:02 AM rue_mohr: where 1 != 1
03:02 AM exp: well positive ints should be ok but yes i know what you mean
03:02 AM rue_mohr: I have a set of macros...
03:02 AM rue_mohr: lessish
03:02 AM rue_mohr: ()
03:03 AM rue_mohr: greaterish()
03:03 AM exp: not sure if i would call numcol a state machine exactly :)
03:03 AM rue_mohr: NumColExtract
03:03 AM rue_mohr: ?
03:03 AM exp: yeah it does have state variables
03:03 AM exp: but it doesn't have any explicit state list or list of permitted transitions
03:03 AM rue_mohr: well, its self-feeding :)
03:04 AM rue_mohr: its not what I like to make as state machines
03:04 AM rue_mohr: and there is a horrid hack where it kinda has a copy-recursion in there
03:04 AM exp: what i'd probably do for this case is split each particular variable assignment up into their own if blocks
03:04 AM exp: yes i see not QUITE recursion :-p
03:05 AM rue_mohr: it was a pain to write
03:05 AM exp: this is fairly straightforward to read each case, but when trying to work backward through the cases it will become quite frustrating
03:05 AM rue_mohr: but it takes all sorts of formats
03:05 AM exp: if each variable like haveMult or whatever were handled in their own if block, it would be more easy to work both forwards and backwards i think
03:05 AM exp: but that's speculation, i don't like to claim that without actually writing it
03:06 AM exp: it certainly doesn't look like it was fun to write
03:06 AM rue_mohr: I wonder if I could make a proper LUT FSM for it...
03:07 AM rue_mohr: not sure if it would come out better or worse...
03:07 AM exp: yeah, that's what i was mentioning before
03:07 AM exp: when code is this succinct, many rules do not apply
03:07 AM rue_mohr: anyhow, thats it
03:07 AM exp: you could have made your siprint stuff more generic, so it was just a list of orders of magnitude
03:07 AM rue_mohr: you can of course give it any 2 params, it works out everything else
03:07 AM exp: but that code would ahve been more verbose then, and actually harder to read
03:08 AM exp: more prone to bugs and the only advantage is it would be marginally easier to extend
03:08 AM rue_mohr: I put siprint in a few other projects...
03:08 AM rue_mohr: dont reacall which ones
03:08 AM exp: there's only so many orders of magnitude you need, and a few lines covers it all
03:09 AM rue_mohr: thats not the linux way
03:09 AM rue_mohr: handle the obsurd too!
03:09 AM exp: in an ideal world yes!
03:09 AM exp: and people should never stop striving for that ideal world
03:10 AM exp: but the older and fatter i get, the more pragmatic i get :D
03:10 AM rue_mohr: I am usually rewarded when giving linux programs obsurd inputs, getting properly obsurd outputs back
03:10 AM rue_mohr: where as microsoft usually just crashes
03:13 AM exp: haha, honestly i do not understand how anyone uses windows these days
03:13 AM exp: i do have a windows laptop for work and a windows PC for gaming
03:13 AM exp: but i use both of them remotely and try to interact with windows hardly at all
03:13 AM exp: every time i do it's always just continuous pain
03:13 AM rue_mohr: yea
03:14 AM exp: i'm currently constantly getting a popup saying "There's a problem with your Microsoft account (your password has probably been changed)"
03:14 AM exp: it hasn't, i haven't accepted their new privacy policy
03:14 AM exp: and they're trying to deceive me into doing so incidentally
03:14 AM rue_mohr: I dont know how anyone gets anything done on windows with it always prioritizing its own crap
03:14 AM exp: i lost a bunch of work because i forgot to save a pspice sim
03:14 AM exp: and windows just rebooted on its own in the afternoon, presumably for updates
03:14 AM rue_mohr: yea, wtf eh?
03:15 AM rue_mohr: but you should save every time you sit back to think
03:15 AM exp: linux has plenty of rough edges but at least it pretty much does what i expect and what i tell it to
03:15 AM exp: yes it was really my fault i do know to save regularly
03:15 AM exp: but have you seen how slow pspice gets when you're doing stuff with complex models?
03:15 AM rue_mohr: I think I go min 100 days between reboots
03:15 AM exp: i'd press a button and go have a coffee and a snack before it started the sim
03:16 AM rue_mohr: usually cause of browsers freezing my vid card by leaking too much memory
03:16 AM exp: i'm getting better about regular updates + reboots
03:16 AM exp: i have fewer transient services running
03:16 AM rue_mohr: you know about putting the optical mouse on a mechanical clock?
03:16 AM exp: and my desktop comes back up in a minute or so
03:16 AM exp: lol, that's a good one
03:16 AM rue_mohr: :)
03:16 AM exp: you've just reminded me of something else
03:17 AM rue_mohr: apparenly its a great zoom trick
03:17 AM exp: my gaming PC lives in a cubby and has basically nothing plugged in
03:17 AM exp: but one thing it does have in is a real mouse
03:17 AM exp: because if it doesn't, windows will remove the cursor
03:17 AM exp: and thus a bunch of games will not have cursors
03:17 AM exp: it is the silliest of the silly problems
03:18 AM exp: (i also have to have a fake monitor dongle plugged in to set larger resolutions, all because windows)
03:18 AM rue_mohr: hehehe
03:21 AM rue_mohr: hmm ok
03:21 AM rue_mohr: only so much farther me and salee can go here
03:22 AM rue_mohr: I have a renewed love for nedit since I found out its got rectangular select
03:23 AM exp: i'm an old vim user, using nvim these days
03:24 AM exp: also, salee?
03:24 AM rue_mohr: (knockoff)
03:24 AM exp: oh lol
03:24 AM rue_mohr: hobby makes $0 ya know
03:24 AM exp: i have one of those knock-off logics lying around too
03:24 AM rue_mohr: I love 'em
03:24 AM exp: just about to replace mine with a picoscope
03:24 AM exp: gotta actually make the bulkhead for all the wires to connect to first
03:25 AM rue_mohr: I realized that LOTS of the stuff I do is just digital anyhow
03:25 AM rue_mohr: I have a tek 754c for the analog stuffs
03:26 AM exp: i was foolish and bought a 2 channel DSO instead of a 4 channel MSO when i could have done so for cheap
03:26 AM rue_mohr: 2GHz is TOOO MUCH ZOOOM!!!!
03:26 AM exp: so i also got a few different logic analysers
03:26 AM rue_mohr: it heats the shop too
03:26 AM exp: added picoscope because of the frequency response analyser app
03:26 AM rue_mohr: good in winter
03:27 AM exp: so i can hook the trigger out of my DSO to one of its input channels
03:27 AM exp: and set it to trigger off that
03:27 AM rue_mohr: I'm building an analyser with a stm32
03:27 AM exp: and now i have many more scope channels and some digi channels too
03:27 AM rue_mohr: low freq, for servos
03:27 AM rue_mohr: from 0.1Hz to 20kHz
03:27 AM exp: should be relatively straightforward, getting accurate time tags might be tricky but i don't know the stm series well yet
03:27 AM exp: oh 20khz then whatever
03:28 AM rue_mohr: so far, I'v learned real-world attenuation doesn't lie on 3db/decade slopes
03:28 AM exp: you can sample a hundred digital inputs in some tiny fraction of that
03:28 AM exp: sure 3dB is just the point at which you mark the bandwidth usually
03:28 AM exp: as it's half the response
03:28 AM exp: also butterworth filters i think?
03:28 AM rue_mohr: yes, but
03:28 AM exp: or is that 6db/dec
03:28 AM rue_mohr: hmm, this is a topic switch
03:29 AM rue_mohr: so, I have a mechanical servo
03:29 AM rue_mohr: I do a sweep from 0,.1 to 5Hz
03:29 AM rue_mohr: the idea is to make a compensation filter
03:29 AM rue_mohr: so pick up the high end respose
03:29 AM exp: you want to linearise your motor output
03:29 AM rue_mohr: yea
03:30 AM rue_mohr: but the slopes are crazy rates
03:30 AM exp: i'm not so great with linear algebra
03:30 AM exp: but that's all that is required really i think
03:30 AM rue_mohr: so I cant make a mutli stage filter to fit it
03:30 AM exp: i guess technically complex analysis but i guess that folds in
03:30 AM rue_mohr: cause its a goof-ball slope
03:30 AM rue_mohr: I'd have to approximate it in steps
03:30 AM rue_mohr: I wish I had the chart, stand by
03:31 AM rue_mohr: god, not a good day when you have to add 4 more xterms...
03:31 AM exp: try a tmux, and a tiling window manager :-p
03:31 AM exp: it might not actually be tidier, but it'll look tidier!
03:31 AM rue_mohr: I have 17 xterms up
03:32 AM rue_mohr: all on important stuff
03:32 AM exp: only 10 in tmux on this machine
03:32 AM exp: i'm weak :)
03:34 AM rue_mohr: drat, I dont know where i put the charts...
03:35 AM exp: it's ok i doubt i would be much help really
03:35 AM exp: i don't really know why it would have a lower response at 5Hz
03:35 AM rue_mohr: I'd like you to see what I'm up against trying to compensate for
03:35 AM exp: some of the servos I have seem to have very high rates
03:35 AM exp: but they're for RC vehicles
03:36 AM rue_mohr: I think I charted them in gnumeric...
03:36 AM exp: i'm also not really sure if i'd call this a filter, because it requires you have intentional signal gain, but maybe that's counted as a category of filter
03:41 AM rue_mohr: here is phase angle as a fn of freq...
03:41 AM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/p1220721.jpg
03:42 AM exp: i like your hand drawn annotations
03:42 AM rue_mohr: heh
03:43 AM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/p1220722.jpg
03:43 AM rue_mohr: "Av" vs freq
03:43 AM rue_mohr: so, climbing at 4.5db/decade to start with
03:43 AM rue_mohr: WTF
03:44 AM rue_mohr: I think there is more missing off to the left, but I cant go that low
03:44 AM rue_mohr: a zero
03:45 AM exp: rue_mohr: "Av"?
03:45 AM rue_mohr: linear gain
03:45 AM rue_mohr: linear, ...
03:45 AM exp: well these do have little controllers in them don't they?
03:46 AM rue_mohr: its not a hobby servo
03:46 AM rue_mohr: its a gearbox to pot
03:46 AM rue_mohr: the sine wave input is balanced forward/reverse
03:46 AM exp: and the control method is an analog input voltage that corresponds to output position?
03:47 AM exp: or is this forward and reverse drive?
03:47 AM rue_mohr: yes
03:47 AM rue_mohr: I think thats open loop
03:48 AM rue_mohr: the hardware was experimental and I was having a hell of a time seeing the numebrs I'd always wanted too
03:48 AM rue_mohr: the result of what I learned had me dial a loop filter up so good I blew the motor driver
03:48 AM rue_mohr: .. feeding the control input of the servo a swquare wave...
03:48 AM rue_mohr: :D
03:49 AM rue_mohr: it was jumping on the bench
03:49 AM exp: under-rated parts, perfectly acceptable in put :)
03:49 AM rue_mohr: hah, I dont think the motor was far behind the driver
03:49 AM exp: i don't understand the ripple in the first plot either if i'm honest
03:50 AM rue_mohr: yea, I'm working on better hardware
03:50 AM exp: it may be some actual filtering and there's a small amount of resonance there
03:50 AM exp: you see that in powersupply control loops
03:50 AM rue_mohr: I think my phase measurement method went funkey
03:50 AM rue_mohr: oh
03:51 AM rue_mohr: I left the profiler project off with problems getting a proper "zero crossing" from the input signals
03:51 AM exp: 'profiler' being 'motor profiler'?
03:51 AM rue_mohr: its hard to work out where the middle of a 0.1Hz sine wave is
03:51 AM rue_mohr: its a filter profiler
03:51 AM exp: a VNA?
03:52 AM rue_mohr: so, it gives you a 5vp-p sine, and has two inputs, one watches the output, the other you stick on the return from your filter
03:52 AM rue_mohr: yea
03:52 AM rue_mohr: gives you the amplitude/phase of the return signal
03:52 AM rue_mohr: you can chart it all up and know things
03:53 AM rue_mohr: the corner freq of that servo was interesting
03:53 AM rue_mohr: quite pronounced
03:53 AM exp: yeah that's unlikely to be a simple board filter
03:53 AM rue_mohr: all the issues are cause of 0.1Hz
03:54 AM exp: you want a locked square wave output i guess
03:54 AM rue_mohr: my general method is to wait for 1 cycle, during which high/low peak trackers do their thing, and then assume the zero is at 50%
03:54 AM rue_mohr: comparators switch at that level to give phase
03:55 AM rue_mohr: while the results of the peak trackers are used to work out amplitude
03:55 AM exp: yeah you're always going to suffer from the noise at mHz levels i suspect
03:55 AM exp: i don't want to do the calculations though :)
03:55 AM rue_mohr: part of the issue is knowing when you have a complete cycle on the trackers
03:55 AM exp: the other option would be to switch to a nice sharp square wave input signal and use that as your base
03:56 AM exp: i learned over the last month how tricky generating a nice pure sine wave with no tones can be!
03:56 AM rue_mohr: the 0.1hz signal is generated by an AVR 'playing' values into an 8 bit DAC
03:56 AM exp: oh a DDS
03:56 AM rue_mohr: cause I couldn't get any analog circuit to give me anything better than a 'roundie wave'
03:57 AM exp: well yes you'd want some low frequency VCO i guess
03:57 AM rue_mohr: which means, at 0.1Hz I have sampling "whine"
03:57 AM rue_mohr: but its 512 samples/cycle
03:57 AM rue_mohr: so, its a few octaves out
03:58 AM rue_mohr: I had fun with that dds
03:58 AM rue_mohr: I used asm to push 8 bit values to a port in a loop
03:59 AM rue_mohr: I vary the avr clock to change the freq :)
03:59 AM exp: hah funny i was talking about something similar in ##electronics yesterday
03:59 AM exp: i have an old X10 network in my house here, i think i mentioned a while ago
03:59 AM rue_mohr: at the peak, the value doesn't change for 10 cycles, so I have time for the hump
03:59 AM rue_mohr: jump
03:59 AM exp: and the controller was an awfully designed board that died
03:59 AM exp: so now i need a way to generate 120khz OOK on the power lines
03:59 AM exp: someone linked the ST7540
04:00 AM rue_mohr: huh
04:00 AM exp: which is a FSK transmitter but that supports a carrier frequency of 110khz
04:00 AM exp: so i'm going to try misclocking it slightly
04:00 AM rue_mohr: I have a lot of X10 junk if you want?
04:00 AM rue_mohr: :)
04:00 AM exp: nah it's ok, a lot of stuff i have moved over
04:00 AM exp: but certain dimmers can't be changed
04:00 AM exp: no neutrals and buried in walls
04:00 AM exp: plus there is probably a small market for a modern x10 controller
04:00 AM exp: and if you check the example schematic it's very simple
04:00 AM rue_mohr: dont know what to do with it :)
04:01 AM rue_mohr: I think I had two people bring me a bunch of NIB X10 stuff
04:01 AM rue_mohr: at about the same time
04:01 AM exp: honestly lots of it is fine
04:01 AM exp: all the dimmers and switches etc
04:01 AM exp: they all function just fine
04:02 AM rue_mohr: we have power issues here
04:02 AM exp: oh?
04:02 AM rue_mohr: I understand their easily confused
04:02 AM rue_mohr: lots of winks, blinks, and outages
04:02 AM exp: probably what happens is they lose their ID
04:02 AM exp: they shouldn't be mis-controlled by transients
04:03 AM exp: because the signalling is a 120khz carrier for 1ms in the zero-crossing
04:03 AM exp: but they're not exactly fast and you don't get feedback obviously
04:03 AM exp: but honestly if it's the choice of that or wifi, i'd probably still go x10
04:04 AM rue_mohr: at work we were installing UDP stuff for a while
04:04 AM rue_mohr: no
04:04 AM rue_mohr: UBP?
04:04 AM exp: not aware of it
04:04 AM exp: zigbee seems second most common after wifi
04:04 AM rue_mohr: products for home automation are too short lived and too complex for the people who want them
04:04 AM rue_mohr: "I JUST WANT TO TURN ON MY KITCHEN LIGHTS"
04:04 AM rue_mohr: uhu
04:05 AM exp: it's something we're looking into in the medium to long term
04:05 AM exp: trying to come up with something reliable and not bullshitty
04:05 AM rue_mohr: they spend thousands on an automated system, cant use it and find out 5 years later it all needs to be replaced
04:05 AM exp: exactly
04:05 AM rue_mohr: well
04:05 AM rue_mohr: this new cell phone controlled junk doesn't impress me either
04:06 AM exp: all of the stuff i have runs on Tasmota now
04:06 AM exp: which is on an esp32/8266 (not sure which)
04:06 AM rue_mohr: "yea, they dont make the app for your new phone..."
04:06 AM exp: and connects to wifi
04:06 AM exp: so it can be controlled agnostically, and i own the source code
04:06 AM exp: but a few dozen devices on wifi will get real shit real quick
04:06 AM rue_mohr: and cloud based "yea, that company went under, and its cloud with it"
04:06 AM exp: plus it means exposed bulky devices on every plug, lamps with big ACDC converters in them generating loads of heat etc etc
04:06 AM rue_mohr: so, yea
04:07 AM rue_mohr: GE lighting contactors :)
04:08 AM rue_mohr: and...
04:08 AM rue_mohr: who made the other one, they used diodes...
04:08 AM rue_mohr: so its all 2 wire...
04:09 AM rue_mohr: https://cdn11.bigcommerce.com/s-wlejmk/images/stencil/640w/products/1128/28163/ge-rr7-low-voltage-remote-control-relay-switch-gel-rr7__25162.1596041883.jpg?c=2
04:09 AM exp: sorry work guy calling
04:10 AM exp: wacky, no idea what that is
04:10 AM exp: UK here
04:10 AM rue_mohr: oh
04:10 AM rue_mohr: 20A rated latching contactor
04:12 AM exp: i don't know if i've seen any old low voltage control gear for lighting in homes here, i assume that was for home?
04:12 AM rue_mohr: yes
04:12 AM rue_mohr: it was used in schools too
05:42 AM rue_mohr: http://www.engbedded.com/fusecalc/
05:46 AM rue_mohr: ok I have not closed the loop, but I should be able to see what I need to to know if it'll work
05:47 AM rue_mohr: test tommroow
05:47 AM rue_mohr: slweeeeep
05:48 AM exp: goodnight rue_mohr
05:48 AM exp: congratulations on your progress
05:48 AM exp: it is excellent work
05:48 AM rue_mohr: meh, if I could just be awake I could be done by now
05:50 AM exp: we all feel that
05:51 AM rue_mohr: hmm
05:51 AM exp: i have so much to learn and so much to do and so much to test
05:51 AM exp: and i ran out of energy months ago
05:51 AM rue_mohr: so I have code ready to test tommorow
05:51 AM exp: i am currently trying to find a small form factor toggle switch that my engineers won't break
05:51 AM exp: it's only for board testing, but that won't stop them
05:51 AM exp: they'll break it anyway
05:51 AM rue_mohr: it should control the motor speed and show me where its sampling the adcs
05:52 AM rue_mohr: how about bolting a switch right into the pcb?
05:52 AM exp: needs to be small but through-hole or screw would be fine
05:52 AM exp: was going for dip switch but £2/ea lol, don't want to pay that out of principle
05:53 AM rue_mohr: https://static.cytron.io/image/cache/catalog/products/SW-TO-MTS-102-A2/SW-TO-MTS-102-A2%20(1)-512x512.jpg
05:53 AM rue_mohr: those are way too big?
05:53 AM exp: yeah those are huge
05:53 AM exp: this is for testing a 4" wide PCB
05:53 AM rue_mohr: mounted thru the pcb and connected with jumper wires?
05:53 AM exp: and it slots into a card edge connector
05:54 AM rue_mohr: ah
05:54 AM rue_mohr: well
05:54 AM exp: i will find a budget dip switch and send them double the amount
05:54 AM exp: :)
05:54 AM rue_mohr: how about using a small nut/bolt that fits in one of 2 holes that short pads
05:54 AM exp: it's alright i just ideally wanted something with an extended actuator
05:55 AM rue_mohr: hmm
05:55 AM exp: just trying to make it as user friendly as possible
05:55 AM rue_mohr: careful lowering the dumb bar
05:55 AM exp: https://www.digikey.co.uk/en/products/detail/grayhill-inc/76STD01T/2680742 would be nice
05:55 AM exp: lol yeah
05:55 AM exp: you always have to design for the dumbest conceivable person
05:56 AM rue_mohr: reed and magnet?
05:56 AM exp: they're quite expensive on digikey!
05:56 AM exp: anyhow this will do, i'm good
05:56 AM exp: thank you for thinking :)
05:56 AM exp: get some sleep
05:56 AM rue_mohr: oh yea
05:57 AM rue_mohr: have to turn the shop off
01:34 PM specing_ is now known as specing
04:48 PM joakimk: Anybody have experience flashing an ESP8266 using Esplorer IDE? I'm trying to follow a basic Instructable, but can't seem to get the IDE to "do" anything... I've got a lua file, and I'
04:48 PM joakimk: and I've got the ESP connected through a USB-serial (FTDI) chip, but I can't get the IDE to either compile to hex, nor to connect to the ESP... Not as far as I can tell
04:48 PM joakimk: Looking at this https://www.instructables.com/ESP8266-Web-Server-Without-Arduino/
04:51 PM joakimk: so the usb interface I've got is essentially this, https://www.kjell.com/no/produkter/elektro-og-verktoy/arduino/moduler/luxorparts-usb-til-seriell-adapter-for-arduino-p88064
05:05 PM joakimk: I'm now getting some output in Esplorer, saying "PORT OPEN 115200" and " Communication with MCU..." but then nothing
05:07 PM joakimk: There are buttons for "Chip ID", and "FS Info" (executes `file.fsinfo()` which should show info on the ESP) and I can see (in the log viewer) that something is attempted sent to the ESP, but nothing in response
05:08 PM rue_mohr: hmm I dont recall what I used
09:41 PM rue_mohr: https://twitter.com/RueNahcMohr/status/1485069935789285378
09:41 PM rue_mohr: dump the link everywere ;)
09:43 PM cehteh: whats that? stepper with sensor?
09:43 PM cehteh: bw the salamander as pretty doctile .. sat in the middle of the street as almost freezing temperatures, i put him into the gradd
09:43 PM cehteh: grass
09:47 PM cehteh: https://public.pipapo.org/VID_20181230_183946399.mp4 remmbers me when i had fun with steppers :D
09:47 PM cehteh: https://public.pipapo.org/VID_20190105_110717437.mp4
09:47 PM rue_mohr: no, thats a 3V dc brushed motor
09:47 PM cehteh: ah ok
09:48 PM rue_mohr: with no encoder
09:48 PM cehteh: abusing it as 2 steps per rotation stepper with microstepping? :)
09:49 PM rue_mohr: its a dc motor
09:49 PM rue_mohr: unmodified
09:49 PM cehteh: yes hence the abuse
09:49 PM rue_mohr: its a bit less than 1024 positions/rotation
09:50 PM rue_mohr: it measures the backEMF to get an idea of the position
09:50 PM cehteh: ah
09:50 PM rue_mohr: but it doesn't take to aggravation
09:50 PM rue_mohr: sadly
09:50 PM rue_mohr: the other persons version did
09:50 PM rue_mohr: not sure how they did it
09:50 PM cehteh: well its not made for that, you can be lucky that it basically works
09:51 PM rue_mohr: I think thats pretty amazing
09:51 PM cehteh: and poor torque prolly too or?
09:51 PM rue_mohr: for no sensor
09:51 PM cehteh: yes but impractical for any real use
09:51 PM cehteh: well for some toys maybe
09:51 PM cehteh: anyway .. i am out, good night
09:51 PM rue_mohr: not sure, its incremental for sure