Wednesday, March 18, 2015

Programming 3D Anaglyph Approximations in TurtleArt

or Give Yourself a Headache Trying.

I have been playing with this idea in my head for a little while and sat down to try it. How about using TurtleArt to program approximations of 3D anaglyphs, those red and blue images that you wear the red and cyan glasses to view?

I say approximations because a quick google search suggests that to create a true anaglyph you need to use algorithms to figure out the displacement of the two images. However, you can write TurtleArt procedures that are pretty close approximations and do appear to float off the screen (or sink into the screen, depending on how you order your colors) when viewed with the anaglyph glasses.

Here is how I programmed my first anaglyph image in TurtleArt.

Start by programming a procedure to draw a square. I made mine 200 to a side. Name the procedure by adding the diamond-shaped block to the top of the procedure and typing its name.

For these anaglyphs we will program them so they appear to come off the screen. To make them recede into the screen, draw your blue object on the left and the same object in red on the right.

Create another master procedure. I start by clearing the screen. I set the color to red, and I set the shade to 75 to make it light red. Then I draw a square.

Next, we need to offset the turtle from where it was when it drew the first square. Use the setxy block to move the turtle slightly to the right and down.

Next, change the pen color to blue and set the shade back to 50. Draw another square, offset from the first and in blue.

Connect the procedures to create your master procedure. Put on your 3D glasses! Run your procedure by double-clicking the top of your stack of blocks.

Viewed through the red and cyan anaglyph glasses you should see a darker square floating slightly above the monitor. Success!

Next, remix your square procedure and make it do more.

Replace the square block in your master procedure with your new remixed block. Put on your 3D glasses. Run your procedure.


Here are some additional things to try.

  • Adjust how much offset the second drawing is from the first.
  • Reverse your colors so the turtle draws with blue on the left and red on the right. What happens?
  • Create multiple objects in a single project.

After tweeting about this experiment I got a very helpful reply.

Since I am subconsciously biased against left handed turtles, it would seem, I generally make the turtle turn right.

Turning the turtle 7.5 degrees left when you create the design is an optimal offset to work with the 3D anaglyph images you program.

If the turtle turns left, offset the turtle to the left and up.

The results are much more apparent when viewed through the red and cyan glasses.

Many, many thanks, Valeri, for your assistance!

Monday, February 2, 2015

MaKey MaKey Scratch Musical Instrument Construction Suggestions

My friend asked me to write down an outline for a MaKey MaKey Scratch Musical Instrument workshop. 

Start by showing them Scratch and how to select a musical instrument and the note that it plays. Scratch 1.4 has 130+ instruments/sounds and Scratch in the browser has a little more than 20 at this point. Everyone seems to be moving to Scratch 2 so I would use it unless you have Scratch 1.4 installed already (I am using 1.4 with my 2nd graders to build instruments right now).

Use the "If key is pressed," then your instrument, then the note. 

I start them on Scratch now, as opposed to starting by building an instrument, to reinforce that the instrument works by key presses. You have a limited number of keys (I really don't show the younger kids the header on the back of the MaKey for "wasdfg" but older kids should be tolds about it), and each key should make a different note or chord or sound effect.

Based on the instrument they choose in Scratch, either through familiarity or because they happen to like the sound it makes, they can then sketch their instrument on cardboard. 

Cut out the cardboard. I don't have the 3rd graders cut it. I use a boxcutter. Give the student the instrument and have her trace it on another piece of cardboard. Give her a ruler, have her measure inch wide strips. Use the two "faces," strips, hot glue, and masking tape to create a 3D instrument, so it looks like more than a piece of cardboard. 

Use copper tape with conductive adhesive for strings, bows, or pads. Pads are most durable with a wire stripped of insulation sandwiched between two pieces of copper tape: you can clip onto the other end of the copper wire to reduce wear on the copper tape. Strings can be grounded with the bow, which also has copper tape on it. A paper clip makes a great guitar pick clipped to the MaKey ground and used to "pick" the strings.

Use aluminum foil with wire sandwiched, like copper tape pads, for drums and cymbals. The ground for a drum is a drumstick made from a chopstick, with wire, ends stripped of insulation, wound around the chopstick, and secured with copper tape at one end and masking tape at the other. You can add a ball of aluminum foil over the copper tape to turn the drumstick into a mallet.
Hook up the MaKey to the completed instrument. Since the students started with Scratch they get the gratification of immediately being able to test and play their instruments. Troubleshoot strings, pads, drums that don't work by checking connections, checking the circuit they have created, and the Scratch project.

How do you write down a song you invent so other people can play your song? Most kids figure out to write down the arrows/space bar/keys they are "pressing" to write down a song. Rehearse. Perform.

I have been experimenting with air gap piano keys and the xylophone I built with 3D printed bars and bridges I designed and printed. 

Friday, November 14, 2014

Sharpie Drawings to 3D Prints: Considerations

I have been working with a couple eighth grade art classes to produce 3D printed silhouettes. We start with Sharpie drawings that the students made from their shadows.

The drawings are scanned on a networked photocopier and emailed to the teachers. They are converted from jpgs to svg files in Inkscape. Finally, the svg file is imported into Tinkercad, extruded, and turned into an stl for printing.

The workflow was inspired by the MakerHome blog post about turning a Sharpie drawing into a 3D print. However, we started running into issues with some of the drawings we were trying to print. Some models were printing with extra strings, while others were air printing, not extruding filament as the extruder worked its way around the model.

I tried adjusting the Trace Bitmap thresholds thinking that might help, but the models still wouldn't print.

Here is the solution I serendipitously stumbled across.

From the Path menu, select Trace Bitmap. Leave the threshold levels alone. 

Click the Update button then close the Trace Bitmap window.

Select the image by clicking on it. If you drag the image you will notice that there is a tracing over the bitmap image.

 Here is a close-up of the image above.

In the image above you can see the bitmap on the left and the tracing on the right. Take a close look at the bitmap and you will see it is not uniform. I believe that Inkscape was including this data in the svg and Tinkercad was trying to model it, hence the ugly models, stringiness, and general failure of many of the print jobs.

Delete the bitmap portion of the drawing in Inkscape by selecting it and pressing Delete on your keyboard. Only the solid dark tracing should remain.

Save the file as an svg.

Import the svg file into Tinkercad at 10% size.

Clean up any "dots" left from the scan of the original image by using Box Holes to cover them. Size the silhouette to about 270 mm deep, so it will fill most of the build platform on a Replicator 2.

You will notice that the walls of the model are pretty smooth and free of holes.

Group the objects and download an stl of the model.

When you import the stl into MakerWare do not scale it to fit.

Use the Turn and Move tools to get the model completely on the build platform.

Your model should print beautifully with these settings.

Monday, July 28, 2014

MaKey MaKey Scratch Operation 2

Operation Game 2: browser-based, global low-scores, modular bodies, advancement of the platform. 

Contribute your ideas and Scratch projects, please.

Friday, July 25, 2014

Thing-O-Matic 3D Printed Upgrades

My trusty MakerBot Thing-O-Matic finally suffered from the bad design choice to use Molex connectors for the power supply to the Heated Build Platform. I went to print a project for a friend and the bed would not heat up. After some Google Group searching I found JetGuy's explanation of the problem, which turned out to be my problem, too. Putting too much voltage through a Molex connector not designed to handle such voltage will eventually burn out the connector and sometimes the Heated Build Platform, too.

Since a replacement cable is as scarce as hen's teeth, I took JetGuy's advice to salvage the good parts of the cable and replace the faulty parts. I went to a close-by HobbyTown USA. I purchased a Deans connector, which is designed for the voltage the Heated Build Platform requires. By the way, the clerk at Hobbytown was fascinated with what I was doing with the part. Support businesses that supply the arcane parts makers need for projects like this!

I cut the Molex apart, preserving in the Molex the blue ground wire and the three wires that read the temperature of the Heated Build Platform and freeing up the electrical wires.

Soldering the electrical wires in the harness to the Deans connector and a short piece of wire from the Deans connector to the Heated Build Platform was very stressful. I am not great at soldering and worried about doing more damage than repairs. Fortunately, I was able to solder good connections. I used some Sugru to seal up the connection between the wires and the Deans connector. The Deans connector and Sugru are red and part of the harness in the photo below. The Deans connector and the remaining Molex encased parts can be unplugged if the Heated Build Platform needs to be removed.

I used Tinkercad to design a bracket and cover for the remaining Molex and soldered wire connection to the Heated Build Platform.

Afterwards, I thought about printing a few Thing-O-Matic upgrades I had not yet added to my trusty 3D printer. The best thing about the original and subsequent Rep-Rap heritage 3D printers is that they were meant to be upgraded with 3D printed parts from the printers themselves.

First, the super-awesome universal X-Y axis tensioner. 

My friend Jaymes printed a set for me back when I originally received the printer but it was more meaningful for me if I printed them myself. I was scared to drill through my Thing-O-Matic to install the tensioning screw and the X axis required a good breakdown, but the results are awesome. Super easy to adjust X-Y axis, keeping the vertical walls of my 3D prints truly vertical from top to bottom.

Next up, a better X-Axis support from Jetty, one of the authors of Sailfish firmware for Makerbot and other Rep-Rap style 3D printers.

My Thing-O-Matic still skipped steps printing above 50 mm/s, probably because I am lazy and not printing from the SD card. But my default test object, difficult but fast to print, a circa second century BCE Indian lion, printed beautifully.

After these prints I changed my Skeinforge profile back to the Thing-O-Matic defaults with better results. Dan and Jetty really have Sailfish dialed in.

It is exciting to own a 3D printer that can still be hacked. As 3D printing becomes mainstream and the devices become more close boxed, without user-upgradable parts or accessories, the spirit of innovation behind 3D printing will change. I appreciate a 3D printer that requires some tweaking and updating now and then, as it keeps it a challenging maker project for me.

Blokify 3D Printed Puzzles

I ran two 3D design and printing five-day workshops for elementary and middle school students this summer. One design tool we explored was the Blokify app on the iPad. While the app is based around themes, like castles, space ships, and more, think outside the box and use Blokify to build 3D puzzles that you can print.

Start with a collection of LEGO bricks. I sorted through a big bin and pulled out 2x2, 2x3, and 2x4 bricks. My first prototype, shown above, was built with the studs all facing to the side, instead of up, but subsequent student builds used a studs up build.

If you are working as a group, this is a great collaborative exercise because all of the pieces of the puzzle must fit together. Aim to create a puzzle that when assembled creates a big cube or rectangular-shaped, smooth-faced solid.

Next, use blue tape to label each piece with a number. It is also important to label each piece on the same side of each piece, so you can remember how to solve the puzzle.

Divide the pieces of the puzzle among your teammates and open the Blokify app. When you re-create your LEGO prototype pieces in Blokify, each peg in the LEGO piece stands for one block in Blokify. So, a 2x2 LEGO piece translates into a single-layer 2x2 square in Blokify.

Additionally, turn you LEGO prototype pieces so your Blokify models have minimal overhangs. If your pieces have overhangs you will need to print them with a raft and support, which uses additional plastic and takes extra time.

Once your Blokify model is complete, have your teammates check it over next to the LEGO prototype piece. Make sure one peg on the LEGO corresponds to one block in Blokify. Once you are confident you models are ready to print, load them into your slicing software. I scaled these puzzle pieces down 50% to reduce print time. They were still very useably sized pieces at this scale. Print your puzzle.

Keep your LEGO prototype handy: you will need it to troubleshoot any puzzle pieces that end up not fitting. You might even need the labeled LEGO prototype to help you solve your puzzle the first few times you play with it!

Some students colored the white filament with Sharpie pens after printing. The pieces looked good in the distinct colors and a sharp individual might even use the colors to help remember how to solve these delightfully tricky puzzles.