Digital Pin 0 and 1 (RX, TX)

if its a lowish impedance circuit it will be a problem.

Exactly the opposite, a high impedance load is no problem but a low impedance load will distort the signals coming in / out to / from the serial / USB chip.

Exactly the opposite, a high impedance load is no problem but a low impedance load will distort the signals coming in / out to / from the serial / USB chip.

Errmm, isn't that what I said ? :slight_smile:

Extrema apologias, yes that is what you said. :-[

In my defence I do have a cold at the moment.

Don't worry about it GM :slight_smile:

If an LED is okay, how about an array of them?

What I need to do is run a piezo speaker and four 20 segment bargraphs. I would like to hook the piezo up to one of the analog pins so I can do PWM, and use 18 more pins to drive the four bargraphs as set of eight in a 10x8 led array.

I would also like to hook a switch up so I can change the display mode.

That requires exactly 20 pins, which I have, IF I can make use of those serial pins without screwing up my ability to upload sketches.

So let's say Digital Pin 0 and 1 were each connected to the anodes of 8 leds, and the cathodes of those leds were connected to pins 10 thru A3 via some 82 or 150 ohm resistors.

Would I have any trouble uploading my sketches in that case?

I just looked up impedance, cause I wasn't sure if that was another word for resistance or something else, and I founf out it's resistance to alternating current.

So I guess that is why the leds will work? They're high-impedance because electricity can only flow through them one way?

If that is the case, out of curiosity, could one hook up low impedance stuff, like say, a switch, to those pins, without interfering with uploading sketches, as long as you placed a diode in series with it?

They're high-impedance because electricity can only flow through them one way?

Sorry that's not how it works. A diode would present a low impedance because it would short out half the time and the other half it would be open circuit. In effect the short wins and gives a low impedance.

Here impedance is used to indicate the load on a pin. What you have to consider is that the USB / Serial chip is trying to drive the arduino pin, if you put another load across it there might not be enough power to drive both the arduino and the load you put on the pin.

Good advice is not to mess with those pins unless you know exactly what you are doing. Use a shift register to get your extra outputs. You are also limited to the 200mA maximum output current from all the combined pins of the arduino.

Also, I guess this means that as long as you can disconnect whatever it is you have hooked up to that pin while you're uploading the sketch, you could reconnect it after the sketch is uploaded and everything will work fine? I plan to stick my pro-mini in an IC socket, so it occurs to me that I could simply unplug it if I need to update the sketch.

Or in the future, I could connect things via a socket and just unplug that one component from the board while uploading.

I guess this means that as long as you can disconnect whatever it is you have hooked up to that pin while you're uploading the sketch, you could reconnect it after the sketch is uploaded and everything will work fine?

Yes exactly. That is what I have done here:-
http://www.thebox.myzen.co.uk/Hardware/MIDI_Shield.html

Sorry that's not how it works. A diode would present a low impedance because it would short out half the time and the other half it would be open circuit. In effect the short wins and gives a low impedance.

Ah. :frowning:

Here impedance is used to indicate the load on a pin. What you have to consider is that the USB / Serial chip is trying to drive the arduino pin, if you put another load across it there might not be enough power to drive both the arduino and the load you put on the pin.

So what about the circuit I described?

If I have an LED with the anode connected to pin 0, and the cathode connected, via a resistor, to another pin, then as long as that other pin is low, there won't be a load, right? The serial pin may go high and low, but when it's low, no electricity would flow from one pin to the other, and when it's high, the led would prevent the electricity from flowing. Correct?

What state are the pins in when I reset the Arduino though? They are low, aren't they? If they're high, that might be a problem.

What state are the pins in when I reset the Arduino

They default to inputs so they are all high impedance.

Then the boot loader takes over and initialises pins 0 and 1 to use serial communication. So the TX (pin 1) is an output set high and the RX (pin 0) is an input. The Serial / USB chip is connected to these pins through a 1K resistor so it has a limited capacity for pulling pin 0 low if another load is attached to it. Similarly pin 1 is connected through a 1K resistor, if this has a load on it then it might not be able to drive the serial chip to the required voltage levels.

You said earlier that a high impedance load is no problem. And that an LED is such a high impedance load.

But you also indicated that a diode isn't a high impedance load. Or at least, that connecting a diode in series with a low impedance load wouldn't allow you to connect the low impedance load.

Does high impedance mean low resistance?

You also just said the pins are set to an input state which is high impedance. Does that also mean low resistance? I thought the input state was one where they went to ground via a large resistor, which is why you can use that state to charlieplex... because electricity won't flow easily.

But then you said:

Then the boot loader takes over and initialises pins 0 and 1 to use serial communication. So the TX (pin 1) is an output set high and the RX (pin 0) is an input. The Serial / USB chip is connected to these pins through a 1K resistor so it has a limited capacity for pulling pin 0 low if another load is attached to it. Similarly pin 1 is connected through a 1K resistor, if this has a load on it then it might not be able to drive the serial chip to the required voltage levels.

Given that it's been said leds are high impedance, and the pins are high impedance, and that it was said high impedance loads aren't a problem for the serial pins, why does it seem here like you're indicating that the setup I descibed will interfere with uploading the sketches?

I'm totally confused now. :frowning:

Let's start over.

Kind of depends exactly what you're doing with the digital pins beside using them for serial communications. If you're blinking LEDS with them it isn't going to be a problem, if its a lowish impedance circuit it will be a problem, of course your sketch will need to allow for it if you're using it for serial communication within the sketch

a high impedance load is no problem but a low impedance load will distort the signals coming in / out to / from the serial / USB chip.

What state are the pins in when I reset the Arduino?

They default to inputs so they are all high impedance.

Then the boot loader takes over and initialises pins 0 and 1 to use serial communication. So the TX (pin 1) is an output set high and the RX (pin 0) is an input. The Serial / USB chip is connected to these pins through a 1K resistor so it has a limited capacity for pulling pin 0 low if another load is attached to it. Similarly pin 1 is connected through a 1K resistor, if this has a load on it then it might not be able to drive the serial chip to the required voltage levels.

Okay, so I've been reading up on impedance, and what I've read seems to indicate that in general, impedance = resistance. Therefore, high impedance means high resistance.

If that's the case, then I'm guessing that those pins which are set to input, a high impedance state, are going to ground through a large resistor.

And when you say that it's okay to connect a high impedance load to the serial pins, what you mean is that it's okay to connect a load with a lot of resistance.

What I don't get is why that means an led is okay, but something else with a resistor in series is not.

What I also don't get is if it's the voltage that matters to the serial chip, then why is an led okay, but something else with a resistor is not. A resistor to my knowledge doesn't affect voltage levels. An led does.

Lastly, if an led is a high impedance load, and the pins are set to a high impedance state, then that's like twice the impedance. Shouldn't an LED connected (via a resistor) between one of the serial pins, and another pin therefore have no effect on the serial signal when it is off?

What I really need to know is if I can multiplex an array of led's using those serial pins for a couple of the rows without affecting my ability to upload sketches.

I could unplug the arduino to upload a sketch, but I'd rather not stress the chip plugging and unplugging it if I don't have to. I don't even know how easy it will be to get those header pins out of the IC socket once they're in there.

Hm, well the good news is once I get the pins into my 20 pin socket they seem to go in and out without too much difficulty... and I don't need to worry about bending them like with ic pins, so maybe pulling the arduino out to program it will work for me.

I'd still like to understand exactly what I can and can't do with the serial pins though.

Also, if pin 1 is set high when the arduino is reset, and shutting off the power to it is the same as a reset, then does that mean when I turn the power on, pin 1 is going to be high?

If pin 1 is high, and I have an led on that going to another pin, and the other pin is set to an input state... then the led is either not going to light, or will light dimly, correct?

How long after I apply power to the arduino does it take for the program to start running so I can set that pin to some other state?

If that's the case, then I'm guessing that those pins which are set to input, a high impedance state, are going to ground through a large resistor.

Sort of only it means they are effectively disconnected.

what you mean is that it's okay to connect a load with a lot of resistance.

Yes.

What I don't get is why that means an led is okay, but something else with a resistor in series is not.

No an LED is not a high impedance load. An LED is a load, it can be quite heavy (low impedance). If you put a bigger series resister with the LED it can make it a higher impedance BUT it has to be a much higher resistance than you would normally use and the LED will be quite dim.

and shutting off the power to it is the same as a reset

No shutting off the power is turning it off, it is not resetting it.

when I turn the power on, pin 1 is going to be high

When you turn the power on all pins are inputs (high impedance), when it starts the boot loader program makes it into an output and sets it high because that is the state of a serial line sending nothing.

How long after I apply power to the arduino does it take for the program to start running so I can set that pin to some other state?

It is about 3 seconds before the boot loader decides it is not going to get a new program and so runs the existing one.

No shutting off the power is turning it off, it is not resetting it.

I was told by someone else shutting it off is the same as resetting it.

Both resetting it and cutting power seem to put the arduino in a state where it will accept new programming, so what's the difference?

It is about 3 seconds before the boot loader decides it is not going to get a new program and so runs the existing one.

I have found that when I plug in my USB cable only partway, the program runs immediately. Are you saying that is not how it will behave when I simply apply power to it normally, without the breakout board attached? Why does it behave that way in this instance?

I was told by someone else shutting it off is the same as resetting it.

You was told wrong. Were you perhaps told turning off the power AND THEN turning it on again caused a reset?

Both resetting it and cutting power seem to put the arduino in a state where it will accept new programming, so what's the difference?

When you cut the power there is no power and so the board can not do anything, it is off.

have found that when I plug in my USB cable only partway, the program runs immediately.

You shouldn't do this as you have no idea as to what is being connected.

Were you perhaps told turning off the power AND THEN turning it on again caused a reset?

Yes. That's what I meant.

I have found that when I plug in my USB cable only partway, the program runs immediately.

You shouldn't do this as you have no idea as to what is being connected.

You're right of course, but that doesn't answer my question as to why it executes the code immediately in that instance.

So I was wondering, I have to send a signal through a transceiver to a receiver, does this mean I must use the pin 1 and 0?