The Fab(ulous) Lab Journey of Sophie K.

Week 15

Machine Design

This part was suprisingly more fun than I thought it would be. Probably because I was stressed doing this week due to lack of commrades. But it ended up being fun because I not only did the code on my own without assistance (shows how fab academy has grown me in terms of my coding skills), but seeing the code I wrote actually work! And knowing why I wasn't for the most bit when it didn't.

Setup: Automating/Moving the Machine

I started off by using a simple code (see below) and testing to see if it worked.

  
        #include <Servo.h>
const int SOFT_POT_PIN = A0;

Servo servo;
void setup() 
{
  pinMode(SOFT_POT_PIN, OUTPUT);
  servo.attach(SOFT_POT_PIN); //analog pin 0
  servo.write(0);
  delay(2000);
}

void loop() 
{
  servo.write(90);
  delay(1000);
  servo.write(0);
  delay(1000);
}
      
      
      Sophie Kiarie, Fab Academy 2018
      

Then I decided to try and get a little creative with it....I combined my soft pot code from my previous inputs week, with my networking and communications code from networking and communications week to get a pretty cool output (see video below)

This was the code that combined the weeks:

  
        #include <Servo.h>

const int SERVO_PIN = A0;
const int SOFT_POT_PIN = A1;
const int GRAPH_LENGTH = 9;

Servo servo; 
void setup()
{
  Serial.begin(9600);
  pinMode(SERVO_PIN,OUTPUT);
  servo.attach(SERVO_PIN); //analog pin 0

  pinMode(SOFT_POT_PIN, INPUT);
}

void loop() 
{
  int softPotADC = analogRead(SOFT_POT_PIN);
}

  Serial.println(softPotADC);
  delay(500);

  while(Serial.available())
  {
    char c = softPotADC;
    Serial.println(softPotADC);   
  
    if (c == '9')
    {
      servo.write(90);
      delay(1000);
    }

    else if (c == '0')
    {
      servo.write(0);
      delay(1000);
    }

    
     else if (c == '8')
    {
      servo.write(180);
      delay(1000);
    }
     
  }
}
 

Sophie Kiarie, Fab Academy 2018

The final code

  
        
        #include <Servo.h>
Servo myservo;
Servo myservo2;

const int SERVO_PIN = A0;
const int SERVO_PIN2 = A4;
const int POT_PIN = A2;
const int POT_PIN2 = A3;
int val; 
int val2;

void setup()
{
  myservo.attach(SERVO_PIN);
  myservo2.attach(SERVO_PIN2);
  //myservo.write(0);
  //delay(2000);
}

void loop()
{
  val = analogRead(POT_PIN);                
  val = map(val, 0, 1023, 0, 180);                
  myservo.write(val);            
  delay(15);

  val2 = analogRead(POT_PIN2);                
  val2 = map(val2, 0, 1023, 0, 180);                
  myservo2.write(val2);            
  delay(10);
}

Sophie Kiarie, Fab Academy 2018
     

Although it looks pretty simple...it actually sort of is haha. But in the sense of when someone says something is simple but they only say it because they are used to something or know how to do something. I simply used my knowledge from before and implemented it here. And of course with the help of my trusty datasheet to tell me which pins were analogue pins on my board.

Problems Faced

I faced 3 major problems.

  1. Wiring - I quickly realized that my wires needed to be setup differently to fit inside the box because if i wasn't careful, when putting in the cables and circuits into the box, they would disconnect and so when I went to run the code, it wouldn't work.
  2. Filming with one hand- it may sound petty but doing this on my own with my make shift stands or only using my hand made it hard to film because really, I needed three hands; one to film, one to control the potentiometers and one to input data (for the other code trials). But I did try my best to hold my camera steady. I suppose in retrospect I could have made a camera stand using the 3D printer. That would have probably been quite helpful to not only myself but others. But of course I only realize this now that I am calmly writing this and not trying to figure things out in the middle of a storm.
  3. Weight of the servos- Now I realize this might be more of a week 14 problem, but it didn't come into realization until I actually got the servos to move. It is what made me realize that the weight of the MDF might be too much afterall as without the servos needing to move, there wasn't any need for friction or resistance so to speak because it was all manual. But this can be solved by simply going back to the cardboard idea.

Reflection and Future

I think this was a pretty successful project. I will admit I initially thought it was hopeless and that I would not be able to get this section done because of my lack of commrades, BUT I pulled through and showed myself up. It's a nice feeling when you prove yourself wrong. On top of that I had fun! Minus a couple bumps along the way, it was a really cool thing to do. With more time and tools I would love to make this a sort of rainbow project (meaning more colors), but also make it so that others can come and alter it to have as many colors as they want on the arms. I think it would also be cool to look into working a bit more towards my initial final project idea of the paint based on music idea (see below) since I feel this is somewhat on the same path

Another cool potential idea is to completley rid the potentiometers and replace them with movement sensors, or perhaps incorporate Kelly Snook's gloves to them control the servo arms! That would allow for move fluidity I would think.

Downloadable Links to Project Files:

This weeks homework:

  1. Actuate and automate your machine