Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / Re: architecture degree project on: October 15, 2012, 09:27:09 pm
I have tested LEDs with 82 ohm resistors, plain just that and they work fine. So there must have been a mistake in wiring. I'll rewire everything again see what happens.

Meanwhile, I get back to the question about the code. Could this be because the structure of the code doesn't allow arduino to correctly distribute its sources over multiple functions running at the same time? And generally could this even be a problem in arduino or never mind how many functions it runs at the same time it can always deal with them?

That serial.print freezes as well, really annoying me, cant see the values the sensor is reading... However, when the sketch was simply running code for sensor without the LEDs and servos, serial.print was working fine...
2  Using Arduino / Sensors / Re: guitar pickup to analog pin? on: October 15, 2012, 11:53:40 am
It's possible, than what's  next, what do you need arduino to do with a signal?

http://coolarduino.wordpress.com/2012/06/22/audio-input-to-arduino/

i was thinking to map data to servo motion. I wanted to make some kind of vibrating surface for people to interact with and then read that vibration.
3  Using Arduino / Project Guidance / Re: architecture degree project on: October 15, 2012, 11:50:20 am
How much current do those LEDs require?

20mA
4  Using Arduino / Project Guidance / Re: architecture degree project on: October 14, 2012, 07:07:33 pm
Quote

To test the LED wiring and hardware, write a sketch that just turns all the LEDs on.

Each LED should have a current-limiting resistor in series with it. The important thing about the resistors is their resistance, not their Wattage. The required resistance would depend on how much current the LEDs require.

Thank you for quick response!

I realised i described poorly. I have 4 high intensity white LEDs with 82 ohm resistors (which i have tested and calculated, i think correctly). I will double check the circuit, might have done a stupid mistake in wiring, but i have checked numerous times. Could it be because arduino is not dealing with it properly, the way i structured the code, it cant distribute its power correctly? i am not sure if thats even possible to run into a problem like that, but worth asking as i dont know it.

Thanks
5  Using Arduino / Sensors / guitar pickup to analog pin? on: October 14, 2012, 06:38:41 pm
Hi all

Has anyone tried attaching a magnetic pickup to an analog pin to use it as a sensor?
How could this be done? i guess it needs an op amp circuit?
6  Using Arduino / Project Guidance / architecture degree project on: October 14, 2012, 05:53:42 pm
Hi all

I am quite new to arduino and its culture, so forgive for any obvious mistakes that may appear in my following case.

At the moment, I am prototyping for an architecture project, which is embodied in a form of a pavilion. Not many specifics at the moment, just a lot of experiments.
One of the prototypes has arduino at its heart. I have a capacitance sensor hooked up to a pencil drawing (hoping to further develop it into some kind of conductive surface), so that reacts to human's touch. The data in the sensor is transferred into servo motion (which controls some kind of building skin) and LED lights behind the skin. So the function of this prototype is to sense human touch which controls envelop, when there is contact, envelope unfolds exposing lights.

The things that I am struggling with and questions: 1. there seems to be some kind of a problem with LEDs, i have 4 leds in a circuit, each is wired trough 1/4 W resistor to its own digital pin, they respond, but not very bright almost unnoticeable. 2. on this one i think my coding is not right, everything is very jittery and lagging, and serial print freezes, i think thats because the structure of the code is not allowing arduino to process everything at the same time (this concept I am still not understanding, arduino can't process too much information at the same, so the code needs to give it breath room, is that correct?). Otherwise, the whole thing is working, but not very stable.

Code:
Code:
#include <Servo.h>


// Pin for the LED
int LEDPin = 13;
int LEDPin1 = 4;
int LEDPin2 = 5;
int LEDPin3 = 6;
int LEDPin4 = 7;

// Pin to connect to your drawing
int capSensePin = 2;
// This is how high the sensor needs to read in order
//  to trigger a touch.  You'll find this number
//  by trial and error, or you could take readings at
//  the start of the program to dynamically calculate this.
int touchedCutoff = 18;
Servo servoMotor;
Servo servoMotor1;
Servo servoMotor2;

void setup(){
  Serial.begin(9600);
  // Set up the LED
  pinMode(LEDPin, OUTPUT);
  pinMode(LEDPin1, OUTPUT);
  pinMode(LEDPin2, OUTPUT);
  pinMode(LEDPin3, OUTPUT);
  pinMode(LEDPin4, OUTPUT);
 
  digitalWrite(LEDPin, LOW);
  digitalWrite(LEDPin1, LOW);
  digitalWrite(LEDPin2, LOW);
  digitalWrite(LEDPin3, LOW);
  digitalWrite(LEDPin4, LOW);
 
  servoMotor.attach(8);
  servoMotor1.attach(9);
  servoMotor2.attach(10);
}

void loop(){
  // If the capacitive sensor reads above a certain threshold,
  //  turn on the LED
  int servoAngle = map(readCapacitivePin(capSensePin), 0, 40, 0, 179);
  if (readCapacitivePin(capSensePin) > touchedCutoff) {
    digitalWrite(LEDPin, HIGH);
    digitalWrite(LEDPin1, HIGH);
    digitalWrite(LEDPin2, HIGH);
    digitalWrite(LEDPin3, HIGH);
    digitalWrite(LEDPin4, HIGH);
   
  }
  else {
    digitalWrite(LEDPin, LOW);
    digitalWrite(LEDPin1, LOW);
    digitalWrite(LEDPin2, LOW);
    digitalWrite(LEDPin3, LOW);
    digitalWrite(LEDPin4, LOW);
   
  }
 
  // Every 500 ms, print the value of the capacitive sensor
  if ( (millis() % 200) == 0){
    Serial.print("Capacitive Sensor on Pin 2 reads: ");
    Serial.println(servoAngle);
    servoMotor.write(servoAngle);
    servoMotor1.write(servoAngle);
    servoMotor2.write(servoAngle);
  }
}

// readCapacitivePin
//  Input: Arduino pin number
//  Output: A number, from 0 to 17 expressing
//          how much capacitance is on the pin
//  When you touch the pin, or whatever you have
//  attached to it, the number will get higher
//  In order for this to work now,
// The pin should have a 1+Megaohm resistor pulling
//  it up to +5v.
uint8_t readCapacitivePin(int pinToMeasure){
  // This is how you declare a variable which
  //  will hold the PORT, PIN, and DDR registers
  //  on an AVR
  volatile uint8_t* port;
  volatile uint8_t* ddr;
  volatile uint8_t* pin;
  // Here we translate the input pin number from
  //  Arduino pin number to the AVR PORT, PIN, DDR,
  //  and which bit of those registers we care about.
  byte bitmask;
  if ((pinToMeasure >= 0) && (pinToMeasure <= 7)){
    port = &PORTD;
    ddr = &DDRD;
    bitmask = 1 << pinToMeasure;
    pin = &PIND;
  }
  if ((pinToMeasure > 7) && (pinToMeasure <= 13)){
    port = &PORTB;
    ddr = &DDRB;
    bitmask = 1 << (pinToMeasure - 8);
    pin = &PINB;
  }
  if ((pinToMeasure > 13) && (pinToMeasure <= 19)){
    port = &PORTC;
    ddr = &DDRC;
    bitmask = 1 << (pinToMeasure - 13);
    pin = &PINC;
  }
  // Discharge the pin first by setting it low and output
  *port &= ~(bitmask);
  *ddr  |= bitmask;
  delay(1);
  // Make the pin an input WITHOUT the internal pull-up on
  *ddr &= ~(bitmask);
  // Now see how long the pin to get pulled up
  int cycles = 16000;
  for(int i = 0; i < cycles; i++){
    if (*pin & bitmask){
      cycles = i;
      break;
    }
  }
  // Discharge the pin again by setting it low and output
  //  It's important to leave the pins low if you want to
  //  be able to touch more than 1 sensor at a time - if
  //  the sensor is left pulled high, when you touch
  //  two sensors, your body will transfer the charge between
  //  sensors.
  *port &= ~(bitmask);
  *ddr  |= bitmask;
 
  return cycles;
}


7  Using Arduino / Sensors / Re: Sound sensor to servo on: October 02, 2012, 05:29:12 am
Thank you for sharing! I am going to have a go with this later today, will report back!
8  Using Arduino / Sensors / Re: Sound sensor to servo on: October 01, 2012, 07:38:39 am
I was going to have lm358, but when i went to maplin electronics shop, they havent had that in stock since 2011, so i got a ts358cd and tl072cn instead!
9  Using Arduino / Sensors / Sound sensor to servo on: September 30, 2012, 03:32:19 pm
Hi all

This is my first post on here and first arduino encounter. I am as beginner as it gets!!!

With my project I am trying to achieve: read noise levels and convert them to servo motion.

At the moment I am at the first stage of building a sensor, i have an electret mic, with which i have built amplified circuit.
This is how it looks:



In arduino i get readings quite constant within 410-450
So i guess my amplifier isnt working so well

Any help would be appreciated
Thanks
Pages: [1]