Friday, October 4, 2013

Mandala update

 This is a model I made in maya.. for my box project and the class music box..we 3d printed
pretty cool!









Here are some Arduino sketches I have been working on:

1. ping and servo with if clause

#include <Servo.h>

Servo myServo; // Create Servo object to control the servo

int mspeed = 1500;

const int pingPin = 7;

void setup() {
 
  myServo.attach(9);
  Serial.begin(9600);
}
void loop(){
    Serial.println(readSensor());
  if(readSensor() < 20)
  moveMotor(readSensor());
   //Serial.print ("close =");
    delay(200);
 
  //else if(readSensor() > 1) num = 3;
  if (readSensor() > 150)
  //Serial.println(readSensor());
     myServo.writeMicroseconds(1500);
    //Serial.print ("far =");
      delay(200);
   
}

long readSensor(){
  long duration, inches, cm;
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);
  inches = microsecondsToInches(duration);
  cm = microsecondsToCentimeters(duration);

  // Serial.print(inches);
  // Serial.print("in, ");
  Serial.print("SensorVal = ");
  Serial.println(cm);
  // Serial.println();

  return cm;

  delay(20);

}

void moveMotor(long SensorVal){
  long MotorVal=map(SensorVal, 0, 32, 1700, 1500);
  Serial.print("MotorVal = ");
  Serial.println(MotorVal);
  myServo.writeMicroseconds(MotorVal);
  delay(20); //time for the servo to move
}





long microsecondsToInches(long microseconds){
  return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds){
  return microseconds / 29 / 2;
}
2. ping sensor with continuous rotation servo


#include <Servo.h>

Servo rmotor;
int num;
int mspeed = 1500;

const int pingPin = 7;

void setup() {
  rmotor.attach(10);
  Serial.begin(9600);
}

void loop(){
 // Serial.println();
 // Serial.println(readSensor());
 
  if(readSensor() < 20)
  moveMotor(readSensor());
   Serial.print ("close");
  //else if(readSensor() > 1) num = 3;
  if (readSensor() > 150)
    rmotor.writeMicroseconds(1500);
    Serial.print ("far");
    //writeLED();
    //break;
    //case 3://PR is far
    //Serial.print ("far");
     //rmotor.writeMicroseconds(1500);
   
    //digitalWrite(LEDpin, LOW);
 delay(100);
  }
 



long readSensor(){
  long duration, inches, cm;
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);
  inches = microsecondsToInches(duration);
  cm = microsecondsToCentimeters(duration);

  // Serial.print(inches);
  // Serial.print("in, ");
  Serial.println (" SensorVal = ");
  Serial.print(cm);
  // Serial.println();

  return cm;

  delay(100);

}

void moveMotor(long SensorVal){
  long MotorVal=map(SensorVal, 0, 329, 1600, 1500);
  Serial.println (" MotorVal = ");
  Serial.print(MotorVal);
  rmotor.writeMicroseconds(MotorVal);
  delay(100); //time for the servo to move
}





long microsecondsToInches(long microseconds){
  return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds){
  return microseconds / 29 / 2;
}
 3.my knock

/* Knock Sensor
 
   This sketch reads a piezo element to detect a knocking sound.
   It reads an analog pin and compares the result to a set threshold.
   If the result is greater than the threshold, it writes
   "knock" to the serial port, and toggles the LED on pin 13.
 
   The circuit:
    * + connection of the piezo attached to analog in 0
    * - connection of the piezo attached to ground
    * 1-megohm resistor attached from analog in 0 to ground

   http://www.arduino.cc/en/Tutorial/Knock
  
   created 25 Mar 2007
   by David Cuartielles <http://www.0j0.org>
   modified 30 Aug 2011
   by Tom Igoe
  
   This example code is in the public domain.

 */


// these constants won't change:
const int ledPin = 13;      // led connected to digital pin 13
const int knockSensor = A0; // the piezo is connected to analog pin 0
const int threshold = 5;  // threshold value to decide when the detected sound is a knock or not


// these variables will change:
int sensorReading = 0;      // variable to store the value read from the sensor pin
int ledState = LOW;         // variable used to store the last LED status, to toggle the light

void setup() {
 pinMode(ledPin, OUTPUT); // declare the ledPin as as OUTPUT
 Serial.begin(9600);       // use the serial port
}

void loop() {
  // read the sensor and store it in the variable sensorReading:
  sensorReading = analogRead(knockSensor);   
 
  // if the sensor reading is greater than the threshold:
  if (sensorReading >= threshold) {
    // toggle the status of the ledPin:
    ledState = !ledState;  
    // update the LED pin itself:       
    digitalWrite(ledPin, ledState);
    // send the string "Knock!" back to the computer, followed by newline
    Serial.println(sensorReading);        
  }
  delay(50);  // delay to avoid overloading the serial port buffer
}









This is a sketch of first plan for user activated moving sculpture and animated projection






This is update of Mandala Project

First vector drawing


   
simple version







and final sketch-up model

Wednesday, September 25, 2013

a little boxamation


this box was made using some left over plywood, gorilla glue and finally two hinges

Sunday, September 22, 2013

Mandala





This a picture of my Mandala










 It is constructed in the form of a Phenakiscope.. a historical animation technique whose principle was recognized by Newton but not invented until 1841 by a Belgian scientist Joseph Plateau..The colors orange yellow red and blue are my choices as I am mostly warm but need a bit of cool thrown in...
The machine works by attaching a rod to the center and spinning in front of a mirror while looking through the slots on the edge.. It works with the principal of persistence of vision.. the slots creating a strobe effect.. I am curious about adapting moving elements while still retaining its historical perspective, orientation and aesthetic quality. 



Friday, September 13, 2013

Here is the link to the robot painting artist I came across at the LX Factory in Lisbon two summers ago...
http://www.leonelmoura.com/#ROBOT

He is a bit over the top but interesting with lots of links etc..

There is a lot of robotic activity out there almost to much to wrap my head around but would like to learn to apply a bit of it to my practice..hopefully...