Shop OBEX P1 Docs P2 Docs Learn Events
The S2 LED Dot Matrix Printer Thread — Parallax Forums

The S2 LED Dot Matrix Printer Thread

WhitWhit Posts: 4,191
edited 2016-04-07 00:20 in Robotics
Basic Concept: The idea is to use an unmodified S2, the GUI Program Maker, and long exposure photography to "print" messages with the S2's LEDs in Dot Matrix format. This should be a fun and impressive project for new learners in robotics (requiring some good problem solving skills - without having to do it all). The design should easily transfer to the new S3.

History: This all began over on the Nikos' Fibonacci Spiral Challenge Thread. Scribbling with the Pen Port and Chalk led to scribbling with LEDs and capturing the images with long exposure photographs. The first posts were here and here by Carol Lynn Hazlett.

Work continued with other ideas - use of the stock LEDs, spirographic scribbling, etc. All of these are recorded on the Nikos' Fibonacci Spiral Challenge Thread.

S2 LED Dot Matrix Printer: At some point, I got the idea of using the stock LEDs to "print" in a Dot Matrix format. Since there are three (not including the "power" LED, I knew it would take two passes. Because the S2 has excellent encoders I figured a carefully configured turn at the end of a line - along with a return trip to the starting point could achieve this.

Using a stock (or unmodified) S2 and the GUI Program Maker (no Spin required) would be ideal for beginners.

Details follow...
«1

Comments

  • WhitWhit Posts: 4,191
    edited 2016-04-06 18:19
    I began where we always begin - with "Hello World!" or in my case "HELLO!" I sketched a diagram of the steps of the process on graph paper. Pass One (left to right) is on top), followed by the turn at the end of line, and Pass Two (right to left) is on the bottom. Each step is numbered for reference. O is LED off, X is LED on.

    HELLO%21%20Map.jpg

    Note: My Dot Matrix Letters are 5 dots high and 4 dots wide (in this example). So, Pass One uses two LEDs and Pass Two uses all three.
    1917 x 446 - 617K
  • WhitWhit Posts: 4,191
    edited 2016-04-07 00:26
    The End of Line turn is critical. In it, the LEDs for Pass One and Pass Two must align vertically and horizontally. This was achieved by trial and error (along with knowledge and info over at the Nikos' Fibonacci Spiral Challenge Thread. Also note that the LEDs on the S2 are not in perfectly straight line( or at exactly a right angle with the wheel path) on the S2 - this little variation make the printing a tiny bit uneven!

    Hint: Placing the S2 on a piece of paper at the End of Pass One, then use a Sharpie in the Pen Port to make a mark. Then placing the S2 on the same paper in just the right vertical and horizontal alignment position of the LEDs for the start of Pass Two and again use a Sharpie in the Pen Port to make a mark - This gives you a template to help program the turn with the GUI.

    The GUI Code for the Dot Matrix Turn is attached.
  • WhitWhit Posts: 4,191
    edited 2016-04-07 00:27
    A screen shot of the GUI Code for the Dot Matrix Turn is attached. Pause at the start and end of the turn just keep movements separate.
    574 x 635 - 113K
  • WhitWhit Posts: 4,191
    edited 2016-04-07 00:30
    Now, let's look at the "HELLO!" GUI code - full code is attached in this thread below.

    The GUI program for "HELLO!" uses subroutines for each "condition" of the LEDs.

    HELLO%21%20GUI%20Screen%20Shot%20Subs.JPG

    The Main Program is on the far left under the green gear. The subroutines (Yellow through Cyan) are on the right.

    We begin with a 2 second pause, followed by the "Charge!" sound, and another 2 second pause. The allows the S2 to be turned on (or the reset button to be pressed). The photographer can then move into place to operate the shutter (since this is all in the dark), the "Charge!" sound helps you to know when to press the shutter (more on the photography set-up later).

    All the LEDs are set to off - the S2 moves one "step" forward at motor speeds 50/50 - the S2 pauses and the "printing" begins by calling the correct subroutines (for turning on LEDs) in sequence.

    Notice that each subroutine, turns on/off the LEDs (per condition) for 0.25 (or a quarter) of a second - turns all the LEDs off - the S2 advances a "step forward at motor speeds 50/50 - the S2 pauses - and the program returns to Main for the next instruction or subroutine call.

    988 x 614 - 184K
  • WhitWhit Posts: 4,191
    edited 2016-04-07 13:35
    The "HELLO!" Program begins printing with Pass One of the letter "H"

    Pass%20One%20H%20and%20Space%20GUI%20Screen%20Shot.JPG

    The top two dots of the vertical left leg of the "H" are lit (ochre subroutine), followed by two open columns (cyan subroutine), then the top two dots of the vertical right leg of the "H" are lit, and then two columns (cyan subroutine again) are left open for the "space" between the "H" and the "E."
  • WhitWhit Posts: 4,191
    edited 2016-04-07 00:33
    Pass One for the sequence "E" space "L" space "L" space "O" space "!" continues in the GUI Main Program (calling each subroutine as needed).

    At the end of line the line, the turn is made. In this photo - we see Pass One (left to right) of the "!" followed by a pause, the turn, a pause, and then Pass Two (right to left) for the bottom of the "!"

    Pass%20One%20%21%20Turn%20Pass%20Two%20%21%20Screen%20Shot.JPG
  • WhitWhit Posts: 4,191
    edited 2016-04-06 20:06
    The GUI Main Program continues with Pass Two (right to left of "0" space "L' space "L" space "E" space and finally "H"

    End%20of%20Main%20Screen%20Shot.JPG

    The program ends by pausing one second, playing the "Tada!" sound, and stopping the S2's movement and the Program. The final "Tada!" sound signals the photographer that the shutter can be released ending the time-lapse photo.
  • WhitWhit Posts: 4,191
    edited 2016-04-06 20:09
    The HELLO! v. 2.0 Dot Matrix 2.0 Best Code attached in the posts below produced this Dot Matrix photo.

    HELLO%21%20v%202.0%20Photo.jpg
  • WhitWhit Posts: 4,191
    edited 2016-04-06 20:13
    To document this work and to allow other word "Maps" or diagrams to be created - I created a file of Dot Matrix Letters, Numbers and some punctuation - along with Pass One and Pass Two symbols and a symbol for the end of line turn. They yielded this graphic. More on this will follow below.

    HELLO%21.jpg
  • WhitWhit Posts: 4,191
    edited 2016-04-06 20:15
    Photos for previous posts attached along with the S2 GUI Program Maker Code for "HELLO!" - This one is HELLO! v 2.O Dot Matrix 2.0 Best.
  • That's not easy to pull off, it looks really accurate. Nice work!

    Maybe that Zuta printer will work after all.
  • WhitWhit Posts: 4,191
    edited 2016-04-07 02:51
    Attached are example (representative graphic file for the Dot Matrix Letter, Numbers and some punctuation marks. Blank Letter (for creating new symbols is included along with the "space" symbol and end of line turn symbol - And a screen shot of them all.

    I created these with Paint.net (freeware), but Paint can also be used. I just cut and paste them together to create new word and message diagrams or "maps." These maps really help when writing the message code in the GUI. You can check off each portion of each letter as you go (including spaces), Pass One, followed by the turn, and then do the same for Pass Two.

    Finally - note that some letters work better in a 5 High X 5 Wide format (Plus) - See "W" and "W" alt for example. Also the X in PARALLAX is in this wide format. That "map" is also attached.

    Update: More Characters added below.
    961 x 1338 - 157K
    961 x 1338 - 156K
    961 x 1338 - 152K
    961 x 1338 - 88K
    961 x 1338 - 188K
    961 x 1338 - 182K
    961 x 1338 - 127K
    961 x 1338 - 94K
    961 x 1338 - 157K
    961 x 1338 - 156K
    1142 x 352 - 67K
    1171 x 244 - 36K
    6817 x 1338 - 2M
  • WhitWhit Posts: 4,191
    edited 2016-04-07 00:39
    Here is a photo, GUI Program Maker Code (named PARALLAX v 1.0) and the (again) the Map or Diagram for "PARALLAX" created as described above. The alignment is not perfect, but still very readable.

    PARALLAX.jpg

    PARALLAX%20v%201.0.jpg
    6817 x 1338 - 2M
    2274 x 881 - 609K
  • WhitWhit Posts: 4,191
    edited 2016-04-07 13:32
    A note about the photography...

    Here is a photo of how I set things up to take the photos (long exposure) of the "printing." I have the camera on a tripod mount laying on a board sitting on two chairs. The camera is focused on the S2 below. Be sure to include the full run - Pass One and Pass Two in the frame. The bathroom mats are at the bases of doors to keep out external light. By the way - when I am doing this whole process, it drives my family nuts!

    Photo%20Set%20Up.jpg

    The camera (Canon Digital) is set in the bulb setting (f20, IS0 100) - that means that the shutter is open as long as the shutter release is pressed. My exposures are in the minute to a minute and a half range.

    Here also is a time lapse video of what the S2 looks like (with the lights on) stepping along, printing with the LEDs, making the turn and returning to the start. Note the black tape covering the programming port (to stop light bleed) and the blue "power" LED. This is the only "modification" to the S2!



    Note: Forum member xanadu suggested a way of "stitching" together individual photos using software - here is his quote from another thread - "There is another option, you can combine the pics post process using something like this. - Startrails.exe http://www.startrails.de/html/software.html" Facebook folk can see some amazing images created with this software here.

    I have not tried this yet, but it might allow the use of less expensive cameras and maybe even a phone camera. There is probably such an app. Any ideas?
    1280 x 1280 - 665K
  • WhitWhit Posts: 4,191
    edited 2016-04-06 21:25
    Have fun using this yourself or with your students. I hope you all learn some new tricks and help others learn to love robotics as much as I do! Thanks to Carol, Nikos, Ken, erco and all the other Forum Members for the support, inspiration and encouragement.

    Can't wait to try this on the Green S3!
  • ercoerco Posts: 20,256
    Very impressive, Whit! You're a one-man, one-stop ideation, development and documentation resource.

    Ken, I highly recommend that you double or triple whatever you are paying Whit for his fine continuing work.
  • WhitWhit Posts: 4,191
    Some more characters...

    Ltr%20Photo%203.JPG
    819 x 246 - 37K
  • WhitWhit Posts: 4,191
    A couple of new challenges... Will try to get photos and GUI code up soon!

    I%20%20Love%20S2.jpg

    I%20Love%20Prop.jpg
    3833 x 1337 - 853K
    4000 x 1338 - 964K
  • WhitWhit Posts: 4,191
    edited 2016-04-07 13:24
    Had to create a "?" Character for this secret message to Ken and anxious fans everywhere... See the Next Post for the secret message.
  • WhitWhit Posts: 4,191
    S3%20NE1.jpg
    961 x 1338 - 157K
    4067 x 1334 - 996K
  • WhitWhit Posts: 4,191
    edited 2016-04-07 20:51
    Created a new S2 Pass Icon (attached) which can be added to a message "Map" or Diagram to add just a bit more clarity for the youngest students. Also attached are S2 N, S, E, W facing graphics - for any use.


    197 x 187 - 25K
    187 x 197 - 23K
    187 x 197 - 29K
    197 x 187 - 27K
    961 x 1338 - 210K
  • WhitWhit Posts: 4,191
    I discovered that one LED configuration was not included in the original GUI Program Maker code. That condition was On On Off - it is now the Cyan subroutine. That means that the spaces between letters need to be placed into the main program.

    The latest base version of GUI code (including the End of Line turn, but not Pass One subroutines or Pass Two subroutines is attached. Simply insert the correct subroutine sequence for each Pass and save replacing the Generic "NAME" with your message name.

    Code is called S2 LED Dot Matrix Printer 3.0 NAME - Remember this code is just the base - It is incomplete - also notice how the subroutines are lightened if they have not been called. This provides a good check once you've modified the base.
  • WhitWhit Posts: 4,191
    edited 2016-04-08 03:48
    The Propeller Beanie had to be done!

    Attached are the GUI Program Maker Code for S2 LED Dot Matrix Printer 3.0 Beanie, the "Map" or Diagram (with S2 Pass Icon and Subroutine Symbols for each column of each pass.

    When you look at the GUI Program Maker Code, you will notice that is the S2 LED Dot Matrix Printer 3.0 NAME modified with the subroutines as indicated in the "Map" - first is Pass One, the the Turn, and then Pass Two. Note also that repeated steps are done in loops (per number of times) and that "spaces" are in the main line of code (LEDs set Off Off Off, and "step" forward, and a pause.

    Enjoy!
  • WhitWhit Posts: 4,191
    Photography Side Note - I've begun playing with Long Exposure iPhone camera apps too. Will report back when I have some news. So far, nothing is beating my wife's expensive Canon Digital SLR. I guess there is a reason they cost so much, but just think of all the robot stuff you could get for all that money! :D
  • WhitWhit Posts: 4,191
    edited 2016-04-09 02:50
    "Print Head Alignment" - Okay, I know there is not really a print head, but I have been working on an improved End of Line turn, along with a way of calibrating the "row" separation and column start and stop points.

    I discovered the best way to do this is using the photo process itself! Essentially the GUI code attached gives a tone for start (less cumbersome over repeated trials than Charge!) - Turns on all LEDS (On, On, On), drives ahead at motor speed 50/50 for 3 seconds - Stops and turns LEDs to (Off, Off, On - so you can see the turn) - makes the turn (lots of trial and error refinement here) - Stops and turns LEDs to (On, On, On) - drives ahead a motor speed 50/50 for 3 seconds - turns LEDs to (Off, Off, Off) - Stops and plays and End tone (again, simplified from Tada!)

    By repeating the process of adjustment, photo, adjustment, photo - you can dial in the row and column alignment. Code, best photo and some misaligned photos attached.

    Using only the GUI provides some limitations (of course), but keeps the the project accessible for true beginners!

    Photo%20S2%20LED%20DMP%204.0%20LED%20Alignment%20Test%205.0%20d040816.jpg
  • Whit,

    Don't think this is going unnoticed. I have been following for that last week with much interest.

    Keep up the great work!

  • WhitWhit Posts: 4,191
    Thanks Publison! I've really been having fun!
  • WhitWhit Posts: 4,191
    edited 2016-04-13 02:30
    Nikos - Look at this... see the end of this post too.

    All the code so far is based on my original idea. To "print", the Main Program of the GUI would call a subroutine (see Yellow example below). In the subroutine, the S2 fully stopped - would flash its LEDs in one of the various conditions for 0.25 of a second, turn the LEDs off, advance a fixed increment or step - and stop again - awaiting the Main Program to call the next subroutine. This resulted in multiple stops and starts and L O N G exposures for the photograph of the results (one to two minutes).

    Old%20Method.JPG



    Yesterday, I began using a "New Method." To "print" the Main Program gets the S2 moving forward at a slow speed (30/30). As it rolls, it calls subroutines, the flash on and off the LEDs for 0.1 seconds - one subroutine after another. This results in the S2 continuously moving except before and after the turn for a slight pause (I may try to eliminate this pause too. Exposures now are MUCH shorter. See Yellow example of the new subroutine below.

    New%20Method.JPG

    Getting the movement speed and LED flash duration (On, Off) right keeps the LED flashes from being dashes rather than dots. See below.

    NM%20Beanie%20Too%20Long.jpg


    The Propeller Beanie 3.0 using the Old Method took about 1 minute 20 seconds to run and photograph.

    Beanie%203.0.jpg

    The similar Beanie v4 using the New Method took about 12 seconds to run and photgraph - it also a bit easier (clearer to program) - see next post for code.

    NM%20Beanie%20v4.jpg

    Nikos - this continuous movement printing will be much better suited to the sort of sky-writing that could be done with the ELEV-8!
    803 x 554 - 133K
    1029 x 415 - 27K
    493 x 393 - 19K
    110 x 520 - 26K
    111 x 445 - 23K
  • WhitWhit Posts: 4,191
    edited 2016-04-09 15:08
    Here is the S2 LED Dot Matrix Printer 4.0 New Method Beanie GUI Code, Propeller Beanie Map, and a photo. Take a look a the code and see the continuous movement method described above. The dash looking version above is previous experiment that did not get things just right and did not turn the LED off correctly!

    Subroutine Symbols (Y - Yellow, O - Ochre, R - Red, M - Magenta, V - Violet, B - Blue, and C - Cyan - Use S for spaces or all LEDs off) are inserted on the Propeller Beanie Map for ease of writing the GUI code. I made a chart for this, but cannot get it to upload!
  • WhitWhit Posts: 4,191
    edited 2016-04-09 15:50
    Attached is chart of Subroutine Symbols & Names for the New Method 4.0 GUI Code. Using one of the Message Maps (with the S2 Pass Icon and Turn Icon and adding these symbols above or below each column for Pass One (Top) and Pass Two (Bottom) makes writing the GUI Program Maker Code childsplay - which is the point!

    Subroutine%20Symbols%20and%20Names%20-%20New%20Method.JPG

    Remember this is for students!

    The "Base Version" of the S2 LED Dot Matrix Printer 4.0 New Method NAME is attached below - use this code to start - insert your subroutine calls for Pass One and Pass Two in the locations shown in the diagram below per a Message Map you create. Finally, substitute your Message "NAME" in the NAME spot when you save your new code (Example: S2 LED Dot Matrix Printer 4.0 New Method Beanie)

    Slight tweaking of the turn code may be required for your particular S2 or message!

    Sub%20Insert%20Points.JPG

    One last note - One of the great things about Phil Pilgrims GUI Program Maker is that Subroutines not used will be shown in a lightened color format (See the Beanie Code in the post above for example). This is gives a good visual clue whether you've used the correct Subroutines needed for your Message.
Sign In or Register to comment.