PID -Hardware needed for a software fix

Dang I think you are right, how the heck did that get messed up?

I think you copied the pin numbers from your PCB schematic since the numbers match there. They just don’t coincide with the IR sensor pins so when you combined the two pictures into the diagram the pin numbers didn’t align.

Delete, I can’t find where to delete this duplicate post.

Thanks for bring this up. I’m also a bit confused are you talking about the number for the sensor section of the board or are you talking about the diagram of the sensor at the bottom?

Either way thanks for pointing this out.

 

Ryan, Do you think you’ll be able to have a new image up before April? I’d love to be able to finish this in time for my birthday.

 

 

Hey guys,

Diving into this stuff as someone who was completely clueless about electronics/controllers/etc… going into it. AAAnd lost too much sleep the past few nights trying to figure it all out. :slight_smile:

I’ve had success doing ā€œdumbā€ AC dimmer control just using an Arduino sketch to control the PWM output values. Now trying to get the communication with the rambo board working properly before adding in the sensor/PID. I enabled everything in the Rambo firmware and have combed through that over and over and I’m pretty sure everything there is right.

I have mine wired just as Ryan has shown in some of the forum posts (albeit this is just hooked up on a breadboard for now). Using the 45 Pin for PWM and 31 for enable to Nano pins 3 and 5, respectively. My enable pin is working as expected with M3/M5 commands, but for some reason, the input signal doesn’t seem to be working correctly. I get the same response to my Nano regardless of the spindle value I enter (ie M3 S10000/S20000/S30000). I attached a screenshot of the serial plotter using the debug line in the Github code:

Serial.println(pwm_value); // For debugging the PWM MAP

I’m basically just running the code off of the Github but disabled the PID portion for now, and am not even worrying about outputs until I’m convinced that I have a good input signal.

One thing also that may or may not be affecting this: should I be ā€œbridgingā€ grounds between my Rambo and Nano circuits? Not sure if that matters or not. Is that what the 3rd wire is in Ryan’s picture on pg. 6 of this thread?

Ā 

Thanks in advance! This project is trying so far to say the least but still a lot of fun

Minor update:

Tried simplifying it down to just use a pulseIn to read the Rambo input and figured out that if I issue:

ā€œM3 Oxxxā€ where xxx = value 0-255, the signal works perfectly.

No success whatsoever with using M3 Sxxxxx commands. It just automatically sets it at a PWM value corresponding to ~213 (of 255).

I’ve been reading through the Marlin code trying to figure out what might be causing this, but I think it’s a bit over my head…I guess for now I’ll just use the O command. Would really appreciate some feedback if anyone has had a similar issue.

A few pages in you can see the part of marlin that gets edited, you input your routers max RPM and then just use the RPM you desire not the PWM value,

I’ve noticed I spend more time tinkering with my MPCNC than using it. Not because it doesn’t work, I just enjoy trying things.

Anyway, I’m ready to give the PID control a try and noticed that while the kit is in stock, the PCB is not. Any chance there will be a reorder?

Otherwise, I’ve been considering trying to cut a PCB so I suppose I could give that a whirl first ?

1 Like

I think I have the link to order some yourself. Unfortunately my insurance wants a lot of money from me if I sell this. I am about to change policy’s so I will try to talk to another person about this.

It does work well and I would love to spend more time on this as it is awesome. You can pretty easily make one without the PCB though, or there is the superPID commercially available.

I would love to get the screen and a few controls on this thing.

Firstly, this thread should be stickied!

@vicious1 as far as turning this into a low cost product/kit for the MPCNC goes have you considered making an open loop controller? I’d wager that the majority of users would benefit from a much simpler device that lets them drop the RPM down to something like 10k while keeping a reasonable amount of power for plastics. You can wire a switch into the SuperPID to toggle open loop mode to rule out a dusty/blocked optical sensor; I’m more/less asking if that would be sufficient for the majority of use cases here.

While it’s cool to know exactly what chiploads and speeds the machine is running I’m going to guess that it’s not critical for most users here :slight_smile:

Pardon me if this has already been discussed. I’ll admit that I haven’t read all 15 pages of this thread but instead dumping thoughts from my SuperPID experiences.

That was step two, adding a screen for stand alone control. It is ready for it and the code should be simple to add. I hope to revisit this soon, if not this project has always been open source.

2 Likes

I had started working on building a prototype with LCD and a few buttons, potentiometer, etc…to be able to manually control the speed and switch between open/closed loop control. I actually got the code mostly written to enable the additional functionality, just still haven’t gotten around to finishing the hardware.

That being said, I have no idea what I’m doing and even I think it would be super easy to do if you just wanted a simplified version with open loop control and skipped the Gcode input stuff.

I kind of suspect though that the motor wouldn’t do well with just dropping the voltage way down without the closed loop control to keep it stable? I know my harbor freight manual speed controller only gets me down to around 20k rpm and I assume it’s limited like that for a reason. Maybe someone more knowledgeable could shine some light on this though.

I am not sure what you mean by open loop?

It is a loop, which needs an input. Right now the input from the board is the only way to set it. Adding a few more line of code for another input (knob, or buttons) is all that is left. I believe I already have the Oled code in there. I stopped when I was trying to decide if I wanted a rotary input or a bank of buttons. The RPM wobble was the main goal so there would be a button for that as well.

The foundation is laid now just some hardware choices need to be finalized.

So what I think bruh was talking about with open loop (at least least my interpretation) would be just a ā€œdumbā€ speed control without the added complication of PID feedback control via sensing the RPM.

Now that I’m thinking about it though, if that was all you wanted, there are cheaper/easier ways of accomplishing it, like the Harbor freight router speed controller I have, or the diy ones people make from a dimmer switch. I think cost would just come into play here, since the cost of the AC dimmer circuit we’re using is about equivalent to the cost of one of the manual speed controllers. If you were going to go through the effort of hooking up the rpm sensor/Arduino stuff, you might as well benefit from the PID control.

Additionally, what I had mentioned in my last post was being able to switch between open/closed loop control (ie PID on/off) on the Arduino circuit. I think this would be nice for the random cases where the PID isn’t properly tuned for whatever you’re cutting, and you just want some manual control (exactly like the harbor freight controller) to get the job done. This is pretty easily accomplished with a push button and some modifications to the code.

Ohhhhh, I see. Yup it could be added but easier would be just use the dimmer I have and skip all the rest, you can wire up a potentiometer I think and be done. It would be about the same cost as a manual dimmer though.

I have some parts coming on a boat to join in on the festivities here! :smiley:

Out of curiosity, has anyone tried a bang-bang control loop for controlling the speed (easier to tune than PID)? (if over x RPM, drop/lower the power. if under x RPM, increase/raise power). I suppose in our case, we could adjust PWM between 1 and 255 depending on how far out the actual RPM is from the target.

1 Like

That is proportional control.

Right, but it would still be bang-bang as well. We would just have the luxury of applying variable power instead of 100% like a heated print bed.

Sounds like a PI controller, no? I’m wondering if in this instance if it wouldn’t just be easier to tune the PI/PID as is than it would be to rework the code.

But it is such a fast response system I can see where hysteresis control makes sense. But I haven’t built this project so my arm chair anecdotes don’t count for much…

I cannot wait for my parts to arrive so I can start messing around with it. :smiley: I will most likely start off with the base code that Ryan has put together. I have trouble leaving things asis though haha