npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

raspi-cap

v0.0.5

Published

Raspberry Pi / Node.js module for the CAP1188 capacitive touch breakout

Downloads

4

Readme

Raspberry Pi / Node.js module for the CAP1188 capacitive touch breakout

The CAP1188 is an 8-channel capacitive touch sensor and is available in a handy breakout board. This module enables I2C communication with the chip to easily get information about which pins are being touched. It's based on Espruino CAP1188 lirrary which itself is based on the Adafruit CAP1188 Arduino libary.

Wiring

You can wire this up as follows:

| Device Pin | Pi | | ---------- | --------------------------------------------------------------- | | 1 (GND) | Ground | | 2 (VIN) | 3.3v | | 3 (SDA) | BCM 2/SDA | | 4 (SCK) | BCM 3/SCL | | RST | BCM 17 (0) Optional* |

* Any GPIO pin can be used, see Reset below.

Install

Enable I2C on the Pi

  1. sudo raspi-config
  2. "Interfacing Options"
  3. "I2C"
  4. "Would you like the ARM I2C interface to be enabled?" -> "YES"
  5. "OK"
  6. "Finish"

Install this library

npm install --save https://github.com/andrewn/raspi-cap/archive/master.tar.gz

Usage

Basic usage:

const connect = require("raspi-cap").connect;

// Connect to the CAP1188 breakout.
// When it's ready, the Promise resolves
// with the CAP1188 instance
connect().then(cap1188 => {
  // Returns an array of 8 items for pins C1 - C8
  //  true indicates a touch, false is no touch
  // e.g. C6 is being touched
  // [ false, false, false, false, false, true, false, false ]
  const touches = cap1188.readTouches();
  console.log(touches);
});

See the examples directory for more examples.

Sensitivity

You can read and set the sensitivity using getSensitivity() and setSensitivity(level) where level is a number between 0 and 7 inclusive.

0 is most sensitive and 7 is least sensitive.

See examples/cap1188-sensitivity.js.

From the datasheet:

| Level | Sensitivity Multiplier | | ----- | ---------------------- | | 0 | 128x (most sensitive) | | 1 | 64x | | 2 | 32x (default) | | 3 | 16x | | 4 | 8x | | 5 | 4x | | 6 | 2x | | 7 | 1x (least sensitive) |

Reset

Optionally, you can connect the reset pin on the board (marked RST), to a pin on the Pi. Call the reset() method to reinitialize the sensor which can recalibrate it instead of having to cycle the power. A Promise is returned that resolves when the board has been reset.

See this page about how to specify a pin.

In addition, the reset event is also emitted.

var cap = require("CAP1188").connect(I2C1, { resetPin: 0 }); // using WiringPi number for BCM17
cap.reset(function () {
  // the board has been reset
});

GUI

There's a tiny GUI you can run:

sudo raspi-cap-debug

It'll show red circles (🔴) for untouched pins and blue circles (🔵) for touched pins.

Buying