Mathematics has always been a riveting subject both conceptually and practically, since the longest time. On my way to practicing design, I discovered an outlet into art based off of mathematics. We are going to make a ‘Harmonograph’ based on physical computing using an Arduino.
A “harmonograph” is a drawing machine that makes geometric patterns that are related to the frequencies of activity on (at least) two actuators. These can be made using rotating platters where the relative speed and direction of the multiple rotating platters controls the figure being drawn. Even a simple harmonograph as described can create ellipses, spirals, figure eights and other Lissajous figures.
Step 1: Materials Required
- Arduino Uno(Duemilanove also works)
- Solder less Breadboard
- Continuous Rotation Standard Servo Motor X 2
- Wires for connecting Components
- Potentiometer X 2
- Foam Core Board( This is one of the cheapest yet suitable materials that can be used to make the harmonograph arms, we can also use acrylic, wood and so on)
- Masking Tape
- Assorted Screws, washers, nuts
- Drawing Paper
- Pens,Pencils or markers
*All these can be found at your local stationary, hardware stores)
- Box Cutter( Anything like the X-Acto Knife)
- A standard screw driver
*Additional tools will be needed to make the arms using different materials, choose suitably, happy to help in the comments section)
And some patience, GET READY to create some beautiful art!
Step 2: Assembling the Control Circuit
The circuit for this system can be divided into two basic parts. Namely, one attaching the photoresistors to the breadboard and the other part attaching the servos to the circuit breadboard.
// Some important points to note before assembly
1. The servo motors to be used in this case should be continuous rotation servos, meaning ones that do not have a limited moving angle. These can be bought as is, however, if you have 'non-continuous' ones lying around it is fairly easy to convert these to continuous ones with an easy 'fix'. Essentially, it consists of removing the potentiometer and replacing with resistors, thus cutting feedback. A helpful tutorial for the same is here.
2. The servos can be controlled using any form of variable resistance input, be it simple potentiometers to photoresistors, any sensor doing the same can be used.
// Assembling the sensors:
Working a photoresistor with an Arduino is fairly easy, the circuit can be followed here. Using the same technique attach two photoresistors to the circuit without the LEDs( they are present only to show the working of the resistors).
An important point to note with the light sensors is their calibration, these can be calibrated according to the light input and others, You can then use this knowledge in your control program to get the range of motion that you want in your drawing machine.
Once the photoresistors are connected, the attached code can be used to calibrate and get a feel of the values from the environment.
// Attaching the servos
We start by wiring the servos by wiring the power and ground connections. I’ve wired the centre (red) pin of each servo connector to the 5v (RED) bus, and the brown pin of each servo connector to the ground (BLUE) bus on the breadboard.
Here the servo control wires (yellow in my case) have been wired to digital output pins on the Arduino. I’ve wired the top servo to pin 9 using a green wire, and the bottom servo to pin 10 using an orange wire. Note that your servo might have different coloured wires. On most hobby servo connectors, the centre pin is power (4.8- 6v). Note that, on some servos the ground wire is black and the control wire is white.
Note that driving two servos directly from the Arduino 5v connection is about as much as the Arduino can handle. If you need more servos, you will have to use a separate power supply just for the servos. In this case, make sure that you connect the grounds of all the power supplies together.
Now the circuitry is ready.
Step 3: Assembling the Structure
1. Cut the foam core into the given shapes and dimensions, the dimensions can be approximated by the half inch squares beside the shapes. It does not have to be exactly the same, depends on the size of drawing machine you want. Proportions should be the same, though.
2. Cut two discs from the rectangle, the circular shape does not affect its function, does not have to be exact circles. Cut two rectangles in the other form, to fit in the servos.
3. Stick the servos firmly to the disks using tape, make sure this connection is firm.
4. I have used 6-32 nut and bolts to punch holes and make the fixture as shown in the pictures. It is recommended to use small washers between the nut and foam core and between the foam cores, to ensure smooth functioning. Then attach the arms to the discs in a similar fashion, as shown in the picture.
5. Finally, I assembled the pieces to form the drawing machine, I also painted the arms to give it some body, you may or may not want to do that.
Note: The structure can be made using any material ranging from acrylic to wood, this is the first rough prototype of what this machine could be. The premise of using those materials will be the same. With minor considerations like using a drill to punch holes etc.
Step 4: Working
Once we have connected the servos to the circuit, the Arduino is uploaded with the following code and we have a working harmonograph.
sensor1Val = map(sensor1Val, 170, 630, 75, 105);
sensor2Val = map(sensor2Val, 380, 740, 75, 105);
This section of the code determines the light input and the reaction from the servos. 170-630 are the values for the light sensor and 75-105 are the corresponding angles for the servos. These can be modified as per requirements, one thing to consider is that servos change the direction of rotation at 90. Thus a range of 75-105 will include changing direction as well.
This setup can be installed near a window or transient light source. Example, I am setting up this one near a window receiving ample light. Switch on the machine between 4-7 pm, this will give the machine enough time and variation in light(starting from afternoon to going dim in the evening) to draw beautiful curves and I could track the variation in drawings over a period of time.
Looking forward, I plan to make another with acrylic or wood.Stay tuned. I hope you liked it, please contribute with questions or comments!