#garfield Logs

Feb 21 2024

#garfield Calendar

12:37 AM rue_mohr: hmm?
02:41 PM rue_shop3: obfuscated_d, test 1, 2
02:41 PM obfuscated_d: 3,4
02:42 PM rue_shop3: oh I have to change the motor drive stuff
02:44 PM rue_shop3: wow that stacks up fast
02:44 PM obfuscated_d: ?
02:44 PM rue_shop3: my 20 is 517 counts
02:44 PM obfuscated_d: 20ms?
02:45 PM rue_shop3: is it in ms driect?
02:45 PM rue_shop3: rifraf,
02:45 PM obfuscated_d: it's printing ms pulse length
02:45 PM rue_shop3: ok
02:46 PM rifraf: mornin
02:46 PM rue_shop3: how long did you run your data to?
02:46 PM obfuscated_d: I ran to about 500ms
02:46 PM rue_shop3: here, I'd say 250ms looks like full speed
02:47 PM rue_shop3: rifraf, whats for breakfast today?
02:47 PM obfuscated_d: the accel curve flattened out by ~50ms on mine
02:47 PM rue_shop3: ah ok
02:47 PM rue_shop3: I'll go with this then
02:48 PM rifraf: nutrigrain, iron man food
02:49 PM rue_shop3: hmm
02:49 PM rue_shop3: looks like by 20ms I'm leveled off
02:50 PM rue_shop3: rifraf, have any of your own projects going on these days?
02:50 PM rifraf: er yes, this new machine is my life last few months
02:51 PM rifraf: many other things made in last few years
02:51 PM rue_shop3: bot or cnc?
02:51 PM rifraf: cnc
02:51 PM rue_shop3: you still working for cnc company?
02:51 PM rifraf: not selling radiators now
02:51 PM rue_shop3: ? didn't hear about that one
02:52 PM rifraf: yes its not much to talk about
02:52 PM rifraf: just turning tonnes of copper and brass into aftermarket cores
02:52 PM rue_shop3: "but when you want BTU/hr? THIS is your UNIT!"
02:53 PM rifraf: we have all the cnc toys, but no point trying to get access, so makin me own
02:53 PM rue_shop3: ? oh
02:54 PM rue_shop3: obfuscated_d, my motor starts up too fast to see down to the deadband line counts
02:54 PM obfuscated_d: we could change to microseconds
02:55 PM rue_shop3: http://ruemohr.org/%7Eircjunk/tempimage/test1.png
02:56 PM rue_shop3: whats yours look like?
02:56 PM rue_shop3: rifraf, how many have you built now?
02:58 PM obfuscated_d: rue_shop3 https://paste.debian.net/1308141/
02:58 PM rue_shop3: hahah graphics denied
02:59 PM rifraf: rue robots?
02:59 PM rifraf: not many, just tools to make more one day
03:00 PM rue_shop3: no cnc mahicnes
03:00 PM rifraf: well finished the big mechmate router, but its gone now
03:00 PM rue_shop3: so get this rif, someone calls me up about some cnc machines for sale (estate sale) AND ITS 1 BLOCK FROM MY HOUSE!!!!!
03:00 PM rue_shop3: oh you selling machines?
03:00 PM rifraf: i still have gantrey and controlbox
03:00 PM rifraf: no, had no where to put it
03:00 PM rue_shop3: see, if I tried that nobody would buy the damn things
03:01 PM rifraf: so gave most away
03:01 PM rue_shop3: oh
03:01 PM rifraf: my shed is 2.4 x 3m now
03:01 PM rue_shop3: so were you able to hold on to that compressor?
03:01 PM rue_shop3: heh
03:02 PM rifraf: ony have smaller compressor left, big one with a freind
03:02 PM rue_shop3: obfuscated_d, yours is a lot more wiggly than mine
03:02 PM rue_shop3: heh sam?
03:03 PM rifraf: nah
03:03 PM rifraf: ok 7am, too early to wake the neighbourhood you think?
03:03 PM rue_shop3: depends on the neighbourhood
03:03 PM rifraf: got new gcode to test
03:04 PM rifraf: quiet suburbia
03:04 PM rue_shop3: I should do up a rotary axis for mine
03:04 PM rue_shop3: I have the one I made for the old cnc
03:04 PM rifraf: need to make soundproof enclosure very soon
03:04 PM rue_shop3: but...
03:04 PM rifraf: and soundproof shed more
03:04 PM rue_shop3: I have started to favor slower high torque drives
03:04 PM rue_shop3: spindles
03:05 PM rifraf: i'll show ya vid later of making a part, with about 10 tool changes
03:05 PM rue_shop3: started it all with a dremel
03:05 PM rue_shop3: oof
03:05 PM rue_shop3: I try to keep mine to 0
03:05 PM rifraf: getting cammera set up, will make tonight
03:05 PM rifraf: can't make cool parts with only 1 tol
03:05 PM rifraf: tool
03:06 PM rifraf: i have become a glorified tool chager, slave to the machine
03:06 PM rue_shop3: obfuscated_d, gonna change the divider to 20
03:06 PM obfuscated_d: void pulseTimerInit()
03:06 PM obfuscated_d: {
03:06 PM obfuscated_d:   // 16mhz / 8 = 2mhz /20 = 100khz = 10us = .01ms per tick
03:06 PM obfuscated_d:   TCNT0 = 0; // clear counter
03:06 PM obfuscated_d:   TCCR0B |= (1 << CS01); // prescaler 8
03:06 PM obfuscated_d:   OCR0A = 0x14; // compare value of 20
03:06 PM obfuscated_d:   TIMSK0 |= (1 << OCIE0A); // enable compare match interrupt
03:06 PM obfuscated_d: }
03:06 PM obfuscated_d: ISR(TIMER0_COMPA_vect)
03:06 PM obfuscated_d: { // compare match interrupt
03:06 PM obfuscated_d:   if (count >= wait)
03:06 PM obfuscated_d:   {
03:06 PM obfuscated_d:     wait += 1; // add .01 ms to the wait time
03:06 PM obfuscated_d:     count = 0;
03:06 PM obfuscated_d:     printFlag = 1;
03:06 PM obfuscated_d:   }
03:06 PM obfuscated_d:   else
03:06 PM obfuscated_d:   {
03:06 PM rue_shop3: you can just use "20" :]
03:06 PM obfuscated_d: haha, I guess so. I'm used to hex
03:07 PM Tom_L: mornin down under
03:07 PM obfuscated_d: I got rid of the divider in the print function also
03:08 PM rue_shop3: 0.2ms is 1 count!
03:08 PM rue_shop3: print function?
03:08 PM rue_shop3: didn't it all use a that table lookup stuff?
03:08 PM rue_shop3: hicomms.c ?
03:09 PM rue_shop3: Pulse (0.1ms) Position (lines)
03:09 PM rue_shop3: 2 1
03:09 PM rue_shop3: 3 5
03:09 PM rue_shop3: 4 14
03:09 PM rue_shop3: 5 25
03:09 PM rue_shop3: 6 40
03:09 PM rue_shop3: 7 60
03:09 PM rue_shop3: 8 86
03:09 PM rue_shop3: 9 114
03:09 PM rue_shop3: 10 147
03:09 PM rue_shop3: 11 176
03:09 PM rue_shop3: 12 206
03:10 PM rue_shop3: 13 247
03:10 PM rue_shop3: 14 278
03:10 PM rue_shop3: 15 321
03:10 PM rue_shop3: oof
03:11 PM obfuscated_d: that thing is screaming up to speed
03:11 PM obfuscated_d: really high line count encoder
03:12 PM rue_shop3: http://ruemohr.org/~ircjunk/tempimage/test2.png
03:13 PM rue_shop3: so we want the range from 0-20 lines
03:13 PM rue_shop3: oh hah, let me try to verify the timing
03:15 PM obfuscated_d: oh, yeah my comment math there is wrong hah
03:15 PM rue_shop3: first pulse is 1.175ms
03:15 PM rue_shop3: wait
03:16 PM rue_shop3: hu? the pulse times are out
03:17 PM rue_shop3: uh, I have it set to 20, and I'm getting 1, 2, 3, 4ms
03:17 PM obfuscated_d: hmmmm
03:17 PM rue_shop3: void pulseTimerInit()
03:17 PM rue_shop3: {
03:17 PM rue_shop3: // 16mhz / 8 = 2mhz /200 = 10khz = 100us = .1ms per trigger
03:17 PM rue_shop3: TCNT0 = 0; // clear counter
03:17 PM rue_shop3: TCCR0B |= (1 << CS01); // prescaler 8
03:17 PM rue_shop3: OCR0A = 20; //0xC8; // compare value of 200
03:17 PM rue_shop3: TIMSK0 |= (1 << OCIE0A); // enable compare match interrupt
03:17 PM rue_shop3: }
03:18 PM rue_shop3: ah, but your adding 10 to wait
03:18 PM rue_shop3: which is an extra x10 factor
03:18 PM obfuscated_d: oh, what I pasted it +1
03:19 PM obfuscated_d: the older code was +10
03:19 PM rue_shop3: oh!, missed that
03:19 PM obfuscated_d: it should be adding .1ms
03:20 PM obfuscated_d: I am initializing wait at 1ms
03:20 PM obfuscated_d: since, nothing really happens in less than that
03:21 PM rue_shop3: oh I see,
03:21 PM rue_shop3: ah ok
03:21 PM obfuscated_d: and first pulse is probably going to be a little over, because I'm starting the motor then entering the loop
03:23 PM rue_shop3: the times are a bit +- too
03:23 PM obfuscated_d: how close?
03:24 PM rue_shop3: stand by, gona let it capture a bit more
03:24 PM obfuscated_d: (y)
03:25 PM rue_shop3: I started it at 0.5
03:26 PM rue_shop3: times are .537, 0.78, 0.91, 1.04, 1.168ms...
03:26 PM rue_shop3: odd
03:26 PM rue_shop3: its not really adding up?
03:27 PM rue_shop3: hmm
03:27 PM obfuscated_d: might be the way I'm handling the motor starts
03:27 PM rue_shop3: it could be slight rounding on the cheap logic analizer
03:28 PM rue_shop3: but whats more important
03:28 PM rue_shop3: is that we be able to generate pulses that move 1-20 lines
03:29 PM obfuscated_d: on my end, with the .1 code, I'm getting 1 - 2 lines difference per .1 ms
03:30 PM rue_shop3: http://ruemohr.org/~ircjunk/tempimage/screenshot.png
03:30 PM rue_shop3: here is some evil for ya
03:31 PM rue_shop3: the bottom two traces are the encoder
03:31 PM rue_shop3: see at 90ms where it changes direction?
03:31 PM obfuscated_d: what's up with that
03:31 PM rue_shop3: motor cogging
03:32 PM obfuscated_d: ah
03:32 PM rue_shop3: its just for that moment
03:32 PM rue_shop3: there are to direction changes there actually
03:32 PM rue_shop3: but also notice how there is no detectable motion during the pulse
03:33 PM rue_shop3: not till almost another 0.78ms later do we see a line
03:33 PM rue_shop3: this is why for the "deadzone" you cant wait for lines
03:33 PM rue_shop3: the drive pulse is completely blind
03:34 PM rue_shop3: the motor kept "rolling" for 32ms after the pulse
03:35 PM rue_shop3: oh no thats 1 direction change not two?
03:36 PM obfuscated_d: looks like one at ~87ms
03:36 PM rue_shop3: resulted in 6 lines by the time it finished
03:36 PM rue_shop3: to know the direction, choose a trace, and watch the rising edge
03:37 PM rue_shop3: at that rising edge look at the state of the other channel
03:37 PM rue_shop3: one direction it will always be high, and the opposite it will be low
03:38 PM rue_shop3: but this all is why you dont really want to try to step a motor less than about 10-15 degrees
03:38 PM rue_shop3: it can be held, its just work to do it
03:39 PM rue_shop3: that little yellow motor would step well casue its ratio is so high
03:39 PM rue_shop3: actually,they are all rolling back a bit
03:40 PM rue_shop3: ah this one doesn't
03:41 PM obfuscated_d: yea, the motor I have is well suited, with the insane gear ratio it has
03:41 PM rue_shop3: http://ruemohr.org/~ircjunk/tempimage/screenshot.png (new)
03:41 PM obfuscated_d: different motor?
03:41 PM rue_shop3: same, longer drive pulse, but I put the cursors on the whole coast-out
03:41 PM rue_shop3: you can see it picked up some good speed
03:42 PM rue_shop3: which is why we need a braking pulse
03:42 PM rue_shop3: the software technically records that as 1 line :)
03:48 PM rue_shop3: hey, you want to install "Logic" from salee and I'll send you a capture file of fixed5 to check out?
03:48 PM rue_shop3: (I'll put that on github too)
03:48 PM obfuscated_d: sure
03:48 PM obfuscated_d: I'm going to take care of the dog, i'll be back in a bit
03:50 PM obfuscated_d: I'm ordering one of those logic analyzers, I'm tired of shooting blind here
03:51 PM rue_shop3: hah, their pretty cool
03:51 PM obfuscated_d: wow, $13 and next day delivery
03:51 PM rue_shop3: http://ruemohr.org/~ircjunk/tempimage/Step-15Hz-1p8degrees.logicdata
03:52 PM rue_shop3: in the meantime you can install the program and open that :]
03:52 PM rue_shop3: I hope I dont get you spending all your funds while your not employed
03:52 PM rue_shop3: :/
03:53 PM obfuscated_d: haa, nah I'm fine. I have my savings, and my wife works full time. she makes way more than I ever did
03:53 PM rue_shop3: I could have labeled the channels
03:53 PM rue_shop3: 0 and 1 are my drive signals, 2 and 3 are the encoder, 4 is the input step line
03:54 PM rue_shop3: the random step I grabbed does not see an encoder line till 1.44ms after the motor is turned on
03:55 PM rue_shop3: ok, I have to dress up and go get food
03:55 PM rue_shop3: but you can see that my small steps (1.8 degrees) have a lot of rollback
03:56 PM rue_shop3: which is where state 6 needs to change
03:56 PM rue_shop3: oh I need to post that code
03:57 PM obfuscated_d: I installed logic2 and I need logic1 :|
03:58 PM rue_mohr: wat!?
03:58 PM rue_mohr: didn't know about that
03:59 PM obfuscated_d: I installed 1, it's up. I really need to go walk my dog now haha. I keep getting distracted
03:59 PM rue_mohr: like, 2 wont open the file?
04:36 PM obfuscated_d: yea, incompatible with 2
04:43 PM rue_mohr: ... why would they do that...
04:43 PM obfuscated_d: the interface is wildly different between the two, but, yeah, why wouldn't they keep backward compatability
04:44 PM rue_mohr: esp with just a capture file format
04:44 PM rue_mohr: so!
04:44 PM rue_mohr: those are 1.8 degree steps with enc_pwm_egmk_fixed5
04:47 PM rue_mohr: of course it corrrects for any error from the last pulse with the next one
04:52 PM rue_mohr: wow
04:52 PM rue_mohr: the 1 bit has 25 stars...
04:53 PM rue_mohr: for github, thats a lot!!!
05:01 PM rue_mohr: wait wtf 46 follows!?!?! on GITHUB!?
05:01 PM obfuscated_d: I gave you a follow
05:02 PM rue_mohr: https://github.com/ruenahcmohr/EGMK
05:02 PM rue_mohr: anyhow, there is an update with v5 of the loop control
05:02 PM rue_mohr: hah
05:04 PM rue_mohr: oh I didn't put the velocity profiler in there
05:04 PM rue_mohr: ugh
05:04 PM obfuscated_d: maybe add a .gitignore for all the build files
05:05 PM rue_mohr: oh show me that one!
05:07 PM obfuscated_d: gitignore? just create a .gitginore file in the root and put
05:07 PM obfuscated_d: *.srec
05:07 PM obfuscated_d: *.bin
05:07 PM obfuscated_d: *.elf
05:07 PM obfuscated_d: *.map
05:07 PM obfuscated_d: in there
05:07 PM obfuscated_d: .gitignore*
05:07 PM obfuscated_d: has to have the .
05:07 PM rue_mohr: yea
05:09 PM rue_mohr: ok, did I do it right?
05:13 PM obfuscated_d: yup!
05:13 PM rue_mohr: :]
05:19 PM obfuscated_d: although, all the files are missing from stepDirComp2 and motoraccel
05:20 PM rue_mohr: uh
05:20 PM rue_mohr: they dont exist...
05:20 PM obfuscated_d: ?
05:20 PM rue_mohr: https://github.com/ruenahcmohr/EGMK/tree/main/firmware/atmega328
05:21 PM obfuscated_d: oh, ha. those are directories i had locally
05:21 PM rue_mohr: I need to build motoraccel
05:21 PM obfuscated_d: my bad
05:21 PM rue_mohr: np :]
05:22 PM rue_mohr: huh
05:23 PM rue_mohr: so, the next goal is to make corrections of less than the deadzone of steps
05:23 PM rue_mohr: and we know we cant count encoder lines for doing that
05:23 PM rue_mohr: so, we output a specific pulse to move from where we know we are
05:23 PM rue_mohr: to where we want to be
05:23 PM rue_mohr: but, how long do we wait for it to happen?
05:24 PM rue_mohr: before we do 'it again'?
05:24 PM rue_mohr: my guess, is about 2ms
05:25 PM rue_mohr: oh, but before we get deep into that, it might be good to go back and take all the local system data out of main.c for the projects
05:34 PM obfuscated_d: I can start work on the refactor in the am. I need to go do family things
05:35 PM rue_mohr: np
05:36 PM rue_mohr: I build all the github stuff in a different dir, so I have a lot of forward and backposting to do
06:58 PM rue_shop3: rue_mohr, send the invoices
07:02 PM Tom_L: then it will rain money
07:02 PM rue_shop3: haha
07:02 PM rue_shop3: I wish that were motivation
07:02 PM rue_shop3: wait, what does motivate me
07:03 PM rue_shop3: oh right, a challenge people say is impossible
07:03 PM rue_shop3: or otherwise just "the impossible"
07:06 PM rue_shop3: so, on my hardware I see to be getting that it takes 1.5ms to see movement from a motor pulse
07:06 PM rue_shop3: we should try to solidify the avr measurements
07:07 PM rue_shop3: BUT, having numbers in terms of avr timers is more important than real time values
10:51 PM rue_mohr: rif_shed,https://twitter.com/RueNahcMohr/status/1610859509404295170
10:51 PM rue_mohr: stepper motor stepping, the angle is amplified to see it, and its at 1Mfps (logic capture)
10:51 PM rue_mohr: thats how a stepper motor does microsteps (its only half stepping)