# Using NodeRED with the Grove-Base-Hat for raspberry pi

**URL:** <https://discourse.nodered.org/t/using-nodered-with-the-grove-base-hat-for-raspberry-pi/93712>\
**Category:** General\
**Tags:** raspberry-pi\
**Created:** [5 December 2024 16:53 UTC](https://discourse.nodered.org/t/using-nodered-with-the-grove-base-hat-for-raspberry-pi/93712 "2024-12-05T16:53:51Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajsiyer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rajsiyer/32/96927_2.png) [@rajsiyer](https://discourse.nodered.org/u/rajsiyer)\
**Post date:** [5 December 2024 16:53 UTC](https://discourse.nodered.org/t/using-nodered-with-the-grove-base-hat-for-raspberry-pi/93712/1 "2024-12-05T16:53:51Z")

</div>

Hi, I am new to both NodeRED and raspberry pi. I'd been reading the excellent book by Taiji Hagino. He uses the node-red-contrib-grove-base-hat. Despite installing it from the palette manager, I am not getting it right. I can make simple flows work in NodeRed and they work well until I use the nodes that are for the Grove-Base-Hat. Seeed Studio's wiki doesn't guide how to use the module for NodeRed. I could use some help

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [5 December 2024 17:41 UTC](https://discourse.nodered.org/t/using-nodered-with-the-grove-base-hat-for-raspberry-pi/93712/2 "2024-12-05T17:41:13Z")

</div>

Welcome to the forums @rajsiyer

The first thing to remember, it's possible that no one here uses that Node.  
Therefore, may have no answer to gives.

Example: I have no idea what Grove is 🤷‍♂️

If you can explain what the issue is in detail and what Grove is, it may help.  
if still no answer - you're better off seeking support from the Node Author, but they don't give any help links - so good luck

---

<div class="post-metadata">

**Author:** ![kitori](https://avatars.discourse-cdn.com/v4/letter/k/f08c70/32.png) [@kitori](https://discourse.nodered.org/u/kitori)\
**Post date:** [6 December 2024 07:13 UTC](https://discourse.nodered.org/t/using-nodered-with-the-grove-base-hat-for-raspberry-pi/93712/3 "2024-12-06T07:13:59Z")

</div>

Looking at the website ([https://wiki.seeedstudio.com/Grove\_Base\_Hat\_for\_Raspberry\_Pi/](https://wiki.seeedstudio.com/Grove_Base_Hat_for_Raspberry_Pi/)), they seem to use some python packages. So maybe it is worth following this path and send the sensor inputs via mqtt to node-RED.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [6 December 2024 12:07 UTC](https://discourse.nodered.org/t/using-nodered-with-the-grove-base-hat-for-raspberry-pi/93712/4 "2024-12-06T12:07:01Z")

</div>

@rajsiyer `node-red-contrib-grove-base-hat` hasn't been updated in over 4 years and if you go to it's [GitHub issues section](https://github.com/1ft-seabass/node-red-contrib-grove-base-hat/issues) and it looks like it won't work with newer Pi versions.

There is another version you could try:  
[node-red-contrib-grove-base-hat-bash (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-grove-base-hat-bash)

Note: I have never used either of them.

---

<div class="post-metadata">

**Author:** ![rajsiyer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rajsiyer/32/96927_2.png) [@rajsiyer](https://discourse.nodered.org/u/rajsiyer)\
**Post date:** [6 December 2024 15:07 UTC](https://discourse.nodered.org/t/using-nodered-with-the-grove-base-hat-for-raspberry-pi/93712/5 "2024-12-06T15:07:19Z")

</div>

Thanks, I'm trying out something and will update the outcome here, so that someone may find it useful. Seeed Studio's Grove sensors and hats are reputed to work well. They are like Adafruit isto the Arduino world. And Taiji Hagino is one of the original creators of NodeRED at IBM. His book is great.

---

<div class="post-metadata">

**Author:** ![rajsiyer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rajsiyer/32/96927_2.png) [@rajsiyer](https://discourse.nodered.org/u/rajsiyer)\
**Post date:** [6 December 2024 15:08 UTC](https://discourse.nodered.org/t/using-nodered-with-the-grove-base-hat-for-raspberry-pi/93712/6 "2024-12-06T15:08:06Z")

</div>

Thanks I'll see where this takes us.

---

<div class="post-metadata">

**Author:** ![rajsiyer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rajsiyer/32/96927_2.png) [@rajsiyer](https://discourse.nodered.org/u/rajsiyer)\
**Post date:** [6 December 2024 15:10 UTC](https://discourse.nodered.org/t/using-nodered-with-the-grove-base-hat-for-raspberry-pi/93712/7 "2024-12-06T15:10:02Z")

</div>

Right and I have seen your reply in 2020 to Steve. Nothing appears to have changed after that. Since the original thread was closed, I had to re-open it here again.

---

<div class="post-metadata">

**Author:** ![rajsiyer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rajsiyer/32/96927_2.png) [@rajsiyer](https://discourse.nodered.org/u/rajsiyer)\
**Post date:** [6 December 2024 15:26 UTC](https://discourse.nodered.org/t/using-nodered-with-the-grove-base-hat-for-raspberry-pi/93712/8 "2024-12-06T15:26:30Z")

</div>

Several people have faced this issue. Like @StevenRott who was helped by zenofmud in 2020. Two years later, fenneck got a solution.

This was indeed the case when I debugged the Grove Base Hat using python. He has done something similar here on this link. [contrib-grove-capacitive-moisture-sensor - #6 by fenneck](https://discourse.nodered.org/t/contrib-grove-capacitive-moisture-sensor/68042/6) So my expectation is that this will certainly resolve the issue in NodeRed as well.

---

<div class="post-metadata">

**Author:** ![fenneck](https://avatars.discourse-cdn.com/v4/letter/f/58956e/32.png) [@fenneck](https://discourse.nodered.org/u/fenneck)\
**Post date:** [6 December 2024 20:12 UTC](https://discourse.nodered.org/t/using-nodered-with-the-grove-base-hat-for-raspberry-pi/93712/9 "2024-12-06T20:12:48Z")

</div>

Hi @rajsiyer,

Do you have modify your adc.py file ?  
What is the result now ?

---

<div class="post-metadata">

**Author:** ![rajsiyer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rajsiyer/32/96927_2.png) [@rajsiyer](https://discourse.nodered.org/u/rajsiyer)\
**Post date:** [7 December 2024 04:42 UTC](https://discourse.nodered.org/t/using-nodered-with-the-grove-base-hat-for-raspberry-pi/93712/10 "2024-12-07T04:42:47Z")

</div>

Thanks fenneck, This is the story.

When I first tried using the Grove hat for R-pi, (GHRP) it was on python, outside of Node-Red and guided by the instructions at its Wiki page on Seeed Studio. I had a persistent error "Check whether I2C enabled and Grove Base Hat RPi or Grove  
Base Hat RPi Zero inserted…"

This was fixed by these steps...  
sudo find / -name adc.py  
/usr/local/lib/python3.9/dist-packages/grove/adc.py  
/home/pi/.local/lib/python3.9/site-packages/grove/adc.py  
/home/pi/grove.py/grove/adc.py

Therein, the file was changed  
sudo chmod 666 /usr/local/lib/python3.7/dist-packages/grove/adc.py  
Some 50-60 lines down, You'll find a line `def __init__ (self, address = 0x08): I changed it to: `def **init** (self, address = 0x04):` because the my GHRP is the STM32 variant.

This works beautifully in the python virtual environment. Yes you have to create one.

Coming to NodeRED I have not found the solution, I installed the node node-red-contrib-grove-base-hat. I created a flow, placing the light sensor node between an inject and a debug nodes. When triggered, you see the following responses

on the NodeRed Debug:- ----  
12/7/2024, 10:04:48 AM[node: debug 1](http://192.168.1.20:1880/#)msg.payload : string[41]  
"SyntaxError: Unexpected end of JSON input"

on node-red-log by ssh -ing the pi.  
Error: Command failed: python -u /home/pi/.node-red/node\_modules/node-red-contrib-grove-base-hat/grove-light-sensor-v1\_2/grove-light-sensor-v1\_2.py 2 1733546091029  
Traceback (most recent call last):  
File "/home/pi/.node-red/node\_modules/node-red-contrib-grove-base-hat/grove-light-sensor-v1\_2/grove-light-sensor-v1\_2.py", line 24, in   
from grove.adc import ADC  
ModuleNotFoundError: No module named 'grove'

Regarding grove.adc . I have not found this file as yet. And when I do I'll change it in the same way as adc.py.

Today, I will try out the other node library suggested by @zenofmud

Please guide by sharing your own experience. Thanks again.

---

<div class="post-metadata">

**Author:** ![rajsiyer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rajsiyer/32/96927_2.png) [@rajsiyer](https://discourse.nodered.org/u/rajsiyer)\
**Post date:** [7 December 2024 04:58 UTC](https://discourse.nodered.org/t/using-nodered-with-the-grove-base-hat-for-raspberry-pi/93712/11 "2024-12-07T04:58:32Z")

</div>

Thank you Sir, this works well. I can resume my journey after being stuck here for a couple of days  
Best wishes.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 December 2024 04:59 UTC](https://discourse.nodered.org/t/using-nodered-with-the-grove-base-hat-for-raspberry-pi/93712/12 "2024-12-21T04:59:08Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
