Show Posts
Pages: 1 [2] 3 4
16  Forum 2005-2010 (read only) / Interfacing / Re: Communication between LEDs on: December 03, 2009, 12:35:43 pm
for this experiment I'm trying, yes i do want to use LEDs...I just want to see the many things i can do with this..

but anyways, in the code, i see there is Cathode and Anode, which i assume mean the anode and cathode of an LED? would it be possible if i manipulated those to do what i want?

i found something on youtube that reflects about the same idea of what i would like to do: http://www.youtube.com/user/randomskk

17  Forum 2005-2010 (read only) / Interfacing / Re: Communication between LEDs on: December 03, 2009, 10:56:53 am
how can i approach this?

I am tempted to just fix up the digital write somehow so that when the one LED on pin 13 is on and the other LED detects it, it will go on. I wish i was more code-savvy
18  Forum 2005-2010 (read only) / Interfacing / Re: Communication between LEDs on: December 03, 2009, 10:04:34 am
yes i did look at this, but i was hoping for some other form of references...

i think there is an issue with the code....

i'm not exactly sure what
19  Forum 2005-2010 (read only) / Interfacing / Communication between LEDs on: December 03, 2009, 09:35:50 am
So, i am trying to figure out how to make two LEDs communicate with each other. More specifically, when one LED(1) is turned on, the other LED(2) will turn on, and when the LED(1) shuts off, the other LED(2) will also turn off.

Code:
// ARDUINO

//TOUCH SENSING BETA - LED TURNS ON WHEN LIGHT IS PRESENT
//BY: RICARDO DE LEMOS 1/17/2007
int led1 = 13;
int cath = 2; // negative
int ando = 3;  // positive

void setup()
{
  pinMode(led1, OUTPUT);
  pinMode(cath, OUTPUT);
  pinMode(ando, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  //REVERSE BIAS
  digitalWrite(cath, HIGH);
  digitalWrite(ando, LOW);
  //CHARGE LED
  delay(6);
  //READ LED CAP
  pinMode(ando, INPUT);
  delay(6);
  //WRITE TO LED
  if (digitalRead(ando) == LOW)
  {
    digitalWrite(led1,HIGH);
  }
  else
  {
    digitalWrite(led1,LOW);
  }
  //RESET
  pinMode(ando, OUTPUT);
}

And the translated version for Processing.

//Processing


//biblio

import processing.serial.*;

import cc.arduino.*;

Arduino arduino;

//variabler

int turnOnLED = 13;

int sensorP = 3;

int sensorN = 2;

//setups

void setup(){
 
 size (500,500);
 
 println(Arduino.list());
 
 arduino = new Arduino(this, Arduino.list()[0], 9600);
 
 arduino.pinMode(turnOnLED, Arduino.OUTPUT);
 
 arduino.pinMode(sensorP, Arduino.OUTPUT);
 
 arduino.pinMode(sensorN, Arduino.OUTPUT);
 
}

 //drawing

void draw(){
 //charging LED
 arduino.pinMode(sensorP, Arduino.OUTPUT);
 arduino.digitalWrite(sensorN, Arduino.LOW);
 arduino.digitalWrite(sensorP, Arduino.HIGH);
 
 delay(6);
 arduino.pinMode(sensorP, Arduino.INPUT);
 if(arduino.digitalRead(sensorP) == Arduino.LOW){
   background(255);
 }
println((arduino.digitalRead(sensorP)));
println((arduino.digitalRead(sensorN)));
}

does this code look right?

also, is there any specific way of actually building this? Any links or suggestions would be very helpful
20  Forum 2005-2010 (read only) / Interfacing / Re: making a bubble machine with a touch sensor? on: November 20, 2009, 08:41:51 am
hmmm this may sound very strange....

i made another touch sensor just using the connections in the MOSFET.
Basically, i just touch the resistor and it turns the bubble machine on and off!!!!
21  Forum 2005-2010 (read only) / Interfacing / Re: making a bubble machine with a touch sensor? on: November 20, 2009, 07:28:20 am
alright

using the code that i have here

Code:

// 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
int ledPin =  10;    // LED connected to digital pin 10


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

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 8), 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

if(x > 1) {
  digitalWrite(ledPin, HIGH);
}
else
  digitalWrite(ledPin, LOW);
    
 

}



now the interesting part is, when i wire the capacitive touch sensor to the appropriate areas (ie digital pin 8,9, 10 being the mosfet connection), the serial monitor does not produce any values.
I also attached the LED to make sure it lights up, and it doesnt.
22  Forum 2005-2010 (read only) / Interfacing / Re: making a bubble machine with a touch sensor? on: November 20, 2009, 06:06:45 am
@grumpymike

yes! the machine turns on and off at 3 second intervals!

 i have the capacitive touch sensor code and i uploaded it and attempted to connect it the appropriate way along with the MOSFET connections....

funny thing is, the touch sensor bit is not even working at all with the MOSFET....

how can this be so?
23  Forum 2005-2010 (read only) / Interfacing / Re: making a bubble machine with a touch sensor? on: November 19, 2009, 12:31:17 pm
alright i got the blinking LED code to work and it blinks every 5 seconds....

now how would i make this machine turn on with code?
24  Forum 2005-2010 (read only) / Interfacing / Re: making a bubble machine with a touch sensor? on: November 19, 2009, 12:11:14 pm
alright...my bad...i readjusted it and now when i touch the two (+)s it does NOT turn on...alright

i have not yet written the code for the blinking...
would be something like this?
 
Code:
int ledPin = 10;                 // LED connected to digital pin 10

void setup()
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(1000);                  // waits for a second
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(1000);                  // waits for a second
}
25  Forum 2005-2010 (read only) / Interfacing / Re: making a bubble machine with a touch sensor? on: November 19, 2009, 11:36:56 am
alright....i did according to your instructions, and whenever i connect the (+) terminal of the battery to the (+) of the machine, the machine turns on! Fantastic....

now what would be the next logical step from here? i really am not very good at schematically drawing circuits...so i apologize for that
smiley-sad

26  Forum 2005-2010 (read only) / Interfacing / Re: making a bubble machine with a touch sensor? on: November 19, 2009, 10:20:19 am
alright here is the image of the setup i have so far with the MOSFET connections and the touch sensor setup (minus the LED which goes into pin 10).


on the side with the (+) and (-), that is the touch sensor components, including a wire from pin 8 to (+) a resistor connecting to (-) and another wire from the (-) to pin 9.

The mosfet components are the rest
27  Forum 2005-2010 (read only) / Interfacing / Re: making a bubble machine with a touch sensor? on: November 19, 2009, 08:01:37 am
alright....i tried taking the source pin of the MOSFET and inserting it into the ground of the digital output of the arduino. Also, i connected the negative terminal of the 9V battery of the bubble machine to pin 10. However, it just turns on regardless of whether i touch the capacitive sensor or not.....


@ Grumpy Mike
i actually connected the MOSFET to the breadboard...where exactly on the arduino pin can i insert it?
28  Forum 2005-2010 (read only) / Interfacing / Re: making a bubble machine with a touch sensor? on: November 19, 2009, 07:20:18 am
@grumpyMike

alright, so what "lingo" do i use for a MOSFET in coding?
could you give me an example
29  Forum 2005-2010 (read only) / Interfacing / Re: what kind of relay should i get? on: November 18, 2009, 01:41:50 pm
alright, thanks for the suggestions first off.

I decided to mess around with the mosfet and get that working, and it has been quite successful!!

 Now the next step would be to make this more interactive, ie using a touch sensor.

So basically, the touch sensor will work with MOSFET to turn on  the machine.  

the touch sensor code is the following:
Code:
// 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
int ledPin =  10;    // LED connected to digital pin 10

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

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 8), 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

if(x > 1) {
  digitalWrite(ledPin, HIGH);
}
else {
  digitalWrite(ledPin, LOW);
  }
delay(10); //Delay for good measure! (not strictly necessary but might as well have it)


}

Anybody have any suggestions or ideas?

30  Forum 2005-2010 (read only) / Interfacing / making a bubble machine with a touch sensor? on: November 18, 2009, 08:50:53 am
hello

so i am trying to make a 9V bubble machine that is motion-sensored and will turn on when someone walks by. Basically, i rewired the wires in the bubble machine such that 2 wires are extruded that when put together will activate the machine. Now i tried to put this on my arduino. But frankly, i am at a loss. What kinds of things should i be looking at for putting on the arduino? Would i need a relay?
Pages: 1 [2] 3 4