Wiring for use with I2C
Chances are you'll use this board with the I2C interface pins. I2C is handy because you can have multiple sensors all connected on two I2C pins and share them nicely as long as each one has a unique address. I2C isn't particularly fast but that's fine for a sensor like this one (it's not good for video or audio type data)
I2C is really fast to get started, so we suggest that. Connect the VIN pin to 5V and GND pin to ground. Then connect the SDA pin to your I2C SDA/data line and SCL pin to your I2C SCL/clock line
- On UNO/Duemilanove/etc, SDA == Analog 4, SCL == Analog 5
- On Leonardo/Micro, SDA == Digital 2, SCL == Digital 3
- On Mega/ADK/Due, SDA == Digital 20, SCL == Digital 21
The reset pin is not required for use, but if you can spare a pin, it will make the system a little more rugged - the Arduino will do a hard reset of the CAP1188 on startup, connect RST to any digital I/O pin. In the library example code you can set up that pin in the CAP1188 object creation.
If you're using multiple sensors, or you just want to change the I2C address to something else, you can choose from 5 different options - 0x28, 0x29 (default), 0x2A, 0x2B, and 0x2C
The I2C address are selected by connecting a resistor to the AD pin in the lower right: different resistors set a different address. The easiest address to set is 0x28 which is just a wire from AD to the 3Vo pin.
- Wire connecting AD to 3V -> I2C address 0x28
- No resistor or wire attached to AD -> I2C address 0x29
- 600K resistor from AD to ground -> I2C address 0x2A
- 300K resistor from AD to ground -> I2C address 0x2B
- 180K resistor from AD to ground -> I2C address 0x2C
Wiring for use with SPI
You can put the CAP1188 in SPI mode by powering it up with AD connected to ground. Then the 4 SPI pins are used to communicate instead of I2C. SPI may be preferrable for your project if you have an I2C address collision (which is unlikely given you can choose 5 addresses!) or say if you have an UNO and you want to use the I2C pins for analog input instead of I2C, or if you are porting to a microcontroller that does not have hardware I2C.
Either way, SPI is there for you!
Connect Vin to 5V and GND to ground, then tie a wire from AD to ground as well. Now connect the SCK, MISO, MOSI, CS and RST pins to your microcontroller. If using an Arduino you can use either the hardware SPI pins which are fixed for each Arduino, or go with software SPI where you select any 5 digital I/O pins
Page last edited March 08, 2024
Text editor powered by tinymce.