Author Topic: Adding some buttons  (Read 3318 times)

edolecki

  • RFduino Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Adding some buttons
« on: January 08, 2014, 07:00:06 AM »
So I have a stack up of battery shield, RFduino, USB shield, and button shield on top. So that gives me 2 buttons to use. I need to add about 4 more - what's the best way to do this? Of course I can use a breadboard but where do I connect them? I'm a bit new to this stuff. Put the RFduino on the bottom of the stack up, slap that into a breadboard, and ... are there pins left?

edorphy

  • RFduino Full Member
  • ***
  • Posts: 86
  • Karma: +0/-0
    • View Profile
Re: Adding some buttons
« Reply #1 on: January 08, 2014, 10:46:54 AM »
Why do you want to use the USB shield AND the battery shield at the same time?
I would not advise using both the USB and Batteryshield at the same time. Your RFduino will draw power from the USB device.

The ONLY reason you would need to use the USB shield is if you wanted to program the chip, or communicate via serial port. If you don't need to do either of these in place, just use the battery.

The usb shield will use TX and RX GPIO 0 and 1 respectively. The button shield will use All other GPIO pins, 2 for Red LED, 3 for Green, 4 for Blue, 5 for button A, and 6 for button B.

If you ended up using the LED's but not the buttons you can expose extra pins using an I2C I/O expander such as the MCP23008 or MCP23017.

I've developed an embedded PIC LCD/Keypad driver with the SPI version of the 16-bit (MCP23S17). It was rather simple and there is a lib for the MCP23008 here: https://github.com/adafruit/Adafruit-MCP23008-library

If you are going to use the bush buttons but NOT the RGB led on the button shield you could expose I2C on the other pins. You just need to call another function to start I2C on the other pins.

What sort of project are you working on and what kind of devices do you hope to integrate and use in it?

edolecki

  • RFduino Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Adding some buttons
« Reply #2 on: January 08, 2014, 11:24:38 AM »
Okay - yes, I'd remove the USB shield. Now, I'm using the RGB button shield... not using the LED on it. You're saying that I could expose the other pins... can I simply do that by using a breadboard and running wires from the button shield to other buttons?

I really wish there was a 6 button shield available ;)

mkay

  • RFduino Team
  • *****
  • Posts: 405
  • Karma: +15/-0
    • View Profile
Re: Adding some buttons
« Reply #3 on: January 13, 2014, 06:35:29 PM »
I would recommend using an I2C port expander like edorphy mentioned. (MCP23008 or MCP23017)

They will allow you to add more GPIOs using only 2 GPIOs ( I2C )

edolecki

  • RFduino Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Adding some buttons
« Reply #4 on: January 14, 2014, 07:48:31 AM »
Thank you - I'll order some 8 and 16 pin variants and see how it goes.

Dofey

  • RFduino Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Adding some buttons
« Reply #5 on: November 04, 2014, 02:32:51 AM »
Is it possible to use PWM with the MCP23008 or MCP23017?

mkay

  • RFduino Team
  • *****
  • Posts: 405
  • Karma: +15/-0
    • View Profile
Re: Adding some buttons
« Reply #6 on: December 09, 2014, 05:36:21 PM »
The MCP23008 or MCP23017 don't support PWM. There are dedicated I2C PWM ICs out there you can use.

 

anything