Fighting with computers

Computers are not always friendly.

Sunday, April 28, 2013

LEDs getting smarter


Sometime ago, I used for a project a set of RGB LEDs that were networked and responded to a few commands sent through a shared bus. It was a lot of work but it was fun. A while ago, at a RepRap meeting, user fungus showed me how he was using new controllers for doing exactly that, controlling RGB leds through a shared bus (daisy-chain would be the exact term though). They are available either as a small PCB with the chip so you can solder your own LED, or with a built-in LED or in a long stripe of LEDs.

Other manufacturers just included the chip together with their RGB leds, so you can get a three pin RGB led that includes internal memory to be set at any desired color from a single-pin output of your favorite micro-controller. And my favorite during the last few years has been Arduino so I just downloaded the FastSPI library and try to make sense of it. Unfortunately it never is so easy, so this time I was forced to upgrade my Arduino to 1.0.4 (I was avoiding that and keeping the 023 version that worked nicely with my 3D printers firmware, I hope nothing will break now) as library was not compiling and I did not want to go through the effort of backporting the code to an old version of Arduino environment.

I did not find a simple example, but eventually got everything running fine with an Arduino UNO using just one output pin. Now I have to figure out what patterns may look cool and to code them.

Here you have my sample code I used for the video above (I am using digital pin 5 on Arduino for the data line):

// Sample code for WS2811 LED bars
// by misan

#include "FastSPI_LED2.h"
#define NUM_LEDS 60

struct CRGB { byte g; byte r; byte b; };
struct CRGB leds[NUM_LEDS];

WS2811Controller800Mhz<5> LED;

void setup() { LED.init(); }
int counter=0;
int MAX=16;     //keep power usage low

void loop() {
    leds[counter].g = random(MAX);
    leds[counter].b = random(MAX);
    leds[counter].r = random(MAX);
    LED.showRGB((byte*)leds, NUM_LEDS);
    delay(10);  
    counter = ( counter + 1 ) % NUM_LEDS;
}

Sunday, April 14, 2013

Running in circles with the extruders

While my Wade-type extruder works nicely in my old Prusa, I planned to use a smaller geared stepper motor for my new Prusa i3 3D printer. But the road to a reliable extruder that is lighter and smaller is paved with many different trouble.

The first problem was to source PG35L-048 motors that Josef Prusa was using for his compact extruder and shown in different youtube videos. Sourcing it in Europe was not easy but I was lucky buying some units from an Austrian supplier called Neuhold Elektronik. But my joy was brief, once I could not easily extract the gear of the motor and I ended up sawing it off, because the shaft of my motor was shorter than the version used by Prusa, so I had to adapt the 3D design of the extruder to fit my motor. I got that extruder eventually working, but in order to get consistent extrusion the motor needed a bit more current than its specs so it was overheating. An aluminium piece, part of a heat-sink of an Intel processor took care of the extra heat. Still, I was not impressed with that extruder performance, though part of the fault might be caused by a not so great hotend.


Once I saw that even Josef have moved away from that stepper, I bought a unit of the new one he was using from 2engineers.com. The motor was more or less the same price of a regular nema17 but delivered much more torque due to a 50:1 reduction gearbot. User OhmEye complained of some gears early failure on an extruder of his own design but once I got the extruder working it was all good. Or so I thought, till I noticed some banding on my prints. It ended up not to be a fault of the extruder but of my hotend that was incapable to handle speeds above 40mm/sec and it started to stutter.


This new motor did not overheat and it works ok, but I was not impressed with the results due to the additional delay introduced by the gear box, that did not allowed fast retracts.  



So I took an modified Wade extruder and I made a small change for it to fit the x-carriage part of the Prusa i3 and this is what is working the best for me. The added advantage is that you can do the hobbed bolt at home, which leads to a quite cheaper solution to the extruder.



It seems more people like it and it has become my most popular part in Thingiverse.



But I seem to have a problem leaving things that work alone, and I am testing yet another extruder right now. It is just a bit more compact but it uses nema 17 motors too.

Sunday, March 03, 2013

Heated bed blues

Reprap 3D printers can benefit of having a heated bed because that helps preventing part's warping. When a part is printed, it is done depositing layer after layer of fused plastic filament. Either PLA or ABS, these fused filaments will experience some contraction when the melted filament solidifies and cools down. This effect will be more dramatic the faster it happens. And the end result is that some of your printed parts will have a round bottom instead of a flat one. And that is if you are lucky, as some parts will completely detach from the print bed mid print and they will be totally ruined.

So we use a heated bed so the print bed is kept at a relatively high temperature. This way the filament will cool down not so fast and hopefully the parts will stay well grabbed to the print bed even in the corners.

There are several ways of creating a heated bed: a printed circuit board with a long copper track zig-zagging the surface that will create a resistor.



An aluminium plate with some power resistors attached at  the bottom. A heat mat, Peltier cells, and I am sure I am missing others. So I recently created a heated bed for a new printer with four 6ohm/10W power resistors as shown in the picture below. I assumed that though the total power will be around 100W, the resistors will handle that extra power given the aluminium plate would act as a big heat sink and they never will get too hot to break.


The system work nicely for a while achieving both 60C and 110C without a problem, which are the two temps used when printing either PLA or ABS plastic. Unfortunately, this bed would work only for more than a day. Next attempt was taking no chances, so I moved up to 50W power resistors, almost same price but quite larger.

This time the bed warmed happily every day, but the resultant bed was a bit taller than 30mm. This means that the tallest object you can print is now 30mm lower than without the bed. This is not a big deal most of the time but it needs to be taken into account.

So I was looking for a way to reduce the resistor's footprint and after checking the heated bed I have in my Prusa that is working nicely for almost a year I realized I was using 25W resistors. I bought some one eBay and I noticed they can fit nicely in the bed holder cutouts of the Prusa i3 as shown below.


Because the resistors can attached to the bottom of the bed's aluminium plate in a pattern that matches these cutout, the distance between the top plate of the bed and the one shown in the picture can be reduced to just a few millimeters (instead of more than 25 mm of my other bed). So this is what I am going to do for my next bed for my aluminium frame i3.

While a PCB-based heated bed is definitely thinner, these beds do need something like a glass on to as the PCB is not very flat and it warps when heated, which adds cost and parts to the bed (maybe some bulldog clips will be needed for keeping the glass fixed to the PCB too). An aluminium bed can be very flat and strong with the need of an additional glass. Kapton tape will make both glass or aluminium surface something hot plastic can attach too. Some plastics may bond well to some glasses without the need of kapton tape, but none to aluminium. 



Friday, January 25, 2013

Getting back to SQL magic

Recently I was asked for a way of numbering a subset of records of database table. It could be done using a programming language, as I did with a small code in Visual Basic for Applications using MS Access connected through ODBC to the database server.

But I wanted the real deal, so several ideas came to my mind. The first one was to transfer the desired rows to a temporary table, while deleting them from the original one to later create a new column of type serial that will handle the numbering. However, this idea was not possible as different set of rows required to have their own counter. Let's say that different cities required to have their sales numbered using independent counters.

The solution I used was to create a temporary sequence value, to then update the table for each city value. Something like this in Postgresql:

ALTER TABLE sales ADD COLUMN number;
CREATE TEMP SEQUENCE counter;
UPDATE TABLE sales set number=n FROM (SELECT nextval('counter') AS n, order FROM sales WHERE city='desired_city' ORDER BY date) AS foo WHERE sales.order=foo.order;
DROP SEQUENCE counter;


Sunday, January 20, 2013

Tuning extrusion values

After building the acrylic Prusa i3 3D printer is when the challenge began. I tried to get proper values for the compact extruder using a PG35L geared stepper motor and that proved to be quite a challenge. The problem was two-fold: on one hand, this is a small low-power stepper, that thanks to a 1:35 gear reduction it can achieve 0.45Nm of torque, but this motor is rated at 12V/180mA, which make it not ideal for our 12V drive voltage. But the motor needs a bit more current to create a bit more torque to obtain a consistent extrusion. The second problem is that due to the gear the motor skips if speed is too high. So retraction speed has to be dialed down to 7-10 mm/sec.

Being the motor that slow is giving me more trouble, as retraction takes a while and I am getting some ugly plastic blobs in some corners.

This time my troubles were deepened because I am using a [for me] new hotend I bought from one of my students, who bought a couple of them off eBay and only needed one. I do not like this hotend as it is bulky and it needs to be bolted to the extruder, but it seems to work ok. Besides, it is difficult to get anything cheaper that $40 unless you do it yourself. I do not like it because it is PFTE-based, which is known to be the recipe for disaster sooner or later, as it does not have the required structural strength. I will keep my fingers crossed.

I have collected some configuration info I will like to share with you. While not yet printing perfectly, the results are ok till 70 mm/s. I guess this hotend-extruder combo won't go reliably any faster.

  • Max extruder feedrate 45 mm/sec
  • Max extruder acceleration 5000 mm/sec^2
  • Default extruder acceleration 1500 mm/sec^2
  • Default retraction acceleration 1200 mm/sec^2
  • Retraction speed 10 mm/sec
  • Steps/mm: 825 (I am using MK7 gear drive).
  • E jerk: 1 mm/sec
  • Motor current 500mA (Pololu Vref=200mV)
What I like about this motor is that it is very light, but it gets pretty hot, so I have added an aluminium heatsink. I have bought another, beefier, geared motor, but I had some trouble with the compact extruder design file. While this other motor is stronger, it is also heavier and no additional cooling is required, but the 1:50 gear set will make it quite slow reaction too. Besides, some people had trouble with the gear box after a while (some teeth broke). 

Meanwhile, the printer seems to be working nicely while I dial in the different parameters of the slicer to get quality prints.




Tuesday, January 01, 2013

A tablet that does it

I have blogged in the past on how to use iPad for viewing electronic magazines and how it failed to me with some PDF files. I have recently got a Samsung's Note 10.1 tablet and I can certainly call it a success in terms of both PDF browsing and ebook reading. Everyone I have shown how to scribble on a PDF article was amazed. Yes, this unit comes with a stylus and it is a pressure sensitive one.

Adobe reader works nicely and it does not crash. My benchmark is Circuit Cellar PDF that use to crash on the iPad (I do have an iPad1).

This together with Cool Reader free app make the unit a very useful book reading plataform as it supports the common formats FB2, EPUB and MOBI plus CHM as a nice addition.

The picture shows a screen capture at the original size, which is easy to read without zooming in.

Thursday, December 27, 2012

On extrusions speeds

I have been losing a fight with my latest extuder/hotend combination. It works ok as far as I do not want it to work too fast. I want to keep the PG35L motor not too hot or it will break. So I am powering at 500mA, which seems to be well beyond its maximum rated current, so it gets hot. But I've added a passive cooler to it so won't get dangerously hot. Should I used a higher current, as someone suggested, maybe my mileage might vary, but at the expense of needing a fan blowing directly to keep the motor from frying itself.

One of the things that was bothering me was the maximum printing speed I could use with this new setup on my Prusa i3. Extrusion speed on Pronterface software (the host I use) is user selectable but measured in millimeters per minute, while travel speed is usually configured in the slicing software in millimeters per second. But doing the apparently simple math of dividing by 60 will not help here, among other things because the extrusion speed is the 3mm filament input speed.

As the hotend nozzle is much thinner than the 3mm stock filament, a much longer distance is expected at the output of the nozzle. A simple calculation can be done (assuming the volume is preserved through the extrusion process). If we consider that both input and output filaments are cylinder shaped, then, for a 0.5 mm output nozzle I can measure a 0.6mm diameter for my extruded filament output. Each millimiter that enters the hotend is 7.07 cubic millimeters of plastic, that for a 0.6 mm output diameter will turn into 25 mm of length (yes, that's right, every input millimeter turns into 25 mm of filament at the output).

Equipped with this data, we can finally do the math. For example, if the maximum speed you can get an steady flow of plastic is 180 mm/min, then that means you can lay output filament (without stretching it) at 180 * 25 / 60 = 75 mm / sec.

Of course this calculation needs to be adapted whenever input or output diameters of filament differ from these above. Please let me know if I am getting the facts wrong.