How many devices can be controlled

Hi,

I am only now starting to look at Arduino so I have a few newbie questions -

  • How many different external electronic circuits can Arduino control simultaneously? Does this change with the model of the Arduino?
  • If the answer to 1 is 'Yes' where can I find guides (hardware & software) for this?
  • Can I connect a few Arduino boards to the same one PC USB port via a USB hub?
  • Again, if the answer to 3 is 'Yes' where can I find guides for this?

Many thanks for your help.

(deleted)

How many different external electronic circuits can Arduino control simultaneously? Does this change with the model of the Arduino?

this depends on what you mean by control. turn on a switch, or juggle flaming chainsaws?

The Mega has 54 digital pins, an I2C bus, many hardware serial ports, is capable of hosting CANbus...

Menashay:
I am only now starting to look at Arduino so I have a few newbie questions -

It will be much easier to give you useful advice if you describe what you would like to create.

...R

What is your technical background?

Thank you for your replies.
As to my background, I learnt electronics; I used to fix electronic circuits and I used to design electronic circuits but very many years ago. Now I develop software.

I know to look at the Internet and read documents however this takes time. Before I start spending the time I wanted to know the capabilities of this microcontroller called Arduino.

With respect to my needs (or what circuit I want to build), at this stage my questions were general in nature just to better understand this device. To the best of my understanding Arduino really works in a loop, one pin at time which due to the frequency appears to be simultaneous control. Please correct me if this is wrong.

A general question - what if my external electronic circuit requires a parallel bus as input so that all pins change simultaneously. In this case all output pins need to change at the same micro second. Is this achievable with Arduino (perhaps with additional 'add-on' boards)?

(deleted)

"The Mega has 54 digital pins" -->> The Mega has 70 digital pins. 16 of them may also be used as analog inputs. Up to 8 can be changed at one time with a PORTx statement:
PORTx = 0b01010101; // binary bits
PORTx = 0x55; // or hex
PORTx = yourValue; // variable from somewhere
PORTx= yourArray[index]; // element from an array

"my external electronic circuit requires a parallel bus as input so that all pins change simultaneously" This board, controlled by a 328P (same chip as the Uno) has 96 outputs for example.


You load the 12 bytes for the output, and a 2nd clock signal updates all outputs together. It is hardwired for SPI.transfer:

digitalWrite (ssPin, LOW);
for (x=0; x<12; x=x+1){
SPI.transfer[yourArray[0]]); // array of 12 bytes
}
digitalWrite (ssPin, HIGH); // all outputs update on this rising edge

spycatcher2k has me beat with 500. I've done another design for up to 45 shift registers, with 360 outputs.

So yes, lots of outputs can be updated simultaneously. The board above is daisychainable, so many more outputs can be controlled by the one processor.

Menashay:
so that all pins change simultaneously.

That raises two questions in my mind ...

What is the maximum acceptable timing error between the slowest and fastest pin? (Many people use the term "simultaneous" very loosely).

How often do the pins need to change? (The suggested business of pre-loading a register and then updating the state of all the pins takes some time).

Which is why a description of what you actually want to do is required to avoid a lot of time wasting with superfluous questions and answers.

...R

Menashay:
A general question - what if my external electronic circuit requires a parallel bus as input so that all pins change simultaneously. In this case all output pins need to change at the same micro second. Is this achievable with Arduino (perhaps with additional 'add-on' boards)?

You can change 8 pins of the "bigger" AVR's in a single 62 ns cycle. In 1 us you can change 4 ports and have cycles left over.

Still at high frequency events the AVR's hit limits. Minimalist sketches can run loop() at over 110K but not much faster.

We have 2 clock functions that return 32-bit unsigned values, millis() and micros(). Micros() is good to 4 us, it takes that long to get the 4 times word length value --- which should serve to show practical limits of the chip. You can time closer counting fixed-cycle loops but that's it.

If you write tight code you could get reasonable responses to inputs started in 100 us or less. I have some serial input code that tasks in on average <40 us steps, no big surprise as that's 640 cycles on an 8-bit RISC cpu.

If you need much more speed, look into the ARM chip Arduinos and compatibles. Some run well under $20.