Beast Rabban's Lost Pistol

In this guide, we're building a Dune inspired movie replica using 3D Printing and electronics. Beast Rabbon's pistol is a unqiue harkonnen weapon that was never seen in David Lynch's 1984's Dune. There are only two images of the pistol on the net and currently isn't anyway to get one. 

3D Printing Movie Replicas

This project combines the original pistol with functional features. A Trinket micro-controller reads an EZ4 rangefinder and writes the distance in centimeters onto a 14-segment LED display. 

Prerequisite Guides

Be sure to walk through the following guides to get yourself familiar with the Trinket micro-controller, LED Backpacks, and distance sensor.

Ultrasonic + Trinket

Follow the circuit diagram above for referencing how to wire up the circuit. Use a breadboard to prototype this circuit. 

Programming Trinket

You will need to download and install special libraries in order to get the Trinket to work with the Adurino IDE. Check out the link below for setting that up.

Ultrasonic Distance Sensor for Tirnket and Quad Alphanumeric LED Display

Copy and paste the following code into a new sketch in the Arduino IDE. Select the Adafruit Trinket 8MHz in the board section under the Tools menu. Make sure the Programmer section is set to USBTinyISP. Once those are confirmed, plug in the Trinket via USB to your computer and hit upload while the trinket is blinking red.

#include <TinyWireM.h>
//#include <avr/power.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

#define EZ1pin 1               // Trinket GPIO #1   

Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4(); 
char printMe[3];
String str;
int8_t arraysize = 9; // quantity of values to find the median (sample size). Needs to be an odd number
uint16_t rangevalue[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint16_t modE;        // calculated median distance

void setup() {
  pinMode(EZ1pin, INPUT); // Sey ultrasonic sensor pin as input
  //if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
  alpha4.begin(0x70);  // pass in the address
  alpha4.writeDisplay();  // clear display

void loop() {
  int16_t pulse;  // number of pulses from sensor
  int i=0;
  while( i < arraysize )
    pulse = pulseIn(EZ1pin, HIGH);  // read in time for pin to transition
    rangevalue[i]=pulse/58;         // pulses to centimeters (use 147 for inches)
    if( rangevalue[i] < 645 && rangevalue[i] >= 15 ) i++;  // ensure no values out of range
    delay(10);                      // wait between samples
  isort(rangevalue,arraysize);        // sort samples
  modE = mode(rangevalue,arraysize);  // get median

    alpha4.writeDigitAscii(0, printMe[0]);
    alpha4.writeDigitAscii(1, printMe[1]);
    alpha4.writeDigitAscii(2, 'C');		// write to LCD
    alpha4.writeDigitAscii(3, 'M');
  delay(500);                        	// Read every half second

// Sorting function (Author: Bill Gentles, Nov. 12, 2010)
void isort(uint16_t *a, int8_t n){
  for (int i = 1; i < n; ++i)  {
    uint16_t j = a[i];
    int k;
    for (k = i - 1; (k >= 0) && (j < a[k]); k--) {
      a[k + 1] = a[k];
    a[k + 1] = j;

// Mode function, returning the mode or median.
uint16_t mode(uint16_t *x,int n){
  int i = 0;
  int count = 0;
  int maxCount = 0;
  uint16_t mode = 0;
  int bimodal;
  int prevCount = 0;
    while( x[i]==x[i+1] ) {
    if( count > prevCount & count > maxCount) {
    if( count == 0 ) {
    if( count == maxCount ) {      //If the dataset has 2 or more modes.
    if( mode==0 || bimodal==1 ) {  // Return the median if there is no mode.
    return mode;

PLA Filament

We recommend printing the parts in PLA filament. Follow our slice settings as a reference point. Settings will vary from printer to printer, so you'll need to adjust your printers settings accordingly. Each part is optimized to print with no support material and saved in the best oriention to print.


PLA @230
No support
0.2mm Layerheight
3 Shells
90/120 Speeds
10% Infill

Takes about 8 hours to print all pieces

Prop Details

We recommend printing the dhp-grip-bottom.stl and dhp-grip-top.stl parts together in a set. The dhp-dot.stl pieces can also be printed in one set to speed up the process. Most slicing software can allow you dubplicate STLs. This project uses 12 dots, 6 on each side.

Finish Part Surface

We added a light coat of silver spray paint to the parts to give it a metal look. Using sand paper and a brass sponage, we smoothed out the surface and added abasion  to the parts giving it a worn and aged textured.

Add JST to Trinket

First step is to get a JST connector onto the Trinket so we can easily remove any JST compatible power source.

We'll grab the JST battery exnsion cable and measure the length like in the photo. Cut and strip the wires from the JST cable.

Tin the postive and negative pads on the bottom of the Trinket and solder the red wire from the JST cable to the postive pad, and the black wire to the negative pad.

Trinket JST Connector

Adding a JST female connector to the Trinket micro-controller makes it easy to swap out capatible power sources. Most of our battery holders, rechargable lithium polymer and lithium ion batteries use JST connectors.

Soldering a battery directly to the Trinket is not recommended.

Assemble Quad Alphanumeric Display

The quad alphanumeric display comes in a kit that requires assembly. Add the LED matrixes to the driver with the dots lined up for proper orientation. Bend the terminals on the far end aparts so it keeps the LED matrix in place while you solder. Secure the LED backpack to a panavise and solder the 18 pins. Use a diagonal cutters to remove the excess leads.

Assembled 14-Segment Quad Alphanumeric Display

Double check all of the pins have been soldered. 

Solder Wires to LED Matrix

Tin the five pins on the top of the LED Matrix. Solder one 30AWG wire to each pin. Use either a long strand of wire (about 20meters long) or the whole wire spool. 

LED Matrix Connections

Try using a different color for each wire so that you can easily tell them apart.

Measure LED Matrix Connections

Position the LED matrix over the parts and measure the length required to make a connection. Cut the wires and add a piece of heat shrink tubing to bundle the wires. Insert the bundle wire through the opening in the dhp-led.stl part.

Wire EZ Rangefinder

Solder a 30AWG wire to the GND, 5V and PWM pin on the EZ distance rangefinder. If you solder to the leads of the header, be sure to add a piece of heat shrink tubing to secure the connection.

Position the sensor over the parts and measure the length of wire required for connecting to the Trinket. 

Gently insert the distance sensor into the dhp-barrel.stl part with the black plastic part going in first.

Slide Switch Adapter

Shorten a JST extension cable to about 10mm long by cutting the positive and negative cables with wire cutters. Use wire stripers to strip the ends of the positive and negative wires. Apply a bit of rosin to the stripped ends and tin the tips of the wires. Add a piece of shrink tubing to the positive wire and solder them together by holding them in place with a third-helping-hand.

Wired Components 

Yay! All of the components are wired and ready for installing to the enclosure.  The trinket and LED matrix will be secured to the printed parts with machine screws. The next page will walk you through the build process.

Insert LED Matrix to Enclosure

Insert the wiring from the LED Matrix through the opening in the dhp-led.stl part. Fit the LED Matrix into the dhp-led.stl part with the triangle part lined up with the top of the LED (The noticable dots indicate the LED's orientation).

Install Sensor to Barrel

Place the sensor over the barrel and line up the orientation. Carefully insert the distance sensor into the dhp-barrel.stl part with the plastic part going in first. 

Add Trinket to Enclosure

Insert the Trinket into the dhp-box-bottom.stl part with the USB port facing the port opening. Line up the two mounting holes on the trinket with the holes on the part.

Mount Trinket to Enclosure

Add two #4-40 flat phillips screws to the dhp-box-bottom.stl part and fasten it together while holding the Trinket down to the part.

Connect Switch to Trinket

Insert the male JST connector from the slide switch adapter to the female JST conncetor on the Trinket.

Add Screws to Trigger

Fasten two #4-40 flat philips screws into the holes with stand-offs. These need to be inserted so that the heads of the screws are on the opposite end of the stand off.

Add Switch to Enclosure

Insert the Slide Switch adapter into the dhp-bottom-box.stl part.

Connect Battery to Switch

Insert the male JST connector to the female JST connector on the slide switch adapter.

Add Battery to Enclosure

Insert the 3 x AAA battery holder in the dhp-bottom-box.stl and gently position the cables in between the sides.

Add Barrel to Enclosure

Insert the dhp-barrel.stl part onto the dph-bottom-box.stl part with the bottom edge fitting into the opening on the enclosure.

Position LED Matrix Wiring

Place the wiring from the LED Matrix through the opening near the top of the battery like in the photo. This wire needs to route through the opening near the triggne and out the handle.

Install Trigger

Place the trigger on the enclosure with the heads of the scews resting inside the indents of walls.

Add Cover to Enclosure

Place the dhp-top-box.stl part over the dhp-bottom-box.stl part and make sure wires are not covering the standoffs.

Secure Enclosure

Add #4-40 flat phillips screw to the three mounting holes. Hold down the top and bottom parts together so both pieces are flush when they're secured together.

Add Handle to Enclosure

Position the dhp-bottom-handle.stl part to the battery+trinket enclosure like shown in the photo. 

Adjust LED Matrix Wiring

Press down the excess wiring and bend it behind the standoff in the handle.

Add Cover to Handle

Place the dhp-top-handle.stl part over the dhp-bottom-handle.stl part and line up the mounting holes and standoffs.

Check Trigger Placement

Ensure the two screws in trigger are properly positioned inside the enclosure.

Secure Handle

Join the top and bottom handle parts together with machine screws. Fasten three #4-40 flat philips screws while tightly holding the two parts together.

Secure Bottom Handle to Enclosure

Line up the mount holes on the bottom of the handle and add two #4-40 flat phillips screws to the bottom. Fasten these screws tightly to join the bottom of the handle to the enclosure.

Secure Top Handle to Enclosure

Line up the holes on the top of the handle and add two #4-40 flat phillips screws to the top. Fasten these screws tightly to join the top of the handle to the enclosure.

Secure LED Enclosure to Handle

Postion the dhp-led.stl part over the top of the handle and line up the mounting holes. Make sure the triangle piece is pointing towards the barrel. This serves as line of sight. Add two #4-40 flat phillips screws to join the part to the handle.

Secure LED Matrix to Enclosure

Flip the part over and fasten 4 #2-56 flat phillips screws to secure the LED Matrix to the enclosure.

Add Cover to LED Enclosure

Snap the dhp-led-cover.stl part on top of the LED Matrix to cover it up.

Measure In Style

Now you ready to test out your shiney Ultrasonic Ruler.

This guide was first published on Sep 15, 2014. It was last updated on Sep 15, 2014.