Jump to content

rwblinn

Members
  • Gesamte Inhalte

    121
  • Benutzer seit

  • Letzter Besuch

Posts erstellt von rwblinn

  1. To share my Project Lighthouse58 - a Node-RED Internet of Things Learning Case using a Raspberry Pi with connected TinkerForge Bricks and Bricklets.

    Good fun integrating TinkerForge Bricks into LEGO. Communication is based on MQTT.

     

    Prototype

    lighthouse58-p.png

    Control Unit

    lighthouse58-cu.png

    Circuit

    lighthouse58-c.png

     

    Lookup http://www.rwblinn.de > IoT > Lighthouse58 or for the detailed PDF document http://www.rwblinn.de/iot/lighthouse58.pdf.

     

  2. Hi,

     

    while testing the OLED 64x48 MQTT write_line/set, noticed a mismatch between the german and english documentation:

     

    german: The text can have a maximum of 14 characters

    english: The text can have a maximum of 13 characters.

    The tests showed 14 char length is not working, 13 char length is OK.

    The same applies for the position 0-12 vs 0-13.

     

    Further more number of lines stated 0-5, while testing 0-4 is working and not 0-5.

     

    Please verify.

     

     

     

     

  3. Hi,

     

    noticed that get_port is not exposed in the MQTT Proxy.

    Are there any plans to include?

     

    For the IO-4 several getters are defined.

    Are these also planned for the IO-16 Bricklet?

     

    class BrickletIO4Proxy(DeviceProxy):
        DEVICE_CLASS = BrickletIO4
        TOPIC_PREFIX = 'bricklet/io4'
        GETTER_SPECS = [('get_value', 'value', 'value_mask'),
                        ('get_configuration', 'configuration', None)]
    

  4. Thanks for reply.

    For MQTT

    Looked at source brick-mqtt-proxy.py and noticed work in progress (see code snippet). So will wait for an updated brick-mqtt-proxy.

    Any timelines when special chars will be supported?

     

    # FIXME: get_custom_character and get_default_text need special handling
    class BrickletLCD20x4Proxy(DeviceProxy):
    GETTER_SPECS = [
    ... 
    ]
    SETTER_SPECS = [
    ...
    (set_custom_character', 'custom_character/set', ['index', 'character']),
    ...
    ]
    

     

  5. UPDATE

    Installed:

    $sudo npm install -g tinkerforge

    Added to NODE_PATH:

    $export NODE_PATH=$NODE_PATH:/usr/local/lib/node_modules

    Installed:

    $npm install body-parser in the .node-red folder under node_modules

    Created folder:

    /home/pi/.node-red/node_modules/node-red-contrib-tinkerforge

    Copied the lib folder and other files to node-red-contrib-tinkerforge

    Started node-red

    TinkerForge nodes available

     

    COOL

     

    Added the ambientlight (v1) sensor by amending lib/bricklets.js, tinkerforge.js & tinkerforge.html.

     

    Again Thanks a Lot = Job Well Done

     

  6. Solved by using the MQTT proxy as broker on localhost:1883.

    Defined a simple test flow with:

    • Input Node "MQTT In" subscribing to topic "tinkerforge/bricklet/ambient_light/mdh/illuminance"
    • Function Node JSON to convert MQTT string to javascript object
    • Function Node Function to log the payload properties illuminance and _timestamp
    • Debug Node to log the MQTT payload (which is a JSON string)

     

    Looks promising to explore further integration of TinkerForge in Node-RED.

  7. Hi,

     

    is there guidance available on how to use the TinkerForge Javascript Bindings in Node-RED.

     

    Have tried to define a simple call to an ambilight bricklet in a Node-RED function, but received error 31=timeout.

    //var Tinkerforge = require('/usr/lib/node_modules/tinkerforge');
    var Tinkerforge = context.global.tinkerforge;
    var HOST = '192.168.0.88';
    var PORT = 4223;
    var UID = 'mdh';
    var ipcon = new Tinkerforge.IPConnection();
    var al = new Tinkerforge.BrickletAmbientLight(UID, ipcon);
    ipcon.connect(HOST, PORT,
        function (error) {
            node.warn('Connect Error: ' + error);
        }
    );
    ipcon.on(Tinkerforge.IPConnection.CALLBACK_CONNECTED,
        function (connectReason) {
            al.getIlluminance(
                function (illuminance) {
                    msg.payload = "{\"Illuminance\":" + illuminance/10.0 + "}";
                    node.warn('Illuminance: ' + illuminance/10.0 + ' Lux');
                },
                function (error) {
                    msg.payload = "{\"lluminance\":" + error + "}";
                    node.warn('Get Error: ' + error);
                }
            );
        }
    );
    ipcon.disconnect();
    return msg;
    

    Note: defined in node-red settings, after installing tinkerforge via npm:

        functionGlobalContext: {
        		tinkerforge:require('/usr/lib/node_modules/tinkerforge')
    

  8. Hi,

     

    tried to run on a Raspberry Pi with Master Brick, Wifi Ext 2.0, Ambientlight the ExampleSimple.js.

    When running from the commandline $node ExampleSimple.js, received error:

    module.js:340

        throw err;

              ^

    Error: Cannot find module 'tinkerforge'

     

    The line in ExampleSimple.js not changed:

    var Tinkerforge = require('tinkerforge');

     

    Installed the javaScript bindings using npm. Steps taken as user Pi with install message.

    cd /home/pi

    sudo npm -g install tinkerforge

    tinkerforge@2.0.9 /usr/lib/node_modules/tinkerforge

     

    When adding the full path to require('/usr/lib/node_modules/tinkerforge') it is working.

     

    How to setup without the need to add the full path in require.

     

    Any help appreciated.

     

×
×
  • Neu erstellen...