Close
0%
0%

How To Make WiFi Sensor and integrate to Node-RED

Make in minutes a battery powered WiFi sensor with its Web dashboard in Node-RED on Raspberry Pi!

Public Chat
Similar projects worth following
How to build battery powered WiFi sensors (i.e. temperature) and visualise data on a custom dashboard either on a phone or PC. All this without coding! We use Node-RED software and IOT Cricket WiFi module.

In this project we show how to build battery powered WiFi sensors (i.e. temperature), buttons or any other IOT end nodes with Cricket WiFi module and integrate them easily, without writing any code or programming to Node-RED. We use Raspberry Pi to host Node-RED in our local network.

This project can be realised by makers at all skill levels. It may require some basic soldering however it doesn't require any coding or programming. In the end of this project you will get a solid idea how you can easily build your own system and quickly extend by adding your own IOT end nodes.

Our system is going to be based on MQTT communication protocol, which is hugely adopted in most home automation systems. We use Mosquitto MQTT broker and if you do not have it yet we recommend to follow our simple RPi + MQTT project showing how to set it up first.

  • 1 × IOT Cricket WiFi module https://thingsonedge.com
  • 1 × Raspberry Pi
  • 1 × Battery holder 2x AAA
  • 1 × 2x AAA batteries

  • 1
    What is Node-RED?

    It is a very easy, event-driven tool for setting up your own automation system.

    You may also find more formal and precise Node-RED definition on their website: 

    "Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click.

    " (ref. nodered.org)

    The best way to learn about it, is obviously by doing it by ourselves. There are plenty of resources available on the internet. However this project is sufficient to provide you a basic introduction how get started and integrate your devices built with WiFi Cricket module to your system.

  • 2
    Installing Node-RED on RPi

    You can find the most up-to-date official instructions how to install Node-RED on Raspberry Pi here: https://nodered.org/docs/getting-started/raspberrypi


    However, at the time of doing this project it is as simple as executing this single command line on RPi:

    pi@raspberrypi:~ $ bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)


    After successful installation we should get the following output:

    All done.  You can now start Node-RED with the command  node-red-start  or using the icon under   Menu / Programming / Node-RED  Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880


    For our convenience we would like Node-RED to be running permanently as a service in the background. So whenever we restart RPi the Node-RED system will be automatically started at boot time. All we need is to execute the following commands:

    pi@raspberrypi:~ $ node-red-start
    
    // Press Ctrl-C (it doesn't stop Node-RED it keeps running as a service in a background)
    
    pi@raspberrypi:~ $ sudo systemctl enable nodered.service


    This is it! Node-RED is up and running in the background. Now we can open the Node-RED editor from any computer / phone which are in the same network as the RPi. In order to do that we need IP of the RPi and we can obtain it with this command:

    pi@raspberrypi:~ $ hostname -I
    192.168.1.126 <- our RPi IP address, yours will be different


    Now we can open its editor from a web browser using in our case the following address: http://192.168.1.126:1880

    Great we have got the Node-RED up and running.

  • 3
    Receiving MQTT messages in Node-RED

    It is a very simple and straight forward way to start receive MQTT data in Node-RED. All we have to do is to create a "mqtt in" node:

    Then we need to configure the mqtt node by double clicking on it and setting up IP and Port. Note you can use any MQTT broker, however for this project we are using our MQTT broker installed on the the same RPi as Node-RED. (see RPi + MQTT project ).

    In our case it is:

    Server: 192.168.1.126 (alternatively you can type localhost)

    Port: 1883

    Temporarily we are going to receive all messages from our MQTT broker by setting up topic as: #

    (Later we will change it to specific topics once we know what device we want to receive data from.)

    Our MQTT receiver is configured. Now we can attach "debug" node to print out all the messages coming from the MQTT broker. Press the "Deploy" button.

    In the debug tab we should see incoming messages from the broker. However it is empty now because we do not have any device sending messages. Let's go and make a simple temperature sensor with Cricket to send data here.

View all 6 instructions

Enjoy this project?

Share

Discussions

hanifbossify wrote 06/28/2021 at 16:30 point

Creating a dashboard in Node-RED
create two "mqtt in" and assign with the above topics.
create a chart(for Temperature) item and connect it with the temp mqtt input.
create a gauge (for Battery) item and connect with the batt mqtt input.

https://jannatasia.net/kids-clothes-wholesale/

  Are you sure? yes | no

setes45701 wrote 05/24/2021 at 18:49 point

This is looking very nice and amazing project. I want to test it for my cricket blog, you can see here https://et20slam.net/best-apps-to-watch-ipl-on-mobile-and-pc/

  Are you sure? yes | no

Dusan Petrovic wrote 04/26/2021 at 17:21 point

Slick! Nice job, agree with the instructions.

  Are you sure? yes | no

stefan.schnitzer wrote 04/26/2021 at 16:18 point

Nice project and clear instructions (y) 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates