Skip to content →

penelope – final documentation

Like I’ve said in many posts before, for my final project I designed a weaving loom that weaves during the day and unweaves during the night. So the system works in this order:
1) p5 access data from the web a) geolocation of the piece b)time when the sunrises and when the sunsets
2) p5 says if it’s day or if it’s night
3) send this data to Arduino
5) arduino turn stepper motors on, changing the direction according to the information received
6)build the final weaving loom
6) mount arduino and steppers on the weaving loom

And I tried to build the separate parts in separate steps but that didn’t work separately at all. So bellow is an attempt to separate them in three big segments/posts that were developed simultaneously:


At first I started to take a look on how sunrise/sunset astronomy APIs work to understand what kind of information I would need as a geolocation reference for it. I opted to use the weather channel API ( ), that can call astronomy information from different positions according to city name or latitude and longitude.

var currentTime;

function setup() {
  createCanvas(480, 240);
  loadJSON("", gotData);

function gotData(data) {
  currentTime = data;

function draw() {
  if (currentTime) {
    fill(255, 200, 0, 100);
    ellipse((currentTime.sun_phase.sunrise.hour) * 20, height / 2, 10, 10);
    fill(0, 200, 255, 100);
    ellipse((currentTime.sun_phase.sunset.hour) * 20, height / 2, 10, 10);
    if (currentTime.moon_phase.current_time.hour > currentTime.sun_phase.sunset.hour || currentTime.moon_phase.current_time.hour < currentTime.sun_phase.sunrise.hour) {
      fill(100, 100, 100, 100)
    ellipse((currentTime.moon_phase.current_time.hour) * 20, height / 2, 10, 10);


Since most geolocation APIs give back latitude and longitude coordinates, I was now ready to find a geolocation API that works with those two variables. For commodity and popularity I started testing with the google geolocation API. After a while trying to make the sketch to work on my computer and failing overtime with some error related to the API variable, I decided to go to the ICM group and ask for help. John Farrell told me I could try to work with a built-in HTML function called navigator, so that I didn’t need to worry about APIs and it would give me the object in pre-formatted standards. That also didn’t work at first and after a while googling I found out that because those were referring to variables outside my sketch, they didn’t work unless they were running on the web. I uploaded the sketch and charm – it worked!


Now that I knew how to use the navigator and google api , it was just a matter of understanding how the weather channel API worked, how I accessed the sunrise and sunset objects and how I could put an api inside an api. So what I got as a solution was to assign a new global variable to each of the coordinate values and add them up to the weather channel API url. Tom Igoe gave an interesting comment about the geolocation that I didn’t know: they only actually work outdoors, inside building they get the closest value they can get. But for now, all I needed to know where the loom is and that worked.

Once I had the sunset and the sunrise hours of the day, it was time to compare it to the current time and define if it was either day or night. Creating new variables for each of those hours and comparing them through if statements to know if it’s day or night. Once I had that comparison I had to work with some tricky situation with accessing the weather channel API: I’ve put it on the draw function and soon enough I got an email from them saying I had accessed the limit of access per day I could have. It took a while for me to understand that to only access it once a day I’d have to create universal variables, assign them values inside a “weather channel” function and then call them back on the function draw.

var coordenadas;
var data;
var posR; //position sunrise time
var posS; //position sunset time
var posC; //position current time

function setPos(position) {
  var lat = position.coords.latitude;
  var lng = position.coords.longitude;
  text("latitude: " + lat, 50, 50);
  text("longitude: " + lng, 50, 70);

  var url = '' + lat + ',' + lng + '.json';
  loadJSON(url, gotData);

function gotData(data) {
  text("sunrise: " + data.sun_phase.sunrise.hour + ":" + data.sun_phase.sunrise.minute, 50, 90);
  text("sunset: " + data.sun_phase.sunset.hour + ":" + data.sun_phase.sunset.minute, 50, 110);
  var hora = hour();
  var minuto = minute();
  text("current time: " + hora + ":" + minuto, 50, 130);
  line(posR, height / 2, posS, height / 2);
  posR = ((data.sun_phase.sunrise.hour) * 50) + data.sun_phase.sunrise.minute;
  posS = ((data.sun_phase.sunset.hour) * 50) + data.sun_phase.sunset.minute;

  posC = ((hora) * 50) + minuto;
  fill(255, 255, 0);
  ellipse(posC, height / 2, 20, 20);
    ellipse(posR, height / 2, 10, 10);
      ellipse(posS, height / 2, 10, 10);


function setup() {
  createCanvas(1200, 600);


function draw() {
  background(180, 225, 255);

After I was able to get all the values working, I asked some friends around the world to test it (just to be sure it was working).


Now that I had everything running well on the p5 , it was time to connect it to the Arduino sketch – and this was also tricky because I needed to access a serial port from a sketch that was uploaded on the web. I didn’t quiet understand how the communication between both happened, so this was a good exercise to understand how it works. I also went up to the ICM group and was help by Shawn Van Every, who told me I could access the serial server manually, through the p5 serial port node library.

var serial; // variable to hold an instance of the serialport library
var portName = '/dev/cu.usbmodem1421'; // fill in your serial port name here
var inData; // for incoming serial data
var outByte = 0; // for outgoing data

var coordenadas;
var data;
var posR; //position sunrise time
var posS; //position sunset time
var posC; //position current time
var texto = "";

var hora, minuto;

// var dados = {};

function setPos(data) {

  var url = '';
  loadJSON(url, geoLocation);

function geoLocation(data) {
  var lat =;
  var lng = data.location.lng;
  sunTime(lat, lng);


function sunTime(lat, lng) {
  var url = '' + lat + ',' + lng + '.json';
  loadJSON(url, test);

function test(data) {
  hora = hour();
  minuto = minute();
  posR = ((data.sun_phase.sunrise.hour)) + data.sun_phase.sunrise.minute;
  posS = ((data.sun_phase.sunset.hour)) + data.sun_phase.sunset.minute;
  posC = ((hora) * 100) + minuto;


function printData() {
  hora = hour();
  minuto = minute();
  text("current time: " + posC, 50, 130);
  text("it is", 50, 150);
  if (posC > posS || posC < posR) {
    text("NIGHT", 70, 150);
    texto = 'H';
    // turn the motors this way
  } else {
    text("DAY", 70, 150);
    texto = 'L';
    // turn the motors the opposite way
  text(texto, 70, 150);


function setup() {
  createCanvas(1200, 600);
    serial = new p5.SerialPort(); // make a new instance of the serialport library
  serial.on('data', serialEvent); // callback for when new data arrives
  serial.on('error', serialError); // callback for errors; // open a serial port


function serialEvent() {
  // read a byte from the serial port:
  var inByte =;
  // store it in a global variable:
  inData = inByte;

function serialError(err) {
  println('Something went wrong with the serial port. ' + err);

function draw() {
  text("sunrise: " + posR, 50, 90);
  text("sunset: " + posS, 50, 110);
  // gotData(data);

Everything works the way it should be, yay! Some improvements I’d like to do in the future regarding to this computational media part of the project:
– be able to make it refresh by itself once a day
– be able to string the data and send to the how long the day / night is and therefore how low the weaving and unweaving should take


For sure one of the biggest challenge on this project was to work with motors – something that I was very excited about but I didn’t have a lot of knowledge over. I had some stepper motors I had recently bought and therefore I decided to use them. I started by putting them to work through an H bridge and powering it with a bench power supply, which worked with a simple code but had a lot of wiring that didn’t make a lot of sense and was extremely messy. I was also very concerned about wiring the motor with the power supply, because I didn’t want to exceed the limit current of the motors.


I was able to make both motors to work separately and the mechanism (the stepper winding and unwinding the thread) as well. When I tried to turn the two motors at the same time, I wasn’t sure on how I should power them and after talking with some friends & Jeff, I decided to test some motor shields to control the steppers. I tried sparkfun’s super easy driver (but it didn’t work at all – maybe the way i wired and/or solder it) and adafruit motor shield, that had a great documentation online and was very straight forward on how it should be wired as well as how the code/stepper library worked.


How to manage the power supply seemed a bit arbitrary at the beginning and I accidentally burned one of the chips on the motor shield because both motors working at the same time were demanding more than 3A, the maximum current the shield can take. But after having some office hours with one of the residents(Pedro), I was able to understand that the power supply is not actually that controllable and what you can do (and for this case it was very important) is limit the current.
Once I had the wiring and power figured out, it was time to test and experiment with the speed of the motors and speed modes (single, double, micro steps etc). At first I thought that all I needed was to make them work at the same time, running in different directions; ater testing, I’ve realized that this was actually tensioning the thread in different directions and wouldn’t make the thread to move around. Some experiments were made, specially with the single and micro steps, and I chose to use a combination of alternated micro steps between both motors. This way, the thread was never 100% tensioned and it was moving elegantly smooth.
Now that the mechanism of arduino + motors was also set, I had to change the serial communication code on the arduino side, so that it would turn on the motors and move them in the right speed and direction.

int incomingByte;     // a variable to read incoming serial data into

#include "utility/Adafruit_PWMServoDriver.h"

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();

Adafruit_StepperMotor *myMotor1 = AFMS.getStepper(200, 1);
Adafruit_StepperMotor *myMotor2 = AFMS.getStepper(200, 2);
void setup() {
 Serial.begin(9600);             // initialize serial communication

AFMS.begin();  // create with the default frequency 1.6KHz
  //AFMS.begin(1000);  // OR with a different frequency, say 1KHz

  myMotor1->setSpeed(100);  // 10 rpm

  myMotor2->setSpeed(100);  // 10 rpm

void loop() {
 if (Serial.available() > 0) {   // see if there's incoming serial data
   incomingByte =; // read it
   if (incomingByte == 'H') {    // if it's a capital H (ASCII 72),
  myMotor1->step(100, FORWARD, MICROSTEP);
   if (incomingByte == 'L') {    // if it's an L (ASCII 76)
  myMotor2->step(10, FORWARD, MICROSTEP);

It worked!! The only thing that I’d like to continue to develop is to make the shift from day to night (motor direction and speed) automated. For now, when the sunset/sunries time comes, it doesn’t understand that it changed – so I have to refresh the p5 sketch so that it changes the direction. It’s fine for the moment because it can be controlled manually but I think that for a consolidated version of this project (maybe with several pieces around the world?) this should be working automatically.


At last but not least at all – while I was developing icm and p-comp parts, fabrication was happening in a sort of obsessive rhythm. During the time I developed this project, I kept on building different versions of the loom: different mechanisms for the thread to roll as well as a wide range of sizes and cloth’s weft. There were 10 versions of a weaving loom to understand which would work with the mechanism i was dealing with : two steppers working in different and/or same direction to pull a thread one way or another. Like it has been shown in other assignments for fabrication, I was able to get some positive conclusion by myself as well as feedback from Ben and other builders that have much more experience within designing mechanisms/machines than me.


For sure there were three big challenges on building the loom: working with a mechanism that wouldn’t lock the thread’s movement, fitting the parts of it perfectly and giving the whole piece a nice polished finish. One colleague and Jeff Federsen were following the building process and suggested that I tried to work with pulleys, that were available at McMaster and they were great to work with. It was a bit of a short in the dark but a shot that for sure was likely to work since they can handle much more tension/friction than I was putting on them. While looking for the right pulley, I found out that McMaster Carr not only has a great search engine but also there are so many different types of pulleys – and there are specific pulleys for ropes. I didn’t find pulleys with the small dimensions I had in mind and those rope pulleys were a bit over my budget, so I chose to buy 10 big rope pulleys; you don’t have the sensation of being a fabric (in the case of the concept of this piece, a shroud), but it does have the visualization of the weaving being done and undone.
Since this was the final version of the loom, I wanted to plan if very well and be sure that I didn’t miss any of the measurements or that after starting to build it I’d realize I needed more of x or y material. From the sizes that I’ve tested on older versions of the loom and also according to the number and sizes of the pulleys (thank you McMaster for the downloadable files!!), I picked a “medium” size that was a bit bigger than my small looms but that I felt comfortable that would work – and then I went straight to Illustrator to calculate precisely how much of each of the materials I would need. So this is the technical drawing of the piece:


After finishing this technical drawing, I went straight to metropolitan lumber shop to get the wood for building it. I knew I wanted to try to work with either pine wood or poplar tree, but I didn’t know which would be more affordable. Surprisingly I was well treated at metropolitan: they helped out explaining the differences, gave the cost of each one of them and explained me better about wood thickness – something that I didn’t count in on my technical drawing, but it was ok because i got a pine wood that was thicker than i needed.
Back to the shop, it was time to face the band saw the way it is: it doesn’t cut straight and it requires a lot of filing to make your pieces to fit each other. The positive point was that there were only four pieces of pine to be filed (for the weaving frame); but even though, it was an afternoon full of dust to make the pieces fit each other and to have the same exact measures.
After this, it was a matter of marking where the pulleys and motor mounts would go and assembling the pieces together – so before starting this, I went to the yellow cabinet and looked for unlabeled finishing wood oils. I knew I wanted to make the wood a less pale due to the fact that the thread had to be white and it kind of disappeared if kept the pine wood in its natural color. I had some spare piece of the wood and this was great for testing finishing oils. I tested a few tinted finishing oils and decided to go with one layer of the oak wood finishing oil, that gave a golden/tanned finish to the wood enough to pop the thread out of it and to make it look well finished. I waited 10hrs for the oil to dry and started marking down and assembling the pulleys to the side of the weaving frame.

penelope_15Using the punching whole tool and putting a tape on the driller bit as a stopper were very handy for this step: making sure i didn’t go through the wood and that the holes were drilled where they should be assured me that both sides of the frame were aligned as initially planned. After assembling the pulleys, i assembled the weaving loom frame to realize i hadn’t plan where the motor mount would go. i improvised and went to the laser cutter with some thick acrylic I had, doing some tweaks on a vector file of a motor mount I had so that it would fit the stepper motor i had.

so one of the motor was mounted and the other was loose, in front of the weaving loom. I’ve put the loom to work to realize that motors have to be better mounted and any change on the thread direction would cause a lot of friction and lock the movement at some point.


So I decided to get real motor mounts and rethink both thread reels position within the weaving loom. With the stepper mounts, I’ve put them as aligned with the weave as possible, so the one that was pulling the fishing wire was upside down on the inside-top-left corner of the loom and the one that had the cotton thread was on the horizontal axis, with a thread reel mounted on the stepper rod outside the wooden frame, but keeping the direction of the thread the same of the weaving. I had laser cut a disk to fit the stepper rod and to attach the wooden spool to; it definitely worked to make the reel to spin according to the motor direction and speed but I had to improvise a bit because the thread started to wind before the spool – for the show, i used a small pencil to stop this.



BUT I MUST CONFESS that this was not the last version of the loom. the guys from metropolitan accidentally gave me some poplar wood big enough to make a new version of the loom. Seeing that the pulleys worked, I got confident to try to make my own pulleys with sewing machine reels and aluminum tubes, making more horizontal lines as well as hiding the pulleys and the arduino. Again, I went back to illustrator and got all the measurements correct.

penelope_25v2I got some help from a friend to make the pulleys and one motor’s slot inside the wood with the CNC machine. I did the illustrator file and got a lot of help to transform it and export it to the CNC machine. It looks more scary than it actually is; you just have to pay a lot of attention when you set the file on the shop computer and when you set the machine to work. And also I’ve learned that you really have to attach your wood to the table to be sure it won’t start spinning with the CNC on.

And so I spend more time building this loom that I thought it would be my final solution. I also had to think how the motor of the fishing wire would be mounted, how it would fit the pulley column etc. It was a lot of work but I felt that it would work – or at the worse situation, it would be just a manual weaving loom. So I built it and put all the elements in it. When I turned it on, it didn’t work. At all. It was too much fiction and I didn’t give enough space for the reels to spin freely – so if one of two got locked, it ended up locking up the whole movement.

For those who came to the show probably saw me live weaving on supenelope_29nday (since it was not working and there was no time to go back to the other version). On monday I was able to get the earlier, mount both motors to the old version of the loom and made it work!


I wish to continue on improving the weaving loom, making it bigger and adding more horizontal lines, trying new pulleys & other materials. I don’t know how long it would take, but I’ll try to see if I can get any kind of grant or short artist residence to develop it further. And I really got the hang of building things, I’m looking forward to improve my shop skills and learn other machines, making fabrication more and more clear and easy.


Thank you Dan, Jeff and Ben for helping out through the process; I do feel I learned a lot and specially because you all pushed me further to test and experiment with possibilities that I haven’t tried before. Thank you all itp friends who helped me out from the moment Penelope was just an idea to the final moment of mounting motors right before the show started on monday!


It was indeed a great semester, see you soon ITP =)

Published in fall 2015 icm intro to fab p-comp


Leave a Reply

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