Assembling a machine for string art

Creative people are so creative that they can draw anything on anything. For example, threads on nails. This type of art is called string art (Let’s be captain of the obvious and say that no, thongs have nothing to do with it). In fact, the final result looks beautiful and unusual. True, the work is very delicate and painstaking, and not everyone can handle it. What if you try to automate this art? It turned out that the task, although difficult, was real.

Before creating a string art machine, I decided to start with software that could turn the original image into a rope and nails version. I had to make sure that I could actually write it.

The first iteration of the program worked on a simplified algorithm:

  • Create a fixed grid of nails.

  • Start with nail 0 (top left corner).

  • For each nail in the grid, calculate the total difference between the source image and the target image if that nail was connected by a rope to the current nail.

  • Of all the nails, choose as the next one the one that has the least difference from the target image.

The algorithm worked well. True, performance was terrible initially, but getting the program to run on all available cores was very easy. I converted the images to black and white and processed the data as byte arrays, which allowed me to more efficiently calculate the differences between the images.

Once the concept for the program seemed to work, I moved on to the next baffling problem: how to physically align and distribute the nails.

Before spending money on building a machine, I wanted to have a reliable mechanism that would allow me to take an unsorted pile of loose nails and place them vertically, with the heads facing up (you know, driving nails with the heads facing down is not always convenient).

The most obvious idea that came to mind: use identical, randomly selected nails that are immediately ready for insertion into the tool. However, after much searching, I was unable to find nails small enough that would not spoil the “resolution” of the final string art design.

Brad Nails (pneumatic stapler nails) were thin enough, but they broke like matches, making them unsuitable for my purposes. In addition, an unpleasant adhesive layer remained at the site of the break.

The nails I decided to use were panel pins with screw fastening M1.6x40mm. They were long enough to wrap threads around, but thin enough to remain invisible in the final image.

I was trying to figure out how the machine could sift out the nails and it turned out that it was actually quite difficult. The nails will behave differently: when there are few of them, their movement will resemble liquid, and when there are many, they intertwine, forming a lump that does not come apart.

I also thought about using an electromagnet to grab the nails into the grooves, but for some reason the nails didn’t want to fit into the grooves, and they spread out wherever they wanted.

After brainstorming and prototyping, I came up with a working design for a nail sorting mechanism that included a slot and a solenoid with magnets. Here’s how I scientifically model my idea of ​​how a machine works:

Before I came up with this design, there were several modifications – some used an electromagnet instead of permanent magnets, spring force, etc.

In the video above I used a curved slot to feed the nails. My theory was that I could have an infinitely high line of nails leading to the “gate”. However, this did not work because the nails were getting stuck due to the extra weight of the nails in the queue. So I straightened them out but left them slightly tilted.

Instead of trying to sort an unlimited number of nails, I have found that if you maintain a small flow of nails, you can sift them directly into the mouth of the nail gate. This creates a new problem: how to feed small bundles of nails into the screen section. In the video I do this manually, but later you still have to figure it out.

Once I was convinced that my ideas worked, I could shell out for the machine itself. Technically, I haven’t figured out all the problems, but buying things is much more fun than messing around with theory.

I didn’t want to be limited by the actual dimensions of the machine, so I bought four 1 meter long and 16 mm diameter guides with bearings as the basis of the CNC gantry machine. These 4 guides were also the most expensive part of the machine, costing around £120.

Once the guides and bearings arrived, I was able to easily come up with several designs to connect them together.

You only need 3 parts to assemble a functional axle, and the flat top bearings make it even easier. I designed several motor and timing belt mounts. I placed a flat plate with a few mounting holes on the Y axis carriage since I haven’t yet figured out how the Z axis will mount to it. This means I can continually make changes to the design of the nail assembly without having to change the Y axis carriage.

After assembling the Y axis, I wondered how the machine would insert the nails into the material. How the Z axis would be designed depended on the material and method of nail insertion. If you use wood, you need some kind of hammer to knock them in. This seemed too extreme to me and not precise enough, so I settled on a stepper driven axis that could insert/press nails into soft material.

I designed a basic axis with another common attachment point, which made it possible to prototype various nail tools. I started with a fixed nail slot that would magnetically hold the nail in place before it was inserted into the material. In the material, friction, in turn, holds the nail in place, overcoming the attraction of the magnet. It worked in my initial test.

At this point the Y axis was starting to look normal and I couldn’t wait to turn on the motors for testing. I assembled the car on two pieces of 1200mm x 600mm 18mm thick MDF, supported by some spare wooden boards I had lying around.

On thingiverse I found cable chain model, which could easily be modified to fit the cables needed for this machine. It turned out to be more economical than buying on eBay. I also printed some mounts for the motors and belt pulleys.

After completing the basic assembly, I started connecting the electronics. To do this, it was necessary to remove my structure from the floor. It was only after I had everything assembled that I realized how much space it actually took up.

For electronics I used a board RAMPS 1.4and for software and firmware – a modified version Repetier. The only modifications needed were to support any additional sensors I might need. I also had to add a solenoid protection code after one of my solenoids left on melted after the control software crashed.

After the initial setup, the machine started working!

I temporarily glued my prototype nail sorter to a wooden base and programmed the software to perform a very simple sequence of actions: pick up a nail and place it in the polystyrene at 1cm intervals.

As you can see at the end of the video, the nails appear to be placed alarmingly imprecisely.

It was very disturbing to see and I couldn’t figure out what the hell was going on until I saw him carefully hammering the nails. It turned out that the problem is in the structure of polystyrene: it consists of small balls, and the nail, trying to go around them, deviates from the straight direction. The difference in density where the balls touched deflected the nails when they were pushed down.

Look at this, if I may say so, diagram:

So I knew I wouldn’t use polystyrene as a base for attaching nails. I went to Wickes and bought a 16mm Celotex board which didn’t have this problem as it is a much thinner foam.

I was also concerned about the time it would take for the machine to go back and pick up the next nail, and how long it would take to make each individual string art design if the work continued at the same pace.

I thought the ideal place to store the nails would be the Y carriage itself. There was plenty of space on the platform and the handrails were made from 16mm thick steel so they could easily support the weight of the nails.

The only problem with moving the forklift was that it had to be behind the nail pick-up head. This meant that the head had to be made movable somehow so that it could fit into both positions. So I installed a homemade servo.

Unfortunately, this greatly reduced the force with which I could drive the nail because the actual servo shaft is very small in diameter (about 5mm) and because of the flexibility of ABS. This meant that I needed to remove the silver foil from the Celotex before driving the nails as it provided too much resistance.

With this new configuration I was able to do some extensive testing and found that my nail gates were very unreliable. About 20% of the time they missed multiple nails, which then cut into the material at random angles.

I spent a lot of time selecting gates and nail grips before I had a solid design. There was only one remaining problem that I found: a nail with a larger head than usual would sometimes get stuck where the plastic met the nail presence check button. To fix this, I replaced the button with a linear Hall effect sensor, which measures the change in magnetic field between when the nail is present and when it is not.

There are now no sharp edges for the nails to catch on, meaning the machine doesn’t have to try to insert a nail to determine whether the gate has one or not. This also meant that it could be easily detected if a nail was inserted incorrectly.

I made a second solenoid gate that acted as a gateway, with the gap between the two gates adjusted to only allow one nail to be inserted at a time.

This option turned out to be more successful than the previous one, but it still failed in about 1% of cases. It seems like a small thing, but it meant that in a string art painting of 1000 nails you would get 10 out of place. But this result was already enough to try to create a large enough grid of nails for testing winding.

The problem with winding testing is that once I start the machine it uses a lot of nails which can cause the Celotex board to become unusable. So I bought plaster of paris that I will use to secure the nails after they are initially installed. I assumed that a couple of millimeters of plaster would be enough for my tests. So I prepared a quick sample to test.

The plaster did not fit perfectly. It made the nails rust, and it was easy to spill it on the heads of the nails, but it kept them in place. I started placing a 30 by 30 grid on a 50 by 50 cm piece of Celotex.

After pouring the plaster, I had a fixed test mesh that I could use to develop and test winding algorithms.

Now I had everything I needed to create string art, except the software. So I started working on it.

The first step in the program was to choose the order of placement of the threads, according to which the nails would closely resemble the image without intersecting with other nails.

The program then needs to figure out how to lay the rope while avoiding other nails. To do this, I modeled a safety radius around the nails, and any intersection of this radius will force movement along the safety radius until they no longer intersect. In case of multiple intersections, this process will be repeated until the target nail is reached.

In the video, you can see how the first step visualizes potential nail candidates for each solution, and for each, the resulting image is assessed for similarity to the target photo. The best option is selected. The simulated result is displayed on the left.

It’s essentially the same algorithm as the original proof-of-concept program, but instead of simulating point by point, it accurately represents the way the rope wraps around a nail.

The second step is to create a safe path for the machine head to move. The output data is color coded:

  • Green is the path of the initial winding of the rope on the starting nail or the completion of winding on the end nail of the segment.

  • In red are areas where the path between two nails crosses the safe radius of another nail and the tool head has to move around.

  • Blue is where the program has decided that it will have to make a full 360 degree turn because the angle at which the rope wraps around the nail is such that it won’t catch the nail if it just walks into its safe radius.

In the last few seconds of the video you can see the resulting path that the tool head will take, shown in grey.

This video does not show the calculation of rope Z offset, which is performed by detecting collisions between previously laid ropes and the current segment of the tool path. To do this, it is necessary to use both modeling the rest positions of the threads and the coordinates of the upcoming tool path. The software uses a tree of squares to calculate the intersections and makes an allowance of 0.025 mm for each previously placed thread. This can be seen in one of the later drawings.

I installed a cone with a Teflon tube on the machine, attached a needle and set it up for threading. The thread passed through the tube and was pulled through the needle. In this design, the needle was removable, allowing the machine to be easily switched from nailing mode to coiling mode.

The first attempts were unsuccessful. It turned out that in reality the placement of the nails is not as precise as the needle settings. Luckily, the nails were secured securely enough that I didn’t have to go through the labor-intensive process of restoring the mesh every time the needle got stuck in the already wound threads.

I realized that no matter how cool it looked, the needle idea wasn’t going to work. I needed a thicker, rounder and more forgiving head that would gently pass over the already wound threads.

So I took a piece of smooth steel rod with a diameter of 8 mm and drilled a vertical hole with a diameter of 3 mm in it. I then inserted the same bit into the chuck and began filing and sanding the end, giving the tip a nice rounded shape. I printed out a new mount for this attachment and installed it in the machine. Now everything worked more smoothly, which meant I could increase the speed of XY movement.

Finally I was able to get a single complete thread without a huge amount of problems. Below is the first completed string art result.

As you can see on the right eye there were a few missed stitches, but for a first attempt it turned out well. The missing stitches were caused by a bug in the software that, under certain circumstances, could cause the machine to pull the nail straight through the nail. This rarely happened, so it was difficult to determine the cause.

When I created the first string art, I had to do it again just to make sure it wasn’t an accident. So I cut all the thread off the reusable test net and pasted a photo of my niece into the program.

Again, it worked out pretty well and there were no tricky skipped stitches this time.

Now that I had the software working, I needed to optimize the machine to make it more stable.

I started by repeating the nailing process. Increased pick and place speed which led to issues that needed to be addressed. The problem was that everything was happening so fast that I couldn’t notice what was happening. This is where my phone’s high-speed camera proved incredibly useful.

In this video you can see just one of the problems I had to solve – the second gate pins were not retracted far enough, causing the nail to get stuck when pulling it out of the hole. I also had similar problems between the first and second gate where a nail would get caught on the bottom inside gate pin causing it to pull and stand up perpendicular to the flow of the nails.

I decided that I would have to stop using gate pins. The reason I originally used them was because the tolerances were so tight that I couldn’t 3D print the gates small enough. The “airlock” had to be exactly 1.6mm thick so that only one nail could be driven in at a time. In addition to this, it also needed to be able to separate a row of nails, and sharp tips were ideal here.

The new gateway used a 1mm thick aluminum gate with sharp edges and two solenoids on one side. This completely eliminated the problems with the nails partially catching on the gate pins, but other difficulties arose. If the nail had been lying diagonally over the entrance to the gate, it would have been caught and pressed against the sides. The only remedy I could think of was to keep trying to close the gate and check whether it was successful or not. To do this, you need to install another Hall sensor.

This design began to work even better (the failure rate was only about 0.3%). In the video below you can see 2 nails being placed in the holder, but overall the speed and error rate turned out to be quite good.

In this video I drive nails in the wrong position, which presents a new challenge in making sure all the nails are installed correctly. Considering the failure rate is around 0.3%, another step was needed that would allow me to manually correct any nails that were inserted incorrectly. There was no such problem with a regular mesh, since it was immediately clear where the nail got tangled.

The test tool is a simple probe with a magnet inside and a linear Hall effect sensor to determine the distance.

At this point I also ditched the plaster and kept the original silver foil on the Celotex, just covered it with white tacky vinyl. Here’s the process for testing nails on a loose grid.

Lastly, I added some tools to automatically load nails into the nailer from a larger capacity bucket that holds about 700 nails. However, the small nail sieve will only hold about 10-15 nails at a time. I also attached a small rotating spring that helps guide the nails through the sieve, reducing the chance of getting stuck.

Here are some more finished drawings I did before putting the car away in the closet.

Thank you for your attention!


What else is interesting on the Cloud4Y blog

→ Simpsons TV: assembly guide

→ NAS for a cap of crackers

→ Hack Hyundai Tucson, part 1, part 2

→ Hack a smart toothbrush

→ 50 most interesting keyboards from a private collection

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *