Teaching machines to draw

November 28, 2017

Turns out my steppers and drivers worked just fine, I just didn't have enough voltage. 9V battery does the trick. I also found out my first EasyDriver is in fact perfectly fine, which is good news.

October 3, 2017

Managed to solder pins on my EasyDrivers, they fit nicely into the breadboards now. Hopefully I didn't cook any of the components.

Driver BA Graphic Design level soldering

Driver

October 15, 2017

I found out you can get AutoCAD for free as a student, so I used that to draw up the shaft supports I need to build. What a good piece of software. (I can't believe I ever thought it was a good idea to do this in Illustrator)

Mounting

October 17

Bought some more components to help with the wood:

October 18, 2017

Had a good talk with a technician at Camberwell today concerning cutting my MDF (shouldn't be a problem) and drilling holes for my shaft supports (might be a problem). Turns out the 40cm drill bit I bought yesterday is going to be useless - you can chuck it in a drill press, but because it's so long it will wobble and make it impossible to drill a precise hole. The workshop has some special drill router bits that should work better.

Cutting the 5mm steel rod isn't a problem, he says. I'm starting to think having two shafts at the end might be useful, it allows me to tighten each timing belt seperately (but then again I'm increasing friection and I could probably cut both belts to the same lengths with reasonable precision)

Workshops are closed Wednesday afternoons, and they're doing inductions Thursday - So I'll be cutting my MDF Friday afternoon.

Also I held some screws up agains things and found out that I do have the correct machine screws to go in my linear bearings, and my wood screws will fit in my angle brackets.

Parts

October 20, 2017

Got my MDF cut to size - turns out I couldn't get 15 pieces because you loose 3mm with each cut (the width of the saw blade). I managed to put together a version of the slide mechanism using MDF blocks and mounting brackets.

MDF slide mechanism

Because the rods are so long, there is quite a lot of springy-ness to them - hoping this won't be too much of a problem since there isn't going to be much weight on them.

Problems:

I've ordered some machine-made aluminium shaft supports which should solve both problems at the same time.

Hoping to install the drive shaft (with temporary support) and do a test with the motor by the end of next week.

October 25, 2017

The aluminium shaft supports arrived:

Aluminium shaft supports

With them installed, everything seems much more stable. There's also the added benefit that the slide sits much lower over the table surface, which means the eventual pen won't be too far from the paper. The aluminium supports are also much lighter than the MDF ones. Still, the slide doesn't run perfectly smooth, but I'm hoping some small adjustments and a bit of oil will solve that.

Driveshaft mount

Following my disillusionment with the MDF shaft supports, I got an aluminium part to take the driveshaft. A few layers of paper to bring it to the height of the motor shaft.

I came up with this arrangement to mount the timing belts:

Driveshaft mount

It consists of two corner braces, an M5 screw and some nuts, all of which I had already. However I doubt this will be stable enough to support the belt once it's under tension.

I'm mounting the belt as close to the linear bearing as possible, so there's the least amount of leverage to get it stuck.

October 31, 2017

I came up with this arrangement to attach the sliding platform to the timing belt:

Belt attachment

It's a mending plate mounted to the slide with two M4 screws. The belt is squeezed between it and the platform - originally I was going to use two plates below the platform, but this is simpler and has the added benefit of holding the belt up (which means it needs less tension). This way I don't need to worry about trying to join the two ends of the belt together. I can also adjust the tension when I need to.

I repeated this on both sides, connected by the driveshaft. I then connected the stepper (happy to report the EasyDriver survived my soldering) and it works!

It's moving very slowly at the moment, but I should be able to fix that by going from 1/8 microstepping to 1/4 or 1/2 - effectively reducing the resolution by half and doubling the speed. The EasyDriver has two ports two do this which means I'll be able to adjust speed/resolution based on the drawing I'm trying to do.

Still missing a shaft support and stepper for the Y-axis.

November 2, 2017

I managed to double the speed of the slide using this logic table:

MS1 MS2 Microstep Resolution
Low Low Full Step (2 Phase)
High Low Half Step
Low High Quarter Step
High High Eigth Step

Logic table source

However apparently you get less torque the bigger the steps are? The lowest that would work reliably is quarter steps. This article would suggest it's way more complicated

I've also laid out the x-axis platform, which needs to fit a stepper, the belt attachment, two shaft supports and its own belt support. I'm running the belt in between the two bearings so it shouldn't get stuck. I've realised the pen should probably go between the bearings as well to reduce leverage that could twist the platform.

Ordered some wire to connect the second stepper once it arrives.

November 9, 2017

The stepper arrived, and it fits into the mount perfectly (thanks, National Electrical Manufacturers Association). Here's the full wiring setup with an Arduino, two EasyDrivers, and wires going off to the motors:

Wiring

I wrote the most basic script to run the machine I could think of. Here's some pseudo code:

while i < 1000
    Set stepper one to direction 0 or 1
    Set stepper two to direction 0 or 1
    Do 500 steps on each stepper
    i++

This draws a sort of diagonal grid - the very first work to come out of the drawing machine! Mostly this is a way to have the machine moving continuously so I can tinker with things.

The whole thing is quite wobbly, however some of this might be remedied when I find a beter way than masking tape to attach the pen to the drawing platform. Bringing the pen as close to the slide as possible should help: reduces the amount of leverage.

Tracey makes the point that the wobbly-ness might be part of the work: My individual handwriting is showing through me not being able to drill a hole in th right place. Though I'm hoping to get things at least a little more steady.

On the Y-axis I'm clearly running at the upper limit of torque that the stepper can put out. When there is two much resistance it gets stuck and makes an awful noise. The range of motion is limited by the belt going into a skewed angle, but it's still over a metre.

I have full range of motion on the X-Axis, which is about 90cm. Because the slide is much lighter and shorter (hence less tension on the belt) there aren't any torque issues.

November 10, 2017

Killed my laptop.

I made the mistake of messing with the wiring while the machine was running. I hadn't soldered pins onto the MS1 and MS2 switches on October 3, so I just stuck jumper wires through the holes into the breadboard. One of these came loose, and when I tried to put it back, my laptop went black.

My best guess is that I somehow made a short, which sent 12V from the motor circuit into the Arduino and my laptop's USB port. The laptop went dark immediately and wouldn't turn on anymore, needed professional repair: Wrong assumptions:

  1. The Arduino is idiot-proof. It's clearly not.
  2. 12V isn't enough to do any harm. It clearly is.
  3. Laptops have fuses in the usb ports. Maybe? My machine didn't need a board replacement, which indicates the 12V did get stopped somewhere.

I've bought something called a USB Isolator which is designed to prevent this exact thing from happening. It goes up to 30.000V - should do. Also not going to touch any wires while there's voltage on them again. I also put pins on the MS1 and 2 switches, so no more loose wires.

November 13, 2017

Tutorial w/ Tracey

November 15, 2017

Did some drawings using my freshly fixed laptop (Now being extra careful and using the USB isolator). I figured out a way to reduce the vibration in the machine: Waiting about 100ms between each command. slow things down, but the results are much nicer.

I took some measurements to work out how far the machine moves in a given number of steps. It's about 0.025mm per step (which seems way too precise, but I'm done messing with the microstepping resolution for the moment), or 40 steps in a millimeter. I got slightly different results for each axis (0.023mm/step on the x-axis). I'm assuming this is due to differences in the stepper motors (they come from different manufacturers) and inconsistencies in the overall construction of the machine.

Based on this data I expanded the driver code, so the machine is now aware of where it is at all times. This allows me to move the pen to any point on the table. By setting the two steppers to different speeds I can draw a straight line between arbitrary points. So far I've been using straight Javascript to make drawings - simple loops, random numbers etc. The next step will be to run SVG files through the machine.

I've adapted a script I wrote earlier this year to convert SVG files to machine instructions, but it looks like it needs some more work before it is usable. For shapes with straight lines (<polygon>, <line>), <rectangle> etc.) it just extracts the points. Shapes with Bezier curves in them are converted into straight line segments - if the resolution on this is high enough, it should look like a smooth curve in the drawings.

This is my git repo for all of this.

November 24, 2017

I've had three drawings stolen from the studio, which I guess is some form of compliment. Some ideas by people I talked to about the machine:

In other news, the missing shaft support is finally on the way. It should help make the machine more stable, maybe solve some of the issues with the y-axis getting stuck.

November 25, 2017

Here's some of the images I made on the drawing machine this week. Most of were designed in Illustrator, with any randomness coming only through the machine itself (by it getting stuck, someone bumbping into it, teh pen running out of paper etc.)

Machine drawing 1 Machine drawing 2 Machine drawing 3 Machine drawing 4 Machine drawing 5 Machine drawing 6 Machine drawing 7 Machine drawing 8

December 20, 2017

TODO instagram images

January 19, 2018

Emma suggests I look at Wind Drawings by Cameron Robbins. As he describes it,

The Wind Drawing Machines are installed in different locations to receive weather energy and translate it into an abstract format of ink drawings on paper. [...] The machines respond to wind speed and wind direction, and allow rain and sun to also play on the drawings. The principle employed here is that the wind direction orients a swiveling drawing board connected to a wind vane, while the wind speed drives a pen on a wire arm around in a cyclical motion.

I like the notion that these are abstract drawings, but also in some sense a very accurate record of a specific place at a certain time. Similar maybe to Sam Winston's work. The first thing I thought of was doing something with Met Office Data, but that seems contrived.

January 24, 2018

TODO Random pixel shading

January 25, 2018

TODO Random pixel shading layering

January 26, 2018

I managed to source some CMYK ballpoints. Unfortunately, they only come in a pack of 20 together with 4 other colours that are less useful. Here's the first four-colour drawing I did, using the randomized pixel method:

Here's one using regular pixels, using [this Warhol print] (Primarily because it has bright colours, secondly because it continues the tradition of using communist leaders as test subjects):

I prefer the second one a lot. Each pixel is inked much more evenly, leading to cleaner colours. The square pixels also make it easier to align each layer, although getting it perfect seems pretty difficult. I did, however, run this drawing at quarter step to save time, so there should be room for improvement if I'm willing to wait twice as long. Having developed this method of layering colours on top of each other, I'm now effectively screenprinting (as opposed to doing line drawings).

Some more insights from this test:

January 28, 2018: Another Drawing Machine

Over the weeked I made the decision to build another drawing machine. I've been struggling for ages to find some sort of "interactive mode" for the original drawing machine. I tried building some sort of shape recognition software that would allow you to draw shapes and have the machine interpret them. I also talked about building a language-processing system that would allow people to write Sol Lewitt-style instructions and have the machine interpret them. None of that seemed too promising.

So the solution is to build a second drawing machine, one that is designed to be an interactive installation. It's going to look something like this:

TODO add sketch

The plan is to have it done by the Friday.

I've already written some of the control code. I'm using socket.io to display the function graphs in real time.

I'll need the following parts:

Things I'm not sure about yet:

Using Wikipedia, I managed to cobble together the following functions to generate sine, triangle, sawtooth and square waves that will eventually control the motors. $$a$$ is the amplitude, $$p$$ is the period, $$o$$ moves the curve up and down and $$\varphi$$ moves the curve from left to right (I'm using this to animate it on screen).

$$\DeclareMathOperator{\sgn}{sgn}$$ $$\DeclareMathOperator{\atan}{atan}$$ $$\DeclareMathOperator{\asin}{asin}$$ $$\DeclareMathOperator{\cotan}{cotan}$$

Sine: $$f(x) = a\sin(2\pi px + \varphi) + o$$

Square: $$f(x) = a\sgn\big[\sin(2\pi px + \varphi)\big] + o$$

Triangle: $$f(x) = a\arcsin\big[\sin(\frac{2\pi}{p}x + \varphi)\big] + o$$

Sawtooth: $$f(x) = \frac{-2a}{\pi}\arctan\big[\cot(\frac{x\pi+\varphi}{2p})\big] + o$$

January 29, 2018

I've started construction on the second drawing machine. I'm using a wooden clipboard from the college art shop for the control panel - seems appropriately haphazard. Apparently I'm the first person to ever buy one of these in the art shop - it took them about 5 minutes to find the price in the register.

I drilled holes to mount six potentiometers and wired them to the Arduino's analogue inputs:

Then I plugged their readings into the code for the sine functions, and to my amazement it worked on the first try. You can twist the knobs and watch the curves on the screen change in real time. Insert mad scientist laughter here. There seems to be some interference between some of the potentiometers - manipulating one changes the readings of other ones in the series. Apparently this is because some of them have too much resistance. I'll replace and see if that's fixes it.

Peer assesment

TODO make the 100 drawings book publication

January 31, 2018

The flip switches for drawing machine two arrived. I'm planning to use these to

  1. Switch between different functions for each stepper
  2. Toggle some sort of randomisation for each funtion parameter on each stepper

I'm focussing on one for the moment. Since there are four functions to choose from, I can combine two switches to generate four possible positions by thinking of each switch as a digit in a binary number:

Switch A Switch B Binary Result
Open Open 00 Sine
Open Closed 01 Triangle
Closed Open 10 Square
Closed Closed 11 Sawtooth

Febuary 1, 2018

Got the second drawing machine working today:

I found out that to draw a circle (and similar shapes), the two functions need to be on different phases - otherwise you just get straight lines. At the moment I'm doing this by adding a hard coded number to $$\varphi$$, but that's not the best solution. I can't just add another knob because there are no analogue inputs left on the Arduino. However, I could add another switch to add a secondary function to the "offset" knobs.

This will make the machine needlessly complicated and more annoying to use. So I'm definitely doing it. Problems:

Febuary 9, 2018

A new plan for action

Following the mid-term review with Tracey and conversations with various people.

The drawing machine project needs a point. I think the point is the following:

Book Structure

The machine learning publication could be in a similar format.