PID -Hardware needed for a software fix

Okay, so another day and a half later I think I found something.

Well first, I do not think I was wired wrong…that didn’t solve it. Here is what I have found after all kind of monkeying around with my limited EE abilities. If I have a meter on the power and ground rails of the arduino The issue does not seem to exist. Seems like there needs to be some tiny load. Makes no sense because the sensor has an LED in it (tiny load on the Nano power rail), so is that not enough? Do I need another diode, filter, Cap, resistor?

Well, its the power supply. I forgot I swapped them. I was testing with a 20A, switched to the 6A…all bad. Shoot. Not sure where to go with this now.

Printed the new cap and installed today did not get the same the clean test data as you did.

The highs and lows were not as large as yours. Will have to open the Dewalt back up and try to change the distance the censer is from the shaft. I think it is to high.

[attachment file=61031]

 

It should push all the way down. That print is missing some things. There are edges that should catch the led at the bottom, they aren’t even there on your print.

So my current best guess after all of this is that the line noise from the smaller Power supplies is getting pumped through the IR LED and Received by the sensor. This is causing an almost continual rising and falling situation. So when the router is running the real signal is stronger, but every few cycles the noise happens just in between the real signal and doubles the perceived speed, thus cutting the PID power.

So, clean power supplies work, dirty supplies…not sure if I can add a filter or cap or something. Everything I have tried has not worked so far to make it work with a dirty PS.

If I get the sensor reading just on the edge of the transition I can see the signal, much higher frequency. I am sure it is limited by the arduino interrupt speed only. Looks like it is picking it up down to ~40 microseconds (μs?). Use a different power supply the signal is absolutely clean. I don’t want a new power supply for everyone to be needed just to make this work.

[attachment file=61038]

I emailed a guru…Hopefully he has a simple solution.

How are you powering the LED? Can you use the 5V from the rambo?

The power is coming from the PS, through the Rambo, into the nano. I dissected the PS and there seems to be plenty of filtering in there, the big 20A and 30A No issue. The only thing I saw out of desperation was setting my MultiMeter to HZ or duty cycle and the little PS is all over the place 10-200, the others are ±10 (about 60hz if I remember right). I expected it to be a multiple of 60hz, or just not work on DC, so shows I have no experience in the area. I really don’t know what could cause this, or if this is just from cheap power supplies…

So freaking close…I am also just really glad for whatever reason I did not start with the other power supply, or I would not have tried this hard to make it work.

Can’t just use a pull up and pull down with a debounce cap in the middle? Hmm, I guess I mean a debounce circuit like this:

[attachment file=61049]

The signal change from the sensor is the switch…

Hmmm, I am not sure Bill, I will read up on that. The circuit already has the resistors that is why I tried to add some various Caps I had laying around. They didn’t seem to make it much, if any, better. But maybe I just have the wrong kind. It would also help as Jeff said to have an oscilloscope to see what I was trying to filter out.

 

The other option is reading the analog value of the sensor pin instead of just the rising state?

Maybe just a ferrite bead /choke? The ones on the actual power supplies seem to be fake unless somehow they have embedded metal into the rubber or something.

I don’t understand how the power supply can have that much of an effect through those other power supplies, unless maybe there is a lot of noise on the ground wire (which is common everywhere). Some kind of ground isolation, maybe? The LED is getting it’s power from the Nano?

Filtering the noise with Bill’s circuit (congratulations, you are responsible for all debounce circuits now!) would smooth that out (probably?):

I made a sweet sketch with this: https://sketch.io/sketchpad/ and their default font is perfect!

[attachment file=61074]

Is there a makerspace or a library with an oscilloscope you could use (they aren’t hard to use)? I’d be curious to see how much noise there is on the power to the LED, with and without things running, and on the sensor “output”. It really seems like there shouldn’t be that much noise on there.

Something else that’s bothering me. On that last graph, that is the analog signal from the sensor? And you have tried to put the sensor right on the border between on/off? Maybe that’s OK. You don’t really need to measure it when it’s off, right?

Yup. I know this is not super clear but the idea is, Rambo power from PS, two signals and the ground and 5V power to Nano, out to both the sensor and dimmer.

[attachment file=61077]

I have an amazon page open as we speak, watching an eevlog review first.

That last graph picture is still the time between falling edges. I can get the dirty signal by rotating the dewalt, find a falling edge, then slow move it back to get what I assume is just the edge of the black/white area on the shaft. They are not there with the 30A PS, or just USB power, but only the 6A PS.

 

Just to give you an idea of the Jankyness of the importers newly UL listed PS’s. They feature in there ads new “3 prong power cords” the ground is literally not connected inside, and the “bead”…well…

[attachment file=61078]

 

IMG_20180604_092500.jpg

IMG_20180604_092511.jpg

Things were much more neat and clean but over the last few days of this I have literally changed every single component several times in many many configs.

1 Like

Stick with it. You’ll have a breakthrough soon…

or a breakdown, but then you’ll enjoy building another machine to replace the one you threw across the room. :wink:

HAHAHAHHAHahha soooo true.

Well I had a few emails this morning about this…I am not sure what to do about them. I need some time to think.

Looks like I removed it when I cleaned up the support that was printed with the part. Reprinted last night and it looks better.

1 Like

Wire up a real three prong power to that cheap power supply and see if your problems go away.

You can’t get a clean power without an AC ground, and any noise is unlikely to get squashed anywhere along the way.

You could try to stick a 5v regulator on the output going to the LED to squash the noise.

 

I immediately ripped open the PS looking for somewhere to stick the ground wire. I see nothing obvious. I will look up a few of the components and see if I can figure something out.

I have some 5V regs here, the nano’s have one on them already and I have tried with both the 5V and the 3.3. It is worth a try though, maybe it will do the trick. I have a scope on the way, maybe that will help.

This works and can be used with a good power supply but I can not put the dimmers in the shop yet. I have to talk to a lawyer and make sure a disclaimer will cover me from someone getting zapped by improper use.

I think I am really going to put in some effort to make the time to go test this on some real cuts today if I can’t go sit down with the lawyer today. Need to make sure the system actually reacts fast enough to be of some use other than a speedo.

Somehow even just touching it with the negative lead of my multi meter kills the noise completely.

1 Like