can I switch 2 pins together?

Hi. beginners question: I know I can say “digitalWrite (pinX, HIGH)”, etc… But can I say “digitalWrite, connect pinX with pinY”? That way I wouldn’t have to use relays. If there is no way to internally connect pins could anyone please tell me why not? Isn’t that something people need to use all the time? thank you

karotto:
Hi. beginners question: I know I can say "digitalWrite (pinX, HIGH)", etc.. But can I say "digitalWrite, connect pinX with pinY"? That way I wouldn't have to use relays. If there is no way to internally connect pins could anyone please tell me why not? Isn't that something people need to use all the time? thank you

You can write two digitalWrite statements, one for each pin.
But please explain how that means you do not need to use relays.
You cannot physically connect two output pins together to double the output current available.
Thanks.. Tom...... :slight_smile:
What is your application?

You cannot physically connect two output pins together to double the output current available.

You can if they are on the same port and you use direct port manipulation to ensure that they are ALWAYS at the same logic level. But this is probably not something for a newbie to try, and anyway amplifying a single pin is better.

If you think that 2 pins will do the job then you have a load of no more than 40-50mA and a relay would be overkill, just use a transistor.

Hi. I have two wires coming from an external device and I simply want the Arduino to connect those 2 wires when certain conditions are fulfilled. Like an on/off switch. I just dont want to always have to use relays if the current running though the wires is very low (like in my case a thermostat). Thank you

You cannot physically connect two output pins together to double the output current available.

Actually you kind of can.... I have done this is a couple of applications such as controlling 5V power to a Bluetooth adapter. Many people have copied that application and it seems to work fine..

karotto:
Hi. I have two wires coming from an external device and I simply want the Arduino to connect those 2 wires when certain conditions are fulfilled. Like an on/off switch. I just dont want to always have to use relays if the current running though the wires is very low (like in my case a thermostat). Thank you

Hi, no you cannot regard the arduino outputs a switches like in a relay.
They are voltage outputs that are 5V for HIGH and 0V for LOW with respect to gnd.
Tom... :slight_smile:

Correct, now we know what he wants to do he can't used Arduino pins.

Karatto, you have to use a relay or relay-like component like a FET.

gosh, really? I have a freaking microprocessor and all it can do is high or low? That seems like an odd limitation and utilization of computing power. How simple can a request be wanting to connect various pins to each other? Thank you

karotto:
I just dont want to always have to use relays if the current running though the wires is very low (like in my case a thermostat).

What is the voltage of that thermostat.
Is it AC or DC (heaters/airconditioners could be 24volt AC).
What is "very low current".
Can one of the thermostat wires be grounded to Arduino ground.

If you can't answer one or more of these questions, then use a relay.
"Intelligent" battery powered thermostats use a latching relays, so no power is used when on or off.
Leo..

karotto:
Hi. I have two wires coming from an external device and I simply want the Arduino to connect those 2 wires when certain conditions are fulfilled. Like an on/off switch. I just dont want to always have to use relays if the current running though the wires is very low (like in my case a thermostat). Thank you

It sounds like you want to use a transistor as a switch. A 5 cent BJT and a 2 cent resistor should do.

karotto:
gosh, really? I have a freaking microprocessor and all it can do is high or low? That seems like an odd limitation and utilization of computing power.

That is the way electronics works, get used to it buddy or take up another hobby.

How simple can a request be wanting to connect various pins to each other?

Sure the request is simple, the implementation is not. When / if you learn more you will know this.

I'm pretty sure that the OP just wants a way to short a couple of thermostat wires, same as what a mercury switch does in the bimetal coil thermostats.

I'd say easy but the next steps will be adding sensing and process code to what is already delay ridden.

If the signal on the exsisting switch is DC, you can use an optocoupler for the switching, controlled by the Arduino.

On top of that you will have galvanic isolation, so nothing gets fried if one of the parts shorts out.

Introduction to using Optocouplers

// Per.

Thank you for your replies. I know how to do my project. But as a theoretical discussion could someone please chime in on why microprocessors only do high or low? Wouldn't microprocessors be infinitely be more useful if they had more features you could do with the pins, like connect them? thanks again

High or Low only?
On or Off
Yes or No
Voltage or No Voltage.
1 or 0

Binary is base 2 i.e. 1s and 0s

Transistors can easily be turned On (0v on the output, NPN) or Off (5v on the output, NPN).

Configuring outputs to 0v and 5v only (5 volt logic), results in no or very little power consumption from the power supply.

.

Switching pins together to increase capacity is sometimes even recommended. For example, the port expander PCF8574, one often used with the Arduino, has this in the data sheet:

10.3 High current-drive load applications
The GPIO has a minimum guaranteed sinking current of 10 mA per bit at 5 V. In
applications requiring additional drive, two port pins may be connected together to sink up
to 20 mA current. Both bits must then always be turned on or off together. Up to five pins
can be connected together to drive 80 mA, which is the device recommended total limit.

karotto:
Thank you for your replies. I know how to do my project. But as a theoretical discussion could someone please chime in on why microprocessors only do high or low? Wouldn't microprocessors be infinitely be more useful if they had more features you could do with the pins, like connect them? thanks again

Digital pins are only high or low and take a fraction of a microsecond to read.

They can be moded 4 different ways just as fast, circuit changes made that allow tricks like using a led as both light and light detector in the same few milliseconds that is too fast for humans to notice. When the 0's and 1s come so fast the data generated can aggregate to very fine results.

Analog pins (often the same pin can be used as digital, all Uno analog pins can) can be read as 10 bit values in only 105 microseconds (more if you just switched pins and allow settle time) or as 8 bit ADC quicker. ADC is a chip feature.

If you go to the ATMEL site they have datasheets for every chip family, be sure to get the full version to have full details and not just an overview of the features available.

This "connect them" thing is your idea. The function may be safely possible but with the description you give, the details left out may hide exactly why not to. AVR pins can only take 40mA for so long and more for less to none. What is your idea of low current? You don't say so how to expect a solid answer?

Put the wires on the collector and emitter of the right BJT (need details to know what is right) and a single AVR pin to the base through a resistor and you can switch more current than the chip can take.

Try to find solutions through what is possible (again, details) rather than cry about what you don't know.

karotto:
Wouldn't microprocessors be infinitely be more useful if they had more features you could do with the pins, like connect them?

No.
From your position as a beginner that knows nothing about electronics you might think so but in fact it is not. This is because it is difficult to implement and as others have said any current would be severely limited. But the concept of joining wires together is not very helpful. Look up "ladder logic" that is sort of what you are asking about. It is limited and arcane and has been greatly surpassed.

High and low is much more what you want, but it is difficult to convince you because you know so little. Look at it this way, if it was such a good idea it would have been implemented before now don't you think. Is it not a bit arrogant of you to not only think you have come up with something no one has before, but not to believe people with a lot more experience than you who tell you it is not a good idea.

karotto:
Thank you for your replies. I know how to do my project. But as a theoretical discussion could someone please chime in on why microprocessors only do high or low? Wouldn’t microprocessors be infinitely be more useful if they had more features you could do with the pins, like connect them? thanks again

Theoretically speaking microprocessors are limited to do only functions, that they created for. To make a decision. Look at your PC, CPU is surrounded many others devices, that serves to it’s needs, like hard drive, memory chips, video controllers and mother board itself with a few high speed busses/bridges. Follow your logic one CPU should fulfil all demands, but its not the case. Even for leaving species, brain and muscles are separated.

Why can't cars walk?