Sunday, August 30, 2015

"Pop Goes the Weasel" Marble Machine

The next Marble Machine I helped build was also for a Westport Library staff development workshop. The two participants built a wonderful series of ramps, then I wired the ramps and programmed them to play part of "Pop Goes the Weasel."

This Marble Machine started with a paper towel tube that emptied onto a short foam ramp. They used the foam to slow the marble a bit.

The marble dropped from the foam ramp into a funnel made from a two liter plastic bottle. Dropped at the correct angle, the marble would spin around in the funnel before dropping onto the wood ramp below it. I added additional copper tape as well as two cardboard bumpers. The wobble of the marble as it traveled down the ramp meant that it did not consistently contact both strips of copper tape. These bumpers tried to center the marble over both strips to close the circuit on the MaKey MaKey.

After traveling through a short cardboard tube, the marble dropped into another funnel with a 90° PVC elbow joint taped to it. The marble dropped onto another wood ramp with similar cardboard bumpers. Cleverly, the marble travels into a bamboo tube, around a curved piece of foam, and back into another bamboo tube. There is a cardboard finger that to slow the marble as it rolled down the bumpered ramp.

After emerging from the second bamboo tube, the marble struck a small wood bumper with cardboard padding to slow it down, then dropped onto a short wood ramp before dropping into a cardboard tube. This ramp used short pieces of rubber tubing to slow down the marble.

The final ramp was short and wired at the very end with copper tape. The marble dropped from this ramp into an egg carton on the floor.

The final ramp used the MaKey MaKey and the copper tape to make Scratch play a note, then send a broadcast. Once this broadcast was received, Scratch played the last note and turned on the LEGO WeDo motor for .25 seconds. This made the weasel "pop." 

I learned a couple lessons while debugging this Musical Marble machine. First, a little ramp goes a long way. While the beginning of the Marble Machine should have a slight tilt to get the marble going, let momentum carry the marble through the machine. The rest of the ramps can be mostly flat, I believe. This would eliminate the need to build bumpers to slow the marble. 

Fixing one thing on a Marble Machine breaks something else. No way to avoid it, you are going to have to iterate when you attempt to build a Musical Marble Machine.

Combining technologies, in this case Scratch, MaKey MaKey, and LEGO WeDo, in your bricolage increases the fun. The weasel popping at the end is hilarious and a great conclusion that reinforces the theme of this marble machine.

In addition to aluminum foil, the marble has quarter inch copper tape wound around it in one layer. Still, marble wobble down the ramps remains problematic when trying register key presses with the MaKey MaKey. Slower ramps would help with this problem.

A Marble Machine is not a consistent machine. It took twenty three takes to make the video of it working properly. Again, iteration is key, patience is a virtue.

Without further ado, ladies and gentlemen, boils and germs, I present "Pop Goes the Weasel" Musical Marble Machine!

I have a public workshop scheduled around the Marble Machine, and I have at least one more devious prompt up my sleeve. In the meantime, build your own and start constructing your knowledge of physics, engineering, music, mechanics, programming, circuitry, and more!

Friday, August 21, 2015

"Musical" Marble Machine

There is something about the monolith shape of the Marble Machine that taps into our monkey brains and causes us to tinker with it until a goal is met: getting the marble from the top to the bottom through a series of ramps, tubes, funnels, and whatever other materials are on hand. I enjoy using the marble machines in workshops lately because it is hands on, engaging, hard fun.

Additionally, the Marble Machine is a great place to explore the concept of bricolage, or a DIY sensibility of making do with the materials on hand. When I used the Marble Machine in my latest workshop I provided a number of materials that one might expect with a Marble Machine, like ramps and tubes. I also broke free from the siloed nature LEGO WeDo sets and I added the MaKey MaKey. Instead of treating the LEGO as a distinct play set, what if some of its components were cleverly used in the Marble Machine's construction? What if the goal of this Marble Machine challenge were impossible to accomplish without a MaKey MaKey?

Only two people enrolled in this particular workshop. I provided minimal direct instruction beyond explaining how the MaKey MaKey and LEGO WeDo worked with Scratch. Mostly, I stood back and observed. The goal was a little tricky: make the Marble Machine play music as the marble descends. The participants were a little overwhelmed, so I suggested the opening of "Thus Spake Zarathustra," since it contained four notes.

We started by brainstorming a course of action.

  1. Build the Marble Machine so the marble travels through the course.
  2. Wire the ramps.
  3. "Musicify" the ramps.
The participants worked for about forty five minutes on their course.

By the time they were called back to their regular jobs, these two had built a Marble Machine that usually got the marble from top to bottom and sometimes landed the marble cleverly in an egg carton at the bottom. Instead of leaving the goal of making it play music unfinished, one of the participants sent her son, who was in the library, to assist me in finishing the Marble Machine.

Several times during the course of our work I was ready to give up. Most of the frustration grew from trying to get the wired ramps to work properly with the MaKey MaKey. We were using a marble covered in aluminum foil. The ramps had parallel strips of conductive copper tape adhered to them and hooked to the Earth and key ports on the MaKey MaKey. However, the marble tended to wobble down the ramps, sometimes not making contact between the two strips long enough for the MaKey MaKey to register a key press. However, the young man with whom I was working was so engaged in making the marble consistently land in the egg carton that I was compelled to complete my part of the task.

One way I worked around one ramp not registering consistently with the MaKey MaKey was by using the LEGO WeDo distance sensor on the second ramp.

A Scratch procedure that waited for the marble to get below a distance of "20" as read by the distance sensor then played the note for that ramp. 

After working out the bugs that made one ramp stop working as soon as we got the ramp before it working, we had a successful run that we captured on video!

The Marble Machine is a wonderful constructionist project that allows people to construct knowledge about engineering through iterative tinkering. By adding additional tools, such as LEGO or the MaKey MaKey, one expands the potential for bricolage with the Marble Machine. Such an activity can promote experimentation with new technologies that otherwise might seem intimidating to begin tinkering with. The Marble Machine scales from children to adults and can be used by people of all ages working side by side. Build yourself one today and start having hard fun.

Thursday, August 13, 2015

LightLogo Housing

The LightLogo Arduino and Sparkfun NeoPixel Rings that my friends and I have been constructing have been pretty basic.

The 22 gauge hookup wire is enough to position and hold the light ring upright to display your awesome procedures. However, it seemed a little fragile with the bottom of the Arduino exposed and the wire providing structural support. I wanted to build a housing for my Arduino and NeoPixel ring.

I selected a small cigar box as my housing. My friend gave me a couple bags of these, and I am down to the last of them.

Next, I 3D printed an Arduino base that I found and liked. 

After drilling some holes in the bottom of the box, I used four plastic washers and bolts that came with my Thing-O-Matic to attach the base to the box.

The 3D printed holder for the NeoPixel ring was a remix of the Adafruit design. I added the same screw hole as the Arduino base used to the ring. I used a larger washer and the same bolts as I used for the Arduino to attach it to the inside lid of the cigar box.

I used Tinkercad to design wire clips that I 3D printed. I drilled small holes in the cigar box and inserted the clips. They hold the wires in place nicely.

As the last step, I remixed the Adafruit diffuser that covers the NeoPixel holder. It does a marvelous job of spreading the light a little and making it softer in appearance.

I hope you are able to use some of the 3D printed parts in the construction of your own LightLogo Arduino and NeoPixel ring combination.

Saturday, August 8, 2015

TurtleArt on Vacation

I was fortunate enough to take a vacation to Washington State, where I visited my family's house in the San Juan Islands. The woman who lived there before us designed and made these beautiful stained glass windows on the interior front door and windows. 

I noticed for the first time that in addition to clouds, there are also mountains, like on an adjoining island as well as the Olympics mountain range.

One of the many perks of being at this home is there is no Internet access or mobile phone coverage. I brought my laptop to play with LightLogo and TurtleArt because they both run offline. I thought the stained glass window would make a great project to model in TurtleArt.

I started with clouds, since they would be behind and in front of the sun. Like other procedures, this one has a bit of randomness built into the design.

The sun was positioned in the upper left corner of the screen. 

Next, the rays. I wanted to capture a bit of the light through glass effect, so I used the shade block to adjust the shade as the rays are drawn. Medium and small rays look to the X and Y coordinates of the large ray to try to get them somewhat adjacent to one another, like the glass version.

The mountains' design vexed me for a day until I thought about squares rotated 45 degrees. VoilĂ !

The waves were a copy of the mountains design with smaller boxes.

The master procedure, glass, combines the subprocedures and moves the turtle on the screen. I split the master procedure blocks in two after the green setxy block in the stack. The procedure continues and is typically connected at the repeat block.

Here is the "glass" procedure, which draws all the parts as well as three seagulls.

I appreciate that each time it runs the rays, clouds, mountains, and sea look slightly different.

I also had to remove a number of wasps nests around the exterior of the house. The vinyl flooring in the bathroom also had a hexagon pattern.

This was a fun model to create. While experimenting, I made the pattern overlap, which my mother said looked like a tumbling block quilt pattern. I will have to revisit that design later!

My ultimate TurtleArt vacation project will be a set of procedures that draws an image of my favorite place in the world. Here is a glimpse.

Next time you are on vacation, try using TurtleArt to make some memories of your own!

Friday, August 7, 2015

LightLogo: A Logo Programming Microworld on an Arduino

Brian Silverman is releasing LightLogo. Loaded onto an Arduino, it is a microworld, as Brian explained to me at CMK15, for us to "get back to text programming." Since Brian explained the intent better than I can, let me share his summary.
LightLogo can make interesting patterns emerge with 10 lines of code. 
Sequence, repetition, variables, naming: 80% of what coding is about; add if and you are almost there.
[People teaching coding are] confusing between [the] act of coding and thinking algorithmically.
[Thinking algorithmically is] learning how to express a sequence of things that express itself over time.
LightLogo can be downloaded from the link above. Make sure your computer successfully talks to the Arduino by installing the appropriate FTDI drivers. Brian wrote documentation on how to flash the Arduino to run LightLogo, so use that as your guide to getting that up and running.

Next, build your light ring. I used three short pieces of 22 gauge solid core wire from which I stripped about a half inch of insulation from each end.

I bent the wire into small loops in the PWR, GND, and IN connectors on a 24 LED NeoPixel ring. Make sure the wire rings are snuggly attached to the NeoPixel ring. Optionally, you can solder the connections if you like.

The PWR wire connects to the PWR on the Arduino, the GND wire to GND, and the IN to port 2 on the digital inputs on the Arduino.

The wire can be bent to hold the light ring in a visible manner.

Connected to the computer, you can interact directly with the light ring in the LightLogo program. Typing the following commands, pressing "Enter" after each line
fd 6
setc blue
fd 6  
will illuminate the first 6 LEDs in red, then the next 6 in blue. The Turtle is a pixel, or many pixels at once, in this microworld. 

You write your LightLogo procedures in a word processor and save them as text files with a .txt extension. Remember Brian's advice to write small procedures that are perhaps 10 lines long at the most when building your procedures. Call the subprocedures from a master procedure, typically called startup in the samples included with LightLogo.

Let me walk you through a project I programmed while on vacation and chomping at the bit for the software to be released to a larger audience. I will walk you through the small subprocedures then show you how I called them all from the master startup procedure.

Here, I model a rainstorm in LightLogo. My rain might look different than your concept of rain, but it is pretty cool how this came together.

LightLogo purposefully has a very limited vocabulary: you are exploring how patterns emerge in lights controlled by short procedures, after all. Most commands are familiar to anyone who uses Logo, but there are a couple of exceptions I use in these procedures.
pe -- pen erase. The turtle turns lights off as it moves. 
clean -- turns off all the lights, sets the position to 0, sets the heading to 1 (clockwise), sets the color to 0 and puts the pen down. 
stamp -- sets the color of the light under the turtle to the current pen color. 
loop -- repeats a command indefinitely.
setc -- sets the pen color. The colors are numbered between 0 and 100.
setpos -- sets the turtle's position. 0 is the top. 
reset -- same as 'clean' and also shows the turtle and resets the brightness to the default value.  
setbrightness -- sets the brightness of the current pen color. The default is 20. 99 is the maximum.
 First, a procedure to drip:
to drip 
Next, a procedure to bigdrop
to bigdrop 
all blue
wait 50
The last subprocedure is to smalldrop
to smalldrop
setc blue 
setpos random 0 24 

The master procedure brings all the subprocedures together. 
To startup
[setc white 
setpos 0
repeat 24 [drip wait 25] 
setpos 0
setbrightness 20
setbrightness 20
repeat random 25 125
wait 100]] 
The Vine at the top of the page shows the procedure in action! Here is a longer version of just the light ring running the procedure on a loop.

I highly recommend LightLogo as a great introductory hardware project. You get to load alternative software onto an Arduino. You get to build your own light ring. There is nothing stopping you from building a container to hold the Arduino and the light ring, to take the project further. 

I also heartily recommend LightLogo as a great software project. The limited vocabulary is clear and concise. The encouragement to explore the power of text programming, nearly lost outside of more muddy or difficult to master text programming languages, is made possible by this microworld. People can directly interact with the LEDs and patterns created through their experimentation, then progress to writing subprocedures and procedures in a text document that can be downloaded to the Arduino. It is an amazing microworld. Recall Dr. Papert's description of a microworld as a place where a child might learn "undisturbed by extraneous questions."

Take the time to explore this wonderful hardware and software combination when you return to your students this fall: both you and they will enjoy creating amazing patterns and designs from light!