CodeLabs
  • Introduction
  • Cities
    • Cover
    • Summary
    • Introduction
      • Getting Started
      • Resources
      • Naming Convention
    • Caracol
      • Architecture
        • Intel
        • Operating Systems
        • Hardware Platform
        • Field Requirements
        • Software Development
        • Video Conference Station
          • Applications
          • Entertainment System
            • Services
              • Graphics
              • Video
              • Camera
              • Text To Speech
              • Speech To Text
              • Photography
              • Gaming
                • Super Nintendo Emulators
                • Super Nintendo ROMs
              • Twitter
              • Keyboard
              • Google Drive
              • WiFi
            • Modules
            • Tbd
        • Functionality
        • Bill Of Materials
        • Open Questions
        • Future
    • Chacmultun
      • JHD1313M1
        • Background
          • Inter-Integrated Circuit
          • Linux I2C Subsystem
        • Device Drivers
          • User Space Library UPM
          • User Space Library MRAA
          • User Space I2C Library
          • Kernel Space I2C Driver
    • Chicanna
      • OpenCV
        • Face Recognition
        • Web Streaming
    • Chichen Itza
      • Audio
        • Advanced Linux Sound Architecture
        • PortAudio
        • PyAudio
          • Record
          • Play
      • Text To Speech
        • eSpeak
          • pyttsx
        • VoiceRss
          • VoiceRss Text To Speech Python SDK
      • Speech To Text
        • CMU Sphinx
          • Sphinx Knowledge Base Tool
          • PocketSphinx
          • PyAudio
        • SpeechRecognition
    • Coba
      • Linux Kernel Source Code
        • Git Source Code Management
      • Linux Kernel Development Process
        • A Guide To The Linux Kernel Development Process
        • Challenge
      • Linux Kernel Compilation
      • Linux Kernel Modules
      • Linux Kernel Build System
        • Compilation Kernel Object
        • Compilation Built-In
      • Linux Kernel Patch
        • Patchset
      • Linux Kernel Developer
      • Learn More
    • Dos Pilas
    • Dzibilchaltun
    • Edzna
      • MQ Telemetry Transport
        • MQTT Broker
      • Home Assistant
        • Setup
        • Default Configuration
        • Hello
      • Home Automation
        • Device
          • Light ESP8266
          • Intel Edison
        • Server
          • MQTT
            • Light
            • Sensor
            • Binary Sensor
            • Alarm
          • Dweet
          • Weather
          • Binary Sensor
          • Telegram
          • Camera
          • Automation
      • Shack Automation
        • Configuration Yaml
    • Ek Balam
      • Google Cloud Platform
        • Google API Keys
        • Google Application Default Credentials
      • Google Cloud Translation API
      • Google Cloud Vision API
      • Google Cloud Speech
    • Hochob
      • Introduction
      • Accounts
      • Areas
        • Naming Conventions
      • Digital Media Players
        • Chromecast
      • Keypads
      • Mobile Device
      • Amikoo
        • Architecture
          • Hardware Components
            • Intel® Edison Breakout Board
        • Amikoo
          • Setup
          • Git Repositories
          • Audio
          • Main Intel Edison
          • Main x86
        • Sandbox
          • Tbd
      • Server
        • Setup
          • Root
          • PulseAudio
        • Architecture
        • Media
        • Services
          • Automation
            • Home Assistant
              • Setup
          • Calendar
          • Camera
          • Communications
          • Games
            • Loteria Mexicana
            • Caras Y Gestos
            • Sopa De Letras
          • Image
          • Institution
          • Keypad
          • Messaging
          • Motion
          • Robot
          • Sound
            • Play
            • Speech Synthetizer
          • Stream
          • Usb
          • Survey
        • Applications
          • Captain Maya Lands
          • Southern Maya Highlands
          • Amikoo Maya Lands
          • Central Maya Lowlands
          • Northern Maya Lowlands
          • Console Maya Lands
          • Media Maya Lands
          • Calendar Maya Lands
          • Tradition Maya Lands
          • Techie Maya Lands
          • NohochTata Maya Lands
      • Stations
      • Architecture
      • Release Notes
        • v0.1
        • v0.2
    • Hormiguero
    • Kaminaljuyu
      • WRI Workshop
        • Environmental Protection Agency
      • Arquitecture
        • Bill Of Materials
      • Intel
    • Kanki
      • Device
      • Gateway
    • Kinich KaK Moo
    • Kohunlich
    • La Ruta Puuc
    • Mayapan
    • Mixco Viejo
    • Muyil
    • Palenque
    • Qumarkaj
      • Amazon
      • Amazon Echo
        • Lifx
        • IFTTT
      • Amazon Alexa
        • Alexa Skills Kit
          • Training: Developing Alexa Skills - Hello, Alexa!
          • Training: Alexa - A Free Introduction
          • Projects
            • Intel GDC Visitor Center
              • Cloudy
              • Geek
              • Trivia
              • Kit
            • Voice Control Intel Edison
        • Alexa Voice Service
          • Intel Edison
    • Seibal
    • Tabasqueno
    • Tikal
      • Mexican Red Cross
      • Emergency Medical Services
        • Prehospital Care Strategies
      • Intel
      • Bitalino
      • My Signals
      • Architecture
        • Objectives
    • Tulum
      • Introduction
      • Device
        • Development Board
        • Telegram Bot
        • Bootup
        • Text Editors
        • Setup
        • Main
        • IoT101 Inc
        • Mqtt Clients
        • Sensors
      • Server
        • Setup
        • Dashboard
        • Mqtt Broker
      • Challenge
    • Uxmal
    • Xcambo
    • Xpuhil
    • Xunantunich
    • Sandbox
      • Text To Speech
      • Face Recognition Web Streaming
      • Web Server Flask
      • Speech To Text
      • Image Webpage Flask
      • Audio Capture Playback
      • Image Capture OpenCV
    • Tbd
      • Tbd
      • Linux Kernel Architecture
      • Linux Kernel Device Drivers
      • Tbd
  • Gods
    • Acat
      • Node-RED
        • Installation
          • General
          • Base
          • Npm Packages
          • Node-RED Packages
        • Autostart
      • Projects
        • GPIO
        • MQTT
        • Intel GDC Visitor Center
      • Sandbox
    • Ah Puch
      • Recon Instruments
        • ReconJet
          • Get Started
        • ReconEngage
        • Uplink
        • Intel Developer Zone
          • Recon Dev Kit for Jetâ„¢
      • Bicycles
    • Akna
      • Hardware
        • Intel Edison
        • Sphero
        • Bluetooth Dongle
      • Software
        • Javascript
        • Cylon.js
          • Cylon.js Intel Edison
          • Cylon.js Intel Edison Sphero
            • Examples
        • Sphero Linux API
    • Alom
    • Bacab
      • Getting Started
        • Inventory
        • Accounts
        • Software
      • Proof Of Concepts
        • Doorbell
    • Bitol
      • Drone Software Development Environment
        • PX4
        • JMAVSim
        • Ardupilot
        • SITL Simulator
        • DroneKit
        • QGroundControl
        • MAVLink
        • OpenCV
        • Git Source Code Management
      • Drone Solution Architect
        • Companies
      • Dronecode Project
      • Base Drone Solution
        • Flight Controller Hardware
          • PixHawk
          • Intel® Aero Ready to Fly Drone
          • Emlid
          • Erle Brain
        • Flight Controller Operating System
        • Autopilot
          • Px4
            • Architecture
              • NuttX
              • DriverFramework
            • Shell
          • Ardupilot
          • Software In The Loop
            • jMAVSim
            • DroneKit SITL
        • Communications
          • Mavlink
            • PyMAVLink
        • Ground Control Station
          • QGroundControl
        • Developer APIs
      • Hybrid Drone Solution
      • Autonomous Drone Solution
      • Drone Solutions
        • Erle Robotics
        • Emlid
      • Training
        • Drone Solution Architect
          • Demos
            • Ka’an
            • Múuyal
            • lik’
            • Chak iik’
    • Chaac
    • Bolon Ts'akab
    • Buluc Chabtan
      • Challenge
    • Chaac Uayab Xoc
    • Cacoch
      • Background
        • Open Source
        • Do It Yourself Communities
      • The Project
        • History
        • Career Profile
        • Education Strategy
        • Courses
        • Infrastructure
Powered by GitBook
On this page
  • node-red-dashboard
  • node-red-contrib-upm
  • node-red-contrib-upm: package.json
  • node-red-contrib-upm: GroveStarterKit
  1. Gods
  2. Acat
  3. Node-RED
  4. Installation

Node-RED Packages

Node-RED nodes to talk to sensors supported by the UPM library

root@edison:~# cd .node-red
root@edison:~/.node-red# ls
flows_edison.json  lib  node_modules  settings.js
root@edison:~/.node-red#

node-red-dashboard

root@edison:~/.node-red# npm install node-red-dashboard

node-red-contrib-upm

root@edison:~/.node-red# npm install -g node-red-contrib-upm
root@edison:~/.node-red# cd node_modules/node-red-contrib-upm/
root@edison:~/.node-red/node_modules/node-red-contrib-upm# ls
GroveStarterKit  LICENSE.md  README.md  curieimu  package.json  screenshot.png

node-red-contrib-upm: package.json

root@edison:~/.node-red/node_modules/node-red-contrib-upm# nano package.json
  "node-red": {
    "nodes": {
      "upm-grove-button": "GroveStarterKit/grove-button.js",
      "upm-grove-led": "GroveStarterKit/grove-led.js",
      "upm-grove-light": "GroveStarterKit/grove-light.js",
      "upm-grove-relay": "GroveStarterKit/grove-relay.js",
      "upm-grove-rgb-lcd": "GroveStarterKit/grove-rgb-lcd.js",
      "upm-grove-rotary": "GroveStarterKit/grove-rotary.js",
      "upm-grove-sound": "GroveStarterKit/grove-sound.js",
      "upm-grove-temperature": "GroveStarterKit/grove-temperature.js",
      "upm-grove-servo": "GroveStarterKit/grove-servo.js",
      "upm-grove-speaker": "GroveStarterKit/grove-speaker.js",
      "upm-curieimu": "curieimu/curieimu.js"
    }
  },

node-red-contrib-upm: GroveStarterKit

root@edison:~/.node-red/node_modules/node-red-contrib-upm# ls 
GroveStarterKit  LICENSE.md  README.md  curieimu  package.json  screenshot.png
root@edison:~/.node-red/node_modules/node-red-contrib-upm# cd GroveStarterKit/
root@edison:~/.node-red/node_modules/node-red-contrib-upm/GroveStarterKit# ls
grove-button.html  grove-relay.html    grove-servo.html
grove-button.js    grove-relay.js      grove-servo.js
grove-led.html     grove-rgb-lcd.html  grove-sound.html
grove-led.js       grove-rgb-lcd.js    grove-sound.js
grove-light.html   grove-rotary.html   grove-temperature.html
grove-light.js     grove-rotary.js     grove-temperature.js
root@edison:~/.node-red/node_modules/node-red-contrib-upm/GroveStarterKit#

node-red-contrib-upm: GroveStarterKit: grove-speaker.html

root@edison:~/.node-red/node_modules/node-red-contrib-upm/GroveStarterKit# cp grove-relay.html grove-speaker.html

Make modifications to grove-speaker.html

root@edison:~/.node-red/node_modules/node-red-contrib-upm/GroveStarterKit# nano grove-speaker.html
<script type="text/x-red" data-template-name="UPM-Grove-Speaker">
    <div class="form-row">
        <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
        <input type="text" id="node-input-name" placeholder="Name">
    </div>
    <div class="form-row">
        <label for="node-input-platform"><i class="fa fa fa-wrench"></i> Platfrom</label>
    <select type="text" id="node-input-platform">
        <option value="0" selected="selected">Native</option>
        <option value="512">Firmata</option>
        </select>
    </div>
    <div class="form-row">
        <label for="node-input-pin"><i class="fa fa-map-pin"></i> Pin</label>
        <select type="text" id="node-input-pin">
            <option value="0" selected="selected">D0</option>
            <option value="1">D1</option>
            <option value="2">D2</option>
            <option value="3">D3</option>
            <option value="4">D4</option>
            <option value="5">D5</option>
            <option value="6">D6</option>
            <option value="7">D7</option>
            <option value="8">D8</option>
            <option value="9">D9</option>
            <option value="10">D10</option>
            <option value="11">D11</option>
            <option value="12">D12</option>
            <option value="13">D13</option>
        </select>
    </div>    

    <div id="interval-row" class="form-row">
        <label for="node-input-interval"><i class="fa fa-refresh"></i> Interval (ms)</label>
        <input type="text" id="node-input-interval" placeholder="1000">
    </div>    
</script>

<script type="text/x-red" data-help-name="UPM-Grove-Relay">
    <h2>Grove Speaker</h2>
    <br>
    <p>This node will toggle the Grove Speaker based on the msg.payload input (1 or 0).</p>
    <br>
    <p>Learn More:
        <a href="https://software.intel.com/en-us/iot/hardware/sensors/grove-relay" target="_blank">Grove Speaker</a>
    </p>
    <br>
    <img src="https://raw.githubusercontent.com/intel-iot-devkit/upm/master/docs/images/grovespeaker.jpg" />
</script>


<script type="text/javascript">

    RED.nodes.registerType('UPM-Grove-Speaker', {
        category: 'UPM Sensors',
        defaults: {
            name: {
                value: ''
            },
            platform: {
                value: '0'
        },            
            pin:  {
                value: '0',
                required: true,
                validate:RED.validators.number()
            },
            interval: {
                value: 1000,
                required: true,
                validate: RED.validators.number()
            }
        },
        color: '#a6bbcf',
        paletteLabel: 'Grove Speaker',
        inputs: 1,
        outputs: 0,
        icon: 'debug.png',
        align: 'right',
        label: function(){
            return this.name || 'Grove Relay';
        },
    });
</script>

node-red-contrib-upm: GroveStarterKit: grove-speaker.js

root@edison:~/.node-red/node_modules/node-red-contrib-upm/GroveStarterKit# cp grove-relay.js grove-speaker.js

Make modifications to grove-speaker.js

root@edison:~/.node-red/node_modules/node-red-contrib-upm/GroveStarterKit# nano grove-speaker.js
module.exports = function(RED) {

    var m = require('mraa');
    var upmSpeaker = require('jsupm_grovespeaker');

    function groveSpeaker(n) {
        //init
        RED.nodes.createNode(this,n);

        //properties
        this.name = n.name;
        this.platform = n.platform;
        this.pin = n.pin;
        this.interval = n.interval;
        this.relay = new upmSpeaker.GroveSpeaker(parseInt(this.pin) + parseInt($
        this.board = m.getPlatformName();
        this.status({});

        var node = this;

        this.timer = setInterval(function(){

        });

        this.on('input', function(msg){
            if (msg.payload == "1"){
                //upmSpeaker.playAll();
                this.relay.playSound('c', true, "med");
            }
        });

        //clear interval on exit
        this.on("close", function(){
            clearInterval(this.timer);
            //node.buzzer.off();
        });
    }
    RED.nodes.registerType('UPM-Grove-Speaker', groveSpeaker);
}
root@edison:~/.node-red/node_modules/node-red-contrib-upm/GroveStarterKit# ls
grove-button.html  grove-relay.js      grove-sound.html
grove-button.js    grove-rgb-lcd.html  grove-sound.js
grove-led.html     grove-rgb-lcd.js    grove-speaker.html
grove-led.js       grove-rotary.html   grove-speaker.js
grove-light.html   grove-rotary.js     grove-temperature.html
grove-light.js     grove-servo.html    grove-temperature.js
grove-relay.html   grove-servo.js
root@edison:~/.node-red/node_modules/node-red-contrib-upm/GroveStarterKit#
PreviousNpm PackagesNextAutostart

Last updated 7 years ago