Arduino

Status
Not open for further replies.
Hi

I know you can increase the number of pins the Arduino has using shift registers. I was wondering is it possible to increase the number of pwm, scl, sda, sck, miso, mosi, and ss pins using shift registers. So for example could attach two wifi shields to the arduino using shift register on pins 11, 13, and 12 (spi pins).

Thanks
 
There are many integrated circuits (ICs or "chips) that can do these things.

For certain PWM speeds it would be possible to use a shift register to multiplex, just be aware that since you are effectively shifting out values then latching to turn them on, you will be dividing the maximum frequency of the pin that drives them. The same is true for the digital pins you mentioned, but you would need to understand these protocols well enough to write a library (or in place code, doesn't matter) that can clock out the pulses to the pins. Probably not what you had in mind.

A more common way to add a PWM would be with a PWM generator IC. They come in TTL serial, I2C, and SPI types, as well as analog and ones that you set with several pins in parallel. Some already have libraries.

MOSI and MISO are the pins for SPI, it has an intended way of multiplexing. You can use a chip select pin. If you want to use even fewer pins, instead of SS1-3 you could use a counter or a shift register.


For the other types of serial, which either have a clock pin or are asynchronous, you can use addressing schemes, or chip select, depending on your needs.

Here's a little cartoon to (condescendingly) show what addressing is.

**broken link removed**
 
There are simpler alternatives if you aren't stuck with an Arduino UNO or Mini. The Arduino Mega offer significantly more pin and peripheral count.

https://www.arduino.cc/en/Main/arduinoBoardMega/

There are also other Arduino "compatible" boards that offer processing or peripheral upgrades.

EDIT: Also SPI does not need to use the hardware defined pins. You can run software defined SPI and declare mostly any of the pins functions.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…