Embedded Computing
  • About
  • Blog
  • Hardware
    • Which Platform?
    • Controller Platforms >
      • Adafruit Platform
      • Arduino Plaform
      • BBC micro:bit
      • Espressif Platform
      • iLabs Platform
      • Raspberry Pi Platform (MCU)
      • Seeed Platform
      • Silicon Labs Platform
      • Teensy Plaform
    • Computer Platforms >
      • BeagleBone Platform
      • Raspberry Pi Platform (SBC)
      • UDOO Platform
    • Peripherals >
      • Shields
      • Grove System
      • Sensors
      • Actuators
    • Displays >
      • E-Paper Displays
      • Reflective Displays
      • TFT Displays
      • LCD Displays
    • Legacy Platforms >
      • chipKIT Plaform
      • 4D Systems Platform
      • Intel Platform
      • LaunchPad Plaform
      • BoosterPacks for LaunchPads
      • LightBlue Bean
      • Maple Plaform
      • Mediatek Platform
      • Microsoft Azure IoT DevKit
      • Particle Platform
  • Software
    • Exploring RTOS with Galaxia >
      • Event Library
      • Semaphore Library
      • Mailbox Library
      • Timer Library
      • Clock Library
      • SWI Library
      • Task Library
    • Ultra-Low Power with EnergyTrace >
      • Ultra-Low Power with MSP430
      • Ultra-Low Power with Energia MT and Galaxia
    • Using Integers Instead of Reals
    • Going Python?
  • IoT
    • IoT Platforms: Which Hardware? >
      • Matter with Silicon Labs MG24
    • IoT Services: Which Solution? >
      • Recommended IoT Solutions
      • Platform-Specific IoT Solutions
      • Other IoT Solutions
      • Not tested IoT Solutions
      • Notification Solutions
    • Get Date and Time from Internet with NTP
    • Fast and Easy WiFi Connection with QR-Code
  • Tools
    • How to Start?
    • Reference >
      • Asking for Help
      • Boards Pins Maps
      • Ruler
      • Boards and Plugs
      • I²C Logic Level Converter
      • Standards for Connectors
    • Training >
      • Texas Instruments Workshops
      • Embedded Systems: Shape The World — MOOC edX UTAustinX UT.6.02x
      • Embedded Systems - Shape The World: Microcontroller Input/Output — MOOC edX UTAustinX UT.6.10x
      • Embedded Systems - Shape The World: Multi-Threaded Interfacing — MOOC edX UTAustinX UT.6.20x
      • Real-Time Bluetooth Networks: Shape the World — MOOC edX UTAustinX UT.RTBN.12.01x
      • Systems Thinking with Texas Instruments Robotics System Learning Kit
    • Books >
      • Getting Started with the MSP430 LaunchPad
      • Getting Started with Arduino
      • Arduino Cookbook
    • IDE >
      • The Battle of IDEs
      • More Options
      • Assessing the Next Generation of IDEs
      • Tools for Documentation
    • Equipment >
      • Saleae Logic Analyser
      • Rigol DS1102E Oscilloscope
      • XDS110 Debug Probe with EnergyTrace​
      • Segger J-Link Programmer-Debugger
      • Nordic Power Profiler Kit II
  • Projects
    • Libraries >
      • Master I²C Software Library
      • Date and Time Library
      • highView Library Suite
      • Others Libraries
    • smartDevices >
      • I²C smartColours Smart Sensor
      • I²C smartRFID Smart Sensor
      • I²C smartLED Display
      • I²C smartControls Smart Device
      • I²C smartWiFi Smart Device
      • I²C smartBLE Smart Device
      • I²C smartNode Smart Device
    • IoT Projects >
      • Remote E-Paper Weather and Message Board
      • Typie-Walkie with LoRa and E-Paper Screen
      • Typie-Walkie with E-Paper Screen
      • Remote e-Paper Pictures Panel
      • Remote e-Paper Messages Panel
      • Industrial IoT Project
      • Remote Contactless Temperature Monitor
      • Using Node-RED for IIoT
      • Low Power Home Network Weather Monitoring
      • Updated Low Power Home Network Weather Monitoring
      • Weather and Security Station with Blynk
      • SensorTag to Blynk Using Node-RED
      • Pervasive Reporting
    • AI Projects >
      • Colour Recognition with Neural Network
    • Other Projects >
      • Air Quality Monitoring
      • Driving a Large E-Paper Display with a Compact Xiao RP2040
      • Low-Power E-Paper Weather Station
      • Portable Particulate​ Matter Monitor
      • FRAM-based E-Paper Screen Controller
      • General Purpose 3.5" Screen
      • Colour Recognition with Neural Network
      • A Low Power Weather Station
      • Digital Volt-Amp-Watt Meter
      • Mobile Measurement with LCD Display
      • Screen with SRAM for GUI
      • Volt-Amp-Watt-Meter for Grove
      • Multi-Touch Project with CapTIvate

SensorTag to Blynk Using Node-RED

Node-RED provides an elegant solution to merge different IoT devices and services. 
  • The SensorTag acquires weather data and sends them to the Raspberry Pi through BLE (Bluetooth Low Energy).
  • The Node-RED flow runs on the Raspberry Pi, processes the weather data and sends to the Blynk server, either on the cloud or locally, through WiFi.
  • An iOS- or Android-based phone or tablet connects to the same Blynk server, either on the cloud or locally, and displays the measures on a beautiful way.
The RedBear IoT pHAT provides BLE and WiFi to the Raspberry Pi Zero.
Picture
Picture
Picture
Picture

​General Preparation

​Download the Debian Jessie Lite image and prepare a microSD-card.

​On macOS, I’m using 
ApplePi-Baker to prepare the microSD-card. 
Picture

​In order to enjoy 
SSH through USB, update the microSD-card on the main computer with
​

    
  • ​At the very bottom, add 
  • Press ctrl-O ctrl-X to save and close.
​

    
  • Then launch 
​

    
  • ​​After rootwait, add a space.
  • Press ctrl-O ctrl-X to save and close.
  • Power-cycle the Raspberry Pi.


    
  • ​Connect to the Raspberry Pi, with an USB cable on USB port. On the main computer. 

Default password is raspberry.

    
​To proceed with the update and upgrade,
  • Launch on the Raspberry Pi
Code Editor

    
To set the timezone,
  • Launch on the Raspberry Pi 
​

    
  • ​Install and run rpi-update.
  • Launch on the Raspberry Pi ​​

    

Install RedBear IoT pHAT

  • ​Power the Raspberry Pi off,
  • Plug the RedBear IoT pHAT on the Raspberry Pi,
  • Power the Raspberry Pi on,
  • Connect to it and launch
​
If the answer is IoT pHAT w/eep_v0.3, the board is ready. Proceed to next section. Otherwise, the EEPROM needs to be updated. Just follow this procedure.
​

    
​To confiture WiFi,
  • Launch on the Raspberry Pi​


    
  • Add at the end
  • Press ctrl-O ctrl-X to save and close. ​

    
  • ​​Finally, reboot.
​

    
  • ​Connect using Ethernet over USB or WiFi.
  • Launch on the main computer
​
Default password is raspberry.

    
​To check Bluetooth is running,
  • Launch on the Raspberry Pi
​

    
​To scan Bluetooth devices,
  • Launch on the Raspberry Pi
​
​

    
The SensorTag Node-RED requires Bluetooth, as well as an Ethernet over USB connection or a WiFi connection

​Install node, npm and Node-RED

  • ​Launch on the Raspberry Pi
​

    
  • ​Check

    
  • ​To obtain release 0.12 of node, launch on the Raspberry Pi

​

    
  • ​To install Node-RED
​

    
  • ​To install npm to manage additional nodes,

​

    
  • ​To obtain release 2.15 of npm, launch on the Raspberry Pi

​

    

​Install Additional Nodes

​There are two releases for the SensorTag, node-red-contrib-sensortag and node-red-node-sensortag. I managed to get the first one to work.
  • Install the node.

​

    
  • ​List the installed nodes
​

    
  • ​To install the Blynk node, launch on the Raspberry Pi Zero

​

    

​Launch the Blynk App

On the iOS- or Android-based phone or tablet,
  • Install the Blynk app and launch it.
  • Enter your credentials, either to the Blynk cloud or to a local server.
  • Create a new project.
  • Press E-mail to have the auth token sent.



Picture
For each measure, add a widget.
  • Select one widget among the long list,
  • Name it, and
  • Define a virtual pin.

​On the right, temperature is defined on virtual pin V0, and light on virtual pin V3.

Picture
Picture

​Develop the Node-RED Flow

  • ​Launch Node-RED with one of the two commands.

    
  • Connect using Ethernet over USB or WiFi
  • Open http://raspberrypi.local:1880 on a browser. 

Click to enlarge.



​
Picture
  • Click-and-drop the SensorTag from the left pane to the main area.
  • Each time the Deploy button on the top-right turns red, click Deploy to launch the flow.
  • ​On the SensorTag node, click on Scan and select your SensorTag.
  • Select the sensors from the SensorTag to be included in the messages.
Picture
​If connection doesn't work,
  • Launch bluetoothctl in a separate connection and disconnect the SensorTag with

​On the SensorTag node,
  • Press Rescan and select the line with B0:B4:48:ED:B4:84, corresponding to your SensorTag. 

    
  • Add a Debug node and connect it to the SensorTag node.


​
Picture

​The SensorTag outputs
​

    
  • ​On the Node-RED GUI, add a function node and define it with
​

    
  • Do the same for other messages.
  • Replace the msg.sensor criteria and the payload:msg.payload.json_data.field accordingly.

For example, the criteria for light is "luxometer" and the field payload:msg.payload.json_data.lux. 


Picture
​On the Node-RED GUI,
  • Add a Blynk write node and define the URL and project key.

​The project key is the 
auth token sent from the Blynk app.

    
The URL could be
  • the Blynk cloud, or


​
Picture
  • the IP address of a local server.
Picture
The finalised flow looks like
  • Click Deploy.
Picture
  • Press Update and define the virtual pin. 
  • Do the same for the other measures, with different numbers for the virtual pins.
​
​
Picture
  • Move the SensorTag and check the measures change accordingly on the phone or the tablet.



Picture
Powered by Create your own unique website with customizable templates.