Episode 290: Super Glue Gun 04: Hold Me Closer, ATTiny

Version 1

    element14's The Ben Heck Show

    Join the Ben Heck team every week for amazing hacks! Watch them build and mod community-inspired projects using electronics!

    Back to The Ben Heck Show homepage

    Help a Community Member
    Featured Bonus Content
    See All Episodes



    Previously, the team worked on the triac to control the hot end, extruding glue through the hot end, and finding the best DC motor and drive gear to push the glue to the hot end. In this episode, the team is going to make another test rig using a slightly faster DC gear motor and get started on programming the ATtiny microcontroller that will drive everything in the glue gun.


    Check out more Super Glue Gun Episodes

    Ben finds a DC motor with the same form factor as the one he used before, but its 50 rpm instead of 3 rpm. The mounting is different so he goes into Autodesk Fusion 360 to design a 3D Printed mount.  Ben exports his design as a DXF (Drawing Exchange Format) so he can cut a paper pattern on the laser, make sure the holes are correct, and once that done he can print it. The paper pattern is way off so it was good thing he started this way than with a 3D print. It takes many tests to get the right dimensions.

    After 3D the part and measuring the distance, the latest revision to the motor mount is a little loose so another revision is made on the 3D printed part. Once the part is dialed in, they’re going to take the glue stick and get its center point, and use that to make their guide shaft. That will get them close enough to do a test with the hot end again. 50 rpm motor gives them a lot more speed than the 3 rpm motor, however more speed means less torque so hopefully it has enough power to push the glue through the hot end. Once it seems to work, it’s time to make the next revision to the 3D printed part so they can push it through the hot end.

    Ben has a new board he made for ATtiny development.  It’s got a larger socket on it for the ATtiny20.  He’s also working on a sub socket for the ATtiny4 to give him a couple of options for what he can use. The ATtiny20, is the most likely candidate for use with the Super Glue Gun, as it gives him 6 IO. The board gives him a way to program these little chips as well, especially as they use the TPI – Tiny Programming Interface – instead of the SPI (Serial Peripheral Interface).  Once the board is wired up they can get to work on some code.

    Ben goes on Atmel Studio to do some programming for various ATtiny chips. AtmelStudio is based off of VisualStudio and is well integrated with Atmel microcontrollers. Ben goes over logic for programming an ATtiny chip. The PWM pin is set to be an output. On this a 1 is an output and a 0 is an input.  He sets up a timer to drive the PWM. Ben does all the code in AtmelStudio, so they can be develop it on a low level, have a file that’s easy to program, and they can make the device.

    An H-bridge is a circuit for reversing the direction of a motor. Ben explores making his own H-bridge on the PCB. He looks for some MOSFETs to make a full H-bridge.  He interested in finding out what that would cost vs. a dedicated, integrated circuit. He goes with a Duel MOSFET, N and P Channel.  Once he finds some power MOSFETs to make his own H-bridge, he’ll wire it up manually so he knows exactly what’s going on and can low level control it with a microcontroller.   They will also need to figure out auto stand that kicks out. They could possibly use a servo, use a timer on the ATtiny and have some PWM running at 50 hertz. For now he’s looking for the cheapest way to possibly drive a motor.