By using littleBits Proto modules it is possible to create Raspberry Pi projects with littleBits components. On this project we created a temperature monitor with a local indication and a remote Web page using Node-Red.
The parts used were:
- 1 Raspberry Pi 3
- 1 Explorer Hat (used for Analog Inputs)
- 2 littleBits Proto bits
- 1 littleBits Temperature bit
- 1 littleBits Number bit
- 1 littleBits Wire bit (optional, used for easier wiring)
The Wiring
To complete the littleBits circuit the first Proto bit was wired with 5V to the VCC and the data connectors. Pi GND was wired to the module’s GND. The second Proto bit had the data pin with to the Explorer HAT analog input 1.
Node-Red Logic
On the Pi, the following Node-Red nodes were used:
- Explorer Hat Node – reads the analog input
- Function Node – only pass on analog input 1
- Smooth Node – removes noise and jitter
- Function Node – converts 0-5V to 0-100 C
The logic for the first function node, (to pass only analog input 1), was:
if (msg.topic == "explorerhat/analog.1"){ return msg; }
We added a smooth node to remove noise in the analog input signal. The configuration that we used for the smooth node was:
The logic for the second function, (to convert the voltage to a temperature), was:
msg.payload= (100/5)*msg.payload; return msg;
Finally we used a Chart Dashboard node to show the results on a Web page. Our configuration for this was:
To view the Web page use the URL of : http://the-pi-address:1880/ui