Internet of Customers – Bluetooth Presence Detection & Salesforce

Internet of Customers – Bluetooth Presence Detection & Salesforce

In Internet of Customers – “Jarvis” Style Personal Agenda with Arduino, Bluetooth and Salesforce we used an Arduino to scan for Bluetooth MAC addresses, identify a guest and read aloud the tasks for that user. In this post, we will cover the approach & code used within the proof, as well as supply it for download.


Overview & Bluetooth Module Challenges
The toughest part of this proof was getting the Bluetooth detection working, as my first efforts were potentially complicated with a bad Bluetooth module. I ended up using a Sparkfun Bluetooth Mate Silver with terrific results. It did require soldering, but it ended up being a pretty straightforward process.

Once the Bluetooth was working, I was able to use some excellent Bluetooth detection sample code from Jan Stevens to listen for Bluetooth IDs. Merging this with some code from our Internet of Customers – Heroku, Arduino and for Customer Service example, we are easily able to send any matches to a Node.js application to evaluate against Salesforce for guest identification.

Communication Between Systems
The screens below show console output from the Node.js application, showing any data it has received from the Arduino, as well as some response data coming back from Salesforce1 APIs. The Node.js application then uses Web Sockets to communicate to the client dashboard with our greeting UI.


Salesforce Field Setup
This is the easiest part of the proof and adding custom fields in explained here. Our Node.js will need to query fields to see if the ID sent by the Arduino device will match a user’s Bluetooth ID in Salesforce. If so, retrieve the user photo, as well as a speaking voice preference.

Greeting Dashboard
Using Web Sockets, the dashboard is able to respond to the Node.js application to update as needed with a visitor photo and name. When the Node.js application is done with the audio greeting and Tasks, it sends another update to reset the UI.

Arduino Code
This Arduino code combines a Bluetooth scan using code from Jan Stevens, combined with our code from prior proofs connecting the Arduino to Wifi.

Node.js Application
The following is the featured method from our Node.js application that uses the Say.js package to provide the audio that speaks a user’s Tasks. We evaluate if any Tasks exist on the basis of a user account containing a Bluetooth ID that matches one that the Arduino has sent.

Download Source
Download Source Code from Github