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.
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 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.
@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.
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.