MyPi ISO-BLE Card Configuration

In this example we will walk through an example of how to configure and run a test of the BLE card, in addition to the BLE IO card and an aerial pig-tail cable + antenna you will also need an Android phone to load a Bluetooth BLE peripheral simulator.

We'll be broadly following the steps outlined in the BlueGiga BLE112 app note here :

http://www.embeddedpi.com/pdf/ble112-raspberry-pi.pdf

To start we need to ensure the onboard UART is set with full handshaking lines enabled, to do this we need to edit the /boot/config.txt file as follows :

Raspberry Pi BLE Bluetooth BLE112E configuration step 1

 

Next we need to install the Python BLE112 scanning sample application and Python serial module :

# apt-get install python-serial
# wget https://raw.github.com/jrowberg/bglib/master/Python/Examples/bled112_scanner.py
# chmod +x bled112_scanner.py

Next using your Android phone navigate to the Google Play store via the app project home page below :

https://github.com/WebBluetoothCG/ble-test-peripheral-android

Once you have that installed and running the heart rate simulator you can run the below. Note that the app note uses the device in USB mode where as we have the system in serial mode so need to add command line settings for port and baud rates :

# ./bled112_scanner.py -p /dev/ttyAMA0 -b 57600

Raspberry Pi BLE Bluetooth BLE112E configuration step 2

The BLE Card has a few additional features, it also incorporates 4 independent opto-isolated inputs as well as a GPIO line to put the BLE module into power-saving sleep mode.

The easiest way to configure the GPIO lines for these functions isvia the command sequence below as root user :

# gpio export 12 in
# gpio export 13 in
# gpio export 25 in
# gpio export 9 in

# sudo -u pi gpio export 27 out

# ln -s /sys/class/gpio/gpio27/value /dev/blesleep

# ln -s /sys/class/gpio/gpio12/value /dev/diginput0
# ln -s /sys/class/gpio/gpio13/value /dev/diginput1
# ln -s /sys/class/gpio/gpio25/value /dev/diginput2
# ln -s /sys/class/gpio/gpio9/value /dev/diginput3

Read/write of I/O is possible as as a non-root user due to the use of the gpio command (see GPIO section for more details)

By default the BLE module is active, to toggle the device's sleep mode run the comands below :

$ echo 1 >/dev/blesleep
$ echo 0 >/dev/blesleep

 

 

Ref Links :

http://community.silabs.com/t5/Bluetooth-Wi-Fi-Knowledge-Base/BLExxx-Factory-default-firmware/ta-p/147797

Contact us now to discuss your project

Ready to order, contact us today for pricing or samples

Contact Us