Which way to go with my whishes

hi all,
i'm a beginner with arduino nano, made some little tasks like
switching led, writing to lcd, controling a servo an so far

my world is model railway

for this i want to control as many of controling units (like signals, railroad switches..)
by a list of flags (on,off) as possible with One Arduino (Nano), but the number of pins
for output available is limited..

I considered about using more than one Nano additionally coupling them
in a certain way.

I considered about multiplexing, but didnt understand
what i found in this forum..seems is possible with arduino ..

please tell me the simplest way to realize such a project :

  • I dont need programming advices as have some experience with c and java
  • want to find documentation to understand principles
  • look for infos (links) about additional components if needed

thanks in progress

What is your native language?

Using an I2C I/O expander can significantly increase the amount of pins available.

EDIT - Another option if you already have the parts and don't want to spend money is to use another Arduino as an I/O expander using Serial. This is an idea I had a while back but haven't tested, and it may work. You will have to program two boards though.

Look for port expanders. They might use I2C or SPI...

Using multiple Nanos just to get more pins will cause more hassle that it is worth. Better to use things like I2C or SPI expanders or shift registers.

MCP23008 8 bit I2C expanders or MCP23S08 8 bit SPI expanders

MCP23017 16 bit I2C expanders or MCP23S17 16 bit SPI expanders

PCF8574 8 bit I2C expander

74HCT595 8 Bit serial in parallel out shift register.

There may be other, applicable, devices depending on what you want to drive. Like high current shift registers or specialized LED drivers. We can make recommendations for appropriate devices based on individual needs.

1 Like

thanks all for advices..at now i simply guess SDL and SDA connect to Arduino (like
my lcd-modul) and GP-PINS connect to my railway parts like motor-bridge, signals,
switches..ok ?

SDL + SDA could be multiple connected by more than one expander, i.e ,
A0-A7 are 8 pinss = 4 expanders at 1 Arduino = 4 * 10 = 40 output-pins, ok ?

Whow !

that fits for my actual railroad..some pins are used otherwise i.e. for my lcd-device..

or am i dreaming ?

I am not sure that you understand the I2C bus. Many devices connect to those same 2 pins (SDA, SCL). Each device is identified by its unique address. There are 8 addresses available for each I2C expander chip. So you could have 8 MCP23017 chips connected to the I2C bus. That would give you 128 GPIO pins (16 GPIO x 8 addresses) by using 2 Arduino pins.

The Serial or SPI takes 3 Arduino pins - you can put several chips in a row and the 1 st chip will pass data to the 2nd chip and the 2nd chip to the 3rd chip etc so you can control many chips in a row with the three pins. The chips don't have individual addresses - you send a stream of 8 bit words for the 74HCT595 chip - then enough words have been sent you tell the chips to update their state. My last application I had 4 chips (4 x 8 = 32 outputs) on the three outputs of the Arduino.

Note on the 74HCT595 chip - you can't turn on all the outputs at 20ma at once as you will overload the chip. When I have wanted more outputs on at the same time I have used the TPIC6B595 - programs the same but sinks instead of sourcing like the 74HCT595

Hello
Take some time, serve a glas of wine lay back and read

Have a nice day and enjoy coding in C++.

thanks for this tip..just reading and drinking a glass of wine..
hope i understand hicks :sunglasses: