Sometimes it takes more time and energy to make the project box (case, enclosure) than it takes to actually design and build the electronics. For a final product or a production version, that might make sense. But sometimes you just want something that will do the job, not take too much time, but still look good. Over the years I have watched hundreds of engineering students use laser cutters and 3D-printers to make their project boxes. That bothers me sometimes, especially the mess of cut acrylic sheets surrounding the laser cutters and the knowledge that most of these projects will find their way to the dumpster soon. It seems wasteful and ecologically unsound. Not to mention, this is an expensive way to make a temporary box. 3D-printing has its own problems, one of them being that it is a really slow way to make box. Taking four to six hours to print out an enclosure, when there are dozens of other students in the queue desperately waiting to print their parts, doesn’t seem consistent with the concept of unleashed productivity that 3D-printing is supposed to bring.
All of this waste and inefficiency is made worse by the fact that the project box might have to be remade a few times because of measurement errors and design changes. However, over the last few months I have been working on a system that uses small 3D-printed pieces, in combination with decorated foamcore panels, to make serviceable and attractive enclosures cheaply, quickly, and easily. Better still, these enclosures are quickly and easily modified if there are measurement errors or design changes. And a further advantage is that the 3D-printed pieces can be made up ahead of time, before the dimensions of the enclosure are known. Then, when the dimensions are set, the foamcore panels can be cut and the case put together in a manner of minutes.
I’ve worked out several different methods of building these boxes, which I’ll describe in upcoming posts. For now, I’ll introduce what I think is the best approach for small boxes. It basically consists of two plastic (3D-printed) endcaps which contain slots into which four foamcore panels fit into. A couple of pictures say it all:
Of course, the box need not be quite so plain. Here is rendering of something edgier:
In my next post on this subject I’ll provide some construction details. I also think I’ll have an OpenSCAD program available that generates the STL files for the endcaps.
Using the LPKF Protomat ciruit board machine. In a couple of earlier posts I described rebuilding a LPKF Protomat circuit board etching machine. This wasn’t a recreational project (although I did enjoy doing it). I like to use the machine for quick prototyping when the circuit is not too complicated. This week I used the Protomat to build a board whose components are almost entirely made up of modules and break-out boards:
Modules and breakout boards as components. The components include a Modern Device “RBBB” Arduino-equivalent, an Adafruit real-time-clock breakout board, an Innogear HC-05 bluetooth module, and a Maxbotix ultrasonic rangefinder. There are a couple of other things that plug in as well. The whole system could be sustantially miniaturized, of course. The components could be squeezed closer together, but they are spread out this way because there is something that fits on top of this circuit, and this layout gives access to the pushbuttons and connectors when the other components are placed on top.
Better than the old days. In the “old days” these kind of modules and breakout boards were not available, and I would have had to design, lay out, and build an entire circuit board from scratch. This new way of doing things (thanks Adafruit and Sparkfun!) makes designing and prototyping so much faster. As the current project progresses, I will eventually have to design and lay out a board from scratch — with surface mount components most likely. For now, though, there’s nothing that can beat — in terms of time and convenience — building with off-the-shelf modules and breakout boards.
Spying on my cats. What is this board for? I can’t really say here because of intellectual property issues. There’s more to the project than what’s shown here. But the system shown here could be used to spy on my cats. Let’s say I want to know how much time they spend sitting on the big chair in my living room — and when they’re in that chair. I could use this system and point the ultrasonic range finder at the chair. The Arduino-equivalent would be programmed to recognize when something is in the chair and broadcast (by bluetooth) cat-in-the-chair and cat-not-in-the-chair data to a bluetooth-enabled computer in the house. The realtime-clock would allow the data to be time-stamped; so rather than sending out raw data, the system could send out more processed data: for instance, an hourly cat-in-the-chair report and a 24–hour report. The possibilites are endless. A report might include information such as “maximum uninterrupted sitting time.” As I write this, I’m beginning to think that I might just build an extra one of these circuit boards so that I can spy on my cats. I don’t know whether they’ll be affected by the high pitch emitted by the ultrasonic range finder, but I’ll find out.
The software problem. Now that I had the hardware under control, I moved on to the software problem. Originally the Protomat machine was supported by two pieces of LPKF software: CircuitCam and BoardMaster. CircuitCam took as inputs the circuit board layout pattern (Gerber files) and the drill information (Excellon file). CircuitCam then will figure out how to mill out a board with a small diameter milling cutter so that circuit board traces are electrically isolated from each other. These cuts into the copper-clad board are called isolation tracks. The standard LPKF isolation track is only 0.2mm (0.008 inch) wide. After the isolation tracks are generated in CircuitCam, one can export the LPKF milling machine data to a file. Typically this data would include both the data for the isolation tracks and for the drilled holes. Then, to have the Protomat machine manufacture the circuit board one would use the LPKF Protomat control software, BoardMaster. From BoardMaster one would read in the data file prepared by CircuitCam and then mill and drill the board. BoardMaster would organize the fabrication process in terms of “phases” (e.g., milling top side, milling bottom side, drill holes), associating each phase with a different milling cutter or drill diameter. The problem was, when I got rid of the LPKF electronics, BoardMaster would no longer work and I needed a new way of taking the Gerber and Excellon files and getting the Protomat to move appropriately.
The tool chain. Here is the toolchain I eventually worked out:
The first step, of course, is to lay out the circuit board. I have been using Eagle as my circuit board design software, but I am moving to DipTrace (more about that later). This is how the board layout might look in DipTrace:
For both Eagle and DipTrace I generate the Gerber-X and Excellon files and then import them into CircuitCam. All I do in CircuitCam is to produce the isolation tracks.
This is how this same board looks in CircuitCam. The white lines are the isolation tracks.
So far, no difference with the old way of doing things when I could use BoardMaster. But now, with the new way of doing things, I export a DXF file from CircuitCam. In setting up the export job I make sure to include both the isolation traces and the drill holes. Also, if I am going to be milling out the bottom side of a board, I export a “flipped” DXF. (The standard view orientation for circuit board software is looking down from the top of the board, so that the bottom side is visualized as if you could see through the board. But to actually mill the bottom side, you need the turn the board over so you’re actually looking at it from the bottom side.)
Getting lucky. Now I have a DXF, and I need some way of converting that into G-code. I got real lucky here. I thought that this was going to be tricky, but it wasn’t. I had a copy of the SheetCam. I imported the DXF into SheetCam (a wonderful feature!) and then assigned an engraving tool to the lines associated with the isolation tracks. This engraving tool corresponds to the 0.2 mm cutter. Then there was the problem of the drill holes. But SheetCam can recognize small diameter circles and offer to make them the centers for drill holes. All you have to do is to say, “yes.” SheetCam will then allow you to associate a drill from your tool list to these drill centers. Even better, it will allow you to associate a range of circle diameters to a single drill. For instance, in one of my boards I had holes ranging from 0.039 to 0.043 inches. I let SheetCam know that for all these holes, I wanted to use a 0.040 inch drill. SheetCam automatically figures out all the tool paths. Here is what it looks like in SheetCam:
Modifying the postprocessor. The last step within SheetCam is to run the postprocessor to generate the G-code. If I were going to be using a regular Mach3–controlled milling machine, I would just choose Mach3 as my postprocessor. But this would generate G-codes to move the Z-axis. The Protomat machine, though, has only two z-positions: “up” and “down”, determined by the milling head solenoid. I mentioned in the earlier post that I set up Mach3 so that an M8 G-code would energize the solenoid to pull the milling head down, to cut or drill. And M9 would return the head up. So I modified the postprocessor. The new postprocessor issues an M8 at the beginning of each milling cut and issues an M9 at the end. Likewise, the new postprocessor issues M8 and M9 within each drill cycle. I’ll post the postprocessor code on github as soon as I figure out how to do that.
The last step: Mach3. There is nothing special about running the Mach3 job using the G-code generated by SheetCam. It just runs. If I had time and inclination, I might upgrade the hardware so that Mach3 could directly control the spindle speed. At this point there’s no great advantage to me for doing that. The one improvement that might make a difference is a better way of controlling the drill cycle dwell time. As it is, I issue an M8 command to pull the milling head down, wait a little while, and then issue the M9 command, and wait a little while before executing the next G-code command. These pauses give the head time to move down and back up. Not much time is needed for the milling cutter, but more is needed for drilling. And the bigger the drill, the more time is required for it to drill all the way through the board. Presently, I have a “long” dwell time that will work for larger diameter drills. This works, but it means that for smaller diameter drills I’m taking more time than I really need. I suppose that this would be a problem if I were making boards with lots of holes; but, really, I only use the Protomat for small boards, so this “wasted time” is not a big deal. For now, this project is done! Here’s the ciruitboard (slightly different version) that we’ve seen from DipTrace to CircuitCam to SheetCam:
Goal: to rebuild as a Mach3–controlled CNC machine. My idea was to completely junk the existing electronics, and rebuild the Protomat as a Mach3 controlled CNC machine. It turns out that it was fairly easy to do, so if you have an old machine like this, you might be able to bring it back to life for a few hundred dollars.
Here it is working:
And here is what I did to get it going again.
The stepper-motor controller. The Protomat electronics controls three things: 1) the stepping motors that move the milling head in the X and Y directions; 2) the solenoid that pulls the milling head down to cut and drill the circuit board; and 3) the high speed spindle controller. Getting the stepping motors going again was straight forward. The steppers are bipolar NEMA 23 steppers, and I already had a stepper motor controller using Mach3, so it was just a matter of wiring up the stepper motors. My controller box is the Gecko G540–based STDR-4C system produced by Jeff Birt at Soigeneris, using the ethernet SmoothStepper. The only thing that gave me pause was setting the current limit for the steppers. There were no nameplates on the Protomat steppers. Motor nameplates usually give the current limit. However, by looking at other similarly sized motors, I concluded that 1.5 amps would probably be safe. As it turns out, at that setting the motors have not gone up in smoke, they do not run hot, and they run fast enough, so I think I made a good guess.
The solenoid-controller. To control the milling head solenoid, I had to first figure out the solenoid voltage. I guessed that it would be a standard solenoid voltage, either 12V or 24V. I connected various DC power supplies to the solenoid and found that 12V was too little to pull the solenoid, but 24V worked. I also noted that the original electronics had a toroidal transformer with a 24V tap, which I take as confirmation that it is a 24V solenoid. I also discovered that the solenoid has a diode across it. Next, I had to figure out how to control the solenoid. But that was easy since I already had the controller box, which provides a Mach3–controlled relay. Ordinarily this relay would be used to control a coolant system, but instead I used the relay to control the current to the solenoid. I’ll describe my software arrangement in a later post, but for now I’ll just note that I use a M8 g-code (coolant on) to energize the relay and solenoid, and a M9 g-code to release the solenoid.
The spindle-controller. Replacing the spindle control electronics was the biggest challenge. Initially, all I knew was that it was a three-phase motor because it had three wires going to it. But fortunately the spindle was marked, so at least I knew what I was dealing with. It’s a Jager 33–1 W02 spindle, with a maximum RPM of 60,000. I found the spec sheet online, which indicated that it had a maximum voltage of 21V, a maximum current of 7 A, and maximum driving frequency of 1,000 Hz. It took me a few days searching online to find something suitable. Most of the VFDs I found did not have high enough driving frequencies; and if I found one with a driving frequency that went up to 1,000 Hz, it was for motors with much higher operating voltages. Eventually I discovered the Sunfar E300 inverter, sold by Automation Technology as the “KL-VFD03 Mini-type Integrated Universal Inverter (VFD), 2.2KW.” And it was only $199.
This VFD has a maximum driving frequency of 1,000 Hz, which is just what I needed. It has dozens of user-adjustable operating parameters, but the key one here is the maximum output voltage, which is 25–250V. The spindle has a maximum operating voltage of 21V, but I figured that setting the VFD maximum voltage to its lowest value, 25V, would be close enough. So I purchase the VFD, connected it up, and it worked. I keep checking the temperature of the spindle to make sure that it is not overheating; and so far, so good. It is possible to control the spindle speed from Mach3, but I’ve been doing it manually.
220V supply. One small wrinkle is that the VFD needs a 220V supply, and I don’t have a 220V line where the Protomat is located. But I did have a spare 110V-to-220V step-up transformer. The one I had was 750 W. The spindle is only 170 W.
I also took a close-up. The isolation cuts are very sharp:
Replacing the software. The downside of replacing all the electronics was that I could no longer use the LPKF BoardMaster software to control the machine. I eventually worked out a tool chain to do that, which I will write about next time.