I have been busy with family matter, but when I get a chance and nothing pressing for work to do, I have been working on this monster below. Now there is not too much going on, but there has been much learning. Lets look at what is happening.
Set LCD Function
First lets look at the top flow:
- If we get a WS mesage to /ws/lcd, it should be a message to update what is shown on the LCD.
- The second node is the function node and this takes the message and creates an update query for the mongo. Looks like this:

- The third node updates the mongo collection
- There is a 2 second delay to make sure mongo is updated and then send out a MQTT message to update the LCD, which we will cover below
Regular Updates
Next up is simple: Every 20 seconds ask the LCD to update.
Show Me the Message:
Last set of Nodes in this flow take the MQTT message, query mongo for what should be show and then display that. I covered much of this in my last BLOG post #6 for the Upcycle It Challenge. Here what the query looks like:
And my function
var state = msg.payload[0].state;
if (state == "outside temperature") {
return [null,msg];
}
if (state == "custom") {
var newMsg = {payload: msg.payload[0].custom };
return [newMsg,null];
}
if (state == "time") {
var now = new Date();
var mins = now.getMinutes();
if (parseInt(mins) < 10) {
mins = "0" + mins;
}
var nowDate = now.getMonth() + "/" + now.getDate() + "/" + now.getFullYear();
var nowTime = now.getHours() + ":" + mins;
var newMsg = {
payload: {
msg1: nowDate,
msg2: nowTime,
R:50,
G:100,
B:50
} };
return [newMsg,null];
}
That is really it for now. I have tested this with a Button on my web page that sends a Socket.io message back to the server that then sends a WS message into this flow. I have not finished the custom message, but I have tested it with some editing of the mongo document.
Updates On The Design
I have gone back and forth about using the 74H595 shift registers or not, but I have decided, since I am going to use the Miniboard in my project, to not use the shift register. I will have plenty of GPIO and only thing I will miss is the analog for the temperature sensor, so I will change to an I2C sensor that I already have. I will use pull up resistors and BC337 transistors to pull the relay high to keep the relays off and turn on the GPIO to take signal low. I will have a drawing and test results in the next BLOG post by the end of the week.




