Show Posts
Pages: [1]
1  Using Arduino / Microcontrollers / Just busted 2 capacitors off my Arduino Mega 1280...can you identify them? on: September 02, 2013, 01:06:03 am
Hi there,

While trying to mount my Arduino Mega 1280, I accidentally busted the highlighted capacitors. I want to see if I can replace them to get it working. Can anybody identify the values needed?


Thanks!
2  Using Arduino / Programming Questions / Re: Calling a function with a variable as a part of the name on: July 04, 2013, 01:57:16 am


That's great! Thank you.
3  Using Arduino / Programming Questions / Calling a function with a variable as a part of the name on: July 04, 2013, 01:03:58 am
Hi there,

Simple question here. Is it possible to call a function with a variable as a part of the name? Here's an example where I would use something like this:

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

void loop(){
 
}

void a0(){
  Serial.println("a0");
}
void a1(){
  Serial.println("a1");
}
void a2(){
  Serial.println("a2");
}

for (byte i=0; i<3; i++){
  a/*HOW DO I INSERT i VARIABLE HERE?*/();
}

I'd like this for loop to call a0() a1() and a2(). Is this possible?

Thanks!
4  Using Arduino / Programming Questions / Re: Issues with StackArray library when passing object to function on: March 16, 2013, 12:14:04 pm
Also place that line at the top of your sketch to declare the function ( or above its first use ).

Oh wow, I had no idea I had to declare a function before using it. You don't usually have to do that for functions - why for this one? For anyone else confused, I found more info on this here: http://www.cplusplus.com/doc/tutorial/functions2/ – scroll down to Declaring Functions.

Obviously these were just placeholders for the real code I'm building within these functions. I just couldn't get the build_simple function to even accept the StackArray object, so I simplified it for the sake of this post. I will start to put my real code in and see how it takes it. Thanks for the help!

5  Using Arduino / Programming Questions / Issues with StackArray library when passing object to function on: March 16, 2013, 02:18:48 am
Hi there,

I'm using the StackArray library to create a few StackArray objects that I'd like to pass by reference to a function. Here's my code:

Code:
#include <StackArray.h>

StackArray <int> BD_rgb_stack;
StackArray <int> SD_rgb_stack;
StackArray <int> ST_rgb_stack;
StackArray <int> FT_rgb_stack;

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


void loop(){
  build_simple(BD_rgb_stack);
}


void build_simple(StackArray<int> drumArray){
  //builds a simple stack
    drumArray.push(1);
    //end stack 
}

And here's the error:

Quote
test.ino: In function 'void loop()':
test:33: error: 'build_simple' was not declared in this scope

It seems to be an issue with how the StackArray object is being passed to the build_simple() function. Am I declaring this function incorrectly?

Thanks!
6  Using Arduino / General Electronics / Re: Piezo Sensors + LED Strip = Weird readings on: February 10, 2013, 08:34:28 pm
There may also be electromagnetic induction causing interference from the LED circuit to the piezo.  PWMing a lot of LEDs
means a lot of EMI unless the circuit is shielded - each time the LEDs are switched on and off the rate-of-change of current
can be 10^8 amps/second or so - this will induce voltages in nearby circuits (as Faraday discovered).

Move the LEDs away from the piezo element.

Don't have open loops - these are bad news as the strength of interference is directly proportional to loop area -
always run your wires in a tight bundle, preferably twisted together (but separate bundles for LEDs and piezo,
of course!).

For instance the two wires from the MOSFET to the LEDs should be a twisted pair.  The wires from MOSFET to the 12V supply
should be a twisted pair.  There should be decoupling capacitors on the 12V rail right next to the MOSFET (at least 10uF,
100 would be better), to reduce the radiation back up the 12V supply wires.  Even though the MOSFET isn't directly
connected to the +12V rail you should run the 12V wire up to it, then away again to the LEDs.

Thank you for your help! I've separated out the 2 wires connecting the Piezo to the board (they were in a 6-conductor cable) and it seems to be working well! This is with everything kind of hacked together, so I'm going to connect everything up in a more stable/permanent way and test it out. It did seem that running the Piezo signal along side an unshielded high amperage PWM signal is what gave me crazy readings. I also found that it was only an issue when my program was outputting a PWM signal (anything other than 0 and 255), which would make sense.

Thanks again for your response! Very helpful.
7  Using Arduino / General Electronics / Piezo Sensors + LED Strip = Weird readings on: February 10, 2013, 04:49:19 am


Hey all. I have a circuit that I'm pretty stumped on. I'm a novice working on a project way over my head (but am so close!)

I'm trying to have a piezo sensor activate an LED strip using an Arduino Mega. My circuit is more complex than what I'm showing above, but I believe this is the problem area. It's really just this circuit repeated a number of times with different arduino pins.

The LED strip takes 12v, and has each set of lights in parallel with resistors built in (I'm showing 100ohm as a placeholder, not sure what it actually is). The current is about 3 amps. The trouble arises only when 12v is connected to the circuit and the LEDs are on. When the 12v is disconnected (and only 5v is connected from the USB), all LEDs are off, and I get a nice consistent reading when I tap the piezo. When I have the 12v connected and the LEDs set to LOW in my program, still nothing out of the ordinary (no readings). As soon as I set the LEDs to any value higher than 0, the Piezo actually starts buzzing quietly and the analog input pin gives me rapid very high readings. It's as if the load from the LEDs is partially sinking through the Piezo and into the analog in! Is this possible?

In an attempt to stop that from happening, I placed a 10uF capacitor between the negative side of the Piezo and ground. Same results.

Is there another component I need in the mix, or a change in my circuit? Any help is greatly appreciated!

Here is my test code in case this helps:
Code:
const int redPin = 5;
const int greenPin = 6;
const int bluePin = 7;
const int knockSensor1 = A0; // the piezo is connected to analog pin 0
const int threshold = 150;  // threshold value to decide when the detected sound is a knock or not
float r = 0;
float g = 0;
float b = 0;
 
 boolean fireR = false;
 boolean fireG = false;
 int countdown = 0;

int sensorReading1 = 0;      // variable to store the value read from the sensor pin

int c=0;

void setup() {
pinMode(greenPin, OUTPUT);
pinMode(redPin, OUTPUT);
pinMode(bluePin, OUTPUT);
analogWrite(greenPin, 0);
analogWrite(redPin, 0);
analogWrite(bluePin, 0);

Serial.begin(9600);       // use the serial port
}

void loop() {
  // read the sensor and store it in the variable sensorReading:
 
  sensorReading1 = analogRead(knockSensor1);
 
  ///Serial.println(sensorReading);
  // if the sensor reading is greater than the threshold:
  if (sensorReading1 >= threshold) {

    //pick random color
    r = random(255);
    g = random(255);
    b = random(255);

   
    analogWrite(redPin, r);
    analogWrite(greenPin, g);
    analogWrite(bluePin, b);
     
    Serial.println();
    Serial.println();
    Serial.println("FIRE! ");
    Serial.println(sensorReading1); 
    Serial.println();
    }
delay(5);  // delay to avoid overloading the serial port buffer
}
8  Using Arduino / General Electronics / Re: Transistor Question - Gate threshold voltage not providing max flow? on: October 05, 2012, 01:10:10 am
To clarify - it stopped working after testing my initial circuit, not the circuit you sent.
9  Using Arduino / General Electronics / Re: Transistor Question - Gate threshold voltage not providing max flow? on: October 05, 2012, 01:05:33 am
You're not using it correctly.
N-channel parts like to sink current.
Use a 150 ohm resistor between arduino pin and the gate.

Thanks for the reply. I think I might have fried my uno while testing this. It was getting very hot after sending 12v straight from the Vin to the gate of that transistor. Is it possible something was overloaded with current because I didn't use a resistor between the power source and the gate? Right now the on LED and L LED illuminate when I plug it in but I can't upload and the reset button doesn't affect it at all. I guess this is a lesson in how not to use the Vin. It didnt occur to me the kind of current I was driving to the gate, I guess I thought it had internal resistance? Does this add up or does it sound like another issue?

Thanks again for your help!
10  Using Arduino / General Electronics / Transistor Question - Gate threshold voltage not providing max flow? on: October 04, 2012, 09:16:11 pm
Hi there,

I have a quick question regarding MOSFET transistors. Here's the piece in question: 2N7000_D26Z

In the datasheet it says the gate threshold voltage is .8 min, 3 max, and 2.2 average. When I try supplying 5v to the gate and the source, I only get 2.3v at the drain. When I give the transistor 12v at the gate and 5v and the source, I get the full 5v at the drain.

I'm wondering why this transistor doesn't provide full connectivity between source and drain when the gate is given 5v? Isn't that more than enough according to the spec sheet? I tried this with another transistor I have (511-STP16NF06L) and have the same results.

Here's a little schematic of my test condition in case this changes anything.




Thanks!
11  Using Arduino / Sensors / Using piezo as knock sensor with medium length cable produces noise on the input on: September 03, 2012, 01:17:58 pm
Hi there,

I'm trying to set up a simple knock sensor for a project where I'll later use about 20 of them. I'm running into a weird issue where the length of the wire connecting my piezo to the breadboard is affecting the fidelity of the signal.

Here's my simple circuit:



The problem arises when I lengthen Wire 1 or Wire 2 (I'll get into exactly what's wrong further below). I've done this by soldering some stranded wire that I have (probably about 18 gauge) to the wires already soldered onto the piezo, and then soldering jumpers to the other side so I can connect it to my breadboard. This wire is only about 3 feet. The wire was part of a power cable where the plastic sleeving had both wires stuck together, so I thought it might have been some weird reaction they were having to being so close, but I ripped them apart and tried lengthening each wire independently with the same results.

I'll go through the symptoms here:

- This is only an issue when I've got a 12v power source plugged into the Arduino (which I will need to have for the rest of the project). 5v from USB doesn't create this affect.
- I have a program set up to show me what the analog input is reading at any given time (above a "1" value). Using just jumpers soldered to the piezo, I get zero noise - meaning it's not giving any signal above "2". When the wire is lengthened, I get a rapid peaks up to about 20, and even hire peaks when I move the wire.
- I've even tried isolating other connection issues by soldering both a small jumper and the large wire to the the piezo and switching off between them. Same results.

What's weird is that this only happens on 12v, but it still works fine with the small jumpers. I have no idea what's going on.

Any thoughts? I appreciate the help!

Thanks,
David
Pages: [1]