Join the Ben Heck team every week for amazing hacks! Watch them build and mod community-inspired projects using electronics! | Community Feedback | |
Featured Bonus Content | ||
See All Episodes |
The team is working on a touch control stand for the Super Glue Gun build. To do this they will need to figure out how to mechanically make the stand pop in and out, figure out how to actuate that either with a DC motor or a servo, and then make some code for the microcontroller, if it’s a servo for instance they need to create a timer library with interrupts, and then figure out how to put a capacitive touch sensor on the trigger that can be read by the microcontroller. |
Ben and Felix work on a mock up for the stand. Following a suggestion from Felix, they need to figure out placement of a rod. Ben does a mock up that includes an elongated rectangular piece with teeth, a rack and pinion with a motor, and a gear that would drive the teeth. You’d have this on a linear slide which makes it go forward and back, as well as, some sort of limit switch so you know where it is. The mock up that includes a guitar string hooked up to a brass piece that represents the stand. They have it hooked up to really small servo. A stranded steel cable could go underneath the motor and all the extruders. This would allow them to put the servo motor further back for more space and prevent it from getting overheated by the hot end. They could still control the stand in the front using a cable.
They make a second mockup with a stiffer rod. The servo is making noise when it’s not moving. This means it’s trying to achieve a position that cannot reach and it will eventually burn itself up. A servo is like a motor with a potentiometer in it. It knows where it’s at in degrees, knows where it has to be, and has to get there. Little servos like the one they are using are not smart enough to know when they’re under strain. They’ll just try to keep getting there until they burn up their motor or their circuits. To solve this, Ben remakes the brass stand and rigs up a smaller radius piece.
Ben goes to work on the coding. He’s looking for a servo library for the servo used with the ATtiny20. The library he uses calls an interrupt and every time the interrupt is called it does a counter to see if the timer is past the point where the servo should be on or off and then it turns it on or off. To get the library working it was necessary to decipher the address registers described in the datasheet to set the proper bits. After modifying the code Ben uses an oscilloscope to analyze the pin output and verify the program. The variable pulse state is used to iterate through the state machine.