Code Monkey home page Code Monkey logo

eclipse / upm Goto Github PK

View Code? Open in Web Editor NEW
653.0 92.0 413.0 26.96 MB

UPM is a high level repository that provides software drivers for a wide variety of commonly used sensors and actuators. These software drivers interact with the underlying hardware platform through calls to MRAA APIs.

License: MIT License

CMake 2.26% C++ 47.75% C 46.36% Python 0.64% CSS 0.29% Shell 0.16% JavaScript 0.13% SWIG 1.91% Handlebars 0.50%
actuators sensor iot internet-of-things c cpp java python nodejs upm

upm's Introduction

Eclipse UPM Sensor and Actuator Repository

The Eclipse UPM repository provides software drivers for a wide variety of commonly used sensors and actuators. These software drivers interact with the underlying hardware platform (or microcontroller), as well as with the attached sensors, through calls to Eclipse MRAA APIs.

Programmers can access the interfaces for each sensor by including the sensor's corresponding header file and instantiating the associated sensor class. In the typical use case, a constructor initializes the sensor based on parameters that identify the sensor, the I/O protocol used and the pin location of the sensor. As of UPM 2.0, sensor initialization can also be done, in most cases, via overloaded constructors that accept string identifiers.

We endorse additions that implement the generic C and C++ interfaces provided with the libraries. With the 2.0 release, UPM introduces the following sensor interfaces:

iAcceleration, iAngle, iButton, iClock, iCollision, iDistance,
iDistanceInterrupter, iEC, iElectromagnet, iEmg, iGas, iGps, iGyroscope,
iHallEffect, iHeartRate, iHumidity, iLight, iLineFinder, iMagnetometer,
iMoisture, iMotion, iOrp, iPH, iPressure, iProximity, iTemperature, iVDiv,
iWater.

The developer community is invited to propose new interfaces for actuator types.

The UPM project is joining the Eclipse Foundation as an Eclipse IoT project. You can read more about this here.

Example

A sensor/actuator is expected to work as such (here is the MMA7660 accelerometer API):

  // Instantiate an MMA7660 on I2C bus 0
  upm::MMA7660 *accel = new upm::MMA7660(MMA7660_DEFAULT_I2C_BUS,
                                         MMA7660_DEFAULT_I2C_ADDR);

  // place device in standby mode so we can write registers
  accel->setModeStandby();

  // enable 64 samples per second
  accel->setSampleRate(MMA7660_AUTOSLEEP_64);

  // place device into active mode
  accel->setModeActive();

  while (shouldRun)
    {
      float ax, ay, az;

      accel->getAcceleration(&ax, &ay, &az);
      cout << "Acceleration: x = " << ax
           << "g y = " << ay
           << "g z = " << az
           << "g" << endl;

      usleep(500000);
    }

Browse through the list of all examples.

Multi-sensor samples for starter and specialized kits can be found in the iot-devkit-samples repository.

Supported Sensors

Supported sensor list from API documentation.

IDE Support and More

The UPM project includes support for multiple industrial-grade sensors, actuators, radios, protocols and standards in use today. It is also highly integrated with the Eclipse IDE through the help of the Foundation's partners. Learn more about tools.

Installing UPM

Find notes on how to install UPM on various OS'es on this page.

Building UPM

See building documentation here.

Build Status Quality Gate Status

Guidelines and rules for new UPM contributions

Before you begin development, take a look at our naming conventions. The name you pick for a newly added sensor needs to be unique in the UPM library.

Next, review the project's contribution guide.

Make sure you add yourself as an author on every new code file submitted. If you are providing a fix with significant changes, feel free to add yourself as a contributor. Signing-off your commits and accepting the ECA is mandatory for making new contributions to this project.

Documenting your code is also a big part of the task. We have a strict set of tags used to classify our sensors and their capabilities. You can find out more about this in our section on documenting a sensor API.

Finally, if you really want to ensure consistency with the rest of the library, and the intel-iot-devkit repositories in general, take a look at our extensive author guide.

API Documentation

API Compatibility

Even if we try our best not to, every once in a while we are forced to modify our API in a way that will break backwards compatibility. If you find yourself unable to compile code that was working fine before a library update, make sure you check the API changes section first.

Changelog

Version changelog here.

Known Limitations

List of known limitations here.

upm's People

Contributors

adelindobre avatar alext-mkrs avatar antagna avatar arfoll avatar chihchun avatar deadprogram avatar dnoliver avatar fboudra avatar g-vidal avatar issam-b avatar jontrulson avatar jrvandr avatar laykuanloon avatar malikabhi05 avatar mihaitghstefanescu avatar msgtfrank avatar noel-eck avatar nullr0ute avatar propanu avatar rafaneri avatar rissanengit avatar sasmita avatar skiselev avatar sknepper avatar stefan-andritoiu avatar suyashlakhotia avatar whpenner avatar xbolshe avatar ykiveish avatar zion-ics avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

upm's Issues

Error handling in UPM

As of now most sensors have inconsistent error handling in place. The goal of this thread is to define a universally accepted way of how would you rather have the sensors fail, when something is not working as expected.

Our preferred method of solving this would be using syslog, but we are open to suggestions.

upm::Servo::setAngle has incorrect logic for servo positioning

The setAngle method in upm::Servo uses incorrect logic to position the servo it controls. It appears to send a PWM signal for a calculated number of 8ms periods, then shut off the PWM signal entirely. This behavior is incorrect in that the servo does not have time to move to its intended location, and even if it did the servo would not hold its location once it arrived.

Stepper Motors are Synchronous

This may be by design, but in Node.js the stepper motor controls are synchronous, and completely block execution.

e.g.

var ULN200XA = require("jsupm_uln200xa");

var step1 = new ULN200XA.ULN200XA(4096, 8, 9, 10, 11),
    step2 = new ULN200XA.ULN200XA(4096, 4, 5, 6, 7);

function move(stepper, dir, speed, steps) {
  stepper.setSpeed(5);
  stepper.setDirection(dir || CLOCKWISE);
  stepper.stepperSteps(steps || 1020);
}

// stepper 2 will not start until stepper 1 is completely finished turning
move(step1);
move(step2);

This also severely complicates IoT use cases, as while the motors are turning, the rest of the program is unresponsive (e.g. servers, network requests, etc)

Unusable types in SWIG-auto-generated JS APIs

See output of doxygen2jsdoc tool.

I manually looked into some of them.

  • Most are pointers that didn't get the custom swig typemapping (%array_class or %pointer_functions) that other upm modules have.
  • SWIG treats the JS parameter corresponding to the original C speed_t parameter as a pointer to a speed_t.
  • I don't know what would make sense in JS for a union struct like accelData.

A110X.installISR is omitted from JS documentation.
Error: parameter arg has invalid type void *
DS1307.writeBytes is omitted from JS documentation.
Error: parameter buffer has invalid type uint8_t *
DS1307.readBytes is omitted from JS documentation.
Error: parameter buffer has invalid type uint8_t *
Gas.findThreshold is omitted from JS documentation.
Error: parameter ctx has invalid type thresholdContext *
Gas.getSampledData is omitted from JS documentation.
Error: parameter ctx has invalid type thresholdContext *
Gas.printGraph is omitted from JS documentation.
Error: parameter ctx has invalid type thresholdContext *
H3LIS331DL.i2cContext is omitted from JS documentation.
Error: returns invalid type mraa::I2c *
HM11.setupTty is omitted from JS documentation.
Error: parameter baud has invalid type speed_t
HMTRP.setupTty is omitted from JS documentation.
Error: parameter baud has invalid type speed_t
SSD1308.draw is omitted from JS documentation.
Error: parameter data has invalid type uint8_t *
SSD1327.draw is omitted from JS documentation.
Error: parameter data has invalid type uint8_t *
MHZ16.setupTty is omitted from JS documentation.
Error: parameter baud has invalid type speed_t
Microphone.getSampledWindow is omitted from JS documentation.
Error: parameter buffer has invalid type uint16_t *
Microphone.findThreshold is omitted from JS documentation.
Error: parameter ctx has invalid type thresholdContext *
Error: parameter buffer has invalid type uint16_t *
Microphone.printGraph is omitted from JS documentation.
Error: parameter ctx has invalid type thresholdContext *
MMA7455.readData is omitted from JS documentation.
Error: parameter ptrX has invalid type short *
Error: parameter ptrY has invalid type short *
Error: parameter ptrZ has invalid type short *
MMA7660.installISR is omitted from JS documentation.
Error: parameter arg has invalid type void *
MPR121.writeBytes is omitted from JS documentation.
Error: parameter buffer has invalid type uint8_t *
MPR121.readBytes is omitted from JS documentation.
Error: parameter buffer has invalid type uint8_t *
NRF24L01.send is omitted from JS documentation.
Error: parameter value has invalid type uint8_t *
NRF24L01.setSourceAddress is omitted from JS documentation.
Error: parameter addr has invalid type uint8_t *
NRF24L01.setDestinationAddress is omitted from JS documentation.
Error: parameter addr has invalid type uint8_t *
NRF24L01.setBroadcastAddress is omitted from JS documentation.
Error: parameter addr has invalid type uint8_t *
NRF24L01.getData is omitted from JS documentation.
Error: parameter data has invalid type uint8_t *
NRF24L01.sendBeaconingMsg is omitted from JS documentation.
Error: parameter msg has invalid type uint8_t *
NUNCHUCK.readBytes is omitted from JS documentation.
Error: parameter buffer has invalid type uint8_t *
RPR220.installISR is omitted from JS documentation.
Error: parameter arg has invalid type void *
GFX.GFX is omitted from JS documentation.
Error: parameter screenBuffer has invalid type uint8_t *
ST7735.executeCMDList is omitted from JS documentation.
Error: parameter addr has invalid type const uint8_t *
TM1637.write! is omitted from JS documentation.
Error: parameter arguments has invalid type ...
Ublox6.setupTty is omitted from JS documentation.
Error: parameter baud has invalid type speed_t
WT5001.setupTty is omitted from JS documentation.
Error: parameter baud has invalid type speed_t
ZFM20.setupTty is omitted from JS documentation.
Error: parameter baud has invalid type speed_t
Error: accelData.reg is of invalid type struct upm::accelData::@0. Omitted from JS documentation.
Error: accelData.value is of invalid type struct upm::accelData::@1. Omitted from JS documentation.
Error: NRF24L01.dataRecievedHandler is of invalid type funcPtrVoidVoid. Omitted from JS documentation.
Error: GFX.m_map is of invalid type uint8_t *. Omitted from JS documentation.

Microphone example issue

using the default microphone example, I get this error:
in method 'Microphone_getSampledWindow', argument 4 of type 'uint16_t *'

UPM no longer builds with latest MRAA due to GPIO enums refactoring

Since eclipse/mraa@f080a74 GPIO enums have different names, which causes UPM to fail during building with errors like

<cut>
| /edison_dev/yocto/ww18/build/tmp/work/core2-32-poky-linux/upm/0.3.1+gitAUTOINC+cff584d8b9-r0/git/src/hcsr04/hcsr04.cxx: In constructor 'upm::HCSR04::HCSR04(uint8_t, uint8_t, void (*)(void*))':
| /edison_dev/yocto/ww18/build/tmp/work/core2-32-poky-linux/upm/0.3.1+gitAUTOINC+cff584d8b9-r0/git/src/hcsr04/hcsr04.cxx:52:5: error: 'gpio_edge_t' was not declared in this scope
|      gpio_edge_t edge = MRAA_GPIO_EDGE_BOTH;
|      ^
| /edison_dev/yocto/ww18/build/tmp/work/core2-32-poky-linux/upm/0.3.1+gitAUTOINC+cff584d8b9-r0/git/src/hcsr04/hcsr04.cxx:52:17: error: expected ';' before 'edge'
|      gpio_edge_t edge = MRAA_GPIO_EDGE_BOTH;
|                  ^
| /edison_dev/yocto/ww18/build/tmp/work/core2-32-poky-linux/upm/0.3.1+gitAUTOINC+cff584d8b9-r0/git/src/hcsr04/hcsr04.cxx:53:34: error: 'edge' was not declared in this scope
|      mraa_gpio_isr (m_echoPinCtx, edge, fptr, NULL);
|                                   ^
| make[2]: *** [src/hcsr04/CMakeFiles/jsupm_hcsr04.dir/hcsr04.cxx.o] Error 1
<cut>

I think I could prepare the patch for UPM to fix this, but I wonder what's your view on that, i.e. do you assume only released mraa versions as valid for building UPM? CMake config has >= only and I don't see any other mentions of this elsewhere.

EDIT: I've worked this around in my Bitbake recipe for UPM and it turned out it's just one place where these enums are used, the diff is below, so the patch will be trivial, as soon as we clarify what's your approach to mraa versions dependency.

diff --git a/src/hcsr04/hcsr04.cxx b/src/hcsr04/hcsr04.cxx
index aecd8a5..79609f0 100644
--- a/src/hcsr04/hcsr04.cxx
+++ b/src/hcsr04/hcsr04.cxx
@@ -49,7 +49,7 @@ HCSR04::HCSR04 (uint8_t triggerPin, uint8_t echoPin, void (*fptr)(void *)) {
     }

     mraa_gpio_dir(m_echoPinCtx, MRAA_GPIO_IN);
-    gpio_edge_t edge = MRAA_GPIO_EDGE_BOTH;
+    mraa_gpio_edge_t edge = MRAA_GPIO_EDGE_BOTH;
     mraa_gpio_isr (m_echoPinCtx, edge, fptr, NULL);
 }

ADXL345 - Not working

I am using ADXL345 accelerometer. The sample code compiles but no values are being changed. When I do i2cdetect -y -r 6 I get the address of 0x4c but I notice in the src code for adxl the device address is 0x53 any thoughts?

Segfault with pca9685 and mraa_i2c_init

Python 2.7.9 (default, Jul 20 2015, 13:11:32)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import pyupm_pca9685
pwm = pyupm_pca9685.PCA9685(0)

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff606abc9 in mraa_i2c_init () from /usr/lib/libmraa.so.0
(gdb) bt
#0 0x00007ffff606abc9 in mraa_i2c_init () from /usr/lib/libmraa.so.0
#1 0x00007ffff62838a5 in upm::PCA9685::PCA9685(int, unsigned char) ()

from /usr/lib/python2.7/site-packages/_pyupm_pca9685.so
#2 0x00007ffff628084a in ?? ()

from /usr/lib/python2.7/site-packages/_pyupm_pca9685.so
#3 0x00007ffff7addb1c in PyEval_EvalFrameEx () from

/usr/lib/libpython2.7.so.1.0
#4 0x00007ffff7adebe0 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#5 0x00007ffff7a59b3c in ?? () from /usr/lib/libpython2.7.so.1.0
#6 0x00007ffff7a2c143 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#7 0x00007ffff7a3fbcd in ?? () from /usr/lib/libpython2.7.so.1.0
#8 0x00007ffff7a2c143 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#9 0x00007ffff7a965d7 in ?? () from /usr/lib/libpython2.7.so.1.0
#10 0x00007ffff7a949d7 in ?? () from /usr/lib/libpython2.7.so.1.0
#11 0x00007ffff7a2c143 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#12 0x00007ffff7adb92b in PyEval_EvalFrameEx () from

/usr/lib/libpython2.7.so.1.0
#13 0x00007ffff7adebe0 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#14 0x00007ffff7aded19 in PyEval_EvalCode () from /usr/lib/libpython2.7.so.1.0
#15 0x00007ffff7afb0ef in ?? () from /usr/lib/libpython2.7.so.1.0
#16 0x00007ffff7afd56a in PyRun_InteractiveOneFlags ()

from /usr/lib/libpython2.7.so.1.0
#17 0x00007ffff7afd74e in PyRun_InteractiveLoopFlags ()

Nodejs EBOLED draw function is broken

@Jon-ICS Even the most basic draw call results in a segmentation fault in node.

var lcdObj = require('jsupm_i2clcd');
var oled = new lcdObj.EBOLED();
var tBuffer = new Uint8Array(1);
tBuffer[0] = 0xfe;
var error = oled.draw(tBuffer, 1);

https://github.com/intel-iot-devkit/upm/blob/master/src/lcd/eboled.h

There is no test or sample for the draw function to verify it actually works either. The rest of the functionality in EBOLED works - clear, setCursor, home and write. Any help or a working sample would be very appreciated if this function is indeed functional.

node.h: No such file or directory compilation terminated.

Hi there, following the build guide on my device when I'm met with the following error when trying to install the individual driver at the section? Any ideas?

root@ubilinux:/home/edison/upm-master/build# make
[ 0%] Built target _pyupm_joystick12
[ 0%] Built target joystick12
[ 0%] Building CXX object src/joystick12/CMakeFiles/jsupm_joystick12.dir/jsupm_joystick12JAVASCRIPT_wrap.cxx.o
/home/edison/upm-master/build/src/joystick12/jsupm_joystick12JAVASCRIPT_wrap.cxx:156:18: fatal error: node.h: No such file or directory
compilation terminated.
make[2]: *** [src/joystick12/CMakeFiles/jsupm_joystick12.dir/jsupm_joystick12JAVASCRIPT_wrap.cxx.o] Error 1
make[1]: *** [src/joystick12/CMakeFiles/jsupm_joystick12.dir/all] Error 2
make: *** [all] Error 2

Callback support for C++/node.JS/Python

This will serve as a discussion thread about adding callback support for UPM sensors where it makes sense. For instance, sensors that make use of the MRAA interrupt service routine would fall into this category.

As of now there is no easy workaround to fully implement this functionality using only the SWIG interface files alone. There is also no magic solution that would fix all the sensors at once, so they would have to be addressed individually based on the expected functionality from a particular sensor.

Since it's possible to raise standard POSIX signals when the interrupt occurs, this could serve as an initial solution and would be straightforward to handle in the target language (both JS and Python support this). Feedback on this would be appreciated.

Documentation & function signatures differ

See output of doxygen2jsdoc tool.
(Suggestions are autogenerated from parameters in the function signature that don't have doxygen documentation.)

Warning: A110X.installISR has documentation for an unknown parameter: fptr. Did you mean isr?
Warning: ADXL335.setZeroY has documentation for an unknown parameter: zeroX. Did you mean zeroY?
Warning: ADXL335.setZeroZ has documentation for an unknown parameter: zeroX. Did you mean zeroZ?
Warning: GroveLed.GroveLed has documentation for an unknown parameter: gpio. Did you mean pin?
Warning: GroveRelay.GroveRelay has documentation for an unknown parameter: gpio. Did you mean pin?
Warning: GroveButton.GroveButton has documentation for an unknown parameter: gpio. Did you mean pin?
Warning: H3LIS331DL.setDataRate has documentation for an unknown parameter: one. Did you mean odr?
Warning: H3LIS331DL.setPowerMode has documentation for an unknown parameter: one. Did you mean pm?
Warning: HTU21D.HTU21D has documentation for an unknown parameter: mode.
Warning: SSD1327.setGrayLevel has documentation for an unknown parameter: gray. Did you mean level?
Warning: Jhd1313m1.Jhd1313m1 has documentation for an unknown parameter: address. Did you mean lcdAddress, or rgbAddress?
Warning: Jhd1313m1.Jhd1313m1 has documentation for an unknown parameter: address. Did you mean lcdAddress, or rgbAddress?
Warning: MAX31723.MAX31723 has documentation for an unknown parameter: bus. Did you mean csn?
Warning: MAX31723.MAX31723 has documentation for an unknown parameter: devAddr. Did you mean csn?
Warning: LSM303.LSM303 has documentation for an unknown parameter: i2c. Did you mean bus, or addrMag, or addrAcc, or accScale?
Warning: LSM303.LSM303 has documentation for an unknown parameter: addr. Did you mean bus, or addrMag, or addrAcc, or accScale?
Warning: LSM303.LSM303 has documentation for an unknown parameter: addr. Did you mean bus, or addrMag, or addrAcc, or accScale?
Warning: AM2315.AM2315 has documentation for an unknown parameter: mode.
Warning: MMA7660.installISR has documentation for an unknown parameter: fptr. Did you mean isr?
Warning: MPL3115A2.convertTempCtoF has documentation for an unknown parameter: iTemp. Did you mean fTemp?
Warning: MPL3115A2.convertPaToinHg has documentation for an unknown parameter: iPressure. Did you mean fPressure?
Warning: NRF24L01.send has documentation for an unknown parameter: *value. Did you mean value?
Warning: NRF24L01.getData has documentation for an unknown parameter: load. Did you mean data?
Warning: RPR220.installISR has documentation for an unknown parameter: fptr. Did you mean isr?
Warning: SM130.SM130 has documentation for an unknown parameter: di. Did you mean bus, or devAddr, or rst, or dready?
Warning: SM130.SM130 has documentation for an unknown parameter: dcki. Did you mean bus, or devAddr, or rst, or dready?
Warning: TSL2561.TSL2561 has documentation for an unknown parameter: integration. Did you mean integrationTime?
Warning: WT5001.checkResponse has documentation for an unknown parameter: index. Did you mean opcode?

Hmc5883l seg fault with javascript bindings

Running this javascript program on my Galileo Gen 2 seg faults

var u = require('jsupm_hmc5883l');
var compass = new u.Hmc5883l(0);

I'm running the iot devkit firmware image

root@quark01729f:~# cat /etc/version 
201409031130

With upm and mraa versions

root@quark01729f:~# opkg list | grep upm
upm - 0.1.8.59 - upm built using CMake
root@quark01729f:~# opkg list | grep mraa
libmraa0 - 0.5.2.50 - mraa built using CMake

SSD1327: Segfault when calling the draw method with incorrect arguments from python

When calling ssd1327.draw() from python the library segfaults if the first argument is not of type lcd.uint8Array. It would be much nicer if the library returns an error when it finds an unexpected type, instead of carrying on with a null pointer (see data in the backtrace below) and causing a guaranteed segfault down the line. Ideally passing native python types would work, but I think this would require the use of SWIG typemaps?

The following is a reproducer:

Python 2.7.3 (default, Mar 31 2015, 11:37:49)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import pyupm_i2clcd as lcd
x = lcd.SSD1327(0);
x.draw("\x55", 1);
Program received signal SIGSEGV, Segmentation fault.
0xb7efe7b3 in upm::SSD1327::draw (this=0x805be00, data=0x0, bytes=1) at >/home/root/git/upm/src/lcd/ssd1327.cxx:146
146 uint8_t bitOne = (data[row] << col) & 0x80;

A backtrace from gdb is shown below:

(gdb) bt

0 0xb7efe7b3 in upm::SSD1327::draw (this=0x805be00, data=0x0, bytes=1) at /home/root/git/upm/src/lcd/ssd1327.cxx:146

#1 0xb7ef9573 in _wrap_SSD1327_draw (args=0xb7f4d8ec) at /home/root/git/upm/build/src/lcd/pyupm_i2clcdPYTHON_wrap.cxx:5325
#2 0x4a163aaf in PyCFunction_Call () from /usr/lib/libpython2.7.so.1.0
#3 0x4a1c3dd4 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#4 0x4a1c3a7d in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#5 0x4a1c46c1 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#6 0x4a1c4843 in PyEval_EvalCode () from /usr/lib/libpython2.7.so.1.0
#7 0x4a1de369 in ?? () from /usr/lib/libpython2.7.so.1.0
#8 0x4a1e0536 in PyRun_InteractiveOneFlags () from /usr/lib/libpython2.7.so.1.0
#9 0x4a1e0713 in PyRun_InteractiveLoopFlags () from /usr/lib/libpython2.7.so.1.0
#10 0x4a1e0d38 in PyRun_AnyFileExFlags () from /usr/lib/libpython2.7.so.1.0
#11 0x4a1f07cc in Py_Main () from /usr/lib/libpython2.7.so.1.0
#12 0x08048567 in main ()

lol driver non functional on Edison?

tried following test code - it worked sometimes fine for 2-3 lines. Afterwards the output seems gone.
If I reduce the sleep time I can see all sorts of crazy effects (LEDs on here and there)

include "mraa.hpp"

include "upm/lol.h"

include <unistd.h>

int main(int argc, char** argv) {
upm::LoL lol;

for (int i=0; i<LOL_X; i++) { 
    for (int j=0; j<LOL_Y; j++) {
        lol.setPixel(i, j, 1);
        usleep(90000);
        lol.setPixel(i, j, 0);
    }
}

}

grove rotary function mismatch

It may be that the version of upm that shipped with w05-15 is different than master here.

root@eddiebetter:~# node groverotary.js 

/home/root/groverotary.js:29
var groveRotary = new upm_grove.GroveRotary(0);
                  ^
TypeError: undefined is not a function
    at Object.<anonymous> (/home/root/groverotary.js:29:19)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3
root@eddiebetter:~# python groverotary.py
Traceback (most recent call last):
  File "groverotary.py", line 27, in <module>
    knob = grove.GroveRotary(0)
AttributeError: 'module' object has no attribute 'GroveRotary'

Microphone sensor python and javascript

How do I send a buffer for the Microphone in python and javascript?

import pyupm_mic
m = pyupm_mic.Microphone (3)
buffer = range (1, 100)
m.getSampledWindow (44100, 100, buffer)

this results in an error

bad arguments for node/python getSampledWindow grove mic samples

In trying the samples on a fresh load of w05-15 and connecting the sound sensor, I get the following errors:

root@eddiebetter:~# node mic.js

/home/root/mic.js:46
    var len = myMic.getSampledWindow(2, 128, buffer);
                    ^
Error: in method 'Microphone_getSampledWindow', argument 4 of type 'uint16_t *'
    at Object.<anonymous> (/home/root/mic.js:46:21)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3
root@eddiebetter:~# python mic.py 
Traceback (most recent call last):
  File "mic.py", line 39, in <module>
    len = myMic.getSampledWindow(2, 128, buffer);
  File "/usr/lib/python2.7/site-packages/pyupm_mic.py", line 152, in getSampledWindow
    return _pyupm_mic.Microphone_getSampledWindow(self, *args)
TypeError: in method 'Microphone_getSampledWindow', argument 4 of type 'uint16_t *'

I don't understand...

I get it that this is code that is supposed to work with edison and the grove line of sensors and actuators.

Is there a tutorial that describes how you would put them all together? How would I put together a house full of sensors and track, for example, temperature in every room of my house?

Thanks,
Chris.

Compile errors with g++ v5.1

The new mraa USB sub-platform feature means that you can now develop UPM modules and examples on a Linux workstation as you can access sensors over the FTDI FT4222 USB to i2c bridge.

I am doing this on a Fedora 22 workstation but am hitting compile errors due to the stricter assignment checking in g++ v5. There are many instances of a mraa::Result enum being assigned to mraa_result_t. An example is in src/th02.cxx line 48

mraa_result_t ret = m_i2c.address(m_addr);
if (ret != MRAA_SUCCESS) {
    throw TH02Exception ("Couldn't initialize I2C.");
}

This generates the error

/path/to/upm/src/th02/th02.cxx:48:45: error: cannot convert ‘mraa::Result’ to ‘mraa_result_t’ in initialization
mraa_result_t ret = m_i2c.address(m_addr);

As I can't find a compiler flag that allows this assignment there are two solutions:

  1. Quick hack
    mraa_result_t ret = reinterpret_cast<mraa_result_t>(m_i2c.address(m_addr));
    if (ret != MRAA_SUCCESS) {
    throw TH02Exception ("Couldn't initialize I2C.");
    }
  2. Fix code
    mraa::Result ret = m_i2c.address(m_addr);
    if (ret != mraa::SUCCESS) {
    throw TH02Exception ("Couldn't initialize I2C.");
    }

There are about 95 instances of this less than stellar coding pattern just in the src folder alone and I don't want to roto-till the code base.

Advice welcome.

Henry

Problem of nrf8001

Hi,

I have a nrf8001 board form RedBearLab. And this chip is supported by UPM. I have tried the test programs nrf8001-broadcas and nrf8001-helloworld, but they can not work properly. I can not find the ble device from my smartphone. Does anyone have some idea ?

Node upgrade on Edison to v0.12.7 causes: Error: Module did not self-register.

We recently upgraded our board to v0.12.7 to address a Segmentation Fault we keep getting (understanding is that v12+ fixes this bug). However, after upgrading, we get an error that a module did not self-register. I am thinking this is due to all of the jsupm packages that come pre-installed in /usr/lib/node_modules. I was hoping an npm rebuild would fix, but this fails on the mdns2 package. npm update doesn't work.

Does anyone know the fix for this?

Here is the full output:

module.js:355
Module._extensions[extension](this, filename);
^
Error: Module did not self-register.
at Error (native)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (/home/root/.node_app_slot/asu_sez.js:3:19)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)

Thank you for any help!

Adding Sensors - AM2315, AS3935, and MCP4725

I have nearly completed the support for the Aosong AM2315 Temp and Humidity sensor. The MCP4725 A2D looks to be pretty simple, so I'll do that next. The AS3935 lightning sensor will be last of this group.

Error trying to use PN532 from JavaScript

When attempting to run the pn532.js example, I am receiving the following error:

Error: Cannot find module 'jsupm_pn532'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/root/blink/nfc.js:1:75)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

I am running firmware 159 and the latest released mraa/upm

Unable to use MPR121 driver with Intel Edison

I'm attempting to communicate with the MPR121 via the UPM node module.

I'm using the Arduino breakout board, and am getting power from the wall.

I've been using some other I2C modules fine (grove base kit display, etc) but can't get the MPR121 sensor to work - here's my test code:

var mpr121 = require("jsupm_mpr121");

var touch = new mpr121.MPR121(mpr121.MPR121_I2C_BUS, mpr121.MPR121_DEFAULT_I2C_ADDR);

touch.configAN3944();
// always logs "configAN3944: 101: I2C write failed." and returns false

I've tried all I2C ports on the Grove Shield, to no avail. Similarly, the provided example fails with the same error.

DS18B20 support

I would like to see support for One wire DS18B20 Temperature Sensor

LoL actuator library failure

PROBLEM

When running github:///upm/master/examples/lol-example.cxx the Olimex LoL lights up but in a rather uncontrolled way. Even doing something simple like:

int main(int argc, char **argv)
{
sensor = new upm::LoL();
sensor->setPixel(1, 1, 1);
sensor->setPixel(1, 2, 1);
sensor->setPixel(1, 3, 1);
sensor->setPixel(1, 4, 1);
usleep(100000000);
}

...causes pixels to flash and turn off almost immediately and then repeat (even though there is no loop.) Some of the pixel flashes are in a pyramid form (matching the charliplexing algorithm.)

CONFIGURATION

I'm using a Galileo Gen1 with up to date firmware 1.0.4 on SPI and the latest IoT Devkit 1.1 on a 8 Go SDHC. I'm booting to Devkit of course.

uname -a

Linux hostname 3.8.7-yocto-standard #1 Wed Sep 3 10:41:56 BST 2014 i586 GNU/Linux

cat /etc/opkg/mraa-upm.conf

src mraa-upm http://iotdk.intel.com/repos/1.1/intelgalactic

opkg list | grep -i lol

opkg list | grep -i upm

upm - 0.1.9 - upm built using CMake
Source: https://github.com/intel-iot-devkit/upm
Description: upm built using CMake
Installed-Time: 1424137558

find /lib/ -name 'lol'

find /lib32/ -name 'lol'

find /usr/lib/ -name 'lol'

/usr/lib/node_modules/jsupm_lol
/usr/lib/node_modules/jsupm_lol/jsupm_lol.node
/usr/lib/libupm-lol.so
/usr/lib/libupm-lol.so.0
/usr/lib/python2.7/site-packages/pyupm_lol.py
/usr/lib/python2.7/site-packages/_pyupm_lol.so
/usr/lib/libupm-lol.so.0.1.9
/usr/lib/pkgconfig/upm-lol.pc

QUESTIONS

What do I need to change to properly control the LoL shield? Build a new libupm-lol from source? Which sources are working?

Internal ISRs should not be exposed to the user

Several drivers use internal ISRs that are installed when the constructor or a start-type method is called. These sensors do not offer the the possibility of installing any other ISR; don’t have any insatallISR()-type methods like other sensors do.
In conclusion, the access level should be set to private.

These are:
beatISR() from GrooveEHR
flowISR() from GroveWFS
signalAISR() from RotaryEncoder

Adafruit 16 channel servo controller - PCA9685

This is more of a placeholder/notification that I am developing the library for the above.

if I can work out how will assign to myself - otherwise if unassigned (because I have not worked out how to do it, feel free to assign to me!

Stan

ST7735 class and screen on Edison

Hello,
I'm trying to find any screen (bigger than 64x48), which works with Edison, without the Arduino board.
I'm using Linux with C++ and need a screen attached over SPI directly to Edison.
What are the four numbers in ST7735 constructor?
Did anybody have a working ST7735-based screen on Edison WITHOUT the Arduino board?
Thank you for any information. I spent months looking for a working screen and audio (other than USB cards). Need to show some information and play sounds on Edison without any huge extension boards.

RFR359F objectDetected() function always returning true

When running the provided example code located at https://github.com/intel-iot-devkit/upm/blob/master/examples/javascript/rfr359f.js, the objectDetected() functions is always returning true, hence the program always reports Object Detected.

I have tried with both the current release version of MRAA/UPM, as well also the intelgalactic-dev opkg repo. I have also tried a different RFR359F on a different Edison board, as well as trying a different pin. Same results.

root@edison:~# opkg install libmraa0                                                            
Installing libmraa0 (0.7.3.30) on root.
Downloading http://iotdk.intel.com/repos/1.5/intelgalactic-dev/libmraa0_0.7.3.30_i586.ipk.
Configuring libmraa0.
root@edison:~# opkg install upm     
Installing upm (0.3.2.25) on root.
Downloading http://iotdk.intel.com/repos/1.5/intelgalactic-dev/upm_0.3.2.25_i586.ipk.
Configuring upm.

pyupm_lol: undefined symbol?

Python 2.7.3 (default, Oct 8 2014, 16:39:22)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import mraa as m
import pyupm_lol as lol
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/site-packages/pyupm_lol.py", line 28, in
_pyupm_lol = swig_import_helper()
File "/usr/lib/python2.7/site-packages/pyupm_lol.py", line 24, in swig_import_helper
_mod = imp.load_module('_pyupm_lol', fp, pathname, description)
ImportError: /usr/lib/python2.7/site-packages/_pyupm_lol.so: undefined symbol: _ZN3upm3LoL6getBitEii
print (m.getVersion())
v0.5.1-20-g29b0425

Hx711 ADC support

Hello I have this ADC and I was wondering if there plan for support it yet? I had some problems to use it with node.js. I tried do an addon, but the result was the same that using node.js with mraa lib. Can you help me with this? This is the repository.

Thank you!

UPM doesn't build anymore...

There is an issue with SWIG bindings + st7335, you're using mraa_gpio_init but then storing the result in a mraa::Gpio not a mraa_gpio_context. Change comes from ab73003 from @andreivasiliu2211.

You really should look into setting up travis so you catch these before merging.

Buzzer PWM state indeterminate after use

Several people at the IoT Roadshows have run into an issue with the Buzzer remaining on after the playSound function delay has ended.

Let's say that a call is made to playSound(chord[chord_ind], 1000000). It appears that the buzzer's PWM signal will continue for the 1000000 usecs, but when it ends the state is either high or low. If it's high then the buzzer never turns off.

Our work around is to declare another gpio pin on and write low to it after playing a sound.

Here's the code that has the bug. It's just the buzzer sample.

include <unistd.h>

include

include <signal.h>

include "buzzer.h"

int
main(int argc, char **argv) {
//! [Interesting]
int chord[] = { DO, RE, MI, FA, SOL, LA, SI, DO, SI };

// create Buzzer instance
upm::Buzzer* sound = new upm::Buzzer(5);
// print sensor name
std::cout << sound->name() << std::endl;

// play sound (DO, RE, MI, etc...), pausing for 0.1 seconds between notes
for (int chord_ind = 0; chord_ind < 7; chord_ind++) {
    // play each note for one second
    std::cout << sound->playSound(chord[chord_ind], 1000000) << std::endl;
    usleep(100000);
}
//! [Interesting]

std::cout << "exiting application" << std::endl;

delete sound;

return 0;

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.