week 12

interface and application programming

Group Assignment Page

Interface Languages

First of all, the interface language that I am interested in was as follows.

Node-RED

Installation

  1. Opened Terminal.
  2. First, Downloaded Node.js.
    brew install node
  3. On MacOS, from a terminal window, type: (The npm is a node package manager, and if you download the node, it is downloaded together.)
    npm install node-red
  4. But Node-RED wasn't downloaded and I re-typed as below.
    npm install -g node-red
  5. The download was finished and I could check if it was down to node -v and npm -v and the version.

Start Node-RED

  1. In terminal, Typed node-red. and Copied sever address(for example,http://127.0.0.1:1880). And accessed the Node-RED editor by pointing my browser
  2. To use serial and interfaces, Pressed the menu button on the upper right, pressed the Manage palette button, and installed node-red-node-serialport and node-red-dashboard from the install.

  3. And reloaded page. Then, the serial items and the Dashboard section were created on the left side.
  4. I decided to create an interface using a board made in input device week.
  5. In Node-RED editor, To use the serial port on my board , I had to connect my board and turn on Arduino to select Tools - Port : " ".
  6. Drag and drop network - serial in and common - debug on the left side, then connect them.

  7. Then double click on serial in to select port and set it up according to the code inside.

  8. Then press the Deploy button.
  9. In Arduino, If my board was programmed well and the serial monitor printed the message well, the message on the debug page will also be displayed well as follows.

Result

I designed the interface of the board that I made in the input devices week.

My Interface

Operation Video

How To Use Node Fuction

  1. fuction - delay

    I didn't put the Delay function in my input board's Arduino code. The reason was that the code for reading sensors accounted for 99 percent of the mcu memory. So I put the delay function in the Node-RED.

  2. dashboard - text

    The text function was used to verify that the value in the debug is well-printed on the interface screen.

  3. fuction - switch

    I received two kinds of messages from my board: Temperature and Soil Moisture. And I had to separate the messages into each debug node and print them out through the interface. sequence - split played the role.

  4. sequence - split

    The serial message from my board contained "Temperature : " or "Soil Moisture : ". And I only needed figures for the chart or guage. So I used split function to separate the figures.

  5. dashboard - chart

  6. dashboard - gauge

Files

  • .json(interface code)
  • .ino(arduino code)