Introduction: Flux Capacitor Door Bell Using Intel Edison

Since I was a child, Back to The Future is my favorite movie, all the three. For who knows the movie, the flux capacitor is the primary equipment in the Time Machine. The flux capacitor is what makes the time travel possible.

This year, 2015, is the year that Marty McFly visit the future, and I've decided to build my own flux capacitor during the tird edition of Intel IoT Roadshow in São Paulo.

My initial idea was to use the Intel Edison as a media server, but I've changed to a IoT door bell, that I'll probably install at my house.

The main idea is to use the Intel Edison to drive all the 15 LED and the Bluetooth speaker, that will be installed close to the main entrance door (if I decide to change the place, it will be easy!). Every time that someones pess the door bell, a random sound effect is played. Like the Delorean sound during the time travel.

Step 1: Building the Flux Capacitor

To build the flux capacitor, I've used a MDF box (cheaper than the plastic one), some PVC tubes connections, old spark plugs cable connector, yellow network cables, rubber, brass wire, acrylic, glue, paint and several tools.

I'm not going in details in the building, but I'll describe the top steps to build it:

  1. The first thing is to cut the window in the MDF box.
  2. Glue the PVC connections using epoxy glue.
  3. Paint the box using gray paint.
  4. Glue the U rubber (usually used in case mod).
  5. Glue the acrylic window in place.
  6. Paint the spark plugs cable connector in red.
  7. Use the yellow network cable in the spark plugs cable connector.
  8. Paint the PVC caps in gold using spray.
  9. Cut the 10mm acrylic to be used as light guide.
  10. Using a MDF board, glue all together.

Step 2: Electronics and Schematics

The LED's will be driven by a BC548 transistor to avoid any damage on the Intel Edison.

Each white LED consumes about 20 to 25mA, and we'll connect 3 LED's in a row (it will drain about 75mA) by 5 LED's, so, 15 white LED's will be used.

The driver schematics, is based on the picture.


Connecting in the Intel Edison shield:

To connect the LED driver, I'll use the Grove Shield and the cables, as showed in the picture.

Step 3: Setting the Bluetooth Speakers Connection

To connect the Bluetooth speaker using the Intel Edison Bluetooth, just follow the steps:

Attention: Be sure that you are using the latest version of the Intel Edison Yocto Linux!
  • root@edison:~# rfkill unblock bluetooth
  • root@edison:~# bluetoothctl

In the Bluetooth Manager:

Using the command "scan on", locate your device and copy the address.

  • [bluetooth]# agent KeyboardDisplay
  • [bluetooth]# default-agent
  • [bluetooth]# pair <device_address>
  • [bluetooth]# connect <device_address>
  • [bluetooth]# trust <device_address>

Once connected, exit the Bluetooth manager and follow the next steps:

  • root@edison:~# pactl list sinks

Find your device and copy the following information (see in picture):

bluez_sink.

Now run the command:

root@edison:~# pactl set-default-sink bluez_sink.<device_address>

Now your Bluetooth device is ready to play sounds!

Step 4: Building the NodeJS Using Intel XDK

Please, install the latest version of the Intel XDK by clicking here!

Due the copyright, I'm not going to share sounds effects. But it must be in WAV format!

The source code is available in my GitHub account, click here! You can change the code by your own risk!

var express    = require('express')<br>var bodyParser = require('body-parser')
var mraa = require('mraa');

var exec = require('child_process').exec;
var ring = 'gst-launch-1.0 filesrc location= /home/root/ring.wav ! wavparse ! pulsesink';
var timeOn = 'gst-launch-1.0 filesrc location= /home/root/time.wav ! wavparse ! pulsesink';

var led_0 = new mraa.Gpio(2);
var led_1 = new mraa.Gpio(3);
var led_2 = new mraa.Gpio(4);
var led_3 = new mraa.Gpio(5);
var led_4 = new mraa.Gpio(6);

led_0.dir(mraa.DIR_OUT);
led_1.dir(mraa.DIR_OUT);
led_2.dir(mraa.DIR_OUT);
led_3.dir(mraa.DIR_OUT);
led_4.dir(mraa.DIR_OUT);

function clearAll() {
    led_0.write(0);
    led_1.write(0);
    led_2.write(0);
    led_3.write(0);
    led_4.write(0);    
}

var ledState = [0,0,0,0,0];
var ledStateBlink = true;
var fluxTime = 0;
var playMusic = true;
var waitFlux = false;
var led = 0;
var task_time = 50;

var toutFlux = function() {
    if (playMusic){
        flux();
        setTimeout(toutFlux,task_time);
    } else {
        clearAll();
    }
}

function waitFluxTmr() {
        playMusic = true;
        task_time = 50;
}

var app = express()

// parse application/json
app.use(bodyParser.json())
app.post('/', function(request, response){
    console.log(request.body);      // your JSON
    response.send(request.body);    // echo the result back
    
    if(request.body.ring == 1){
        console.log("Fluxing!");
        task_time = 5;
        exec(ring, function(error, stdout, stderr) {
            console.log(stdout);
            console.log("Stop!!!!!!!!!!!");
            playMusic = false;
            waitFluxTmr();
        });
    }
});

function flux() {
    
    switch(led) {
        case 0:
            led_0.write(ledState[led]?1:0);
            break;
        case 1:
            led_1.write(ledState[led]?1:0);
            break;
        case 2:
            led_2.write(ledState[led]?1:0);
            break;
        case 3:
            led_3.write(ledState[led]?1:0);
            break;
        case 4:
            led_4.write(ledState[led]?1:0);
            break;
    }
    
    if(led <= 4) {
        ledState[led] = !ledState[led];
        led++;
    }
    else {
        led = 0;
    }
}

exec(timeOn, function(error, stdout, stderr) {
    console.log(stdout);
    toutFlux();
});

clearAll();

app.listen(3000);

To test, you can use the following command, in Linux:

curl -d '{"ring":1}' -H "Content-Type: application/json" http://192.168.2.15:3000

You can also test the door bell using the JSONSender Android App!

Step 5: Running and Fluxing!

Now the flux capacitor is fluxing!

I hope you enjoyed and any question, don't hesitate to contact me!

My Blog

IoT Makers

Back to the Future Contest

Second Prize in the
Back to the Future Contest

Make It Glow! Contest

Participated in the
Make It Glow! Contest