This weekend I worked some more on the CNC machine. It’s really meant to be for laser cutting but seems to have become more of a 3D printer. Mainly since there is more involved in getting that to work. It is easier to stick a laser on a 3D printer than stick a 3D print head on a laser cutter! During the week my electronics and extra linear bearings arrived. I spent a bit of free time on Friday getting the RAMPS board fired up. It took me a little while to get things actually working, mainly due to a string of silly but easy to make mistakes.
First I needed to get the firmware on the board. I am using the latest stable version of Marlin (1.0.2-1 at time of writing). Marlin needs configuring before you install it and the way this is done is by changing #defines in a couple of header files. Being an old computer geek this isn’t too hard. Where I did go wonky though was when the code wouldn’t build. That turned out to be and error in one of the header files, dogm_font_marlin.h. Inside there the include path to the library used by the LCD I have was wrong. It should read #include <clib/u8g.h> but the path was originally wrong. The thing that threw me was for some reason that include is in the file twice, once at the top and again half way down. I had changed it in one place and not the other. The IDE was telling me why it wasn’t building, I just wasn’t reading the error carefully enough and assumed I had fixed it!
Most people probably won’t know what I am on about there. It’s probably enough to say if you are building a machine yourself there are quite a few fiddly little things you need to do to get everything working. There is documentation out there but it is all over the place. It takes a bit of digging to figure out what is the best way to do things sometimes. With the software building and uploaded to the Arduino Mega I finally got the screen and controller working. But with the motors connected I couldn’t get anything to move.
One issue was when I plugged the RAMPS board onto the Arduino Mega some of the pins were misaligned and they didn’t go into the sockets correctly. I removed the board, straightened the pins and reconnected everything. Still the motors wouldn’t work. Then I realised I had made a truly daft mistake. I had followed some instructions I had found online for plugging in the stepper driver boards. I am using the DRV8825 stepper driver boards (well Chinese copies anyway). The instructions I found showed an earlier type of driver board so when I plugged mine in I plugged them in the same was as in those instructions. I should have actually looked at the boards and worked out which pin was which. Of course I had them in backwards!
Luckily this didn’t damage anything. With them installed the right way around I finally got stepper motors stepping. So far so good.
In the weekend I spent Saturday morning finally organising the computer wing. It’s been bugging me it was still as it was when I moved in and now I actually want to be doing electronics and making things in here so it needed a tidy up. I was also looking for some things I knew I had for the CNC machine at the same time. After organising things I find what I was looking for. An old ATX power supply out an old PC. I knew I had one floating about but couldn’t remember if it worked.
But then I remembered I had another in an old working PC. So I pulled that apart.
Some people reading this might recognise the old Intel Home PC from way back in the day when Intel decided every employee should be given a free computer! It’s the original box (was a nice HP machine with a great modular case) but had long since had the motherboard, drives, power supply, etc upgraded before finally being retired to the cupboard’o’crap in my spare room. I pulled out the supply (and also a 120Gb drive and 1GB of RAM I didn’t know it had in it) as well as the CPU and case fans.
It’s an old 450W ATX supply. Not exactly a well known brand I think but it worked fine in my old machine so it should be good.
The RAMPS boards needs a 12 volt supply at quite high current, 5A for the motors and extruder and 11A for the heated bed. All of this is explained (not very clearly) here. An ATX supply can easily supply the right current. There are some traps though. Some ATX supplies won’t supply a well regulated 12 volt line unless there is some load on the 5 volt line. There are tons of sites about talking about this, it’s called ATX balancing, so I won’t repeat it here. My supply seems to work ok so far but I will see when things are actually running.
Converting an ATX power supply is also well documented out there. I will briefly mention what I did. First I opened it up.
I gave it a good clean as these things are always dust magnets. Then I unsoldered all the wires after taking note of which colours when where. Black wires are grounds, red are +5 volts, yellows are +12 volts. There are three other wires I was interested in, the green PS_ON, the purple +5VSB and the grey PWR_OK.
The green wire is used to turn the supply on and off. If you short this to ground the power supply will turn on. The purple wire supplies 5 volts all the time (when the mains switch is on) even if the green wire hasn’t been grounded. The grey wire will show 5 volts when the power supply has turned on after the green wire has been grounded.
I left two yellow 12 volt wires and grounds for the two 12 volt inputs into the RAMPS board. I also pulled out a red +5 volt wire and ground wire in case I need it (perhaps for balancing later or to run 5 volt fans). I connected the grey PWR_ON lead to a 220R resistor and a red LED to provide a visual indicator that the power supply is on. I also added a toggle switch to the PS_ON line. The switch either connects the wire straight to ground, turning the supply on, or to an external green wire so the RAMPS board itself can control it. The switch let me test everything was working with some load, in my case two old car headlights.
The next bit about how you get RAMPS to control the switching all gets a bit confusing and the documentation isn’t very clear. How I understand it works is this.
The Arduino is powered either from the 12 volt supply feed into the RAMPS board or via the USB connection to the computer. The ATX supply can supply 12 volts and can be controlled via the green PS_ON green. So you can plug this wire into the RAMPS board on the provided connector and switch the 12 volt supply on and off as needed (there is an M code to do this). This works fine if the Arduino is connected via USB and getting it’s power via that. Then you can switch the 12 volt lines from the ATX supply on and off easily.
The problem is if you don’t have the USB connected. If the Arduino is being powered via the 12 volt in this of course this won’t work. The ATX won’t switch on unless the Arduino tells it to but the Arduino won’t be running until the ATX supply is turned on! So we’re deadlocked.
The way around this is to use the purple +5VSB wire. Since this is powered all the time we can use that to power the Arduino and then that can turn on the main 12 volt supply when needed. The RAMPS board provides a connector for this.
What you need to do is wire the +5VSB from the supply into the VCC pin on the header near the RAMPS reset button. That is the top pin. The green PS_ON wire goes into the bottom pin. The middle 5 volt pin is left unconnected. That is only there to power the servo headers to the right of the reset switch.
The one other VERY important thing to do is remove diode D1. This diode is what feeds 12 volt power to the Arduino. We don’t need that as we are now supplying the Arduino with 5 volt directly via that VCC pin above. It is bad to try to do both at the same time. So we disconnect D1. This is a little tricky as it is hard to reach. The tweezers point to where it was on my board.
So now we have the Arduino powered directly by the 5 volt stand by signal from the supply which means it can turn on and start up. It can then tell the ATX supply when to turn on and off the main 12 volt supply. All this works with no USB connection which is handy since my controller also has an SD card slot so it can run without a PC at all.
With this working I was able to hook up the supply, motors, extruder, extruder thermocouple and heatbed and test it out. Unfortunately the heated bed that came in my kit didn’t have a thermistor! I have ordered one separately but until that comes I can’t test the heated bed. I was able to test the stepper motors and that the extruder heats up and the temperature reading of that works. I haven’t actually tried melting plastic yet though as I only went up to 60 degrees C. One thing I do need to do is provide wiring for the extruder fan and for fans to cool the electronics (using one of the case fans I pulled from the old PC).
So, having gone as far as I could with that, I then went out to the garage to work on the X axis gantry. This was more simple metalwork. I used my laser cut templates to mark where to drill the holes for the mounting points. I ran out of time so haven’t actually bolted everything together yet but it is coming together.
I can do more on that tomorrow evening I hope. The whole thing is rather heavy. I am not even sure it will work as a 3D printer at all. It might be too slow although I think slow isn’t a problem except it means printing anything will take forever! The problem isn’t the speed but accelerating everything up to that speed. It’s going to be interesting to see!