Mini 3D Printer server

Mini 3D Printer server

Devuan Raspberry Pi 2 is ready.

Computer: Raspberry Pi 2 Model B
OS: Devuan 1.0

Modification of 5V/2A power supply

I had a USB to micro USB adaptor and decided to use it instead buying a 5V/2A power supply with micro USB plug.

Find power and ground wires from the power supply cable using a multimeter.


Identifying power adaptor’s voltage polarity

Cut USB and power cable using a wire stripper. 20160815_0030

0.9 mm wire and 4.45 mm USB cable

4 pin USB plug

| 4 2 3 1 |
4: Ground
1: VCC (5V+)

micro USB and USB plug pins

Red wire: VCC (5V+)
Black: Ground
Green and white: signal


Shielded four wires in USB cable

Solder the two cable wires.

I used heat shrink tubes for the insulation.


Soldering power supply and USB wires

5V/2A power supply

3D Printing the case

Case files:

Filament: 1.75 mm PLA red (eSun) and yellow (No brand)
Layer height: 0.25 mm

Install and set up Devuan

Installation guide I followed is here.

I spent few hours from start to finish.

I had trouble while preparing a bootable SD card.  The SD card reader I have intermittent connection problem, which I should replace it for headache shake.

A weird thing is that only long USB cable off of Wacom table makes the card reader being plugged in Devuan.

Each time after I wrote the image file to microSD card, the card reader went dead.
$ sudo dd bs=4M if=raspbian-ua-netinst-v1.0.7.img of=/dev/sdb

gparted couldn’t format the microSD card so  I had to work on a Windows laptop for formatting and creating the installation microSD card.  I need to learn how to format a dd-ed SD card.

In second trial, the board was working. I could see IP address of the board on router’s admin page and “nmap -sn” command.

Installing Devuan Linux

Upgrade from Wheezy to Devuan

I could login in Raspberry Pi Wheezy using ssh.
Login ID/Passwd: root/raspbian

The whole upgrade had done in two ssh terminals.

# dpkg-reconfigure locales

# dpkg-reconfigure tzdata

Update /etc/apt/sources.list

# wget

$ dpkg -i devuan-baseconf_0.6.4+devuan3_all.deb

Create 01lean file
/etc/apt/apt.conf.d# more 01lean
APT::Install-Suggests "0";
APT::Install-Recommends "0";
APT::AutoRemove::SuggestsImportant "false";
APT::AutoRemove::RecommendsImportant "false";

# gpg --recv-keys 94532124541922FB

# gpg --export -a 94532124541922FB | apt-key add -

# apt-get update && apt-get upgrade && apt-get dist-upgrade

# apt-get install -y aptitude

# aptitude search '?installed' | grep systemd

# apt-get install task-lxde-desktop xrdp

# aptitude search '?installed' | grep systemd

# apt-get install sudo

Created a user named penguin.

VNC setup

# apt-get install vnc4server

penguin@pi:~$ vncserver  -geometry 1024x728 -alwaysshared -depth 24

You will require a password to access your desktops.

xauth: file /home/penguin/.Xauthority does not exist

New 'pi:3 (penguin)' desktop is pi:3

Creating default startup script /home/penguin/.vnc/xstartup
Starting applications specified in /home/penguin/.vnc/xstartup
Log file is /home/penguin/.vnc/pi:3.log

VNC client in the remot host

$ sudo aptitude install xvnc4viewer

$ xvnc4viewer

VNC Viewer Free Edition 4.1.1 for X - built Apr  2 2015 21:51:06
Copyright (C) 2002-2005 RealVNC Ltd.
See for information on VNC.

Fri Aug 19 00:57:48 2016
 CConn:       connected to host port 5903
 CConnection: Server supports RFB protocol version 3.8
 CConnection: Using RFB protocol version 3.8
Fri Aug 19 00:57:56 2016
 TXImage:     Using default colormap and visual, TrueColor, depth 24.
 CConn:       Using pixel format depth 6 (8bpp) rgb222
 CConn:       Using ZRLE encoding
 CConn:       Throughput 15714 kbit/s - changing to hextile encoding
 CConn:       Throughput 15714 kbit/s - changing to full colour
 CConn:       Using pixel format depth 24 (32bpp) little-endian rgb888
 CConn:       Using hextile encoding

Install hibernation program
$ sudo aptitude install pm-utils

Posted in DIY, GNU/Linux, Reprap 3D Printer | Tagged , , , | Leave a comment

Addictive manufacturing technologies

What is 3D Printing?

Comprehensive guide to 3D Printing technology written by 3D Hubs.


Posted in Reprap 3D Printer, Science and technologies | Tagged , | Leave a comment

PID tuning variables in Marlin firmware

The code in the bottom is part of Configuration.h in Marlin firmware source code.
When PID auto tuning fails to produce consistent temperature control,  the wiki page suggest you manually change three variables, P, I, and D.

For manual adjustments:

if it overshoots a lot and oscillates, either the integral gain needs to be increased or all gains should be reduced
Too much overshoot? Increase D, decrease P.
Response too damped? Increase P.
Ramps up quickly to a value below target temperature (0-160 fast) and then slows down as it approaches target (160-170 slow, 170-180 really slow, etc) temperature? Try increasing the I constant.

What if the manual adjustment wouldn’t produce satisfactory PID values? Fluctuation over five degrees around target temperature, i.e. 200 Celsius degrees, printing a quality object is impossible. The object will have noticeable layers. Controlling temperature between one to two degrees is essential for quality 3D printing.

I spent hours to PID tuning after replacement of the thermistor on E3D V6 Hotend without success. It prints objects but the quality is below my expectation. While in printing temperature was changing 195 C to 210.

Out of frustration, I looked into Marline source code, changed the values of few variables in the below, made good PID tuning.

Play with PID_MAX, PID_INTEGRAL_DRIVE_MAX values. These two values affects the current heater uses during temperature adjustment. Default settings are both 255, which means the controller uses maximum amount of current.

Excessive current overshoots temperature and it creates fluctuation at target temperature. For instance, let’s set the target temperature at 200 C. The controller supplies current that heats up the heater block always 10 degrees over.

At 190 C, it will be 200 C and cuts current to maintain it. Then the temperature drops. The controller puts current at 197 C, then the heater block will goes up to 207 C. This is already too much and the controller cuts off current until it detects 200 C. Getting back to full power, 200 C becomes 210 C+.

190 -> 200 -> 197 -> 207 -> 200 -> 210

We need to remove excessive current that the controller believes in it’s good value. How to do it?

255 is default value, which is the maximum current. To make it 90% of the maximum value, do 255 * 0.9. And convert into integer is 230 or 229 (229.50)

I obtained 218, which is about 85% of maximum current.
I got PID_INTEGRAL_DRIVE_MAX 230 by multiplying 0.9 to 255, 90% of the value.

Reduced current indeed produced ideal PID values that I used to have, plus or minus one or two degrees of variation at target temperature.

// PID settings:
// Comment the following line to disable PID and enable bang-bang.
#define PIDTEMP
#define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current

// __test__ soft pwm uses PID_MAX/2. Half of power that PSU generates.
// My ATX PSU has 20A in 12V+ rail. Maxium Power output is 240W.
#define PID_MAX 218 // (255)  limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
#ifdef PIDTEMP
#define PID_DEBUG // Sends debug data to the serial port.
// #define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
#define PID_FUNCTIONAL_RANGE 10 // (10) If the temperature difference between the target temperature and the actual temperature
// is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
#define PID_INTEGRAL_DRIVE_MAX 230  // (255) limit for the integral term
#define K1 0.95 //smoothing factor within the PID
#define PID_dT ((16.0 * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine

Posted in Reprap 3D Printer | Tagged , , , , | Leave a comment

How to repair rubber grip of old Nikon cameras

I cleaned Nikon D200 yesterday using 85% alcohol, Q-tip, and cotton rag.


The rubber grips are lifting off here and there. I put small pieces of electrical tape over the  right-hand side grip where thumb rest.


Rubber grip repair

The maker uses “strong” double side tape, alcohol, a utility knife, with replacement grip.


“D200 grip” search on eBay brings sellers in China.


I found an interesting product, mouldable glue that turns into rubber.

Posted in DIY, Photography | Tagged , , , , | Leave a comment

Dimensional calibration in Deltabot 3D Printer

The formula for dimensional calibration is

new_diagonal_rod = measured_length / target_length * current_diagonal_rod

Current diagonal rod is 232.26 in Bulbul Junior.

I printed a test model whose dimension is 40.00×28.00×18.00 (mm).

Actual measurement of the printed model was 40.80×28.85×18.20 (mm). It printed the model little bigger so I would increase diagonal rod length.

x_factor = 40.80 / 40.00 = 1.02

y_factor = 28.85 / 28.00 = 1.02

z_factor = 18.20 / 18.00 = 1.01

average_factor = (x_factor + y_factor + z_factor) / 3

In Deltabot 3D Printer, using one factor is sufficient because a position in 3D space is converted into spherical coordinate by inverse kinematics.

new_diagonal_rod = 1.02 * 232.26 = 236.91

In my case, the Marlin firmware supports data retrieval in EEPROM of the controller board. Below is the EEPROM content of Bulbul Junior 3D Printer.

Printer is now online.
echo: External Reset
Marlin 1.0.0
echo: Last Updated: Mar 22 2016 03:35:52 | Author: (RichCattell v1.0, Bulbul Junior v0.99, No LCD)
Compiled: Mar 22 2016
echo: Free Memory: 3059 PlannerBufferBytes: 1232
echo:Stored settings retrieved
echo:Steps per unit:
echo: M92 X100.00 Y100.00 Z100.00 E450.67
echo:Maximum feedrates (mm/s):
echo: M203 X200.00 Y200.00 Z200.00 E200.00
echo:Maximum Acceleration (mm/s2):
echo: M201 X5000 Y5000 Z5000 E9000
echo:Acceleration: S=acceleration, T=retract acceleration
echo: M204 S3000.00 T5000.00
echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)
echo: M205 S0.00 T0.00 B20000 X20.00 Z20.00 E20.00
echo:Home offset (mm):
echo: M206 X0.00 Y0.00 Z0.00
echo:Endstop adjustment (mm):
echo: M666 X-6.80 Y-6.30 Z-6.95
echo:Delta Geometry adjustment:
echo: M666 A0.00 B0.00 C0.00 E0.00 F0.00 G0.00 R92.50 D232.26 H172.77 P0.00
echo:PID settings:
echo: M301 P18.13 I1.06 D77.84
echo:SD init fail

To set new diagonal rod length, I run:
M666 D236.91

This is typical way of dimensional calibration of Deltabot 3D Printer.  You repeat above calibration cycle until it reaches consistent accuracy range you desire.

One tricky part of Deltabot 3D Printer is dimensional accuracy gets off as the model’s dimension moves away from the calibration size. Suppose you plan to print mating parts whose size is 100.00 mm, do quick dimensional calibration and check the accuracy.

Some serious 3D Printer users exclusively run Cartesian 3D Printers due to this subtle variation of accuracy of Deltabot 3D Printer. I haven’t spend time to investigate why does it yet.

Adjusting flatness of the virtual plane

If the center height is lower than the three tower positions, the virtual plane formed by effector’s movement is concave. Increasing Delta Radius lowers the edges till center and the three tower positions are at the same plane.

Here is the example. Bulbul Junior’s Delta Radius was 92.50 mm.

Lowering the effector to the center on xy plane, Z height of (0, 0) should be zero as the nozzle touches the print bed. Well, the nozzle touches the print bed 0.2 mm down. Z was -0.20 mm.

Three tower positions’ Z height are 0.20 mm, 0.20 mm, and 0.10 mm as the nozzle touches the print bed.

How can we adjust end stops so that four points form one virtual plane, which means exact parallel plane to print bed?

I increased Delta Radius to 93.00 mm. And the measurement of four points were
0.10 mm in X tower, 0.05 mm in Y tower, and 0.05 mm in Z tower. At the center nozzle barely touches the print bed.

I increased Delta Radius to 93.50 mm.
X tower was -0.15 mm, Y tower was -0.1 mm, Z tower was -0.1 mm. And adjustment three endstops made center and three tower positions exactly touches the print bed, Z was 0.00 mm.

Posted in Reprap 3D Printer | Tagged , , , , , , , , | Leave a comment

Four photos

One tip I learned USB MTP makes gphoto2 downloading image files in Devuan.

Sony A6000 will be my main camera. I gotta get used to this camera and the prime lens’ capabilities.

I’ve taken all pictures at f/2.8 for three or four days in different settings.
SCN mode, 2016:08:01 22:16:43, f/2.8, 0.025(1/40), ISO 6400


40 PC

A(perture priority mode) ,2016:08:06 01:06:00, f/2.8, 0.020(1/50), ISO 400

It was a hot today. The thermometer was hitting 35 Celsius degrees around noon.  I felt the heat wave and worked inside the tiny room while I was cutting MDF boards.

A, 2016:08:06 01:06:00, f/2.8, 0.020(1/50), ISO 400

A, 2016:08:05 18:56:13, f/2.8, 0.0003(1/4000), ISO 400

Original image file of the tree. f/2.8 develops rough pixels.


Image | Posted on by | Tagged , , , | Leave a comment

Scissor Z axis?

Travel Range 50mm
Platform Size 80x120mm
Repeatability 0.02mm
Motor Type NEMA17 Stepper Motor (0.9°)
Static Torque 40Ncm
Rated Current 1.7A
Maximum speed 5mm/sec
Center Load Capacity 5kg
Weight 1.3kg


Posted in DIY, Reprap 3D Printer | Leave a comment