Motor Control with MPCnC

Good morning,

I know this question has been asked, and answered but I wanted to expand on the question, so please forgive if its also already been asked.

I want to be able to control the ROUTER and my Vacuum as part of my setup.

I understand the points that have been made safety and leaving it unatended, however this isnt why I am trying to achieve my desire.

basically, the Vacuum and the router are seriously noisy, and I want to control

One of the posts I read, mentioned that you would be able to control the devices through the Fan switches.

So what I was questioning, since I am Running a RAMPS board, and I assume most of the other boards share the same designs.

Why cant we use the Heater bed and Extrusion circuits to control the on and off of the devices.

Using something like:
https://www.amazon.ca/gp/product/B077W1NVLM
or
https://www.amazon.ca/gp/product/B07T5X3XD5

Energizing the heat bed or extruder commands should output the voltage needed to fire the relays to contol it.

understand , that I am not trying to do speed control, I am solely looking for On off.

I want to shut down the Vacuum and router once the job is done.

You can use relays from a controller board to switch a router or vacuum on and off.

The extruder and heated bed have other considerations that might make them more difficult to use. For one, they are 12V instead of 5V so they might cook a 5V relay, and also they are intended to be used with temperature control, so the fake thermistor has to be set properly for it to decide to turn on. Also, Marlin has thermal runaway detection, where if it turns on and does not detect the temperature changing, then it thinks maybe the thermistor has come loose, and it will panic and shut everything down. You would need to make sure this feature is disabled.

I think a simpler way would be to use SPINDLE_LASER_ENABLE and map one of the 5V pins, and then M3 and M5 will work, which CAM typically generates in reasonable places (like switching tools).

When I made my SLA DLP resin printer out of PLA. I successfully use this to control the leds turning on and off from an arduino mega board and a raspberry Pi. All you have to do is call a pin and turn it on and off when you want in the program. Unfortunately it will require to know where in the program to enable it and disable it. I have several of these on hand. Relay that I used is similiar to this. So basically and not to beat this to death. This particular relay works by giving it positive and negative power from the board and the pin out lead (signal) will go to the S pin on the relay. If you have a R/C servo wire laying around or extension that can be use to connect to the relay.
Additionally you should not hook any device through the power switch that is over 10 amps. Good Luck.

I have this relay board, and it works with almost any input. You can plug in your vac and router. You should be able to hook this up to the fan port without modifying the firmware and control it with M106/M107. And all the AC is well bundled up, so you won’t get shocked by any loose wires.

Another nice thing about this setup is, if you kill 12V power, the router will turn off. So E-Stops are easier to wire up.

4 Likes

Nice power station. I just have a power on off switch like a light switch at the front of my machine. My wife knows that if one turns it off it will kill a project.

If you care to look it is on the top left corner of my old control section. I choose to encase it in metal because if it every over heated it would have the same protection any residential or commercial machine has. Basically self contained. I had a metal cover that when over that enclosure so you could not see the electronics.

I agree with @jeffeb3 that the IoT power brick is a great solution. It requires little wiring experience or skill. I was able to find some Dupont connectors to solder on to the wires to control it. It has two wires go from your board to the brick. It has several different options, but basically has two outlets that you can turn on and off together. Perfect for spindle on/off and vac on/off.

I have an Archim board and found the schematic easily enough to plug in the wires.

M106 P0 turns it on.
M107 P0 turns it off.

It works well and doesn’t seem sketchy or poorly made.

I found a local store that will let me go pick it up, the shipping was crazy at many of these places.

I know I could have bought the relay for 10$ and made something better, Electricity doesnt scare me, but for 40$, it wasnt worth my time

thanks!

1 Like

So, other then manually adding

M106 P0 turns it on.
M107 P0 turns it off.

In gcode, is there a way to add it in with spire? Or in octo print?

I assume you mean Vetric Aspire? You would need to edit the post processor for that for starting code and ending code. Just guessing here from the looks of this previous post:

I had an eye-opener scrolling the the Aspire manual. Wow. It can do a lot.

Post Processor Blocks
HEADER
±--------------------------------------------------

  • Commands output at the start of the file
    ±--------------------------------------------------
    begin HEADER
    “Commands”
    The header is the location for the instructions that are output once,
    at the start of the file, these generally setup modal commands for the controller.
    For example, the Header might contain a command to display the filename on the controller and a
    series of “G-Codes” to set the machine up, for instance G20 to tell the control that the moves are in
    inches, or G21 to tell the control that the moves are in millimetres.
    Variables that you might wish to be within the header section,
    could include:
    Information about the Material Block
    Minimum extent in X = [XMIN] Minimum extent in Y = [YMIN] Minimum extent in Z = [ZMIN]
    Maximum extent in X = [XMAX] Maximum extent in Y = [YMAX] Maximum extent in Z = [ZMAX]
    Length of material in X = [XLENGTH]"
    Length of material in Y = [YLENGTH]"
    Depth of material in Z = [ZLENGTH]"
    Home Position Information
    Home X = [XH] Home Y = [YH] H

FOOTER
The footer is the section of the post processor for instructions that are sent to the controller at the
end of a file. These might be instructions to return the tool to the home position, switch the spindle
off or switch the power off to the drives.
±--------------------------------------------------

  • Commands output at the end of the file
    ±--------------------------------------------------
    begin FOOTER
    “Commands”
    Variables that are commonly used include.
    G00 [XH] [YH] [ZH] Rapid to X,Y,Z Home position.
    M05 M Code often used to turn spindle off.
    M30 M Code often used to signify the end of the file

The CNC.js part? You can do a macro in the macro widget. One to start, the other to stop.

Nice @scrounge79 write up. I was gonna say if you know how to open up the gcode in a text file. You could actually just add it to the end of the file if you wanted also. The command that is.

When I had my CNC running off of an Arduino Uno I used the Universal Gcode Sender to send my files to the uno. For me that was prior to me learning about the PI system. No way I would go back now. I digress. lol. I was able to program macros but those I had to press with a mouse click. However I could set up homing with them or center of the platform or plane the scrapboard ect. Again I am eager to start using the new machines I just printed over the next few weeks. :smiley:

1 Like

yes @scrounge79 looking forward to trying it.

@MikeT I figured I could just add it too the Gcode file, but I was hoping to not have to think about it. and just have it do it as part of the process. sounds like it might just be possible.

I have been so lazy this week, I need to start carving to play some more.

Their is a chance I will have a functioning machine by Sunday. I have all the pieces printed. I am just working on getting CNCJS setup. No way I am running this machine with out that program installed. I got real spoiled with Octoprint. Seriously spoiled. :smiley:

Octoprint has been hit or miss for people (say the forums), I haven’t had any issues , but I haven carved much either

Octoprint hasn’t had any real problems, unless you have EXTRUDERS=0. It is funny because it has so much printing stuff.

The fan on and fan off buttons are the same as M106/M107.

CNC.js and octoprint are on my v1pi image, if you want to try both of them.

2 Likes

Cool and thank you jeff. So all I have to do is change the password and put in my ssid and password stuff for the network like normal?

Yeah. Here are the setup instructions: https://jeffeb3.github.io/v1pi/setup/

2 Likes

No problem. I have 3 pi servers in the house. I am no expert. Just an end user. I dont set them up very often that was why I asked. Thank you again. Ya well put together instructions. I can see why you would do that in that way now. It appears to be easier to switch between a hot end and a router. I am guessing.

@jeffeb3 Have you ever had anyone ask if they could hook up a dot matrix or printer head like an inkjet print head? I only ask because I make maps using my cartographer software My maps are as large as building plans on drafting paper. I currently pay over 20 bucks to get a single map printed. I feel that the LR2 could suit that purpose really nice if possible. Thanks again.

Technically, the MPCNC is a plotter if you attach a pen to it, I wonder if there is a way to convert a printer driver to output Gcode.

interesting idea.

I guess, you could output your software to print to a PDF, then PDF to DXF then DXF to Gcode?

I am sure its doable, easy? maybe not.

3 Likes