Thursday, May 19, 2016

Physics and Art: Pollock

This winter, one of my students came to me with an idea to create an 'art robot' - a robot that could create a piece of art. After some research, she found a Discover article summarizing Richard Taylor's work on fractal analysis of Jackson Pollock's drip paintings. Note that there is considerable disagreement over whether this is valid, as the range of available scales (only about three orders of magnitude) is generally considered too small to adequately authenticate fractal structure.

This hiccough notwithstanding, we set about to create a chaotic pendulum that could create paintings with similar fractal dimensions to Pollock's. The general idea of structural complexity is shown in a graphic from the first reference:

The fractal dimension measured by Taylor of Pollock's works is in the middle range: 1.5-1.6. A non-chaotic conical pendulum's traces are not complex enough to reproduce this (left image below), but a chaotic pendulum can (middle and right below, from second reference above):
In order to make the traces chaotic, we attached a pulley controlled by a stepper motor to the pivot of the pendulum and had an Arduino quickly oscillate the pivot infrequently (slightly lower period than the pendulum's natural period). A Glowscript simulation of two such pendula starting with nearly identical initial conditions show quick divergence, the result of the nonlinear chaotic system.

In practice, we gave the system some random horizontal driving as well, as it lost amplitude. The result is a set of five attractive canvases. The set will adorn the hall near my room, along with a poster explaining the process, showing the derivation, and discussing the results (I co-opted some MATLAB code to determine the fractal dimension of each foreground color-layer of each painting and each painting's average fractal dimension).











Wednesday, May 18, 2016

EE Project: Arduino Project Videos and Specifications Sheets

Two of the deliverables that students need to submit during the course of my Electrical Engineering robotics project are Arduino project videos and what I'm calling a "specifications sheet."

The Arduino project video involves them finding a pre-existing project - from the Make Arduino text that they have or the Sparkfun Inventor's Kit book or the Parallax Robot kit's materials or anywhere else - for the Arduino that they think might have some relevance for their robot build, to build it, then to modify it in some way to change its behavior, then to present a short Youtube video explaining the process and its relevance, and providing the commented code in the video description.

These have gone really well; the students haven't had training in coding for the Arduino, but they're fine with the electrical assembly issues, so it's a platform for them to modify code and hardware, which leads to them unpacking some of the working of the scripts. Lots of the projects have combined two functions, which is terrific. For example, several groups took sensor input and used it to output status messages to an LCD.

Here's one example using the LCD and a pushbutton:


...and here's one using the LCD and a photocell, complete with director extras.


The specifications sheet is like a datasheet for the robot. One of my goals is to get students to the point where they can read and use a datasheet, because it's ridiculous to think that they could ever learn all of the devices that they might encounter in their projects after this course. Instead, I want to train them to use the resources at their disposal - Stack Exchange, online tutorials, datasheets, etc. - and learn how to learn to use a new device, software package, or programming language.

These came in with varying levels of success, and I think that I can be more specific with these next year (though they can revise them this year to address any lack of specificity). The one below is a pretty good example, though I wanted some more detail on the values fed to the servos - what do those numbers mean? What's PWM, and how does it work? It's a great start, though.

Input:
Pin A0 - photocell
Gives a number value and identified as “pcellreading”
When the light value reads 250 or lower, the car will stop
Pin A1 - ultrasonic sensor
Need to wire sensor and input code
Will give number value and identified as “ultrareading”
Pin 7 - right whisker
Equal 0 when the right  whisker is touching something
identified as “wRight”
Pin 5 - left whisker
Equal 0 when the left  whisker is touching something
identified as “wLeft”
Outputs:
Pin 13 -left servo wheel (input of 200 means the amount of continuous pulses are being generated) (can be anything from 1-250) (corresponds to amount of time spent rotating the wheel)
Pin 12 - right servo wheel (input of 200 means the amount of continuous pulses are being generated) (can be anything from 1-250) (corresponds to amount of time spent rotating the wheel)
Backs up and turns left 120 degrees
If pcellreading>650 & wLeft=0 & wRight=0
Or if ultrareading>6
Backs up and turn right 60 degrees
If pcellreading>650 & wLeft=0
Back up and turns left 60 degrees
If pcellreading>650 & wRight=0
Moves forward
If pcellreading>650
Stop moving and it has reached the goal
If pcellreading<650 br="">Expected exceptions:
Car goes up ramp at angle so that one wheel goes over the edge before the ultrasonic sensor detects the cliff edge
It gets stuck in a corner area so that it keeps hitting the 2 wall in front of it without turning around