Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Weird unexplainable behaviour on: January 30, 2013, 10:47:31 am
Hi,

I have wrote a simple program that tests external interrupts.

tx is connected to the gate of a mosfet and pin2 is the input of a square wave that goes up and down twice on each loop.

Here is the code:

int tx = 12;     
volatile int x = 0;

void setup()
{
  Serial.begin(9600);
  pinMode(tx, OUTPUT);
  attachInterrupt(0, increment, RISING);
}

void loop()
{
  digitalWrite(tx, HIGH);   
  delay(10);
  digitalWrite(tx, LOW);

  Serial.println(x, DEC);
  delay(1000);
}

void increment()
{
    x++;
}



When i dont turn my circuits battery on, the output is:

1
2
3
4
5
6
7.....

When it is on it is

1
345
346
600
623
689
1100...

Why am i getting such weirdness?

Surely when my external battery off and the external circut recieves no power, the input pin (2) should always be low and the output should be:
0
0
0
0
0
0

when it is on it should be
2
4
6
8
10...

I am totally confused by this.

Any tips or suggestions would be appreciated.

Thanks
2  Using Arduino / Project Guidance / Re: Time an analog comparison? on: January 27, 2013, 02:49:01 am
Of the flyback, the up and down parts of the signal.

Cheers for the links, will start reading ASAP smiley-razz
3  Using Arduino / Project Guidance / Time an analog comparison? on: January 26, 2013, 04:04:43 am
Hi,

I want to time the flyback voltage of an inductor.

I want to use an analog comparator and a timer.

Basically, on the upswing the timer begins and on the down leg the timer stops.



Is this possible with arduino?

4  Using Arduino / General Electronics / Max input voltages? on: January 19, 2013, 09:00:10 am
Hi,

Is there a page anywhere that lists the max input voltages for arduino?

What would happen if i input 9 volts to an arduino anolog read port?

Thanks
5  Using Arduino / Project Guidance / Re: Can arduino handle my circuit? What do i need? on: January 18, 2013, 09:01:27 pm
Great info smiley

Thanks for that
6  Using Arduino / Project Guidance / Re: Can arduino handle my circuit? What do i need? on: January 18, 2013, 12:14:40 pm
By the way, its for a pulse induction metal detector
7  Using Arduino / Project Guidance / Can arduino handle my circuit? What do i need? on: January 18, 2013, 10:00:41 am
Hello,

I have built the below circuit with a breadboard.



The bottom power supplies 5v is supplied by arduinos digital out port for 100ms and then off for 1 second.

The top battery is just a 9 volt battery.

I have an analog read coming from just above the 50 ohm resistor on the very right, and its signal pattern is displayed in the bottom right chart.

Basically, i want to be able to read a stream of voltages as the inductors flyback decays to zero.

The trouble is, when simulating the circuit with my software, using a 400uH coil (which is what i use in the real circuit) decays too quick, in microsecond territory, so i have to use a coil with larger inductance in the sim just so i can see the flyback decay pattern when i turn the circuit off.

Anyway, what would i need to do to make the flyback signal readable by arduino?

I currently recieve 0 when i run it as is so obviously the analogread is too slow to capture some of the flyback voltage.

Any help getting this working would be greatley appreciated.

If i could just take 3 or 4 samples before flyback voltage reaches 0 volts that would be good enough for now.

Thanks
8  Using Arduino / General Electronics / Re: Can someone please explain this simple NPN circuit? on: January 13, 2013, 09:49:04 pm
Its very useful.

Its called Yenka and its free smiley
9  Using Arduino / General Electronics / Re: Can someone please explain this simple NPN circuit? on: January 13, 2013, 10:12:53 am
Yep smiley-razz

Anther thing that confuses me, the real circuit flows from negative to positive?

My negative battery lead is ground in my real circuit and it works, but if i switch positive for negative, it doesnt work.

In other words, only conventional flow works with this circuit.

I'm so confused smiley-razz

Wish i could take a pic of my breadboard so someone could see it, but i will try explain it.

The transistor has its flat square edge facing me.

My positive battery lead, the red one, is first, connected to one side of an led, the other side of the led is connected to one side of a 330 ohm resistor, the other side of the resistor is plugged into the right pin of the transistor. (collector)

The middle pin is connected to arduino digital out pin 13 via a 10k resistor. (base)

The negative lead of my battery and arduino ground pin ar connected to the left pin of transistor. (emitter)

This circuit works but i dont understand why.

It makes sence if electrons flow from red lead to black. But if they flow from black to red, i dont get it.

10  Using Arduino / General Electronics / Re: Can someone please explain this simple NPN circuit? on: January 13, 2013, 01:20:31 am
spot on smiley-razz

Thanks, that worked

I was certain i had it the right way round.

From left to right with flat face toward me CBE

But for some reason, its EBC on this model.

Wierd..

Thanks again
11  Using Arduino / General Electronics / Can someone please explain this simple NPN circuit? on: January 13, 2013, 12:40:34 am
Hi,

I have built the very simple circuit on my breadboard but am getting weird result.



The 5 volt supply is from the arduino digital output pin 13 and flashes on and off every second like in the blink led tutorial.

The other is a 9v battery.

The transistor is a BC338.

Anyway, what happen is, the led stays on even without the arduino plugged in. I measured the voltage across the 10k resistor and it says 3.3volts. It alterates between 3.3v and 6.3v when i plug in arduino.

So confused.

I though no current would flow if arduino wasnt plugged in but somehow current flows from the 9v battery throught the base, to the arduino and also makes it out of the emitter to ground completing the circuit.

Why is this happening?

I tried another transistor, this time the BC547 and the same thing happen.

When i run this circuit on my simulator, it works when i manually flick the switch on and off.

Whats going on?

Thanks for any help
Pages: [1]