Suppose we want to use our S3 to scribble something like the word "Robot". (There is a video of a Parallax S2 doing just that!) If you wanted each letter to be separate, you’d need to remove the pen tip from the drawing surface between each letter. In handwriting or drawing terms, this called a pen lift.
Did You Know?
Pen Lift - “A pen lift is the practice of lifting the tip of a pen from a writing surface. In technical terms, experts identify the pen lift as an event where the “pen axial force” reaches zero. Basically, it means the pen has been entirely lifted from the paper. The effect on paper is a break in a continuous line that represents part or all of a letter or sequence of letters.” Source: http://www.wisegeek.com/what-is-a-pen-lift.htm
The pen lift hack has been around since the very first Scribbler robot. With the S3’s external hacker port - this hack is made much more simple.
Hardware Hack Instructions
In a previous tutorial, we learned how to control a Standard Servo by connecting it to our S3’s hacker port. We can use a servo to lift the pen between letters or for other special purposes when we are scribbling. This tutorial will show you how.
The above video shows the mechanical assembly of the pen lift device. Photos, instructions, and the pdf print-out you'll need are listed below. It is a simple and creative way to add a pen lifter to your S3 using a standard servo and some simple tools.
- S3 Robot
- Parallax Standard Servo (#900-00005)
- 1/2" by 1 1/2” piece of double-sided foam tape (strong double sided tape, clear won’t be strong enough) or similarly sized Command® Strips
- 3/4” wide clear tape
- Pen that fits in the S3 - Sharpie® or whiteboard marker
- Phillips-head Screwdriver
- Diagonal cutters or Tin Snips (or hand saw & clamps)
- Safety Glasses (always a good idea, but use every time when cutting things!)
- Cable tie
- S3 Pen Lifter Paper Template
Preparing the Pen and Attachment Loop
- Print out the “Pen Lifter Template” document (last bullet in the Parts list above).
- Use scissors or a paper cutter to cut out one of the templates.
- Fold lengthwise, along line "a".
- Take a piece of tape the length of the paper strip and tape over/around the long seam, so that it can't be unfolded. (This is optional, but makes the paper last much longer. See the video if the pictures below aren't clear.)
- Fold widthwise, along line "b".
- Align the bottom of the paper template (as indicated by “cap” with the cap of your pen, making sure that the side labeled “this side against the pen” is exactly that.
- Place a piece of tape over the “c” tape area and tape to the pen.
- Tape “d” to the pen in the same way, making sure the template lays flat against the pen. The two ends of the template will NOT match up.
- Carefully push a pencil or similar instrument through the loop of paper just enough to “open” it up.
Modify the Servo Horn
- Use your hand to slowly rotate the servo horn as far counterclockwise as you can, but don’t force it!
- Use a phillips-head screwdriver to remove the servo horn.
- Use diagonal cutters, tin snips, or a hand saw (in that case, hold servo horn with clamp, not your hands) to cut off three of the points. Be sure to wear safety glasses!
Test and Configure the Servo
- Make sure the power is off on your S3. Connect the 3-wire cable to the pin row marked P5. Orient the connector so that the black wire is connected to the Ground column, the red wire is connected to the middle or 5V pin, and the white signal connector is on the pin column - all along the row marked P5.
- Open BlocklyProp, login, make a new program called Pen Down Test, and snap construct the following code:
- Save it, compile and load to EEPROM. This sets the Servo to the center (90 degree) position and sets the center LED to green.
- Place the modified servo horn back over the servo output spline in the orientation (angle) shown below, push down onto the spline, and replace the screw to secure.
- Now rerun the code by pressing the blue reset button. Find the exact angle setting so that horn is centered as shown above. Insert that angle as the pen_down variable value. Power down your S3 when done.
Putting it All Together
- Cut a ½ inch by 1 ½” of double-sided foam tape, (or other strong double-sided tape, etc. See parts list for alternatives.)
- Adhere the tape or strip to your S3 on the surface adjacent to the pinout silkscreen, about 3/4” back from the face that has “S3” written on it.
- Place the servo over the tape in the position show and press/hold in place for 30 seconds to ensure a good bond to the tape.
- Plug the servo into P5 of the hacker port (if disconnected for this process), and use the cable tie to manage the extra cable.
- Place S3 over safe writing surface (remember Sharpie ink in permanent!).
- Remove cap from pen, place the pen in the hole, and twist the paper loop over & onto the servo horn as shown in the next set of photos.
- Congratulations, you’ve completed the Pen Hack! Now let’s write one more piece of BlocklyProp code to test and set the pen’s "up" position.
- Open BlocklyProp, login, and open your Pen Down Test. Save a copy as Pen Down and Up Test. Then modify the code as shown below.
First, you add a pen_up variable block. Your values may vary - see note below. Next, you loop the body of the code 5 times. Green LED indicates that the pen is down. The servo is attached to P5 (as before). The pen is down for 500 ms. The red LED shows that the pen is up. The pen is up for 500 ms. Finally, you disable the servo when finished.
Note: pen_down and pen_up values will vary based on your servo position, paper loop size and position, but the 20 degrees between values should be close to correct. Find what works best for you.
- Save it, compile and load to EEPROM. Make sure that the pen is in contact with the surface at pen down and raised above the surface at pen up. Adjust the variables for these settings in your code, if necessary, save it and test it again.
- Modify the program. Name it “Pen Down and Up Drive Test”- adding a speed variable block and motor speed block (left, below) just above the repeat block.
- Now add the stop driving block at the end. This code makes the S3 move forward as the pen moves from down to up - making a dotted line.
- Save, compile, load to EEPROM, and run the program. Adjust the settings so that your pen lifter works optimally. Change the motor speed variable and wait time to change the dotted line pattern.
- Modify the Pen Down and Up Drive Test - adding a variable for the wait block setting. That makes the previous “Try This” a snap!
- Modify some of the BlocklyProp programs you created in the Draw Simple Shapes or Turning Shapes into Art - adding pen lifts to make the shapes with dotted lines.
- Check out this BlocklyProp program (created by Parallax-friend Whit Stodghill) and see if you can figure out what it does.
- Save a copy of it as S3 Scribble, compile and load to EEPROM. (Note - Use the best variable settings for your personal S3 robot that you discovered earlier.)
- Place your pen and pen port and put the paper loop on the servo horn. To run the program, press the reset button once.
Did your S3 do what you expected? If not, check out the Youtube Video of this program in action here.
Special thanks to Parallax friend Whit Stodghill for his assistance in writing, editing, and testing material for these S3 tutorials.