PrintrBot Simple 2013 Troubleshooting

Getting one of these great little 3D printers working correctly can be quite a mission. I think I’ve worked out most of the kinks though, so here are my quick fixes.

Extruder Clogged

The extruder motor is turning the gear correctly and the motor isn’t skipping.. what next? Most likely you have a clog, which can occur from either dusty filament or uneven filament.

  1. Heat up the hotend to 200°C or so.
  2. Remove the extruder from the head. You need to undo the 2 hex screws that hold the top of the extruder in, then wiggle it loose. You should be able to leave the Phillips head screws in place.
  3. Now try and push the filament through, directly into the barrel. Likely it won’t move.
  4. I found that with a thin nail I could push filament through a bit better.
  5. If you still don’t have plastic spaghetti coming out, remove the hot end tip with a spanner and check if you can push the filament through now. It should push through pretty easy, otherwise go back to step 4 and find something to open up the extruder neck.
  6. Get a jet burner and flame the crap out of the tip. Don’t burn yourself or your stuff. You should hopefully see a small glob of black plastic crud drop out.
  7. Put the tip back on the extruder and try push through some filament again. It should come out correctly now.

Now I attach a bulldog clip with a make up remover pad inside it to the filament to clean it before its pushed into the extruder. Cotton wool would probably work, use what you can find around the house.

Y-Axis Sag

You are suffering from Y axis sag if your bed is level but the tip is hitting the bed when it is fully extended on the Y axis, but a bit above the bed when fully retracted. This is generally because the cable ties holding the steel rods have expanded during use, or were never tight enough to begin with.

  1. Grab the printers arm and see if it wiggles. It should.
  2. Tighten all 6 cable ties using a set of pliers. Grab the end of the cable tie while holding the other end and make it REAL tight.
  3. If  you cut off the cable ties real close to the bearings, it might be possible to use some tweezers to grab just a tiny bit of the tail and stretch the plastic out to something you can grab with normal pliars.
  4. Notice that you can’t wiggle the printer’s arm as much as before.

 Wrong Size Prints

You need to calibrate the printer, see http://zheng3.com/2013/06/02/calibrating-the-printrbot-simple/ for a good guide.

Negative Space Test

See: http://help.printrbot.com/Answers/View/15079/Printer+filling+in+gaps+and+having+trouble+with+circles

The default steps for a Simple 2013 are M92 X84.4 Y84.4 Z2020 E94.5

Dave Matthews Band Perth April 13th 2014

Greyome set that I don’t want to forget:

  • Ants Marching
  • Seven
  • Satellite
  • Don’t Drink the Water
  • Rooftop
  • Squirm
  • Crash
  • Grey St
  • Belly Belly
  • You & Me
  • Dave says ‘quokkas are dumb like chickens’
  • What Would You Say
  • Funny The Way It Is
  • The Space Between
  • So Much To Say
  • Anyone Seen The Bridge
  • Dave says ‘you cant get this shit on the radio’
  • Jimi Thing
  • Sexy Mother
  • Shake Me (encore)

Dozens of drumsticks loosed on the audience at the end.

Can’t wait for the two Byron Bay gigs!

Tracks I would love to see at those gigs:

  • You Might Die Trying
  • Everyday
  • Recently
  • Two Step
  • Louisiana Bayou
  • Crush
  • Seek Up
  • Big Eyed Fish
  • All Along the Watchtower
  • One Sweet World
  • Lie in Our Graves
  • When the World Ends
  • So Damn Lucky
  • Grace is Gone
  • Gaucho
  • Cornbread
  • Mercy
  • Bartender

Dave Matthews band Byron bay April 20th 2014

  • Belly belly
  • Funny the way it is
  • You might die trying
  • Satellite
  • Don’t drink the water
  • Rooftop
  • The space between
  • So much to say
  • Anyone seen the bridge
  • Too much
  • You and me
  • Jimi thing
  • What would you say
  • All along the watchtower
  • Everyday
  • Ants marching
  • Grey st

Setting up Varnish for Drupal on CentOS 6

Varnish has an offical repository so let’s add it to Yum as outlined on https://www.varnish-cache.org/installation/redhat

sudo rpm --nosignature -i http://repo.varnish-cache.org/redhat/varnish-3.0/el6/noarch/varnish-release/varnish-release-3.0-1.el6.noarch.rpm
sudo yum install varnish

Set Varnish to start on system boot

sudo chkconfig varnish on

Setup DAEMON_OPTS in /etc/sysconfig/varnish, something like below. It will be commented out by default:

DAEMON_OPTS="-a :80 \
-T localhost:8080 \
-u varnish -g varnish \
-s malloc,256m"

Edit the default.vcl file. We use the following for Drupal, which Four Kitchens kindly made available.

# https://fourkitchens.atlassian.net/wiki/display/TECH/Configure+Varnish+3+for+Drupal+7

# This is a basic VCL configuration file for varnish.  See the vcl(7)
# man page for details on VCL syntax and semantics.

# TODO: Update internal subnet ACL and security.

# Define the internal network subnet.
# These are used below to allow internal access to certain files while not
# allowing access from the public internet.
# acl internal {
#  "192.10.0.0"/24;
# }

# Default backend definition.  Set this to point to your content
# server.
#
backend default {
  .host = "127.0.0.1";
  .port = "8080";
}

# Respond to incoming requests.
sub vcl_recv {
  # Use anonymous, cached pages if all backends are down.
  if (!req.backend.healthy) {
    unset req.http.Cookie;
  }

  # Allow the backend to serve up stale content if it is responding slowly.
  set req.grace = 6h;

  # Pipe these paths directly to Apache for streaming.
  #if (req.url ~ "^/admin/content/backup_migrate/export") {
  #  return (pipe);
  #}

  if (req.restarts == 0) {
    if (req.http.x-forwarded-for) {
      set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;
    }
    else {
      set req.http.X-Forwarded-For = client.ip;
    }
  }

  # For global redirect
  if (req.url ~ "node\?page=[0-9]+$") {
    set req.url = regsub(req.url, "node(\?page=[0-9]+$)", "\1");
    return (lookup);
  }

  # Do not cache these paths.
  if (req.url ~ "^/status\.php$" ||
      req.url ~ "^/update\.php$" ||
      req.url ~ "^/admin$" ||
      req.url ~ "^/admin/.*$" ||
      req.url ~ "^/flag/.*$" ||
      req.url ~ "^.*/ajax/.*$" ||
      req.url ~ "^.*/ahah/.*$") {
       return (pass);
  }

  # Do not allow outside access to cron.php or install.php.
  #if (req.url ~ "^/(cron|install)\.php$" && !client.ip ~ internal) {
    # Have Varnish throw the error directly.
  #  error 404 "Page not found.";
    # Use a custom error page that you've defined in Drupal at the path "404".
    # set req.url = "/404";
  #}

  # Always cache the following file types for all users. This list of extensions
  # appears twice, once here and again in vcl_fetch so make sure you edit both
  # and keep them equal.
  if (req.url ~ "(?i)\.(pdf|asc|dat|txt|doc|xls|ppt|tgz|csv|png|gif|jpeg|jpg|ico|swf|css|js)(\?.*)?$") {
    unset req.http.Cookie;
  }

  # Remove all cookies that Drupal doesn't need to know about. We explicitly 
  # list the ones that Drupal does need, the SESS and NO_CACHE. If, after 
  # running this code we find that either of these two cookies remains, we 
  # will pass as the page cannot be cached.
  if (req.http.Cookie) {
    # 1. Append a semi-colon to the front of the cookie string.
    # 2. Remove all spaces that appear after semi-colons.
    # 3. Match the cookies we want to keep, adding the space we removed 
    #    previously back. (\1) is first matching group in the regsuball.
    # 4. Remove all other cookies, identifying them by the fact that they have
    #    no space after the preceding semi-colon.
    # 5. Remove all spaces and semi-colons from the beginning and end of the 
    #    cookie string. 
    set req.http.Cookie = ";" + req.http.Cookie;
    set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";");    
    set req.http.Cookie = regsuball(req.http.Cookie, ";(SESS[a-z0-9]+|SSESS[a-z0-9]+|NO_CACHE)=", "; \1=");
    set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", "");
    set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", "");

    if (req.http.Cookie == "") {
      # If there are no remaining cookies, remove the cookie header. If there
      # aren't any cookie headers, Varnish's default behavior will be to cache
      # the page.
      unset req.http.Cookie;
    }
    else {
      # If there is any cookies left (a session or NO_CACHE cookie), do not
      # cache the page. Pass it on to Apache directly.
      return (pass);
    }
  }
}

# Set a header to track a cache HIT/MISS.
sub vcl_deliver {
  if (obj.hits > 0) {
    set resp.http.X-Varnish-Cache = "HIT";
  }
  else {
    set resp.http.X-Varnish-Cache = "MISS";
  }
}

# Code determining what to do when serving items from the Apache servers.
# beresp == Back-end response from the web server.
sub vcl_fetch {
  # We need this to cache 404s, 301s, 500s. Otherwise, depending on backend but 
  # definitely in Drupal's case these responses are not cacheable by default.
  if (beresp.status == 404 || beresp.status == 301 || beresp.status == 500) {
    set beresp.ttl = 10m;
  }

  # Don't allow static files to set cookies. 
  # (?i) denotes case insensitive in PCRE (perl compatible regular expressions).
  # This list of extensions appears twice, once here and again in vcl_recv so 
  # make sure you edit both and keep them equal.
  if (req.url ~ "(?i)\.(pdf|asc|dat|txt|doc|xls|ppt|tgz|csv|png|gif|jpeg|jpg|ico|swf|css|js)(\?.*)?$") {
    unset beresp.http.set-cookie;
  }

  # Allow items to be stale if needed.
  set beresp.grace = 6h;
}

# In the event of an error, show friendlier messages.
sub vcl_error {
  # Redirect to some other URL in the case of a homepage failure.
  #if (req.url ~ "^/?$") {
  #  set obj.status = 302;
  #  set obj.http.Location = "http://backup.example.com/";
  #}
    <h1 class="title">Page Unavailable</h1>
    <p>The page you requested is temporarily unavailable.</p>
    <p>We're redirecting you to the <a href="/">homepage</a> in 5 seconds.</p>
    <div class="error">(Error "} + obj.status + " " + obj.response + {")</div>
  </div>
</body>
</html>
"};
  return (deliver);
}

#
# Below is a commented-out copy of the default VCL logic.  If you
# redefine any of these subroutines, the built-in logic will be
# appended to your code.
# sub vcl_recv {
#     if (req.restarts == 0) {
#   if (req.http.x-forwarded-for) {
#       set req.http.X-Forwarded-For =
#       req.http.X-Forwarded-For + ", " + client.ip;
#   } else {
#       set req.http.X-Forwarded-For = client.ip;
#   }
#     }
#     if (req.request != "GET" &&
#       req.request != "HEAD" &&
#       req.request != "PUT" &&
#       req.request != "POST" &&
#       req.request != "TRACE" &&
#       req.request != "OPTIONS" &&
#       req.request != "DELETE") {
#         /* Non-RFC2616 or CONNECT which is weird. */
#         return (pipe);
#     }
#     if (req.request != "GET" && req.request != "HEAD") {
#         /* We only deal with GET and HEAD by default */
#         return (pass);
#     }
#     if (req.http.Authorization || req.http.Cookie) {
#         /* Not cacheable by default */
#         return (pass);
#     }
#     return (lookup);
# }
#
# sub vcl_pipe {
#     # Note that only the first request to the backend will have
#     # X-Forwarded-For set.  If you use X-Forwarded-For and want to
#     # have it set for all requests, make sure to have:
#     # set bereq.http.connection = "close";
#     # here.  It is not set by default as it might break some broken web
#     # applications, like IIS with NTLM authentication.
#     return (pipe);
# }
#
# sub vcl_pass {
#     return (pass);
# }
#
# sub vcl_hash {
#     hash_data(req.url);
#     if (req.http.host) {
#         hash_data(req.http.host);
#     } else {
#         hash_data(server.ip);
#     }
#     return (hash);
# }
#
# sub vcl_hit {
#     return (deliver);
# }
#
# sub vcl_miss {
#     return (fetch);
# }
#
# sub vcl_fetch {
#     if (beresp.ttl <= 0s ||
#         beresp.http.Set-Cookie ||
#         beresp.http.Vary == "*") {
#       /*
#        * Mark as "Hit-For-Pass" for the next 2 minutes
#        */
#       set beresp.ttl = 120 s;
#       return (hit_for_pass);
#     }
#     return (deliver);
# }
#
# sub vcl_deliver {
#     return (deliver);
# }
#
# sub vcl_error {
#     set obj.http.Content-Type = "text/html; charset=utf-8";
#     set obj.http.Retry-After = "5";
#     synthetic {"
# <?xml version="1.0" encoding="utf-8"?>
# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
#  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
# <html>
#   <head>
#     <title>"} + obj.status + " " + obj.response + {"</title>
#   </head>
#   <body>
#     <h1>Error "} + obj.status + " " + obj.response + {"</h1>
#     <p>"} + obj.response + {"</p>
#     <h3>Guru Meditation:</h3>
#     <p>XID: "} + req.xid + {"</p>
#     <hr>
#     <p>Varnish cache server</p>
#   </body>
# </html>
# "};
#     return (deliver);
# }
#
# sub vcl_init {
#   return (ok);
# }
#
# sub vcl_fini {
#   return (ok);
# }

Now update your web server to serve from port 8080, and restart the server and varnish.

Download and enable the drupal varnish module:

drush dl varnish; drush en varnish -y;

Add something like the following to settings.php:

// Varnish config.
$conf['cache_backends'][] = 'sites/all/modules/contrib/varnish/varnish.cache.inc';
$conf['cache_class_cache_page'] = 'VarnishCache';
$conf['page_cache_invoke_hooks'] = FALSE;

Hopefully the site is now using Varnish, you can get some good stats using the varnishlog and varnishstat programs that are included with Varnish.

Setting up memcached with Drupal 7 on Centos 6

Firstly get access to RPMForge repositories. Next install memcached:

sudo yum install memcached
sudo service memcached start
memcached -h

Check memcache stats:

echo "stats settings" | nc localhost 11211
watch "echo stats | nc 127.0.0.1 11211"

Configure memcache:

sudo vi /etc/sysconfig/memcached

Configuration details for memcache can be found here

Install the PECL memcached extension for PHP

sudo pecl install memcache
echo "extension=memcache.so" | sudo tee -a /etc/php.ini
sudo service httpd graceful
php -i | grep memcache

Install the memcache drupal module and configure the website via settings.php

https://drupal.org/project/memcache

drush dl memcache

You don’t need to enable the module unless you want a stats UI.

Edit your site’s settings.php, adding something like the following:

$conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc';
// The 'cache_form' bin must be assigned no non-volatile storage.
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['memcache_key_prefix'] = 'something_unique';

Truncate the cache table, clear the cache and check that the cache table stays empty when you load some pages. Check the memcache stats and see that data is going into the cache.

Hopefully it’s working now!

References

Drupal Memcache module – https://drupal.org/node/1131468

Configuring Memcache from the memcache wiki – https://code.google.com/p/memcached/wiki/NewConfiguringServer

 

Installing RPMForge repositories on CentOS

By default CentOS Yum has a pretty poor selection of packages compared to something like Debian. So it can be a good idea to add RPMForge to get access to more up to date packages.

cat /etc/redhat-release
uname -a

Now choose the appropriate repository for the CentOs version and architecture:

http://wiki.centos.org/AdditionalResources/Repositories/RPMForge

Install the repo:

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm
rpm -i rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

You should now have access to a heap more packages via Yum.

References

http://wiki.centos.org/AdditionalResources/Repositories/RPMForge