Skip to content

Open Badge V2.0

Oren Lederman edited this page Jun 14, 2016 · 12 revisions

Intro

The first badges we released as an Open Source badges is the 2nd version.

Directories

  • eagle/RFDuino_badge - PCB schematics and layout files in CadSoft EAGLE format
  • firmware/RFDuino_badge - Firmware. Arduino code
  • src/RFDuino_server - server/base station code

Arduino libraries

These badges use the RFDuino SoC, and therefore support Arduino code. In order to compile your own firmware, you will need the following Arduino Libraries

  • Arduino. Please install the latest version (1.6+).
  • RFDuino libraries. Installation instructions can be found here.
  • The latest time library. Can be found here
  • The Lazarus library. A discussion and download links can be found here

Building a programmer to upload your code

What you'll need:

Place the RFDuino USB Shield on the breadboard and use the wires to connect the pins to the male headers:

Then, connect the badge to the programmer using the headers. Make sure that the badge's ground (closest to the battery holder) is aligned with the ground connector on the programmer:

After you Plug in the USB Shield to your computer, it will be recognized as a new COM port. Chose this as the target port in the Arduino IDE.

Badge Server

Background

Once you finish programming all of your badges, you can use the badge server to initialize the badges and periodically pull data. For this version of the badges, we use a Python-based server to perform these operations. The code was tested mainly on Ubuntu (14.04) and Raspbian.

Every time a badge is turned on, it will wait for a server to connect and send the current time so it can initialize the badge's internal clock.

installation

Install dependencies:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get -y install libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libical-dev libreadline-dev libudev-dev libusb-dev make

Download and install BlueZ version 5.29 or higher:

wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.37.tar.xz
tar xf bluez-5.37.tar.xz
cd bluez-5.37
mkdir release
./configure --disable-systemd
make -j4
sudo make install

Then you need to establish a new Python Virtualenv

cd Place/Where/You/Store/Envs/
virtualenv env
source env/bin/activate

Finally clone the project and install the requirements

git clone https://github.com/HumanDynamics/OpenBadge.git
cd OpenBadge
sudo pip install -r requirements.txt

Usage

  1. Go to the Badge server library: src/RFDuino_server
  2. Create a file called "device_macs.txt", and enter the MAC addresses of your badges. The format for this file is . Please use the following format for the MAC address: AA:BB:CC:DD:EE:FF
  3. Start the server: sudo ./badge_server.py pull

The pull command continuously scans for badge within range, sends date for uninitialized badges, and pulls data when available.

Data and data format

The badge server stores the data received from each badge in a separate file (each file name is based on the MAC address). Data is stored in CSV format with the following structure:

datetime,voltage,sample length,array of samples

  • datetime is in YYYY-MM-DD HH24:MI:SS format. For example: 2016-03-04 12:53:30
  • voltage is the voltage of the battery at the time the sample was taken. When the voltage drops below 2.4V data might be noisy
  • Sample length is the time, in milliseconds, that each sample represents (or time between samples). This is typically set to 250ms
  • Samples array is an array of bytes, each represents one sample. The spacing between samples always equals sample length
Clone this wiki locally