Pages: [1]   Go Down
Author Topic: External RGB+Piezo+Vibe motor control chip, I2C I/O module or ATTiny?  (Read 1747 times)
0 Members and 1 Guest are viewing this topic.
Roanoke, VA
Offline Offline
Jr. Member
**
Karma: 6
Posts: 66
Creating order out of chaos!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to find the best way to get five more digital I/O pins back in a particular design I'm working on (the kit form of the Keyglove, actually), since I've run out of pins and I really need those back. I'm using the AT90USB1287 MCU, and everything is pretty much maxed out. I have a number of I2C devices on the bus though, so if I can find an I2C-based solution, that would be ideal.

The five pins in question are currently being used for the following tasks:

1. Red component of RGB LED (active high)
2. Green component of RGB LED (active high)
3. Blue component of RGB LED (active high)
4. Vibration motor on/off control (active low)
5. Piezo buzzer frequency control (either off or some pitch creating by the Arduino tone() function)

I need to move all of these to some external chip. I know there are plenty of I2C I/O expanders out there that would have no trouble at all with tasks 1-4 above. However, I'm not sure if there is anything out there that can do 1-4 and take care of the a tone()-like solution to control the pitch of piezo buzzer.

Does anyone know if such a device exists? I'm looking for something that is a very small 8 to 16-pin QFN or SSOP that is not more than ~$2. Would it be possible (or necessary) to use an ATTiny MCU for this task--something that is built to use to I/O pins for bit-banged I2C device emulation and VERY simple communication protocol, then 4 digital I/O pins for RGB/vibe control and one along with the 16-bit timer for tone()-like pitch control. Maybe an ATTiny24?
« Last Edit: February 08, 2012, 02:22:53 am by Jeff Rowberg » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 207
Posts: 12911
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


PWM on the LED?
Logged

Roanoke, VA
Offline Offline
Jr. Member
**
Karma: 6
Posts: 66
Creating order out of chaos!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

PWM on the LED?

Having the LEDs on PWM pins would be a bonus feature, but right now they are either on or off, and for my purposes, that's okay. Someone recommended the PCA9531 I2C PWM LED control chip to me, and while that would work perfectly for the LEDs and the vibration motor, it looks the like maximum "blink rate" (which would be used to control the frequency of the buzzer) is ~150hz. For LEDs, obviously, this is plenty fast enough, but if I'm trying to bend the functionality to achieve a maximum of, say, ~3kHz, then I don't think that chip would work.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 207
Posts: 12911
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
something that is built to use to I/O pins for bit-banged I2C device emulation

Is there a reason you do not want to use hardware support for I2C?
Logged

Roanoke, VA
Offline Offline
Jr. Member
**
Karma: 6
Posts: 66
Creating order out of chaos!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there a reason you do not want to use hardware support for I2C?

The AT90USB host MCU is definitely using hardware support, but I wasn't sure if the ATTiny24/44 supported that. I figured that one way or another, I'd be able to use an I2C protocol even if it meant bit-banging it on the ATTiny side, but obviously I'm all for using simpler methods if they exist.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 207
Posts: 12911
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


The ATtinyX4 family has a "USI" (Universal Serial Interface).  BroHogan has provided this for the ATtinyX5 family...

http://code.google.com/p/arduino-tiny/wiki/TWIMasterLibrary

USI is identical for the two processor families.  In other words, ATtinyX4 processors have some hardware support for I2C and you will very likely be able to find the software you need via Google.

Full hardware PWM is out.  The processor has two timers / four outputs.  One timer is needed to generate the tone leaving one timer / two outputs for PWM.  I suspect you will get good results with software PWM.

11 I/O pins available. Two I/O pins need for I2C, three for LEDs, one for motor, one for buzzer for a total of seven needed.

For what it's worth, the last time I priced ATtiny24s, ATtiny44s were cheaper.

Looks to me like an ATtinyX4 would work very well.
Logged

Roanoke, VA
Offline Offline
Jr. Member
**
Karma: 6
Posts: 66
Creating order out of chaos!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The ATtinyX4 family has a "USI" (Universal Serial Interface).  BroHogan has provided this for the ATtinyX5 family...Looks to me like an ATtinyX4 would work very well.

Thanks for your help, and for pointing me in the direction of that library (and the *44 recommendation). All very helpful info, and I've decided to go with the ATTiny44. Here goes nothing! :-)
Logged

Pages: [1]   Go Up
Jump to: