Experimental PID troubleshooting

Got the rest of my breadboarding done, tested the PWM and ENABLE (using GRBL on a spare uno). Couldn’t get anything but full speed. Powered everything down, checked the voltage on the dimmer, and I get 120 on the load side. Even with everything else unplugged from it. I’m pretty sure that when I started, that side read 0, which is what I would expect. Is it toast?
update: i found a triac troubleshooting guide that said i should have > 1meg ohm between 1-2 and 2-g. i have more like 450ohm so ive ordered replacements

Looks like that was it. Still not quite right, but the board seems to be doing its thing.

I still have all the stuff breadboarded, so there may be some issues with that, but the controller doesn’t seem to work very steadily or predictably. In fact, it kinda just hums until I start wiggling the wires. After that, the speed is sometimes pretty close (within a few hundred rpms…so perfect) and sometimes it just goes faster…mainly when I push the wires a little more.

I’m sending commands through cncjs, and it turns out that if I touch the laptop frame just above the touch pad, the 660 jumps to full speed.

I’m not sure if I’ve got something wrong on the grounding, if it’s something wrong with the breadboard, or something else. I’m also not quite sure where to start.

Which wires are you wiggling? Sensor to the nano, PWM to the dimmer, or the ac power?

Kind of sounds to me as if the PWM signal is grounding out somewhere.

1 Like

3 and 5 to the nano, pwm and spindle enable. I had those going to another spot on the breadboard, as if that spot were a plug, to keep track of everything. Got rid of those intermediate wires and that problem went away.
Now I get full speed with m3 s1 (or s whatever, really). My uno is calling for 0.2-5v depending on the s value, like it should. The enable goes to 5v, like it should. The nano d9 output to the dimmer is at about 4v (I’m not sure what that one should be).
Perhaps my optical sensor wiring is suspect?

Well, I’ve got continuity from the sensor to the end of each wire, and none of the wires are touching each other.
I did notice that wires 1 and 2 go to power. I wired mine by a diagram that showed the little dot was 1, followed by 234 going ccw (looking from the top). In another diagram, I saw that 1 and 3 should be powered, which makes sense. Following they the circuit, looks like both the power wires are going to the emitter /or is it the sensor?).

I need to go back and check. I seem to recall there was a diagram that had connections reversed, but not sure which diagram that was.

1 Like

Thanks. I’ll go check for it. I tried shipping the plug around, swapping 2/3, and 1-2 for 3-4 after that. Maybe I need to just rework all that stuff.

This might be a long shot but have you tried removing the breadboard from the equation? I’ve had funny issues resolved by hardwiring what I’m working on. 🤷

At the very least try hard wiring the signal wires coming from the sensor to the input of the arduino. That in my mind is the most susceptible to outside forces.

1 Like

I have not. I’ll have to see if I have the right connectors to make it easy. I’m somewhat new to arduino and electronics, and I haven’t collected a ton of stuff yet.
Several points on this one where things group together and I don’t know exactly how to handle that with wires and such.
Heck, now that I admit it out load, I’m not positive I handled it correctly on the breadboard, lol. And most of those multi point connections are resistors, grounds, and a capacitor for…the sensor.
I remember seeing a breadboard Pic somewhere. I’ll see if there is enough detail to help me along.

Mine is hidden away on a shelf somewhere. I’ll try to remember and get it out and look at it tomorrow!

Mine worked well except for the random blown triac now and then. I wondered if it was something wrong with the snubber circuit on my board… but that’s above my pay grade.

Well, i have a whole bag of them now, lol. If I ever get decent at desoldering…

2 Likes

I’m at loss. I’ve moved it up the breadboard, got rid of the wires I could, built my own jumpers because the others were sketchy, found the reference to the plug that wasn’t labeled right.
I triple checked that the sensor was wired correctly.
Where I’m at now is sending M3 S(anything) snaps the router on full blast. Even M3 S0. M5 cuts it off. I’d think if the sensor was at fault it would at least ramp up slowly in response to, say, M3 S1 or M3 S10. Then again, I’d expect it to not go at all for M3 S0, soooo…
Anybody got any clues?

I watched a few videos on that sensor (qr1114?). I’d have watched more but not many in English and I only learned enough Spanish to get around in a kitchen with people who had to care what I wanted, lol.

I saw one guy say they responded to changes in reflection or surface. Going from paper to a table top. I think the two I saw working both used whiteout for one side and one a sharpie on the other and the other paint. I used paint on both sides because I have it. Black and white, but the same finish. Does the color alone do a good enough job or does the finish for one side need to be really really not shiny, like whiteout?

Since you can turn things on and off, I don’t think the triac has failed open. Any chance whatever took out the triac in the first place took out part of the PWM circuit? I would expect full speed operation would be a symptom of not receiving feedback from the speed sensor, so it thinks the spindle is slow and is trying to speed it up.
In my initial build I had to apply a frequency correction a correction to one of the lines of code, but I believe a fix for that was included in a “pull request” for the PID software last summer.

It has been a while since I painted the shaft, but I used nail polish (my daughter happened to have both black and white). I don’t think it was particularly matte finish, but I don’t have a strong recollection of that.

In the original (very long) thread about the PID solution, were there troubleshooting tips about enabling some code to see what you were getting from the sensor. I think they assume you’ve got an LCD wired in, or you may be able to get the debug output to show on the Arduino IDE serial monitor. Check out posts from @jacobalberty in June of 2020 in the PID-Hardware needed for a software fix thread - message 520 or thereabouts…

Thanks. I saw that, but I’m working on a laptop with only one USB port. Maybe I’ll borrow one of kids’ laptops for a couple hours.

I found a couple data sheets for that sensor, and one of them had a description that implied white/black was adequate.

Funny thing happened last night that I forgot to mention. I was measuring the voltage at the load side after sending M3 S1 and the voltage went up slowly. But it only happened once. Couldn’t repeat it. After that it just spiked straight up to 120.

I guess the next step is to see if I can get data out from the nano as you suggest. After that, try another board. I hate to spend the money as a troubleshooting step, but if it turns out the sensor is doing what it’s supposed to…

Well, whatever is happening, I’m getting zero RPMS from the sensor calcs. The pwm value seems proportional to the value I call for, although I can get a really high value out (like 700) depending on what I call for.
I moved the cap, and now the router winds up slowly for a low speed but keeps going until it just stops, and when that happens, the rpms go from 0 to half a million, or 300000 or some stupid number. Clearly not a reading, so something is borked.
I found an extra sensor, so I tried wiring it up on the board and bypassing the one on the router just to see if I could get any response at all on the serial monitor, and I started getting some smoke from around the nano, so I yanked all the wires out and called it a night.

New nano, V1 board, (thanks Jessie) same problems. 0rpms back, pwm varies (8,12,176), full speed. I added a piece of tape to the router on top of the white paint, no help. I have no idea how to test anything on the dimmer except ac volts in/out and the triac resistance between legs. I’m not gonna buy another dimmer unless I can be reasonably sure that’s the problem.
It works for other people, so I must have done something wrong, but I’ll be damned if I can figure out what.
I guess I’ll just throw it in a box until somebody smarter than me has the time/inclination to do a proper writeup, because I’ve got things to do and this is taking up too much time and effort.
Thanks for the help up to here.

As for the RPM readings. If you do have everything wired right, you may be having the same issue I had with the signal from the photo sensor. The sensor sends a voltage back to the Arduino that is proportional to the amount of reflected light it is seeing.

Here’s what you need to do to test this…

  1. Hook everything up like normal except for the signal wire coming back to the Arduino. Instead, connect this wire to the postive lead of your multimeter (set to DC).
  2. Connect the negative lead of your multimeter to the ground that is shared by your arduino and sensor.
  3. Manually spin the router slowly and watch the voltages. You should get a high voltage and a low. Record these.

The arduino must see a voltage higher and 3V to read a HIGH state. It also must see a voltage lower than 1.5V to read a low state.

If this is not what your readings are showing, then you need to play around with the resistor that is feeding the photo sensor… or do a better job than I did with the dark and light surface the photo diode is seeing on the router.

1 Like

I’ll give that a shot.

1 Like

The high is pretty good, 4.8-4.9v. The low dips to 1.2-1.3.
Seems ok, right? Also indicates that I have the wires to the board correctly. But still no rpms being calculated. It is what it is.
I might try to rig the sketch to send a really low pwm_out, like 0.3v or something. See if that fits anything for me. Even if it does manage to spin slowly, I’ll never be able to use this without being able to read rpms. And if I’m getting the right voltage and no calculated rpms, something is really wrong.