Raspberry pi Sensehat

Hi everyone. Thanks for the previous help on my LED question. I have a new question about using the Sensehat with my Raspberry Pi.
I can get the Sensehat to provide me with temperature/humidity/pressure readings and I've been able to set up guages on the dashboard to show what's happening.
I'm trying to use the Sensehat matrix to display the temperature/humidity/pressure readings as a scrolling message and while I can get this to work, the problem is that the Sensehat is taking readings every second which means that my scrolling message gets cut short each time it starts to scroll.
Is there a way to pause or delay the Sensehat so that it only provides readings every say 30 seconds, or how do I insert a delay into the flow to allow time for the message to be displayed?

Thanks again
Colm

Hi Colm

Can you provide your flow and a list of any 'contrib' nodes you are using (i.e. node-red-contrib-??????)
Also what version of NR and node.js?

Unfortunately I haven't got the Pi to hand at the moment so can't provide the flow or the versions, but I would have updated the Pi recently.

I use the Sensehat input and output nodes that are available to download through the browser.

Ok, here is an idea. Lets just take Pressure as an example.

You probably have a change node that moves the msg.payload.pressure to msg.payload before it gets sent to the graph. Add another action to the change node and make it the first action. In this action set flow.pressure to msg.payload.pressure.

Now create another flow with an inject node connecting to the Sense Hat out node. Set the interval of to only run every 5 seconds. for the payload set it to flow.pressure and let it rip.

The idea is to keep moving the current reading into the flow variable - this happens every second. The inject side only runs every 5 seconds and grabs the flow variable once and stuffs it into its msg.payload and sends it to the LEDs. The 5 seconds (you may have to increase that) will allow the Sense hat to display the message before anoteh message is sent to it.

The key is to make sure there is enough time for the message to be written before sending another message.

Alternatively you could put in a Delay node set to Rate Limit mode and Discard Intermediate Messages. Then they will only come through at whatever rate you want.

2 Likes