Difference between revisions of "ADS1115 + RFduino"

From TAMI
Jump to navigationJump to search
 
(10 intermediate revisions by 2 users not shown)
Line 3: Line 3:
Using [https://github.com/adafruit/Adafruit_ADS1X15 Adafruit_ADS1X15] and trying to fix it's quirks [https://github.com/alon/Adafruit_ADS1X15 here].
Using [https://github.com/adafruit/Adafruit_ADS1X15 Adafruit_ADS1X15] and trying to fix it's quirks [https://github.com/alon/Adafruit_ADS1X15 here].


TODO (just a snapshot)
= Summary =
This is about interfacing a RFDuino with a ADS1115 chip and reading from a BLE connection on a computer (linux/windows/android/iphone).
 
Latest source:
* [https://github.com/adafruit/Adafruit_ADS1X15/archive/master.zip zip]
* [https://github.com/adafruit/Adafruit_ADS1X15.git git]
 
What we have:
* Git repository with example program
** Git is here https://github.com/adafruit/Adafruit_ADS1X15.git
** File to run on RFduino is examples/singleended_interrupt/singleended_interrupt.ino
** You need to use the modified Adafruit_ADS1X15 library (patches have not been sent upstream yet)
** For compiling it follow standard [http://www.rfduino.com/ RFDuino].
** The test program for linux is under BLE-receiver. It does not have any dependencies besides gcc (and probably other c compilers work).
 
= TODO (just a snapshot) =
* do and document setup of RFDuino on fedora
* do and document setup of RFDuino on fedora
* why does reading single ended results depend on order for RFduino and not for Uno?
* why does reading single ended results depend on order for RFduino and not for Uno?
Line 24: Line 39:


yum install d-feet (bluez uses dbus)
yum install d-feet (bluez uses dbus)
Some more links
* socket level tutorial, not LE specific: http://www.drdobbs.com/mobile/using-bluetooth/232500828
* stackoverfloweth
** http://stackoverflow.com/questions/17835469/using-bluetooth-low-energy-in-linux-command-line
** http://stackoverflow.com/questions/13360607/bluetooth-low-energy-ble-protocols-other-than-gatt
* http://www.spinics.net/lists/linux-bluetooth/msg29684.html
google "bluetooth GATT"
= RFduino and Linux =
Important lessons (or so I thought):
* You must advertise whenever you are not connected.
** If you don't advertise connections fail. Mysteriously they succeed sometimes as attested by gnome-shell but fail when using the gatttool in bluez 5.13
** Apparently not really - now I get disconnect with the same program. Pointing to a problem with my bluetooth chipset or driver (I'm using broadcom's BCM20702 via thinkpad T530):
*** Error: connect error: Device or resource busy (16)
* hcitool lescan - sometimes it's slow. This correlates with connection errors. Coincidence?
* http://forum.rfduino.com/index.php?topic=73.0
** http://joost.damad.be/2013/08/experiments-with-bluetooth-low-energy.html
** http://stackoverflow.com/questions/17835469/using-bluetooth-low-energy-in-linux-command-line
[E5:36:78:90:4D:E4][LE]> char-desc
handle: 0x0001, uuid: 2800
handle: 0x0002, uuid: 2803
handle: 0x0003, uuid: 2a00
handle: 0x0004, uuid: 2803
handle: 0x0005, uuid: 2a01
handle: 0x0006, uuid: 2803
handle: 0x0007, uuid: 2a04
handle: 0x0008, uuid: 2800
handle: 0x0009, uuid: 2803
handle: 0x000a, uuid: 2a05
handle: 0x000b, uuid: 2902
handle: 0x000c, uuid: 2800
handle: 0x000d, uuid: 2803
handle: 0x000e, uuid: 2221
handle: 0x000f, uuid: 2902
handle: 0x0010, uuid: 2803
handle: 0x0011, uuid: 2222
handle: 0x0012, uuid: 2803
handle: 0x0013, uuid: 2223
Discover descriptors finished: No attribute found within the given range
[E5:36:78:90:4D:E4][LE]> sec-level
sec-level: low
[E5:36:78:90:4D:E4][LE]> mtu
Usage: mtu <value>
[E5:36:78:90:4D:E4][LE]> characteristics
handle: 0x0002, char properties: 0x0a, char value handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0004, char properties: 0x02, char value handle: 0x0005, uuid: 00002a01-0000-1000-8000-00805f9b34fb
handle: 0x0006, char properties: 0x02, char value handle: 0x0007, uuid: 00002a04-0000-1000-8000-00805f9b34fb
handle: 0x0009, char properties: 0x20, char value handle: 0x000a, uuid: 00002a05-0000-1000-8000-00805f9b34fb
handle: 0x000d, char properties: 0x12, char value handle: 0x000e, uuid: 00002221-0000-1000-8000-00805f9b34fb
handle: 0x0010, char properties: 0x0c, char value handle: 0x0011, uuid: 00002222-0000-1000-8000-00805f9b34fb
handle: 0x0012, char properties: 0x0c, char value handle: 0x0013, uuid: 00002223-0000-1000-8000-00805f9b34fb
[E5:36:78:90:4D:E4][LE]> char-write-req 1 1
Error: Invalid value
[E5:36:78:90:4D:E4][LE]> char-write-req 2 1
Error: Invalid value
[E5:36:78:90:4D:E4][LE]> char-write-req 3 1
= TI Sensor Tag =
* http://processors.wiki.ti.com/index.php/SensorTag_User_Guide
= Broadcom chipset & SDK =
* https://groups.google.com/forum/#!topic/btstack-dev/l3XJio_0bDA
= The RFduino BLE chipset - Nordic =
* https://www1.elfa.se/data1/wwwroot/assets/datasheets/PROD_BRIEF_nRF51822.pdf
= Bluetooth Adopted Specifications (aka the spec) =
Beware, 2600+ pages
* https://www.bluetooth.org/en-us/specification/adopted-specifications
= USB BLE Dongles (aka Bluetooth 4.0+) =
* http://bbb.europeangoods.com/P930_usb-bluetooth-low-energy-dongle
* Configuring the BT800 in Linux and Android: [http://www.lairdtech.com/WorkArea/DownloadAsset.aspx?id=2147488769 @lairdtech]

Latest revision as of 20:30, 28 March 2014

We are using the ADS1115 with an RFDuino (github)

Using Adafruit_ADS1X15 and trying to fix it's quirks here.

Summary

This is about interfacing a RFDuino with a ADS1115 chip and reading from a BLE connection on a computer (linux/windows/android/iphone).

Latest source:

What we have:

  • Git repository with example program
    • Git is here https://github.com/adafruit/Adafruit_ADS1X15.git
    • File to run on RFduino is examples/singleended_interrupt/singleended_interrupt.ino
    • You need to use the modified Adafruit_ADS1X15 library (patches have not been sent upstream yet)
    • For compiling it follow standard RFDuino.
    • The test program for linux is under BLE-receiver. It does not have any dependencies besides gcc (and probably other c compilers work).

TODO (just a snapshot)

  • do and document setup of RFDuino on fedora
  • why does reading single ended results depend on order for RFduino and not for Uno?
  • try with Uno
  • use the RDY bit (writing special values to threshold hi and lo)
  • use two with different addresses on the same I2C bus
  • read the Wire library (I2C) and figure out difference between two RFduino and Uno implementations

Python serial for windows

BLE on linux

GATT ; Just saying

yum install d-feet (bluez uses dbus)

Some more links

google "bluetooth GATT"

RFduino and Linux

Important lessons (or so I thought):

  • You must advertise whenever you are not connected.
    • If you don't advertise connections fail. Mysteriously they succeed sometimes as attested by gnome-shell but fail when using the gatttool in bluez 5.13
    • Apparently not really - now I get disconnect with the same program. Pointing to a problem with my bluetooth chipset or driver (I'm using broadcom's BCM20702 via thinkpad T530):
      • Error: connect error: Device or resource busy (16)
  • hcitool lescan - sometimes it's slow. This correlates with connection errors. Coincidence?
[E5:36:78:90:4D:E4][LE]> char-desc
handle: 0x0001, uuid: 2800
handle: 0x0002, uuid: 2803
handle: 0x0003, uuid: 2a00
handle: 0x0004, uuid: 2803
handle: 0x0005, uuid: 2a01
handle: 0x0006, uuid: 2803
handle: 0x0007, uuid: 2a04
handle: 0x0008, uuid: 2800
handle: 0x0009, uuid: 2803
handle: 0x000a, uuid: 2a05
handle: 0x000b, uuid: 2902
handle: 0x000c, uuid: 2800
handle: 0x000d, uuid: 2803
handle: 0x000e, uuid: 2221
handle: 0x000f, uuid: 2902
handle: 0x0010, uuid: 2803
handle: 0x0011, uuid: 2222
handle: 0x0012, uuid: 2803
handle: 0x0013, uuid: 2223
Discover descriptors finished: No attribute found within the given range
[E5:36:78:90:4D:E4][LE]> sec-level
sec-level: low
[E5:36:78:90:4D:E4][LE]> mtu
Usage: mtu <value>
[E5:36:78:90:4D:E4][LE]> characteristics
handle: 0x0002, char properties: 0x0a, char value handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0004, char properties: 0x02, char value handle: 0x0005, uuid: 00002a01-0000-1000-8000-00805f9b34fb
handle: 0x0006, char properties: 0x02, char value handle: 0x0007, uuid: 00002a04-0000-1000-8000-00805f9b34fb
handle: 0x0009, char properties: 0x20, char value handle: 0x000a, uuid: 00002a05-0000-1000-8000-00805f9b34fb
handle: 0x000d, char properties: 0x12, char value handle: 0x000e, uuid: 00002221-0000-1000-8000-00805f9b34fb
handle: 0x0010, char properties: 0x0c, char value handle: 0x0011, uuid: 00002222-0000-1000-8000-00805f9b34fb
handle: 0x0012, char properties: 0x0c, char value handle: 0x0013, uuid: 00002223-0000-1000-8000-00805f9b34fb
[E5:36:78:90:4D:E4][LE]> char-write-req 1 1
Error: Invalid value
[E5:36:78:90:4D:E4][LE]> char-write-req 2 1
Error: Invalid value
[E5:36:78:90:4D:E4][LE]> char-write-req 3 1

TI Sensor Tag

Broadcom chipset & SDK

The RFduino BLE chipset - Nordic

Bluetooth Adopted Specifications (aka the spec)

Beware, 2600+ pages

USB BLE Dongles (aka Bluetooth 4.0+)

  • Configuring the BT800 in Linux and Android: @lairdtech