Mac OS X Bluetooth Dongle

I have a 2011 27″ iMac which only has bluetooth 3.0.

I purchased a SensorTag from TI a while ago and couldn’t use it since I didn’t have BT 4.0. So I purchased a dongle for it to work but I still couldn’t get it to work.

I was so angry I couldn’t figure this out. I started doing some googling, after a bit I found this post:

Adding a BLE (Bluetooth 4.0) dongle to Mac OS X (Mavericks)

I almost cried knowing that I wasn’t wrong, it was OS X being overly helpful and not letting me say “NO I WANT THE USB I PLUGGED IN, NOT THE STUPID DEFAULT ONE!”. Running the Bluetooth Explorer and picking the dongle, the SensorTag showed up right away, and combining that with a npm module that works with it, I soon will be monitoring stats in my house using node.

I hope this helps.

Continue reading Mac OS X Bluetooth Dongle

Johnny Five + Arduino + Node Web Server

Johnny Five Node Module

Johnny Five – Buttons

Arduino + Johnny Five

Johnny Five – Relay

Originally wired the relay and button based on a different diagram. With Johnny five though, its looking for a much more logical and clear setup. So I rewired based on the diagrams and had to see the relay to type: "NC" and was able to get the lights to turn on and off with the correct button pushes.

Johnny Five really helps abstract away the need to figure out how Firmata is handling everything but also allows you a lot of control with great documentation (once you find it).

Pass one of Button + Web Browser turning off and on a light:


var express = require("express"); var five = require("johnny-five"); var board = new five.Board(); var bumper; var app = express(); var httpServer = require("http").createServer(app); var io=require('socket.io')(httpServer); var port = 3000; app.use(express.static(__dirname + '/public')); app.get('/', function(req, res) { res.sendFile(__dirname + '/public/index.html'); }); httpServer.listen(port); console.log('Server available at http://localhost:' + port); var led; var relayShelfLed; var bumperShelfLed; board.on("ready", function() { relayShelfLed = new five.Relay({ pin: 22, isOn: true, type: "NC" }); this.repl.inject({ relay: relayShelfLed }); bumperShelfLed = new five.Button({ pin: 52, // invert: true }); relayShelfLed.off(); bumperShelfLed.on("hold", function() { console.log( "Button held" ); }); bumperShelfLed.on("press", function() { if(relayShelfLed.isOn){ console.log('turn off'); relayShelfLed.off(); }else{ console.log('turn on'); relayShelfLed.on(); } console.log( "Button pressed" ); }); bumperShelfLed.on("release", function() { console.log( "Button released" ); }); //Socket connection handler io.on('connection', function (socket) { console.log(socket.id); console.log(relayShelfLed.isOn); socket.on('led:on', function (data) { relayShelfLed.on(); console.log('LED ON RECEIVED'); }); socket.on('led:off', function (data) { relayShelfLed.off(); console.log('LED OFF RECEIVED'); }); }); console.log('Waiting for connection'); }); //turn light on //turn light off //event emiter for light

I created a quick project to make this work with my arduino and a relay.

Office Manager

Continue reading Johnny Five + Arduino + Node Web Server