The following information is for the EMANT300, EMANT380

Python for Android (Py4A), Windows and Emulator, Ubuntu, Raspberry Pi

Python Driver

  • Android Smartphone (Py4A) (EMANT380 only). Note the following for the emant module:
    • If it is a compiled python module (emant.pyc), it will not appear on the SL4A scripts list
    • The emant modules for the smartphone and PC are different. To check
      import emant print emant.__version__
      The Android version will include the word android
  • Android Emulator on Windows (EMANT380 preferred)
  • Windows (EMANT300, EMANT380)
  • Ubuntu (EMANT300, EMANT380)
  • Raspberry Pi (EMANT380 only)

The folder Python for Android Py4A, Windows, Emulator with EMANT380 can be downloaded from info.emant.com (customers access only)

Requirements

EMANT380 Bluetooth DAQ

  • Windows XP, Vista, 7
    1. Python 2.6
    2. PyBluez-0.18.win32-py2.6
  • Ubuntu 11.04 or later
    1. Python 2.7
    2. PyBluez
  • Raspberry Pi
    1. Python 2.7 (Installed)
    2. PyBluez
  • Android
    1. Py4A Release 5

EMANT300 USB DAQ

  • Windows XP, Vista, 7
    1. Python 2.6
    2. pyserial 2.5
  • Ubuntu 11.04 or later
    1. Python 2.7 (Installed)
    2. pyserial 2.5 (Installed)

Important Notes

Windows

  1. For EMANT300 install drivers and get serial port (use diagnostic.exe)
  2. For EMANT380 pair module
  3. Modify example as per mac address (EMANT380), serial com port (EMANT300)

Ubuntu

  1. For EMANT300 check driver installed correctly and get serial port
  2. $ dmesg | grep tty [ 0.000000] console [tty0] enabled [ 849.395479] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0
  3. For EMANT380 pair module
  4. Modify example as per mac address (EMANT380), serial com port /dev/ttyUSB0 (EMANT300)

Raspberry Pi

Please visit Raspberry Pi DAQ server for more information

If you are a Windows user and Linux and Raspberry Pi is new for you, please familiarise yourself with the Python and Bluetooth DAQ Starter Kit under Windows first before attempting the Raspberry Pi DAQ server exercise.

Android

  1. If you are new to Android Python programming (requires Android scripting), please familiarise yourself with the Android Python programming environment at smartphonedaq.com before attempting to run the following examples.
  2. Please test your smartphone using the Test EMANT380 app at the android installation page to ensure that your Android smartphone model supports the Bluetooth SPP profile required by the EMANT380. Our reference in-house test Android smartphones are the Nexus One and Nexus S.
  3. For the Android example scripts, the bluetooth MAC address for your EMANT380 module is optional. For multiple modules and if you want to specify, you must modify the bluetooth MAC address for your EMANT380 module before running the examples.
  4. For Android Smartphone, the scripts should be stored in the SD Drive->sl4a->scripts folder.
  5. You need to pair the EMANT380 to your Android phone or PC once. Run the examples just like any of the examples provided by Android or PC.

Although the Android emulator does not support bluetooth, due to the way python is emulated, all UI and python services uses the emulator whereas the bluetooth commands are executed via the Windows environment. For the end user, this means you can use IDLE IDE to write your program, test it and when you are satisfied, push the program to the Android phone to run natively. It also allows workshops to be run with just PCs and the emulator. For more information, read Python on the Android emulator. For information on the SDK - you do not need to install eclipse but you do require to install the USB driver.

Python with Bluetooth DAQ examples:

The examples are written for the Light Application Adaptor which comes with the Bluetooth Starter Kit and USB DAQ Training Kit. If you do not have the Light Application Adaptor, you will only read the HwId.

Unless otherwise specified, the examples are written for the Bluetooth Starter Kit. You will need to modify the code to run the USB DAQ Training Kit.

m = emant.Emant300()

Create an instance of emant.Emant300() and assign to m

m.Open("00:06:66:00:A1:D8",dev="380")

Connect to the EMANT380

m.Open("COM5",dev="300")

Connect to the EMANT300 (Windows)

m.Open("/dev/ttyUSB0",dev="300")

Connect to the EMANT300 (Ubuntu)

  1. Measure the light intensity using the light sensor
  2. Turn on and off the LEDs bitwise
  3. Turn on and off the LEDs Portwise
  4. Read Switch status bitwise
  5. Measure Temperature using the Thermistor
  6. Counter and Frequency Measurement
  7. PWM Pulse Width Modulationusing the 24V DIO Application Adaptor
  8. Measure Pressure using the Pressure Application Adaptor
  9. Measure Strain using the Bridge Sensor Application Adaptor
  10. Turn on and off the LEDs Portwise (EMANT300)
  11. Turn on and off the LEDs Portwise (EMANT300 and EMANT380 together)