Wednesday, May 28, 2014

Initial Arduino Code

The process of developing the Arduino code has also a great way for me to organize my ideas. It forces me to write down there verminous aspects of the project in a symbolic, systematic and sequenced structure. My initial


// Perpetual Windmill USB Charger for Arduino
// thatchek
// Last Modified -- May 28, 2014

////////////////////////////////////////////
////////////////////////////////////////////

int pinRPM = 7;  // input pin for the brushless motor phase sensor
int sensor[] = {0,0};  // stores the current sensor reading [0] and the previous sensor reading [1]
long i = 0;  // keeps count of revolutions of mill motor
long millRPM = 0;  // stores the RPM calculated from the mill motor's phase sensor
unsigned long t[] = {0,0};  // the elapsed time [0] and previous time at elapse [1]

int pinMotor = 9;  // output pin for PWM fan motor ESC
float battVolts = 7.4;  // the nominal voltage of the battery in use
int kV = 1000;  // the kV value (RPM/Volt) of fan motor
int fanRPM = 0;  // stores the fans intended RPM
int maxFanRPM = 1000;  // the maximum fan RPM desired
float fanVal = 0;  // the PWM value (0-255) to output to the ESC

int pinUSB = 4;  // the output pin for controlling USB charging port


////////////////////////////////////////////
void setup()
{
  pinMode(pinRPM, INPUT);
  pinMode(pinMotor, OUTPUT);
  pinMode(pinUSB, OUTPUT);
  digitalWrite(pinUSB, LOW);

  Serial.begin(9600);
  Serial.println("Initializing");
}


////////////////////////////////////////////
void loop()
{
  // What is the mill's RPM //
    sensor[0] = digitalRead(pinRPM);
    if ( sensor[0] == 1 && sensor[1] == 0) ++i;
    sensor[1] = sensor[0];
    t[0] = millis() - t[1];
    if ( t[0]  >= 200 )
    {
      millRPM = 1000 * i / t[0];
      i = 0;
      t[1] = millis();
    }


  // Control ESC (fan speed) values from 0 to 255 //
    if ( millRPM >= 10 )
    {
      fanRPM = 2 * millRPM;
      if ( fanRPM > 500 ) fanRPM = 500;
      fanVal = ( fanRPM * 255 ) / ( kV * battVolts );
    }
    else
    {
      fanVal = 0;
    }
    analogWrite(pinMotor, fanVal);


  // Control USB Charging Port //
    if ( millRPM >= 50 ) digitalWrite(pinUSB, HIGH);
    else digitalWrite(pinUSB, LOW);
 

  // Print Debug Values //
//    Serial.println();


  delay(10);


}

////////////////////////////////////////////
////////////////////////////////////////////

Learning?

Reflecting on my design process thus far, I find myself rather disappointed... and I am realizing that this tends to be the norm for me. I am disappointed that I seem to always start a project with a ambitious goals. I incorporate a certain robust elegance into my designs. However, as it always happens, time and money decidedly ruin the day. I must learn to better optimize my design path in order to incorporate a cost effectiveness into my process. I think if I can manage to start with this as a design criteria, it may influence my creative drive to strive for economy.

Never the less, I am interested in witnessing the reactions to my Perpetual Windmill. I have never used my engineering background to produce a product solely for artistic value. This have been a challenging yet very rewarding experience for my educational development.

Solid Modeling

I personally like to use 3-D modeling in my design process. It allows me the opportunity to sketch in three dimensions and better visualize the idea that is in my head. I really like the ability to see the way certain curves in my design react visually to other curves... something that I have a hard time doing in just my imagination.

Initial SolidWorks rendering:


This is my idea of the base of my sculpture. It is made from laser cut 0.22 inch clear acrylic sheeting that is then solvent glued together to form a three dimensional shape.

Hierarchy of Needs

Creativity
Interesting and ironic statement of energy efficiency

Proficiency
Nothing to learn... just start the windmill turning

Usability
So easy a child can do it... just might not understand

Reliability
Once the windmill is turning, it needs to keep turning

Functionality
Windmill must be turned by fan