Blog 3 - Node-RED/Bin Bot - Davin Barron

 Blog 3 - Node-RED/Bin Bot - Davin Barron




Gemini said

Team feedback session

To kick off this weeks sprint, we came together and had a team-based feedback session. The objective behind this was ensuring our technical work to date was sound and, more importantly, ensuring no one was left behind.

In any complex project, it’s easy for team members to "fall out of the boat" due to missed sessions or technical roadblocks. We made it a team priority to identify who was falling behind and actively pull them back in, ensuring everyone was up to speed with our progress, that goes for Jay as well! 😉

During the session we also discussed how we can independently make strategic decisions without relying on external input. By taking ownership of the "How" and "Why" behind our project, we can show that we are capable of spotting interesting problems and proposing our own solutions.




Node-RED

During one of our previous sessions, we looked into different ways we can interact with an MQTT server. One of our teammates, George, looked into Node-RED which is a flow-based programming tool used for IoT applications.

We decided as a group that it would be an interesting technology to use for the bin bot project so we dedicated a lab session to learn about it from George since he had the most experience with it.

George did such a great job at it that he may as well become a lecturer at this point 😄 Careful Jay, even he'll give you a run for your money 😉

George made a very interactive lab session with a set of exercises to help us get started. He helped us throughout the entire project and ensured that everybody was up to speed, now that is teamwork 😎



The exercises we tried:

  1. Download Email using Palette Manager
  2. Create an injection to an email node
  3. Create an MQTT out connection injection that sends drives to the Micro:bits
  4. Create an MQTT in connection and separate them from each other
  5. Do you have a webhook? Try send some messages to it using injections

First was to get Node-RED installed. 

Node-RED Setup:

The way we did it was through setting up a container using Docker. I didn't have docker installed on my machine so I went to their website and downloaded the installer there. This should install the Desktop app and the Docker CLI (Command Line Interface)



https://docs.docker.com/desktop/setup/install/windows-install/

Then over on the Node-RED website there is a command that we can run using our command line terminal to set up the docker container.



https://nodered.org/docs/getting-started/docker

This will automatically start the Node-RED container and will add it to the Docker Desktop app. If you want to rerun the container again you can do it through the app.





With the container setup. Node-RED is ready to go. 

You can launch Node-RED locally on port 1880. You can also see the port number on the Desktop app, clicking it opens up Node-RED on the browser. 

There will also be a confirmation in the terminal window.




From a glance the UI looks really intuitive, you can drag and drop nodes as needed and connect them together. Neato! 

Email Exercise:

I installed the email module from the Palette manager. There's 5859 modules to play around with which is pretty cool. This gives us lots of options for working with the bin bot.



I'll walkthrough briefly how I managed to send an email to myself. 

I dropped an injection node and connected it to an email node. 


For the injection node, I configured the message payload and the topic, in this case it's like the email body and subject.


For the email node, I added the email I wanted to send to. I just used my own here. I gave the node a name so I make it clear to myself and others what this node does. 

We also need a password to send to Gmail. To get this we need to get one from google using:  https://myaccount.google.com/apppasswords

Also, important note, uncheck the TLS option, which is essentially a way of sending a secure email. Unless we have a server certificate then the email will not send.


And that's it! We have everything we need to send an email to ourselves. To run the nodes, click the deploy button on the top right:


Here's how mine turned out. Perhaps I can use this to send myself daily reminders of when assignments are due in 😀



Also if there's any problems along the way, they should appear in the terminal window. This window can also be viewed on the Docker app too! 

For example, here we can see the connection to the BeeBotte server being logged:

Connecting to the MQTT Broker:

Connecting to the MQTT broker is identical to how it was done in the IoT MQTT Panel mobile app that we used in a previous lab.

I setup an injection node and connected it to an MQTT out node to send data to the schools/outputs topic on the MQTT broker.


I configured the MQTT out node with the server name and port.


Username and password.


Then I subscribed to the topic. Yes it was that simple!


For the Injection node, I made a simple JSON payload to test with.


After running the flow, we can see the output being displayed on the debug panel on the mobile app we used.

Connecting multiple nodes together:

One really useful feature that I enjoyed about Node-RED is the ease of being able to connect multiple nodes together seamlessly.

Using the JSON injection I setup before, 
I wanted to test if I am able to send the payload to my email and to the debug window within the Node-RED environment.


In the flow above, I am reusing the email flow I used previously and just extending it's capabilities by connecting additional nodes to it. Isn't that handy! 😊

In the setup, I am using an MQTT In node and using a switch node to send the payload to the email node which we set up earlier and a debug node.

The MQTT In node is configured exactly the same way as the MQTT Out node.


The switch statement has a condition that checks if the payload coming in is empty.


The debug node is already configured by default to output the message payload to the debug window within the Node-RED environment. 

You can also check the option to print the payload to the terminal as well. This can then be found within the Docker App.


After redeploying and running the payload injection again, it's time to see if everything works.

The debug window can be opened using a button found on the top-right hand side of the Node-RED UI.


Here we can see the payload being outputted in the debug window. Great!


Over in the Docker log window, it shows the message payload from the debug too. 

It also informs us that the payload was successfully sent to our email.




Which it has!


Success! And it was pretty easy to set it up too don't you think 😏

Conclusion:

The key takeaway from this lab is I can now understand how to use Node-RED and how powerful it is to setup IoT interactions. It makes it easier for more people to begin developing IoT applications without needing excessive code knowledge to get started.

And the biggest benefit of this lab is that now all of us on the team know how to use it!

It is the perfect tool to use as a unified development platform for the bin bot project.

Bin Bot Brainstorming Session

The bin bot is a smart bin that has technologies like sensors and the ability to connect to the internet. It is made in house by students from SETU and has been continually worked on over the last few years. 

Currently the bin is able to rotate and more recently it now has a set of moving eyebrows which is pretty cool. 

Our aim is to make the bin bot to be more than just an ordinary smart bin, we are trying to make it more interactive and human like. The eyebrows allow the bin to express emotions like sadness, anger, or curiosity, which makes the act of recycling feel like a conversation rather than a chore.


The goal of the team

Our team’s objective is to build upon this foundation by leveraging IoT technologies. By communicating with an MQTT broker, we want to enable smart features that allow us to collect data and make the bin accessible and manageable through the internet.

Here are some of the ideas that we came up with together as a team:

  • Sensors to measure bin fullness.
  • Gamifying rubbish to promote better waste management in schools.
  • Specific eyebrow "mood" presets.
  • Traffic encryption for data security.
  • A barcode reader for identifying items.
  • Automatic rubbish type detection.
  • Data collection and analytics.
  • Sending automated emails when the bin is full.
  • Sending data to the IoT MQTT Panel mobile app.
  • Phone-controlled interaction (moving eyebrows via an app).
  • Subscription services for bin updates.
  • Using Google Classroom for school-based reports.
  • Microphone interaction to detect where a person is.
I put forward the microphone interaction idea as I wanted to play on the unique selling point of our bin to make it more engaging which adds to the human-like elements. 

For example, when someone talks to the bin, the bin can turn and look at the person. The eyebrow presets can also feed into this idea too where it might give off a curious look at the person.

Team Discussions

After piecing together some ideas, we got together to discuss each idea.

Encryption:

We noted that standard MQTT is not very secure by default. We discussed using TLS to encrypt messages and potentially moving toward end-to-end encryption between Micro:bits to protect data sent over radio waves.

Fullness detection:

We discussed about using an ultrasonic sensor to capture the fullness of the bin by connecting the sensor to a Micro:bit. We would use this sensor to measure the distance from the top to the bottom of the bin and publish this data to an MQTT topic.

LCD Display:

We can use the LCD to display data such as bin fullness without needing to see the inside of the bin. This can be like a progress bar or a percentage.

Sound detection:

While we loved the sound-rotation idea, we discovered the eyebrow motors are actually quite loud! Since the Micro:bit mic just picks up the loudest sound, the bin would essentially hear its own eyebrows moving. We have postponed this idea for now.

Tilt:

Using the Micro:bit’s built-in sensors, we can detect if the bin has fallen over. This would then trigger an alert.

Email:

After using Node-RED to do something similar, we thought of an idea that would allow users to subscribe to the bin bot and send on a report by using email. This can be used to send warnings such as bin fullness and if the bin has fallen over.

Rubbish identification:

We discussed how we can make use of Robo-realm vision system with machine learning and classification to identify the different types of rubbish. While at first it was a cool idea, there is also GDPR and data protection issues if we were to capture somebody's face in the data collection process.

I mentioned that we can do something like the current Return plastic bottle scheme and incorporate that into the bin bot project. This caused the discussion to shift from doing a sort of vision system to instead maybe using a barcode reader to collect plastic bottles rather than waste.

We can use a barcode reader module and hook it up to Robo-realm to scan barcodes found on most bottles as a way to collect data for identification.

This further plays into an idea we had for gamification and charity. The bottles we collect can be donated or be used to deposit into the Return bottle facilities.

Different classes within schools can compete where we can use the data we collect to do a sort of leaderboard ranking system to encourage school children to recycle more.

This brought us to the idea of using google classrooms to subscribe to the bin bot for schools where reports and bin bot data can be sent to the classroom.
 

Un Sustainable Development Goals

A massive part of this project is ensuring our work contributes to a better world. We have aligned the Bin Bot with several United Nations Sustainable Development Goals:
  • Goal 4: Quality Education: 
    • Using the bin as an interactive tool to teach children about recycling.
  • Goal 9: Industry, Innovation, and Infrastructure: 
    • Building smart, connected infrastructure for waste management.
  • Goal 11: Sustainable Cities and Communities: 
    • Helping cities manage waste more efficiently via IoT.
  • Goal 12: Responsible Consumption and Production: 
    • Encouraging better waste segregation at the source.
  • Goal 13: Climate Action: 
    • Reducing the carbon footprint of waste by improving recycling.
  • Goal 15: Life on Land: 
    • Reducing pollution and littering in our local environments.
  • Goal 17: Partnerships for the Goals: 
    • Collaborating with schools and charities to achieve these targets.

In Ireland, 45% of rubbish is currently dumped or managed poorly. We hope this project helps reduce that number by making recycling data visible and the process more engaging.

Implementation plan

We have 6 weeks left in the semester, which we have broken into three 2-week sprints. The first two will focus on development, and the final sprint will be for debugging and final touches. 

To stay organised, we created a team based slack channel where we can discuss the project and put together links and resources. In addition, I created a team project board using a project management system called Miro.

You can find the board here with read only access:
https://miro.com/app/board/uXjVG1jZkL8=/?share_link_id=885285499239


Proposed tech
  • MQTT
  • Node-RED
  • Micro:Bits
  • Bar Code Scanner
  • Ultrasonic Sensor
  • LCD Display
  • Google Classroom and Emails

Block Diagram



Bin Bot Pitch

In Ireland, we are currently losing the battle against waste. With 45% of our rubbish exported or managed incorrectly, it’s clear that our current system lacks the engagement and intelligence to make a real difference. We don’t just have a waste problem; we have an education and infrastructure problem.

Meet the Bin Bot: an intelligent, interactive recycling teammate designed to bridge that gap. By leveraging IoT technologies and real-time data analytics, we’ve transformed a static utility into a character-driven experience. With expressive motorised eyebrows that react to your actions, the Bin Bot engages users turning a mundane chore into something fun.


By teaming up with schools, we can teach the next generation about the value of each and every bottle. Students can compete against each other through friendly competition and see how they rank on the leaderboard of waste management, where each recycled bottle scores a point for their class. But it doesn't stop there!

Using the power of Node-RED, students can check up on their bins health and see how the bin is doing through Google Classroom. The collected bottles can then be converted into charity donations to feedback into the local communities. We aren’t just building a smart bin; we are creating a scalable, secure, and fun solution that aligns with the UN Sustainable Goals. Together we can make a real difference; not just to Ireland but the whole world!

Comments

Popular posts from this blog

Blog 1 - Igor Kapusniak