Arduino Micro SPI Pins and Capacitive Touch Controller

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
lcstyle
 
Posts: 76
Joined: Sun Oct 26, 2008 10:55 am

Arduino Micro SPI Pins and Capacitive Touch Controller

Post by lcstyle »

Hi all,

Picked up an arduino micro from adafruit recently to integrate into my project for a final more compact version. Unfortunately my capacitive touch wheel controller from DFRobot refuses to operate with the Micro.

Because I did not buy this capacitive touch wheel from adafruit, i don't expect any support, but I thought maybe a genius here could tell me what I could check on?

I think it might have to do with the SPI pinouts on the Micro, I haven't quite wrapped my head around it yet, but essentially, this little bit of example code refuses to run. It doesn't even print "START".

I've narrowed it down to capatouch.begin method, if I comment that out, the rest of the program runs normally. Capatouch library and header file attached.

Code: Select all

/*
 TouchWheel.pde
 MPR121 WhellPad Example Code
   Hardware: 3.3V Arduino Pro Mini
           SDA -> A4
           SCL -> A5
           IRQ -> D2
*/

#include <Wire.h>
#include <mpr121.h>
int key = 0;
// =========  setup  =========
void setup()
{ 
	//  initialize function
  Serial.begin(19200);
  Wire.begin();
  CapaTouch.begin();
  delay(500);
  Serial.println("START"); 
}

// =========  loop  =========
void loop()
{
  key=CapaTouch.wheelKey();
  if(key>0){
    Serial.print("wheel:"); 
    Serial.println(key); 
  }
	delay(200);
}
Attachments
Wheelpad.zip
sketch and library file for dfrobot wheelpad
(4.16 KiB) Downloaded 35 times

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Arduino Micro SPI Pins and Capacitive Touch Controller

Post by adafruit_support_mike »

The Micro is a smaller version of the Leonardo, so its SPI pins don't live in the same place as an Arduino UNO. They're on the ICSP header (the 2x3 jobber next to the reset button), and on the adjacent pins named MOSI, MISO, and CLK.

In case you need help with the acronyms:

- MOSI is "Master Out/Slave In" : the Arduino talks and the external device listens
- MISO is "Master In/Slave Out" : the external device talks and the Arduino listens
- CLK is 'Clock' : it's the heartbeat that tells the two devices when to listen

You may also have a 'CS' pin which stands for 'Chip Select'. Many external devices can be connected to the same MOSI, MISO, and CLK lines, but each will have its own CS line. The Arduino uses the CS lines to choose which device it wants to talk to at the moment.

User avatar
lcstyle
 
Posts: 76
Joined: Sun Oct 26, 2008 10:55 am

Re: Arduino Micro SPI Pins and Capacitive Touch Controller

Post by lcstyle »

Thanks Mike,

I was able to get it working before I read your response. Apparently I was confused because I was actually looking for the SDA, SCL, and IRQ Pins, which I believe are also moved on the micro. This confusion is due in part to the fact I also have an SPI digipot connected. I think the wheelpad is not SPI based on the pins it uses (sda,scl,irq) but not Clock or MISO/MOSI. Maybe it is i2c, or maybe just serial device?!

I have some residual confusion on whether CS is the same thing as SS? On the Micro I have read that this pin is connected to the RX LED Pin? Is that correct?

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Arduino Micro SPI Pins and Capacitive Touch Controller

Post by adafruit_support_mike »

Lcstyle wrote:I have some residual confusion on whether CS is the same thing as SS?
Yeah, they're the same. SS is an abbreviation of 'Slave Select', which is a more generic term for 'Chip Select'.

User avatar
lcstyle
 
Posts: 76
Joined: Sun Oct 26, 2008 10:55 am

Re: Arduino Micro SPI Pins and Capacitive Touch Controller

Post by lcstyle »

Thanks there is a lot of bad information out there, and with Arduino being an OpenSource hardware design, many off brand vendors have implemented the Atmega32U chip pinout differently. On the Adafruit Arduino Micro, I see there is actually an SS pin, but on other boards, it isn't broken out and if it is, its attached to the RX (led) pin.

This particular image helped me tremendously to find SDA on dpin 2, SCL on dpin 3, and PCINT0 on RXLED (SS). Do you understand my confusion!? :shock:

Image

Thanks again,

LC

User avatar
Caltronics_WSYI
 
Posts: 2
Joined: Fri Apr 11, 2014 9:51 am

Re: Arduino Micro SPI Pins and Capacitive Touch Controller

Post by Caltronics_WSYI »

hi guys,
this is my first post on this forum and i am very excited about.

I Have a problem with this kit from DFRobot : DFR0129 Capacitive Touch Kit For Arduino

i followed all the steps and the connection is ok, but i got this error from the compiler :

Arduino: 1.5.6-r2 (Windows 7), Board: "Arduino Uno"

Wheelpad.ino: In function 'void setup()':
Wheelpad:29: error: 'CapaTouch' was not declared in this scope
Wheelpad.ino: In function 'void loop()':
Wheelpad:39: error: 'CapaTouch' was not declared in this scope

and this code is from the original DFRobot site:

http://www.dfrobot.com/wiki/index.php/C ... U:DFR0129)

thanks in advance.

User avatar
lcstyle
 
Posts: 76
Joined: Sun Oct 26, 2008 10:55 am

Re: Arduino Micro SPI Pins and Capacitive Touch Controller

Post by lcstyle »

TrEmEnDuino wrote:hi guys,
this is my first post on this forum and i am very excited about.

I Have a problem with this kit from DFRobot : DFR0129 Capacitive Touch Kit For Arduino

i followed all the steps and the connection is ok, but i got this error from the compiler :

Arduino: 1.5.6-r2 (Windows 7), Board: "Arduino Uno"

Wheelpad.ino: In function 'void setup()':
Wheelpad:29: error: 'CapaTouch' was not declared in this scope
Wheelpad.ino: In function 'void loop()':
Wheelpad:39: error: 'CapaTouch' was not declared in this scope

and this code is from the original DFRobot site:

http://www.dfrobot.com/wiki/index.php/C ... U:DFR0129)

thanks in advance.
Your DFROBOT capatouch kit libraries, which I use also, are not in the include path.
look in your libraries folder, is there a folder in there called MPR121?

User avatar
Caltronics_WSYI
 
Posts: 2
Joined: Fri Apr 11, 2014 9:51 am

Re: Arduino Micro SPI Pins and Capacitive Touch Controller

Post by Caltronics_WSYI »

Tnx Lcstyle for help me!

Yep the libraries is in this path: /Document/Arduino/libraries/MPR121.

...And i try also to copy the libraries in the root path: /Program Files(x86)/Arduino/libraries/MPR121.

and i really don't know.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”