Page 1 of 1

Bluetooth via I2C - working!

Posted: Wed Sep 30, 2015 3:15 pm
by mikerr
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

Re: Bluetooth via I2C working !

Posted: Fri Oct 02, 2015 10:25 am
by mikerr
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...

Re: Bluetooth via I2C - working!

Posted: Fri Oct 02, 2015 2:48 pm
by BMS Doug
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).

Re: Bluetooth via I2C - working!

Posted: Fri Oct 02, 2015 3:55 pm
by mikerr
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

Re: Bluetooth via I2C - working!

Posted: Mon Nov 09, 2015 2:49 pm
by mikerr
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.