0
\$\begingroup\$

I'm looking at performing a chip conversion for the Sparkfun LED RingCoder. The sample code provided with the product works well on an Arduino UNO, but it uses a pin for each I/O - 5 pins for the shift registers and 6 pins for the RGB rotary encoder. What I want to do is use a 6 I/O Tiny85 instead of a full-blown UNO.

ATTiny85 sharing pins with LEDs, rotary encoder (Swtich / RE A / RE B) and shift registers:

schematic

simulate this circuit – Schematic created using CircuitLab

So I would like to re-use 5 of the 6 pins available and delegate between FSM states. That said, it looks like the three RGB LEDs will have to share a line with the shift register data/latch/clk etc.

My question: Will placing an LED on a shift register data line screw the data up?

\$\endgroup\$
  • \$\begingroup\$ Why an ATtiny85? There is so much in between an ATmega328 an an ATtiny85. Can you extend your circuit diagram with what your idea would look like? \$\endgroup\$ – jippie May 11 '13 at 15:33
  • \$\begingroup\$ Diagram en route. I mostly just wanted to use the boards I have available. \$\endgroup\$ – emc May 11 '13 at 15:50
  • \$\begingroup\$ Schematic updated. \$\endgroup\$ – emc May 11 '13 at 16:05
  • \$\begingroup\$ I just realized that /OE shares with Rotary Encoder B, clearly a problem... /OE would probably work better sharing with Switch. \$\endgroup\$ – emc May 11 '13 at 16:07
1
\$\begingroup\$

You would not be able to do this without an extra ic or two. The simplest would be a Port Expander. An I2C or SPI port expander would be simple to code, and provide both outputs and inputs. A single i2c 8bit port expander could be used for the shift registers and the encoder's outputs, using only 2 pins, if you use polling to check the encoder interrupts. Three pins if you use a port expander with an interrupt pin. The other three pins on your ATTiny could handle the encoder's led pwm directly.

Or you could add an i2c rgb led driver to handle the led pwm. Or use a 16bit expander to handle everything.

The extra overhead for i2c or spi would not be much on a ATTiny85.

\$\endgroup\$
  • \$\begingroup\$ The ATtiny85 has a USI which can emulate both SPI and I2C, so almost no overhead whatsoever. \$\endgroup\$ – Ignacio Vazquez-Abrams Nov 2 '13 at 22:02
  • \$\begingroup\$ @IgnacioVazquez-Abrams even with USI, you still need code to load it, to check for ack/nack, code to shift from the expander's output to the existing code. There is still overhead. \$\endgroup\$ – Passerby Nov 2 '13 at 22:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.