Bluetooth via I2C - working!

Interfacing to the codebug
Post Reply
mikerr
Posts: 83
Joined: Fri Jul 31, 2015 10:37 am
Contact:

Bluetooth via I2C - working!

Post by mikerr » Wed Sep 30, 2015 3:15 pm

One thing missing from codebug as a wearable is bluetooth ...

I have been playing with a bluno beetle -a tiny £10 arduino board with built in bluetooth.
..and it is tiny - smaller than a codebug:

Image

Both codebug and arduino support I2C - although codebug only currently as a slave using the i2c_tether firmware.

I've connected them via I2c and they can talk (codebug is at 0x18) and the bluno is powered from the codebug.

... next step is to find out the raw commands/bytes

- currently delving through the python library at https://github.com/codebugtools/codebug_i2c_tether
Twitter @mikered codebug profile mikerr

mikerr
Posts: 83
Joined: Fri Jul 31, 2015 10:37 am
Contact:

Re: Bluetooth via I2C working !

Post by mikerr » Fri Oct 02, 2015 10:25 am

Success !

A bluetooth controlled codebug !
Image

I can type a letter on the phone, and the codebug displays it

Image

Note the bluetooth part is handled by the bluno beetle itself,
the I2C could be used with any arduino.

Arduino code (reduced for clarity):

Code: Select all

#include <Wire.h> 

int ROUTINE_SET =  3;
int CODEBUG_ADDRESS = 0x18;

int LED_LINE = 1; // row number, can be set to rows 0 - 4
int LINE_VALUE = 0b11000; // 5 bit representation of LEDs in a row

Wire.beginTransmission(CODEBUG_ADDRESS);      
Wire.write(ROUTINE_SET);
Wire.write(LED_LINE);
Wire.write(LINE_VALUE);
error = Wire.endTransmission();

full arduino code on github (work in progress)
http://github.com/mikerr/codebug-arduino

Makes a nice blutooth connected wearable...
Twitter @mikered codebug profile mikerr

BMS Doug
Posts: 61
Joined: Wed Aug 26, 2015 8:54 am
Contact:

Re: Bluetooth via I2C - working!

Post by BMS Doug » Fri Oct 02, 2015 2:48 pm

I'm guessing that the arduino code is just C and therefore could be easily adapted as a C library for use on the Pi as well? (for those people who would rather use C than Python).

mikerr
Posts: 83
Joined: Fri Jul 31, 2015 10:37 am
Contact:

Re: Bluetooth via I2C - working!

Post by mikerr » Fri Oct 02, 2015 3:55 pm

Yes, arduino is mainly C (it has elements of C++ too)

On Pi, there are ways of directly calling the supported codebug python i2c library from C
http://stackoverflow.com/questions/2812 ... spberry-pi
Twitter @mikered codebug profile mikerr

mikerr
Posts: 83
Joined: Fri Jul 31, 2015 10:37 am
Contact:

Re: Bluetooth via I2C - working!

Post by mikerr » Mon Nov 09, 2015 2:49 pm

Someone on twitter asked for more info , so here's a pic of where I soldered a pin header onto the I2C pads of the bluno beetle for easier connection:

Image

Then SCL/SDA and GND are connected to same pins on codebug.
Twitter @mikered codebug profile mikerr

Post Reply