Fighting with computers

Computers are not always friendly.

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.