Introduction: Clap-on Lights With Tessel

About: An engineer, seamstress, cook, coder, and overall maker. Spent a summer at Instructables; got a degree in E: Neural Engineering at Olin College; made a microcontroller (; now thinking about climate c…


Tessel listens for a clap, then toggles a relay to turn something on and off.

(Also view this project/get the code easily at the Tessel projects page)

You need:

To use:

  1. Clone this repo
  2. npm install
  3. Connect lights to Relay Module in Relay port 1
  4. Plug in modules to Tessel: Relay in port A; Ambient in port B
  5. Plug in tessel via USB
  6. Plug in power to lights/relay
  7. Run "tessel run index.js" from this folder in your terminal
  8. Clap! Watch the lights turn on and off.

See it work:

On vine

Step 1: Plug in Wires to Relay Module

A relay acts as a switch– either connecting ('on') or not connecting ('off') the two wires fed into the channel.

Use a pen or a nail to press down on the top of the relay, and feed in the red (power) wire.

The ground wire doesn't go into the relay; it just goes straight to the power adapter.

Step 2: Plug Modules in to Tessel

Relay gets plugged into Port A; Ambient gets plugged into Port B.

Step 3: Plug in Tessel to USB

Plug in the Tessel to your computer. This provides power and lets you push code.

Step 4: Plug in Power to the Lights

Step 5: Push Code and Clap On, Clap Off!

You can download my code from It looks like this:

// Takes a triggering value for ambient sound,
// toggles relay 1 when that trigger is hit.

var tessel = require('tessel'); var relay = require('relay-mono').use(tessel.port['A']); var ambient = require('ambient-attx4').use(tessel.port['B']);

// Sound level (0-1) needed to trigger. You may need to adjust this. var triggerVal = 0.22;

// When the module is connected ambient.on('ready', function () { // Set the sound trigger ambient.setSoundTrigger(triggerVal);

// When the sound trigger is reached ambient.on('sound-trigger', function triggerHit() { // Toggle the switch relay.toggle(1); }); });

  1. Clone the repo to get the code on your computer.
  2. From inside the directory, `npm install` in the command line to install the ambient and relay module libraries.
  3. If you don't have tessel installed already, `npm install tessel -g` so you have the Tessel command line tool.
  4. `tessel run index.js` to run the code on your Tessel.
  5. Clap! Watch the lights turn on and off.


If you want to use it separately from your computer, you can run `tessel push index.js` and it will save the code in memory.

You can then disconnect Tessel from your computer, and power Tessel using any of the methods listed here. I plug it into the wall using my Android charger.

As soon as you provide power, Tessel will automatically run your code.

There are a lot of other things I could (trivially) do with this setup but haven't gotten around to:

  • Hook it up to a web interface so I can turn the lights on and off from anywhere with internet
  • Read ambient light data and automatically turn the lights on and off if it's dark/bright in the room
Home Technology Contest

Participated in the
Home Technology Contest

Epilog Challenge VI

Participated in the
Epilog Challenge VI