Show Posts
Pages: 1 ... 15 16 [17] 18
241  Forum 2005-2010 (read only) / Interfacing / Re: Advice working with solenoids on: March 30, 2008, 09:49:54 pm
All you need is to strap a 400x diode backwards parallel to the solenoid coid. The stripe on the diode (cathode) should connect to the positive supply and the anode should connect to the transistor. (When using an NPN transistor).

BTW if you have an oscilloscope it is perfectly easy to see these pulses, which can be 100 volts or more. Yikes. If not dealt with they can kill your transistor or something more valuable.


242  Forum 2005-2010 (read only) / Interfacing / Re: Expanding PWM on: June 14, 2007, 11:15:02 pm
I've used the 5940 for LED signs and it works great but the datasheet and features you have to deal with are bit daunting.

I wanted to point out the Arduino is fast enough to PWM all of it's pins smoothly, so depending on how many LED's you need dimming for this might be an alternative.  I didn't throw in the Analog pins but there's nothing that would prevent it. You need to do some bitshifting and bitmath though to maintain the speed.

See this approach.

http://www.arduino.cc/playground/Main/PWMallPins
243  Forum 2005-2010 (read only) / Interfacing / Re: Wind sensor on: October 06, 2007, 09:56:46 pm
I've got a little op-amp based wind sensor board that I burned for my students. It works fine with just a puff of air. It's not so great at getting normal breaths (too slow), but it doesn't sound like that's what you're after.  


It works like this, two temperature sensors sit on top of two surface mount resistors, which act as heaters. One temp sensor-heater is covered, the other is exposed. An op-amp amplifies the difference between the two sensors while cancelling out the common mode (absolute) reading. When you blow on the exposed sensor, it is briefly cooled off, and the signal is raised. The raised signal is amplified and fed through the exposed sensor's resistor, which heats up the sensor and cancels the signal. The response to getting puffed on, takes about .25 to .5 seconds and then about another second or two for the signal to go low again - read it with an A/D in. The parts are about $4-5 in small quantities.

I'll eventually release it as a kit but it's way on the back burner.

email if you want a board and we'll work something out - I burned quite a few.

pbadger AT verizon   DOTTY  net
244  Forum 2005-2010 (read only) / Interfacing / Re: 32x32 on: October 06, 2007, 01:11:51 pm
You might want to take a look at my LED board. It's an 8x8 grid but expands nicely in both directions.
http://moderndevice.com ->LC8x8
245  Forum 2005-2010 (read only) / Interfacing / Re: LCD Display on: June 25, 2007, 07:02:10 am
Serial IC's get the interface down to three wires and simplify the programming.

Here's a kit with some options

http://www.wulfden.org/k107/order.shtml


246  Forum 2005-2010 (read only) / Interfacing / Re: interfacing plants on: April 24, 2007, 11:12:50 pm
you might try a capacitive sensing approach.

check out this post - it's one way of capacitive sensing

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=117107625

paulb
247  Forum 2005-2010 (read only) / Interfacing / Re: 10 x 10 LED matrix in 3 colours on: April 16, 2007, 09:19:44 pm
I put together a 2' x 4' sign with about 1800 LED's driven with PWM, and these chips worked fine. They're kind of a swiss army knife with a somewhat intimidating 80 page manual (maybe I'm wrong - this is just from memory).

It's not an Arduino driving it, (SBC with an ARM - 9) but an Arduino would probably drive 30 or so chips with no problem. I think I had some contact with TI and they said there was definitely a limit to how many you could daisy chain - the manual suggests 40 I think.  I never did establish the exact reason - I think it's clock skew issues with some kind of delays multiplying. Just use a new Arduino pin, and a new chain, for more LED's. You would need a new chip select for each chain too.

Try out the SPI port on the Arduino - that will buy some speed I bet - after wading through the datasheet.

Anyway - the TI chips are not for the faint of heart but if you put some work into figuring them out, they'll work fine.

Paul Badger
248  Forum 2005-2010 (read only) / Interfacing / Another, logarithmic LED fader on: March 01, 2007, 03:12:56 pm
/* Fade6LEDExpon
 Paul Badger 2007
 Program to fade 6 LED's up and down, with an exponential curve
 This one looks more organic than the arithmetic version
 Demonstates using arrays
 */


int    i;                                          // counter variable
float  LED[] = {1,1,1,1,1,1};                      //  pwm brightness variables
float  spChg[] = {1.04, 1.05, 1.06, 1.07, 1.03, 1.003};   // speed varialbes to fade LED's   - change these for faster or slower fades
// values should be close to and greater than 1
int    pwmPins[] = {3,5,6,9,10,11};                // PWM pins - 3,5,6 won't work on Atmega8
int     ud[]={1,1,1,1,1,1};                        // up - down multiplier

void setup() {
  Serial.begin(9600);
}

void loop() {
  for (i=0; i<=5; i++){
    if (LED > 255){
      ud = -1;
    }
    else if(LED < 1){
      ud = 1;  
    }
    
    if (ud == 1){       // up flag, multiply spChg variable
   LED = LED * spChg;    // multiply by a fixed amount - spCh array controls the speed of fade
    }
    else
    {                     // down flay,  divide spChg variable
   LED = LED / spChg;
    }
    
    analogWrite(pwmPins, (int)LED);
    delay(1);        // this will interact with the spChg variables to control ultimate fade speed
  }
}
249  Forum 2005-2010 (read only) / Interfacing / Fade 6 LED's w PWM on: March 01, 2007, 02:29:29 pm
A short program for fading 6 LED's (w Atemega168).
Demonstrates use of arrays




/* Fade6LEDs
 Paul Badger 2007
 Program to fade 6 LED's up and down.
 Demonstates using arrays
 */


int    i;                                          // counter variable
float  LED[] = {0,0,0,0,0,0};                      //  pwm brightness variables
float  spChg[] = {.8, 2.75, .21, .61, .49, .99};   // speeds to fade LED's   - change these for faster or slower fades
int    pwmPins[] = {3,5,6,9,10,11};                // PWM pins - 3,5,6 won't work on Atmega8
int     ud[]={1,1,1,1,1,1};                        // up - down multiplier

void setup() {
  Serial.begin(9600);
}

void loop() {
  for (i=0; i<=5; i++){
    if (LED > 255){
      ud = -1;
    }
    else if(LED < 1){
      ud = 1;  
    }
    LED = LED + (spChg * ud);
    analogWrite(pwmPins, (int)LED);
  }
}
250  Forum 2005-2010 (read only) / Exhibition / Re: Arduino as Capacitive Sensor on: May 31, 2009, 09:39:03 pm
You are correct that the guard pin doesn't do much and can easily be omitted. This was a klugy way to implement a technique which is used with op amps and other high impedance (low current) circuits.

You can now use the [[http://www.arduino.cc/playground/Main/CapSense| capSense library]]  and use any pins you want. The results will vary a bit from pin to pin though.

But if you do want to make the wire insensitive and only the foil at the end sensitive, use shielded audio wire and ground the shield on the duino end only. (Make sure the shield on the other end doesn't touch the sensor, or it won't work.

Paul
251  Forum 2005-2010 (read only) / Exhibition / Arduino as Capacitive Sensor on: February 09, 2007, 09:57:38 pm
Some experiments with the Arduino as a capacitive sensor. All it requires is a 10 M resistor and a piece of wire. I was able to sense a hand about four inches from my 1.5" sq aluminum foil sensor.

Included are some machine code and port manipulation and an easy smoothing filter.


// CapSense.pde
// Paul Badger 2007

// Fun with capacitive sensing and some machine code - for the Arduino (or Wiring Boards).
// Note that the machine code is based on Arduino Board and will probably require some changes for Wiring Board
// This works with a high value (1-10M) resistor between an output pin and an input pin.
// When the output pin changes it changes the state of the input pin in a time constant determined by R * C
// where R is the resistor and C is the capacitance of the pin plus any capacitance present at the sensor.
// It is possible when using this setup to see some variation in capacitance when one's hand is 3 to 4 inches from the sensors
// Try experimenting with larger sensors. Lower values of R will probably yield higher reliability.
// Use 1 M resistor (or less maybe) for absolute touch to activate.
// With a 10 M resistor the sensor will start to respond 1-2 inches away

// Setup
// Connect a 10M resistor between pins 8 and 9 on the Arduino Board
// Connect a small piece of alluminum or copper foil to a short wire and also connect it to pin 9

// When using this in an installation or device it's going to be important to use shielded cable if the wire between the sensor is
// more than a few inches long, or it runs by anything that is not supposed to be sensed.
// Calibration is also probably going to be an issue.
// Instead of "hard wiring" threshold values - store the "non touched" values in a variable on startup - and then compare.
// If your sensed object is many feet from the Arduino Board you're probably going to be better off using the Quantum cap sensors.

// Machine code and Port stuff from a forum post by ARP  http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1169088394/0#0



int  i;
unsigned int x, y;
float accum, fout, fval = .07;    // these are variables for a simple low-pass (smoothing) filter - fval of 1 = no filter - .001 = max filter

void setup() {
  Serial.begin(9600);

  DDRB=B101;     // DDR is the pin direction register - governs inputs and outputs- 1's are outputs
  // Arduino pin 8 output, pin 9 input, pin 10 output for "guard pin"
  //  preceding line is equivalent to three lines below
  //  pinMode(8, OUTPUT);     // output pin
  //  pinMode(9, INPUT);      // input pin
  //  pinMode(10, OUTPUT);    // guard pin
  digitalWrite(10, LOW);  //could also be HIGH - don't use this pin for changing output though
}

void loop() {
  y = 0;        // clear out variables
  x = 0;

  for (i=0; i < 4 ; i++ ){       // do it four times to build up an average - not really neccessary but takes out some jitter

    // LOW-to-HIGH transition
    PORTB = PORTB | 1;                    // Same as line below -  shows programmer chops but doesn't really buy any more speed
    // digitalWrite(8, HIGH);    
    // output pin is PortB0 (Arduino smiley-cool, sensor pin is PortB1 (Arduinio 9)                                  

    while ((PINB & B10) != B10 ) {        // while the sense pin is not high
      //  while (digitalRead(9) != 1)     // same as above port manipulation above - only 20 times slower!                
      x++;
    }
    delay(1);

    //  HIGH-to-LOW transition
    PORTB = PORTB & 0xFE;                // Same as line below - these shows programmer chops but doesn't really buy any more speed
    //digitalWrite(8, LOW);              
    while((PINB & B10) != 0 ){            // while pin is not low  -- same as below only 20 times faster
      // while(digitalRead(9) != 0 )      // same as above port manipulation - only 20 times slower!
      y++;  
    }

    delay(1);
  }

  fout =  (fval * (float)x) + ((1-fval) * accum);  // Easy smoothing filter "fval" determines amount of new data in fout
  accum = fout;  

  Serial.print((long)x, DEC);    // raw data - Low to High
  Serial.print( "   ");
  Serial.print((long)y, DEC);    // raw data - High to Low
  Serial.print( "   ");
  Serial.println( (long)fout, DEC); // Smoothed Low to High
}


252  Forum 2005-2010 (read only) / Exhibition / Re: My stab at an Arduino Synth on: October 06, 2007, 11:15:36 am
Sorry, There seems to be a nasty glitch in the forum software that reacts to comment lines in code or something
Funny behavior. Either there's a limit to the size you can paste into the editor or something else is reacting to (comments maybe) something in my code.


I started an "Arduino Synth" page on the playground - find the code there.

http://www.arduino.cc/playground/Main/ArduinoSynth
253  Forum 2005-2010 (read only) / Exhibition / Re: My stab at an Arduino Synth on: September 27, 2007, 09:22:14 pm
Here's my synth code.
Sorry there's not more comments.

It has a bunch of pots hooked up to A/D
and an encoder (to change programs - on pins 2 & ??

I have an R2R (4 bit) ladder on board, but haven't tried it out yet - it needs some serious pin rearranging to get the R2R on better pins for bitmath manipulation.



Code:
// Synth code by Paul Badger   2007
#include <math.h>

#define outpin 9 // high order output

//analog inputs
#define pitchPot 5
#define modPot  4  
#define speedPot 1
#define phasePot 2
#define jukePot  3

#define stopPin 5

#define LEDbit0 10
#define LEDbit1 11
#define LEDbit2 12
#define LEDbit3 13

int randomWalkLowRange;
int randomWalkHighRange;



int val, runlevel;
volatile int encoder0PinA = 2;
volatile int encoder0PinB = 4;
volatile unsigned int encoder0Pos = 0;
int n = LOW;

int ptime, range, strt, inc;
int   k,  x, dur, freq, t,;
int i, j;
int sens, adder;

float ps, fpitch;         // variable for pow pitchShift routine

float noteval;
//note values
float A     = 14080;
float AS    = 14917.2;
float B     = 15804.3;
float C     = 16744;
float CS    = 17739.7;
float D     = 18794.5;
float DS    = 19912.1;
float E     = 21096.2;
float F     = 22350.6;
float FS    = 23679.6;
float G     = 25087.7;
float GS    = 26579.5;
float A2    = 28160;
float A2S   = 29834.5;
float B2    = 31608.5;
float C2    = 33488.1;
float C2S   = 35479.4;
float D2    = 37589.1;
float D2S   = 39824.3;
float E2    = 42192.3;
float F2    = 44701.2;
float F2S   = 47359.3;
float G2    = 50175.4;
float G2S   = 53159;
float A3    = 56320;
//rhythm values
int wh = 1024;
int h  = 512;
int dq = 448;
int q = 256;
int qt = 170;
int de = 192;
int e = 128;
int et = 85;
int dsx = 96;
int sx = 64;
int thx = 32;



float majScale[] = {
  A,  B,  CS,  D,  E,  FS,  GS,  A2,   B2,  C2S,  D2,  E2,  F2S,  G2S,  A3};
  float minScale[] = {
  A,  B,  C,  D,  E,  F,  GS,  A2,   B2,  C2,  D2,  E2,  F2,  G2S,  A3};
float creme[] =  {
  A,  CS,  D, CS,  D,  E,  CS,  D,   CS,  B,   A};
float cremeDur[] = {
  q,  q,  qt, qt,  qt,  q,  q,  qt,   qt, qt,  q};

void setup() {
  pinMode(outpin, OUTPUT);
  Serial.begin(9600);

  pinMode(LEDbit0, OUTPUT);
  pinMode(LEDbit1, OUTPUT);
  pinMode(LEDbit2, OUTPUT);
  pinMode(LEDbit3, OUTPUT);

  pinMode(stopPin, INPUT);
  digitalWrite(stopPin, HIGH);   // turn on pullups

  pinMode(encoder0PinA, INPUT);
  digitalWrite(encoder0PinA, HIGH);   // turn on pullups
  pinMode(encoder0PinB, INPUT);
  digitalWrite(encoder0PinB, HIGH);   // turn on pullups

  attachInterrupt(0, doEncoder, CHANGE);  // encoder pin on interrupt 0 - pin 2
  Serial.println("start");

  pinMode(outpin, INPUT); // turn off audio out
}


void loop(){


  runlevel = encoder0Pos;
  switch (runlevel){
  case 0:

  case 1:
    doJoker1();
    break;
  case 2:
    doScale2();
    break;
  case 3:
    doArp3();
    break;
  case 4:
    doCreme4();
    break;
  case 5:
    doCreme5();
    break;
    case 6:
    doScale6();
    break;
  
  }
}

//*******************************************************
void doJoker1(){
  sens = analogRead(pitchPot);
  //sens =500;  // hardwire for testing
  adder = max((sens/5),1);

  for (x=sens; x<=(sens + (analogRead(speedPot) * 5)) ; x+=analogRead(jukePot)){    
    if ( digitalRead(stopPin) == 0){
      break;
    }                    
    noteval = x;    // transpose scale up 12 tones - pow function generates transpostion
    dur = 100;
    freqout((int)noteval, sens/47);

    // delay(10);
  }
  delay(analogRead(modPot));
}
// endJoker1 ****************************************************
/*void arp2(){
 sens = analogRead(pitchPot);
 range = abs(512 - sens) * 4.0;
 strt =  sens * 1;
 inc=abs(512 - sens);
 if (inc == 0){
 inc = 1;
 }
 
 for (x=strt; ( x > (strt / 4)) && (x < (inc * 30)); x* = (1 + ((sens - 512) / 1023.00))){                      
 noteval = x;    // transpose scale up 12 tones - pow function generates transpostion
 dur = 100;
 freqout((int)noteval, inc);
 
 //   if ((abs(sens - analogRead(0))) > 2){ break;}
 }
 delay(analogRead(modPot);
 }  */

// end  ***************************************************

void doScale2(){
  ps = ((float)analogRead(jukePot)) * 24.0 / 1023.0;         // choose new transpose interval every loop
  for(x= 0; x<=15; x++){  
    if ( digitalRead(stopPin) == 0){
      break;
    }                  
    noteval = (majScale[x] / (float)(analogRead(pitchPot))) * pow(2,ps);    // transpose scale up 12 tones - pow function generates transpostion
    dur = analogRead(speedPot);
    freqout((int)noteval, dur);

    delay(analogRead(modPot));
  }
}

/****************************************************/

void doArp3(){
  Serial.println("arp");

  fpitch = (float)analogRead(pitchPot) / 64;
  Serial.print("fpitch = ");
  Serial.println(fpitch, DEC);
  if (fpitch == 0){
    fpitch = 1;
  }
  strt = pow(2, fpitch);
  Serial.print("strt = ");
  Serial.println(strt, DEC);

  for(x=strt; x<= strt * 4; strt = (strt * ( 1 + ((float)analogRead(jukePot)/1023)))){  
    if ( digitalRead(stopPin) == 0){
      break;
    }                  
    dur = analogRead(speedPot);
    freqout(strt, dur);
    delay(analogRead(modPot));
  }
}
/****************************************************/
void doCreme4(){
  randomWalkLowRange = 0;
  randomWalkHighRange = 10;

  i = randomWalk(analogRead(speedPot) / 32);
  noteval = creme[i] / ((float)analogRead(pitchPot));
  dur = ((cremeDur[i] * (float)analogRead(jukePot)) / 64.0);
  freqout(noteval, dur);
  delay(analogRead(modPot));
254  Forum 2005-2010 (read only) / Exhibition / Electronic art at Montreal Museum of Fine Art on: November 25, 2007, 01:44:03 pm
e-art: New Technologies and Contemporary Art
Ten years of accomplishments by the Daniel Langlois Foundation


September 20 to December 9, 2007
Free Free Admission
Jean-Noel Desmarais Pavilion
Level 3

e-art: New Technologies and Contemporary Art
To mark the tenth anniversary of the Daniel Langlois Foundation for Art, Science, and Technology (DLF), the Montreal Museum of Fine Arts will present works by ten artists from Canada and abroad who have received funding from the DLF. The exhibition e-art : New Technologies and Contemporary Art – 10 Years of Accomplishments of the Daniel Langlois Foundation will present an outstanding selection of spectacular works, some of which were specially commissioned for this event.


This exhibition includes a Philip Beasley piece with 40 networked Bare Bones Boards(Arduinos) that control muscle wire and page motor activators. Also lots and lots of Jim Campbell's work featuring low res LED video and more.

It closes Dec 9 so see it soon.

Paul Badger


255  Forum 2005-2010 (read only) / Exhibition / Re: Conecting Antenas to Arduino (simplified There on: April 29, 2007, 10:22:46 pm
This is not the thermin idea exactly but works a lot like one. A theramin, as I understand it, uses two radio frequency oscillators, and the audio signal is the beat frequency between them, that one controls by detuning one of the oscillators.

The reference below is a capacitive sensor that operates in low radio frequency


http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1171076259

Paul B
Pages: 1 ... 15 16 [17] 18