A proper enclosure for CNC3018 Offline Controller

 Posted by:   Posted on:   Updated on:  2022-01-02T21:15:27Z

Make a 3D printed enclosure for the offline controller of CNC3018 and add a switch to disable the controller when connected to computer.

I like to have an offline controller for my CNC3018 machine because I want to keep my computer away from the CNC during usage. There is a lot of dust and cut material scraps which shouldn't get into fans and electronics. Speaking of electronics, the offline controller of CNC3018 is just a bare PCB stacked between two nicely machined acrylic plates. There is absolutely no dust protection. Here is issue #1. The next one is that this controller hangs around the CNC. There is no way to attach it to the frame. And the third issue one will encounter when using the offline controller is the loss of computer communication. That is right. If the offline controller is plugged in, you cannot connect to CNC via USB. Basically, both USB interface and offline controller share the only available serial port of the ATmega328p based mainboard.

I decided to fix all these issues. Following is a 3D printable enclosure which can be attached to the side of the frame on existing screws. And regarding the serial port issue, there is an optional cable connection mod you can do. Below is the result.

CNC3018 Offline controler attached to frame side

The enclosure

There isn't a single variant available in stores nowadays. So, have a look at the initial state of the offline controller I bought. It is the version with microSD card.

Original offline controller

I kept the front panel because it is nicely machined and has button labels engraved. However, I glued a small piece of acrylic glass on the back, over the LCD cutout. I had 4 mm thick acrylic and it fits tight between front panel and LCD (with the fit and the glue I can be sure it won't fall from its place). I will remove the protection foil from LCD when assembling this. I used common superglue (cyanoacrylate) and two clamps to keep the pieces in place.

The screen protection plate over the back of front panel

The actual enclosure is made from three parts: the top half, the bottom half, and the side holder. PCB sits between the halves; however its sides are not exposed. There is nothing special about these parts. I printed the halves with PLA, 0.4 mm nozzle, 0.2 mm layer height, sliced in Cura with default settings for Artillery Genius Pro. As a side note, I printed the bottom half with supports because I was afraid I would not get a proper SD card slot (but I think it can be printed without). For the side mount I used 100% infill for increased rigidity, although I believe it does not make too much of a difference.

Enclosure model

There is a switch slot in the side of the bottom half. I'll get to that later. There is also a slot in the base and a screw/nut hole. Those are needed to attach the side holder. There is also a cable hole there, and matching holes are present in the holder. Rotate the holder 90 degrees to the left on Y axis for printing.

All STL files are available from Thingiverse, thing:5182830. I included there a small cover for the ribbon cable connector, in case you plan on doing the following electronics mod. Everything is designed in FreeCAD. If you need project files, drop a comment.

Cable and switch

As I mentioned at the beginning, I don't enjoy unplugging the offline controller every time I need to connect to PC via USB. More than that, here is a possible electronics issue. The TX pin (output) of the serial interface chip on the mainboard (CH340G) is wired to ATmega328p RX pin (input, no problem). But, with the controller attached, it is also connected to its TX pin (output). Two output pins wired together - it doesn't sound good.

Back of the controller PCB showing connector pinout

There is a reset pin on the connector. It goes directly to MCU (PB1 of STM32F103RCT6). Here comes another question. STM32 operates at 3.3 V (conversion is made on offline controller board) but ATmega328p on the main board operates at 5 V. This reset pin goes directly to MCU, however the datasheet says almost all of STM32F103 I/O pins are 5 V tolerant (hopefully this one too). I did some tests after disconnecting it from mainboard, and I can get absolutely no pulse on this pin from the controller. Then, I tied it to 3.3V, and after to GND. In both cases, the offline controller works as usual. 

The point here is that somebody anticipated the issue caused by a single serial port shared between two controllers. And that reset signal could have been passed from mainboard to offline controller when connected via USB. The offline controller should respond by deactivating its serial port (setting output pins to Hi-Z, so it would not interfere with the communication). But it does not seem to happen. Practice proves this. When connected to PC and offline controller, the CNC only responds to the controller. Or maybe it works (offline controller deactivates CH340G ?)

So, with the hope that the serial port pins of this MCU are Hi-Z while not powered and will not get affected by external voltage applied to them, I decided to add a button to cut power to offline controller when I need USB connection. Since I didn't want to do any destructive mods to existing hardware (connector modification or cable cutting), I added my own cable. Required pins are 5V, GND (there are two of each available, can use one), TXD and RXD. I have some 4-wire shielded cable (sold under the generic name "alarm cable") which is perfect for this. The 5 V supply needs to pass through the switch.

Wiring the new cable to connector

I have no part number for the switch, it is just something I found in my junk box. In the design shown in the photo, there is no way to insert the switch unless you break one of the stands (this is what I did, then glued it back). I fixed this, and the current design features two standoffs located behind the switch at enough distance, allowing you to insert it. However, you need to apply some hot glue to keep it in place afterwards.

The switch

I soldered wires on the back of the existing PCB connector. I used red for 5 V, black for GND, shield for the second GND, blue for TXD and yellow for RXD. The wires are more than capable, having a section of 0.22 square mm. After assembling the enclosure, I passed the cable through the holes and crimped a 4x2 dupont connector.

Finished offline controller (cable held in place only for photo)

Note I marked the notch on the connector so I can plug it in with the correct orientation. Next I attached this to the right side of CNC3018 frame. It uses the screws for the top linear rod and 2020 V-Slot profile. Having proper shielding is a really good thing, since this cable passes next to stepper wires.


Now, I don't have to unplug anything when connecting CNC3018 to USB port. And when I need to load G-code from SD card, all I have to do is switch on the offline controller. I avoid jogging the CNC from the controller while it is USB connected. The controller should stay off as long as the CNC is connected to computer.

No comments :

Post a Comment

Please read the comments policy before publishing your comment.