Bjarke Gotfredsen ☒
Published © MIT

Virtual Door Button

Using Mongoose and some CHIPs, we made a virtual door button. Instead of a physical button to buzz staff in, they can now do it themselves.

IntermediateFull instructions provided1 hour410
Virtual Door Button

Things used in this project

Hardware components

CW02
XinaBox CW02
You could use the CW01 instead: https://xinabox.cc/products/cw01
×1
IP01
XinaBox IP01
×1
PU01
XinaBox PU01
You could just use the IP01 for power, if you don't intend to program more modules.
×1
OC03
XinaBox OC03
×1
XC10
XinaBox XC10
The "glue" that makes it all work!
×1

Software apps and online services

Mongoose OS
Mongoose OS
Really awesome and easy IoT development tool ... and free!

Story

Read more

Schematics

Buzzer Circuit

Install the OC03 in parallel with the existing push button.

OC03 Circuit

Install the OC03 in parallel with the existing push button.

Code

init.js

JavaScript
Your main and only code for this project.
load('api_config.js');
load('api_gpio.js');
load('api_i2c.js');
load('api_net.js');
load('api_sys.js');
load('api_timer.js');
load("api_rpc.js");

let led = Cfg.get('pins.led');
let adr = 0x38;
let bus = I2C.get();
I2C.writeRegB(bus, adr, 3, 0); 
I2C.writeRegB(bus, adr, 1, 0); /* turn off just to be sure */
let delay = 2000;

GPIO.set_mode(led, GPIO.MODE_OUTPUT);

RPC.addHandler('Switch', function(args) {
  GPIO.toggle(led);
  I2C.writeRegB(bus, adr, 3, 0); /* in case the OC03 gets reconnected */
  I2C.writeRegB(bus, adr, 1, 1);
  Timer.set(delay, false , function() {
    GPIO.toggle(led);
    I2C.writeRegB(bus, adr, 1, 0);
  }, null);
  return true;
});

Credits

Bjarke Gotfredsen ☒

Bjarke Gotfredsen ☒

3 projects • 13 followers
CEO, Founder and Inventor of the XinaBox tech.

Comments