04 January 2016

Building Prusa i3: PSU

Reading about PSU options to power my printer, I decided to use ATX PSU, more specifically a Haswell ready/compatible PSU. Non-Haswell PSU or regular ATX PSU problem is that they require load on 5v rail or they will not switch on at all or will swich off shortly after it's switched on. To use regular PSU-s, you will have to add some base load to 5v rail. Base load can be light bulbs, resistor, etc. But I didn't like the idea to have some resistor that would generate heat just to make PSU work.
So, monitoring week or so a local used PC part sellers forum, I found PSU I really liked - FSP HE-500. New one will cost about 50€, I got it for 15€. It's Haswell compatible, active PFC and has two 12v rails, both with max 18A output current. This PSU is going to power RAMPS 1.4 that has also 2 power inputs. One for stepper drivers and Extruder heater that requires 5A, and second input for Heated Bed that requires 11A. So, heated bed input that requires most current, will have 39% safety margin. So there should be no problems powering Prusa.

All i did next with my PSU is based on this blog post.

Testing
First, I tested my PSU. For that, I measured voltage between Power_OK (gray wire) and ground (black wire). On standby mode, that is if it's just connected to wall socket and powered, then you should get 0V between gray and black wires. Also, you can measure voltage between 5Vsb (purple wire) and ground. This should give you always 5V. Now, turn PSU on by shorting green wire to black one, fan should start and measuring voltage between gray ad black wire should give you 5V. If you have some problems with PSU, then now is time for warranty. Next steps will void your warranty.

12v rails
Yellow wires are for 12V. If you have single 12V rail PSU, then you will have only all yellow wires. In case your PSU has multiple 12V rails, then these yellow wires will have some stripes. Because I have two rails, then I have yellow wire with black stripes for rail 1 and yellow wire with no stripes for rail 2. And because both are rated at 20A max, then I do not need to choose which rail will be connected to hotbed that requires most current. Also, do not connect different 12V rails together. You would think that connecting 2 rails together you could use 20A+20A=40A, but in reality, if you are lucky, your PSU will not power on, or if you are unlucky, you will blow up your PSU. These rails are not meant to be wired together. Well, some of these can be wired together, but to be safe, just don't do it. Here is some interesting reading about multirails (and wiring rails together).

Removing wires
Next, I opened up PSU (disconnect it first!). Removed some dust as it was used PSU. And now it's time to remove some wires, and all connectors. I must say that I was cautious and kept too much wires as I didn't know what i will need in future. But now when I have printer basically working, I'm thinking of reopening PSU and cutting rest of wires. Currently I'm using 2 yellow with black strips, 2 yellow, 4 black, one purple and one green wire. I am using double wires to power RAMPS, meaning 2 yellow with black stripes are wired together and connected to RAMPS. Same with yellow wires and for both grounds. And wires that I left just in case, but are not needed: 11 black (ground), 5 yellow with and without stripes (12V), 2 red (5V), one brown (3.3V maybe?) and one gray (Power_OK) wire. So, total of 20 extra unused wires. Also, you may notice that some of wires are thicker and some are thinner, even if color is same. And these wires have lots of stuff written on, but also there is "18 AWG" or "20 AWG" or some other number with "AWG" written on. Basically, smaller number means thicker wire. So, you should always select thicker wires to use.

Conclusion
If possible, select Haswell PSU. It may or may not be multirail, does not really matter, but make sure your peak-current is at least 25% less PSU-s max current at 12V rail(s). You really need only some yellows, some blacks, one green and one purple wire. Rest of wires (that is over 20 wires) can be removed.

And now it's picture time.
Lots of unused wires from PSU. Also,
big mess with wires on RAMPS, but I will
fix that when I get my printer to work as I want it to.

Close-up of main power

Close-up of 5Vsb and PS_ON






And why not a testing video

03 October 2015

Building Prusa i3: Intro

I want a 3D printer! I have no experience in 3D printing, but i decided to build it myself instead of just buying one. At first I tried to design it myself and after couple of days I concluded that if I build it from scratch, then end result would be probably something big, ugly and probably not very good at printing. So, I decided not to design it myself, but find some simple printer design that I could build myself. There is no need to invent bicycle if there is community who already invented and improved one. Googling around a bit, I found RepRap and from lot of YouTube videos of DIY 3D printers that I have seen, it seems that lot of people are building Prusa Mental type printers. Reading about different printer designs on RepRap site, I chose Prusa i3. There is no real reason for why I chose that design. It just seemed simple and beautiful. My goal is to build it as cheep as possible, but not to compromise too much on printing quality... whatever that means.
I will blog about this building process mostly for myself. This blog series will not be about how to build the Prusa i3, but rather my experiences building one, someone who has never had any 3D printer experience or anything to do with 3D printers. Maybe I will inspire someone to build their own printer.
At the moment most of the parts are already ordered from eBay, they will arrive within next 2 to 4 weeks and I will blog about my building process as parts are coming in.

28 May 2015

Toggle button

I am new to Arduino and C++ and as usual for first-timers, the first project has to do something with some LED-s and buttons.
Nothing complicated, but looking at examples I realized quite soon that there is lot of coding that has to be done to have proper toggle button functionality with debounce handling. Too much  for such a simple thing as push button. And if there happens to be multiple buttons, then it gets even worse. So, there has to be some library that handles all this, there probably is, but I decided that I need to practice some C++ and create my own library. So, couple of days tinkering and here is my first library, named PBtnToggle found in GitHub.
This library handles debouncing, has button press event, release event and long press event. And does not use delay(). User can decide what happens after long press - will it trigger release event after button release or trigger after next button press and release. I am quite happy what I created. There is some changes I would like to do at some point, but I decided that current version is ready for public.

Here's a demo video:


So, how much coding have to be done to use this library?
Lets take Switch example code from Arduino website. Let's change this to use PBtnToggle.
  1. Include PBtnToggle library:
  2. Init PBtnToggle object, specify pin where button is wired and pin state when button is pressed down. This will also set pin mode to INPUT:
  3. In setup(), register function that will be called when button is pressed down:
  4. Create function that will be called by library, registered in setup(). This function will contain anything that has to be done in button press:
  5. Call check() function, without this PBtnToggle will not work:
Atleast for me, this code looks a lot nicer. This is end result that does same thing that example code from Arduino webpage. Compiler log for original code:
Compiler log for PBtnToggle example code:
So library takes about 1KB extra flash and memory footprint is about same. But your sketch will be probably smaller if you have multiple buttons.

Please, let me know if this library is useful for you and if you have some ideas that could improve this library, then please let me know here in comments or in GitHub for more technical ideas/fixes.
Also, if you know any other libraries that do something similar, then let me know about it. I would like to compare them.