PID -Hardware needed for a software fix

Check.

AHHHHAHAHAHAAHHHHHH dang it. I could not figure out the led situation forever. I have a photodiode, tested it with the meter, seems good, a bag of 200 UV leds and all sorts of other ones. Nothing worked. My buddy sparked a lighter at it
works, like works in the rpm code even. So I can only guess that they were not a matched pair as in my photodiode isn’t tuned to the same 395nm as my UV LED’s? Ordered the matched set from the instructables article, so on hold until Tuesday.

 

Awesome, awesome progress man! I’m really happy with the Makita so far with it’s manual speed range settings, but I would definitely look at giving this a try once it gets developed.

As far as I know anything with a built in speed adjust has to be hardwired without it. I have no idea if just setting it to 100% works but I will look into it more when/if this works.

I have one Makita and two of the copycat Rocky 30 routers, I’m willing to take one apart and try this in the name of progress!

1 Like

Yeah, this is interesting. I wish I knew more about it. There’s an interesting story there. I imagine it like two pairs of polarized sunglasses, varying in phase, but I doubt it’s that simple.

Holy cow, have you seen what happens with three polarizing filters?? Blew my mind. I gotta find it.

Sorry for going off topic but that doesn’t sit right with me.

1 Like

So, as long as you put another Triac in there, it will be fine.

Maybe right, All those semesters of physics
I feel like I was lied to. So crazy.

Okay the RPM seems to be getting read but the numbers are off by what I would guess is 10k rpm meaning what I would expect to be 30k is reading as 40k dirty signal though, pretty dam hard to get a good reading. I am going to grab a optical tachometer from HF to try and verify some numbers.

The optical is giving me 20, 400 to 29,500 with my store bought speed control. Sweet numbers to work with and even it works best at an angle and not straight on.

Are you timing rising edge to rising edge? Rising edge to falling edge would have more error, I think.

I’m not sure what you meant in your second post.

Sorry, I was kinds jotting down notes/making an update.

[attachment file=53176]

I don’t think optical reflection is that safe of a indicator. The clean reading point is small and I think ambient light has a lot to do with the interference. I would much prefer an optical encoder style disk. I have nice pre-made all in one sensor and receiver boards and I think that is going to be a much cleaner signal. Hopefully a disk can be 3D printed, but there are tons of issues with that as well. http://amzn.to/2EvyBDp

The second message was just me buying an actual rpm tool and verifying the readings.

Another option would be to put a dot on the cooling fins of the 660 and get the readings from that. It is dark and a better target but the dust build up would probably make it a bad choice.

The comments are just me keeping notes. Using unsigned long just in case there was some sort of math error but a volatile word is the correct option here I think.

Dang it
I see what I did wrong there, that is still for pwm timing. I just need time between falling. Explains the 10k RPM off, doen’t fix the crappy signal.

Using the sensor board and the encoder the readings are super consistent, ± 10-15rpm @20k with many repeat readings! Super sketchy holding a router with a spinning disk and a small pcb in both hands


 

Are you wearing safety squints?

You can use just the one callback to handle the RPMs. If you don’t have a good reason not to, just use ints for any integers. Bytes are mostly just for storing characters and words aren’t really used for anything.

The next thing we could add, since we are literally getting a measurement every 3ms, is to do some low pass filtering. It will make the response slower, but the reading smoother:

smoothed_rpm += ALPHA * (rpmmath - smoothed_rpm);

ALPHA goes from 0-1, at zero, the value never changes, at 1.0, it just copies the input. For this math, you need to just use floating point numbers.

It took me a while to understand the other ISR(? void functions). I kept think how the heck is this doing three freaking loops at the same time. About and hour ago it clicked. Only the void loop is looping, the other two ISR(?) are running once (independently, I get that) and calling each other perpetuating a loop only if the interrupt triggers a falling condition. I kept thinking the loops where piling up or something.

I feel like such a schmuck but it has been a while for fresh coding and never involving interrupts.

I understand your code and need to try it. I had already realized the need for long’s.

This is pretty fun, I do like the logic part of it. I couldn’t work out how to get the two different times in the same ISR(?) your solution makes total sense.

So how does the time work (micros), is there ever a need to zero it out? I mean 8 hours or run time could result in a giant number. Will it roll over at some point? I kept trying to loop it and zero it out each loop.

This is weird that I have questions but not the right language to ask it in. Fascinating, really, I feel like I am on a bus in a foreign country and don’t know the language. I know what I want just not how to ask properly. Each little piece of info is a minor triumph.

Aargh. I had a big post and somehow deleted it while trying to format the code in it. Did it email itself to you?