Posts Tagged ‘electronics’

Fading an LED with PWM and a Potentiometer

Saturday, May 8th, 2010

Using a potentiometer and PWM on an Arduino to fade an LED.

  1.  
  2. /* POT to LED test -> by Owen Mundy March 11, 2010
  3.    from: http://itp.nyu.edu/physcomp/Labs/AnalogIn
  4. —————————————————————*/
  5.  
  6. int potPin = 0;    // Analog input pin that the potentiometer is attached to
  7. int potValue = 0;  // value read from the pot
  8. int led = 9;      // PWM pin that the LED is on.  n.b. PWM 0 is on digital pin 9
  9.  
  10. void setup() {
  11.   // initialize serial communications at 9600 bps:
  12.   Serial.begin(9600);
  13.   // declare the led pin as an output:
  14.   pinMode(led, OUTPUT);
  15. }
  16.  
  17. void loop() {
  18.   potValue = analogRead(potPin); // read the pot value
  19.   analogWrite(led, potValue/4);  // PWM the LED with the pot value (divided by 4 to fit in a byte)
  20.   Serial.println("hello");      // print the pot value back to the debugger pane
  21.   delay(10);                     // wait 10 milliseconds before the next loop
  22. }
  23.  

Here is the schematic for the above project.

Using PWM and a potentiometer to fade an LED and drive a stepper motor, powered by a Boarduino RBBB.

  1.  
  2. /*
  3.   Owen Mundy
  4.  July 29, 2009
  5.  
  6.  p. 262 of Physical Computing
  7.  Using BBB to run stepper motor by manually moving steppers
  8.  
  9.  */
  10.  
  11. int pin1 = 3;                 // PWM
  12. int pin2 = 5;                 // PWM
  13. int pin3 = 6;                 // PWM
  14. int pin4 = 9;                 // PWM
  15. int ledpin = 13;              // LED
  16. int led = false;              // LED monitor
  17. int motor_time_lapse = 80;
  18.  
  19. int potPin = 0;      // Analog input pin that the potentiometer is attached to
  20. int potValue = 0;    // value read from the pot
  21. int ledPotPin = 11;  // PWM pin that the LED is on.  n.b. PWM 0 is on digital pin 9
  22.  
  23.  
  24. void setup()
  25. {
  26.   pinMode(pin1, OUTPUT);      // sets the pin as output
  27.   pinMode(pin2, OUTPUT);      // sets the pin as output
  28.   pinMode(pin3, OUTPUT);      // sets the pin as output
  29.   pinMode(pin4, OUTPUT);      // sets the pin as output
  30.   pinMode(ledpin, OUTPUT);    // sets the pin as output
  31.  
  32.   // initialize serial communications at 9600 bps:
  33.   Serial.begin(9600);
  34.   // declare the led pin as an output:
  35.   pinMode(ledPotPin, OUTPUT);
  36. }
  37.  
  38. void loop()
  39. {
  40.   potValue = analogRead(potPin); // read the pot value
  41.   analogWrite(ledPotPin, potValue/4);  // PWM the LED with the pot value (divided by 4 to fit in a byte)
  42.   Serial.println(potValue);
  43.  
  44.   digitalWrite(pin1, HIGH);   // on
  45.   digitalWrite(pin2, LOW);    // off
  46.   digitalWrite(pin3, HIGH);   // on
  47.   digitalWrite(pin4, LOW);    // off
  48.   delay(motor_time_lapse);    // wait
  49.  
  50.  
  51.   digitalWrite(pin1, LOW);    // off
  52.   digitalWrite(pin2, HIGH);   // on
  53.   digitalWrite(pin3, HIGH);   // on
  54.   digitalWrite(pin4, LOW);    // off
  55.   delay(motor_time_lapse);    // wait
  56.  
  57.   digitalWrite(pin1, LOW);    // off
  58.   digitalWrite(pin2, HIGH);   // on
  59.   digitalWrite(pin3, LOW);    // off
  60.   digitalWrite(pin4, HIGH);   // on
  61.   delay(motor_time_lapse);    // wait
  62.  
  63.  
  64.   digitalWrite(pin1, HIGH);   // on
  65.   digitalWrite(pin2, LOW);    // off
  66.   digitalWrite(pin3, LOW);    // off
  67.   digitalWrite(pin4, HIGH);   // on
  68.   delay(motor_time_lapse);    // wait
  69.  
  70.   blink();
  71. }
  72.  
  73. void blink()
  74. {
  75.   if (led == false)
  76.   {
  77.     led = true;
  78.     digitalWrite(ledpin, HIGH); // on  
  79.   }
  80.   else
  81.   {
  82.     led = false;
  83.     digitalWrite(ledpin, LOW); // on  
  84.   }
  85. }

Letter in Support of Ricardo Dominguez and Brett Stalbaum

Tuesday, April 6th, 2010

commentary_t352

To whom it may concern,

I write this letter in support of Professors Ricardo Dominguez and Brett Stalbaum, and their collaborators at the Bang.Lab at the University of California, San Diego. The criminalization of the research conducted by Dominguez and Staulbaum can and should be expected by xenophobic and racist outsiders in the San Diego community, but I was appalled to hear that the University of California is not whole-heartedly supporting Professors Dominguez and Stalbaum in the wake of recent hateful and threatening responses to their current work. 

As a logistical tool, one could argue their Transborder Immigrant Tool will be only as effectual as the amount of GPS-enabled cell phones that can be made available in the area. Consider especially their demographic primarily includes human beings that would take the chance to cross miles of desert by foot, risking starvation and death, in order to find a better life. While efforts may be made to help the logistics of this project, this is not a group you would expect to have income to acquire such devices.

I think most importantly their research should be looked at as a humanitarian gesture to bring into light an important problem in this geographic region. The inequality between classes in this area, drawn along racial and political boundaries, has caused a deep resentment on both sides of the border. Professor Dominguez and Stalbaum’s tool, while it takes the form of a functional opportunity to save the lives of other human beings, is as much a cultural product that initiates a very public conversation about an important issue, and suggests at the heart of the problem is the inability for some groups to consider the well-being of others.

It is important the University of California facilitate this conversation and acknowledge the contribution this project makes to the fields of visual arts, human computer interaction, and cultural studies, and support the work of Professors Dominguez and Stalbaum in a time when they need it most.

Sincerely,

Owen Mundy
Assistant Professor
Department of Art
Florida State University
omundy@fsu.edu

Masters of Visual Arts, 2008
University of California, San Diego

Learn more about the issue
http://bang.calit2.net/

As usual, a perspective on past issues related to this problem in the area will help contextualize this one.

Learn about Herbert Marcuse and his problems with San Diego/UCSD in this documentary
http://video.google.com/videoplay?docid=-5311625903124176509#

Even more related, David Avalos, Elizabeth Cisco, and Louis Hock’s Art Rebate project which garnered all kinds of dissidence from the San Diego community, was intended specifically to bring into the public eye an important and overlooked part of the local economy—that of wages and labor of migrant workers.
http://findarticles.com/p/articles/mi_m2479/is_n1_v22/ai_15627403/

Articles
UC San Diego professor who studies disobedience gains followers — and investigators, LA Times

Other letters

Temporary Services in Chicago
http://www.temporaryservices.org/current_services.html#dominguez

My retina, photographed at Ars Electronica in Linz

Tuesday, December 29th, 2009

Below is the image and text from the email response to an interactive exhibit at Ars Electronica in Linz where you can photograph your retina.

image

This retina photo was taken in the BrainLab of the Ars Electronica Center Linz, Austria.
We would like to welcome you at the Museum of the Future! More information at: www.aec.at/center

Best regards,
Your Ars Electronica Team

Two stepper motors, one directly connected to PWM on BBB

Thursday, July 30th, 2009

Testing to see if this motor can connect directly to PWM on BBB (Freeduino).

Code embedded in previous post.

BBB (Freeduino) and stepper motor test

Wednesday, July 29th, 2009

Test with BBB (Freeduino) board, Darlington H-Bridge, Mabuchi # PF35T-48L4 stepper motor. Many thanks to Tom Igoe and his Physical computing book.

  1. /*
  2.   Owen Mundy
  3.   July 29, 2009
  4.  
  5.   p. 262 of Physical Computing
  6.   Using BBB to run stepper motor by manually moving steppers
  7.  
  8. */
  9.  
  10. int pin1 = 3;                 // PWM
  11. int pin2 = 5;                 // PWM
  12. int pin3 = 6;                 // PWM
  13. int pin4 = 9;                 // PWM
  14. int ledpin = 13;              // LED
  15.  
  16. void setup()
  17. {
  18.   pinMode(pin1, OUTPUT);      // sets the pin as output
  19.   pinMode(pin2, OUTPUT);      // sets the pin as output
  20.   pinMode(pin3, OUTPUT);      // sets the pin as output
  21.   pinMode(pin4, OUTPUT);      // sets the pin as output
  22.   pinMode(ledpin, OUTPUT);      // sets the pin as output
  23. }
  24.  
  25. void loop()
  26. {
  27.   for (int i=0; i<24; i++)
  28.   {
  29.     digitalWrite(pin1, HIGH);   // on
  30.     digitalWrite(pin2, LOW);    // off
  31.     digitalWrite(pin3, HIGH);   // on
  32.     digitalWrite(pin4, LOW);    // off
  33.     delay(10);                  // waits for a second
  34.  
  35.     digitalWrite(pin1, LOW);    // off
  36.     digitalWrite(pin2, HIGH);   // on
  37.     digitalWrite(pin3, HIGH);   // on
  38.     digitalWrite(pin4, LOW);    // off
  39.     delay(10);                  // waits for a second
  40.  
  41.     digitalWrite(pin1, LOW);    // off
  42.     digitalWrite(pin2, HIGH);   // on
  43.     digitalWrite(pin3, LOW);    // off
  44.     digitalWrite(pin4, HIGH);   // on
  45.     delay(10);                  // waits for a second
  46.  
  47.     digitalWrite(pin1, HIGH);   // on
  48.     digitalWrite(pin2, LOW);    // off
  49.     digitalWrite(pin3, LOW);    // off
  50.     digitalWrite(pin4, HIGH);   // on
  51.     delay(10);                  // waits for a second
  52.   }
  53.  
  54.   blink();
  55.  
  56.   for (int i=0; i<24; i++)
  57.   {
  58.  
  59.     digitalWrite(pin1, HIGH);   // on
  60.     digitalWrite(pin2, LOW);    // off
  61.     digitalWrite(pin3, LOW);    // off
  62.     digitalWrite(pin4, HIGH);   // on
  63.     delay(10);                  // waits for a second
  64.  
  65.     digitalWrite(pin1, LOW);    // off
  66.     digitalWrite(pin2, HIGH);   // on
  67.     digitalWrite(pin3, LOW);    // off
  68.     digitalWrite(pin4, HIGH);   // on
  69.     delay(10);                  // waits for a second
  70.  
  71.     digitalWrite(pin1, LOW);    // off
  72.     digitalWrite(pin2, HIGH);   // on
  73.     digitalWrite(pin3, HIGH);   // on
  74.     digitalWrite(pin4, LOW);    // off
  75.     delay(10);                  // waits for a second
  76.    
  77.     digitalWrite(pin1, HIGH);   // on
  78.     digitalWrite(pin2, LOW);    // off
  79.     digitalWrite(pin3, HIGH);   // on
  80.     digitalWrite(pin4, LOW);    // off
  81.     delay(10);                  // waits for a second
  82.   }
  83.  
  84.   blink();
  85.  
  86.   for (int i=0; i<6; i++)
  87.   {
  88.     digitalWrite(pin1, HIGH);   // on
  89.     digitalWrite(pin2, LOW);    // off
  90.     digitalWrite(pin3, HIGH);   // on
  91.     digitalWrite(pin4, LOW);    // off
  92.     delay(10);                  // waits for a second
  93.  
  94.     digitalWrite(pin1, LOW);    // off
  95.     digitalWrite(pin2, HIGH);   // on
  96.     digitalWrite(pin3, HIGH);   // on
  97.     digitalWrite(pin4, LOW);    // off
  98.     delay(10);                  // waits for a second
  99.  
  100.     digitalWrite(pin1, LOW);    // off
  101.     digitalWrite(pin2, HIGH);   // on
  102.     digitalWrite(pin3, LOW);    // off
  103.     digitalWrite(pin4, HIGH);   // on
  104.     delay(10);                  // waits for a second
  105.  
  106.     digitalWrite(pin1, HIGH);   // on
  107.     digitalWrite(pin2, LOW);    // off
  108.     digitalWrite(pin3, LOW);    // off
  109.     digitalWrite(pin4, HIGH);   // on
  110.     delay(10);                  // waits for a second
  111.   }
  112.  
  113.   blink();
  114.  
  115.   for (int i=0; i<6; i++)
  116.   {
  117.  
  118.     digitalWrite(pin1, HIGH);   // on
  119.     digitalWrite(pin2, LOW);    // off
  120.     digitalWrite(pin3, LOW);    // off
  121.     digitalWrite(pin4, HIGH);   // on
  122.     delay(10);                  // waits for a second
  123.  
  124.     digitalWrite(pin1, LOW);    // off
  125.     digitalWrite(pin2, HIGH);   // on
  126.     digitalWrite(pin3, LOW);    // off
  127.     digitalWrite(pin4, HIGH);   // on
  128.     delay(10);                  // waits for a second
  129.  
  130.     digitalWrite(pin1, LOW);    // off
  131.     digitalWrite(pin2, HIGH);   // on
  132.     digitalWrite(pin3, HIGH);   // on
  133.     digitalWrite(pin4, LOW);    // off
  134.     delay(10);                  // waits for a second
  135.    
  136.     digitalWrite(pin1, HIGH);   // on
  137.     digitalWrite(pin2, LOW);    // off
  138.     digitalWrite(pin3, HIGH);   // on
  139.     digitalWrite(pin4, LOW);    // off
  140.     delay(10);                  // waits for a second
  141.   }
  142.  
  143.   blink();
  144.  
  145. }
  146.  
  147. void blink()
  148. {
  149.   digitalWrite(ledpin, HIGH); // on  
  150.   delay(1000);                // waits for a second
  151.   digitalWrite(ledpin, LOW);  // off  
  152. }