Great Glue Gun Recap!

I recently helped out behind the scenes of the two part Ben Heck Great Glue episode. I did the electronics design, assembly, and firmware for Ben. He put that with the mechanical part of the extruder, changed out the trigger, and packaged it up real nice for the episode. As he rarely does write ups I thought I’d post the code (pre hall effect) and the parts I remember using for others to follow in the great glue gun foot steps.

Here is a partial working demo early in the process


Here are the two episodes-


Original Parts – Sparkfun

H-Bridge $2.35

Trigger Pot (retired)

SSR $4.95

Proto board $2.95

Wall Wart 9V $5.95

Thermistor 10k $1.95 (I think I ruined one and ended up using a 100k though)

RGB LED $.95


By request I cross referenced what I could for Newark , they should be available at as well

BenDuino (Ben’s custom Arduino Uno, link is similar but larger) -

H-Bridge –

Trigger Pot – Sorry no cross reference for this sweet product :-(


Proto board with ground plane – No cross reference

Wall Wart 9V -

Thermistor 10k -

Make sure to change the code to use the 10k, I ruined my 10k’s after a few prototypes, jbweld is too strong.  Anyways I used 100k’s, it’s an easy code change and 10k is more often used

RGB LED we used 10mm not a 5mm -


#include <math.h>
#define MotorENPIN  3
#define Motor1APIN  2
#define Motor2APIN  4
#define Light1PIN  5
#define Light2PIN  6
#define minSpeed 50
#define maxSpeedLow   90
#define maxSpeedHigh  160
#define meltTemp 235
#define speedTempOffset 25
//#define SSRPIN    7
#define ThermistorPIN A0                 // Analog Pin 0
#define TriggerPIN  A1
//#define TempSetPIN  A2
boolean extruding = false;
boolean atTemp = false;
int maxSpeed = maxSpeedLow;
int updateCount = 0;
int setTemp = 0;
int reqSpeed = 0;
int setSpeed = 0;
int temp;
int count = 0;
float pad = 100000;                       // balance/pad resistor value, set this to
                                        // the measured resistance of your pad resistor
float thermr = 100000;                   // thermistor nominal resistance
float Thermistor(int RawADC) {          //converts thermistor reading into a resistance and then temperature in C
  long Resistance;
  float logVal;
  float tempTemp;  // Dual-Purpose variable to save space.
  Resistance=((1024 * pad / RawADC) – pad);
  logVal = 3950/log((float)100000/Resistance);
  //T2= T1*B/ln(R1/R2)  /  ( B/ln(R1/R2) – T1 )
  tempTemp = (25+273.15)*logVal;
  tempTemp = tempTemp / (logVal-(25+273.15));
  tempTemp = tempTemp – 273.15;  // Convert Kelvin to Celsius
  tempTemp = (tempTemp * 9.0)/ 5.0 + 32.0;                  // converts to  Fahrenheit
  return tempTemp;              // Return the Temperature
void setup() {
  pinMode(MotorENPIN, OUTPUT);
  analogWrite(MotorENPIN, 0);
  pinMode(Motor1APIN, OUTPUT);
  digitalWrite(Motor1APIN, LOW);
  pinMode(Motor2APIN, OUTPUT);
  digitalWrite(Motor2APIN, LOW);
  pinMode(Light1PIN, OUTPUT);
  digitalWrite(Light1PIN, HIGH);
  pinMode(Light2PIN, OUTPUT);
  digitalWrite(Light2PIN, LOW);
  //pinMode(SSRPIN, OUTPUT);
  //digitalWrite(SSRPIN, LOW);
void loop() {
  int readTemp = Thermistor(analogRead(ThermistorPIN)); // read ADC and  convert it to F
  if ((readTemp > 0) && (readTemp < 500))
    temp = readTemp;
  //setTemp = analogRead(TempSetPIN);
  //setTemp = map(setTemp,0,1023,50,350);            //analog reading 0-1023, temperature range 50 to 350F
  if (temp <= meltTemp){                            //if less than set temp, turn on SSR, set lights
    //digitalWrite(SSRPIN, HIGH);
    digitalWrite(Light1PIN, LOW);
    digitalWrite(Light2PIN, HIGH);
    maxSpeed = maxSpeedLow;
    atTemp = false;
  if ((temp > (meltTemp + 5)) && (temp <= meltTemp + speedTempOffset)){  //if greater than set temp but less than set temp + 10, set lights
    digitalWrite(Light1PIN, HIGH);
    digitalWrite(Light2PIN, HIGH);
    maxSpeed = maxSpeedLow;
    atTemp = true;
  if (temp > (meltTemp + speedTempOffset + 5)){                        //if greater than set temp + 10, turn off SSR, set lights
    //digitalWrite(SSRPIN, LOW);
    digitalWrite(Light2PIN, LOW);
    digitalWrite(Light1PIN, HIGH);
    maxSpeed = maxSpeedHigh;
    atTemp = true;
  reqSpeed = 1023 – analogRead(TriggerPIN);
  if (reqSpeed < 3){                                 //if less than 3 (deadzone) and was extruding, reverse the motor to suck in the gluestick
    if (extruding == true && count >= 450){
      analogWrite(MotorENPIN, 0);
      digitalWrite(Motor1APIN, LOW);
      digitalWrite(Motor2APIN, HIGH);
      analogWrite(MotorENPIN, 125);
      setSpeed = 0;
      analogWrite(MotorENPIN, 0);
      extruding = false;
      count = 0;
    else{                                              //if less than 3 (deadzone) and was not extruding or reverse timed out, turn off motor
      count = 0;
      analogWrite(MotorENPIN, 0);
      setSpeed = 0;
  else if (reqSpeed > 5 && atTemp == true){                              //if greater than 5 (deadzone), turn on motor mapped to stick, 5-1023 reading 50-150 motor, set extruding
    if (count < 450)
    setSpeed = map(reqSpeed,5,1023,minSpeed,maxSpeed);
    digitalWrite(Motor1APIN, HIGH);
    digitalWrite(Motor2APIN, LOW);
    analogWrite(MotorENPIN, setSpeed);
    extruding = true;
  if (updateCount <= 250)
    updateCount = 0;
  //writeUpdates();                                      //for debugging
void writeUpdates(){
  Serial.print(“Temp: “);
  //Serial.print(“Req Speed: “);
  //Serial.print(“Set Speed: “);
As always code and parts list offered without warranty and very little support but you can always shoot me an email and I’ll see what I can do :-)


Also, if you have questions regarding this project, I did a little write up on Element14, any Ben Heck questions and suggestions should go there, it’s a helpful community with better knowledge base than just me (though I do contribute a lot there).


Oh, and look for a reflow write up in a few weeks.  Ben ended up doing a few episodes on the toaster reflow oven I was working on at his shop.

XBMC and Revival of WiFi Radio!

Well WiFi radio kind of fell off the face of the earth for awhile.  I had a chance to get a free XBMC (Xbox Media Center) kit from Element14 and I figured it would make a great revival of WiFi radio.  Here is an unboxing video of the XBMC kit

and here is a picture of the Pi

Hopefully I’ll get to post more updates and work on this project throughout the summer. I’m also doing more projects with Ben Heck including working on another project for an episode as well as possibly doing a Kickstarter project. More details on that later.

Another Ben Heck Show Appearance

Well, this will be a quick little post, mostly for a location to drop some files.  I made another Ben Heck Show appearance, this brings me up to 3.  The video can be seen here


All the videos can be seen here



It was a cool experience as it always is.  Some guys from Engadget were there to film as well and it was cool to talk with them.  Also Ben and I got in an abbreviation contest which was fun. VHDL stands for VHSIC Hardware Description Language, with VHSIC standing for Very High Speed Integrated Circuit.  That is the coolest one I know.


Anyways, a few people have asked for the code and such so I will embed it at the bottom.  I have the Android code and the TI Launchpad firmware code, both in separate zips.  The Android code was written for either Jellybean or ICS, don’t remember which, and that was for the rotate command, like the pot stir app.  The APK is in the zip file.  I didn’t take the time to really document as I’ve been a busy guy.  Hopefully I’ll get to do a life update and an update on my ShapeOko CNC machine shortly.


Anyways, here you go

Android SANTA Project

TI Arduino Code Files

3D Printing-Minecraft-Shapeways

Next week is my Wife’s birthday.  She loves Minecraft so I decided to get her 3D printed versions of our Minecraft characters from Minetoys.  Minetoys uses Shapeways as their “factory”.  Shapeways 3D prints parts via several methods, these use printing a binder (glue) onto powder, then put more powder, print more binder, more powder, etc.  See more info here.

The parts came in today, see below

My character looks a bit like Cthulhu (looks better in the game with extending tentacle head) and hers was a diamond block based character.  The back of my character is wings

She was very excited and loved them.  As I have been looking into these technologies, I was kind of bothered by the mistakes on the right arms of the characters.  Mine has a big blob of material and hers has a divot in it.  I am not sure if this is the best quality powder-binder printing can do, or if it was a just a bad print.  Either way, it was an experience as my first ordered print and I’m pretty satisfied overall.

Skin files




Took a bit of reverse engineering to get these.  To see any player’s Minecraft Skin, use the following format



Stay tuned for 3D printing and CNC update/preview!

Getting More out of USB Car Chargers


I’ve done this little “hack” twice now and figured others would benefit from it as well.


Have you ever noticed your phone/tablet charges slower from USB than from the wall socket?  Many of these devices have a USB charging mode and an AC charging mode.  This is because USB has a limit to what current it can supply unless the device negotiates with the port for more current.

USB car chargers can usually supply more current than the standard USB charging level, but if your device thinks its charging from USB instead of from an AC adapter it will only charge at the lower rate.  So how do you trick it into thinking its hooked to an AC adapter?

Well, that’s pretty easy.  For most mobile devices nowadays, short the USB Data- and Data+ pins together.  Apple has their own methods using specific voltage levels on those pins.  For an example for an iOS device, see Ben Heck’s Universal Wall Wart episode


First, here is my charger, it is manufactured by Rosewill, I bought it from Newegg


There are two USB ports and the charger says it supports up to 1A total


I took the charger a part and this is what was inside


It is a basic switching circuit, probably a buck topology as your car battery is always (hopefully) going to be higher than your USB voltage.  A fuse was contained on the front end.  More info about buck converters here


What I’m interested in is the bottom of the board, where the USB connector is soldered

I shorted the Data+ and Data- pins together as you can see above.  I also tried removing the resistors near the pins but they are glued to the board.  I think those are the resistors for iOS devices I mentioned earlier.  After looking at them, I can see their values are high, about a 52k equivalent resistance across the 5V and GND lines, meaning very minimal current draw because of them, so I can leave them in.

I tested the device before and after, and before I achieved about 200mA of charging current.  Afterwards, I achieved 400-500mA.  I’m guessing each channel can do a maximum of 500mA to get the 1A total.  I also checked the voltage level it was supplying.  Many of these cheaper chargers are super noisy, here is a scope picture

Pretty good clean signal.  Also, I should take a scope picture class so I remember to actually have some useful info on the right side of the scope and not the display controls :-D

I’ve done this once before with similar results.  It’s a great way to get more out of your USB car chargers, especially if your phone is a battery hog like my Galaxy Nexus, that before could drain the battery while charging if using navigation.  Now I can at least break even, and maybe even get a charge.