How can i change status pin to low on boot

Dear guys,
i wrote also in italian this post...If i connect arduino to a simple led, or a transistor during the boot there is some current passing over it. In the case of a transistor connected with an high power relay can give many problems for 220v dispositive.
I wish to know how avoid this electronically or if i can change status of pin during the boot (before setup routine is called)
Thank you

Which pins?

put pulldown resistors on the pins. I've read here that on reset, the pins are setup as inputs until the sketch kicks in.
You can confirm that by reading the atmel datasheet for your part. (Atmega 168? 328? 1280? other?)

From the 328 datasheet
"The port pins are tri-stated when reset condition becomes active, even if no clocks are running."

So add pull-down resistors if you can't have floating inputs.

Problem is that pins are SDA and SCL pins, that are connected with a I2C port expander pcf8574.
They are pulled up so i think that i cant pull them down too...

Problem is that pins are SDA and SCL pins, that are connected with a I2C port expander pcf8574.

Eh? Then none of your original examples count. Surely you don't have LEDs, transistors, and relays on the I2C lines :slight_smile:

LEDs don't matter, and for a transistor/relay tie the pin low as Crossroads said.


Rob

connections are ARDUINO->I2C PORT EXPANDER->TRANSISTOR->RELAY
When i gve power to arduino for 4-5 second (the same time the arduino led blink) all output are set to high.
I obtain the same problem if i connect an lcd display I2C to arduino...it activate baklight for some seconds...pleae help.

So the problem has nothing to do with the Arduino, it's the port expander.

What chip is it?

I obtain the same problem if i connect an lcd display I2C to arduino...it activate baklight for some seconds..

If the i2c lines are pulled up then no commands or rubbish should go to the LCD, therefore it will do nothing. Normally the back light is a separate connection. Are you saying that this LCD has control over the backlight using i2c commands?


Rob

the chip is pcf8574
i do't think it is the problem because if i connect LCD to I2C without pcf the problem persists...
I can add you an information to understand the problem..
if i write analogRead(4)
and analogRead(5)
before calling wire.begin()
i obtain in output 583 and 1023
Are there normal parameters??
Thank you for the help

So the problem has nothing to do with the Arduino, it's the port expander.

Not necessarily. There is a similar complaint in the Motors section about an Arduino Uno that is fiddling with the PWM pins while the bootloader runs. There is nothing blatantly wrong in Optiboot but westfw found a very subtle bug involving the R0 (or R1) register initialization. It is possible that @gladiatoreAde is effected by that bug (or another very subtle bug).

I obtain the same problem if i connect an lcd display I2C to arduino...it activate baklight for some seconds..

If the back-light is being controlled by a PWM pin then @gladiatoreAde's problem may be identical to the one reported in Motors.

@gladiatoreAde: Which Arduino are you using?

hi coding,
my arduino is 2009.
I discovered that PCF8574 has default output on HIGH state, for te lcd i don't know..but it is not so important (relay all on is worst). I can use a SN74HC540N but i haven't more space on my shield.. :frowning:
Can you tell me if in your opinion MCP23008 would have the same problem?
Tank you

my arduino is 2009

Have you changed the bootloader? Does the board have the original processor?

Can you tell me if in your opinion MCP23008 would have the same problem?

I have no idea.

You really need to provide a schematic.