You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A 3rd‑party MagicMirror² module that integrates the Raspberry Pi Sense HAT. It reads sensor data (temperature, humidity, pressure, optional orientation) and can control the Sense HAT 8×8 RGB LED matrix for simple status indication or scrolling text.
3
+
## Overview
4
+
MMM-SenseHat is a third-party module for MagicMirror² that integrates the official Raspberry Pi Sense HAT.
5
+
It displays sensor readings (temperature, humidity, pressure, and optional orientation) and can control the
6
+
Sense HAT’s 8×8 RGB LED matrix for a status color or scrolling text.
// For familiarity with MMM-PythonPrint, you can also use `pythonName` (alias of pythonPath).
72
+
// pythonPath: "/usr/bin/python3",
73
+
// pythonName: "/usr/bin/python3"
64
74
}
65
-
}
75
+
};
76
+
// Then insert `moduleEntry` into the modules array in your config.js
66
77
```
67
78
68
-
How it works
69
-
- Frontend (MMM-SenseHat.js): Displays data and optionally sends LED status commands based on thresholds.
70
-
- Node Helper (node_helper.js): Spawns the Python helper to read sensors at a set interval and forwards LED commands to it. Respects `config.pythonPath` if provided.
71
-
- Python Helper (python/reader.py): Uses `from sense_hat import SenseHat` to read sensors and control the LED matrix. Prints JSON to stdout in read mode.
72
-
73
-
Troubleshooting
79
+
## How it works (architecture)
80
+
- Frontend (MMM-SenseHat.js)
81
+
- Renders the sensor values in the MagicMirror UI
82
+
- Shows clear states: loading, error, or data
83
+
- May send LED commands (status/text) back to the backend based on thresholds
84
+
- Node helper (node_helper.js)
85
+
- Manages one polling loop per module instance (multi-instance safe)
86
+
- Spawns the Python helper on an interval to read sensors
87
+
- Forwards sensor JSON to the correct frontend instance via an `identifier`
88
+
- Accepts LED commands per instance and uses that instance’s config
89
+
- Respects `config.pythonPath` (or `pythonName`) to select the Python executable
90
+
- Python helper (python/reader.py)
91
+
- Uses `from sense_hat import SenseHat`
92
+
- Reads sensors and prints JSON to stdout in `--read` mode
93
+
- Controls the LED matrix (status color, text, clear)
94
+
95
+
## Troubleshooting
74
96
1) Check that the Sense HAT is detected by the kernel
75
97
```bash
76
98
ls -l /dev/i2c*
77
99
dmesg | grep -i "sense"
78
100
```
79
-
Expect:
101
+
Expected:
80
102
-`/dev/i2c-1` present
81
-
- A line similar to:`fb1: RPi-Sense FB frame buffer device`
82
-
- A joystick device entry for the Sense HAT
103
+
- A line like`fb1: RPi-Sense FB frame buffer device`
104
+
- A Sense HAT joystick device entry
83
105
84
106
2) Probe I²C bus 1
85
107
```bash
86
108
sudo i2cdetect -y 1
87
109
```
88
-
On a working Sense HAT, you should see several non-"--" addresses (for example `1c`, `39`, `5c`, `5f`, `6a`). If everything shows `--`, the HAT might not be seated correctly or could be faulty.
110
+
On a working Sense HAT, you should see several non-"--" addresses (e.g., `1c`, `39`, `5c`, `5f`, `6a`).
111
+
If everything shows `--`, the HAT may not be seated correctly or could be faulty.
- If you get numeric values, the sensors are working.
103
-
- If you see errors like `OSError: Humidity Init Failed`, there may be a contact problem on the header or a sensor issue.
126
+
- If you see `OSError: Humidity Init Failed`, check the 40-pin header seating and try again.
104
127
105
128
4) Check the LED matrix
106
129
```bash
@@ -115,15 +138,41 @@ sleep(1)
115
138
sh.clear()
116
139
PY
117
140
```
118
-
If you don’t see LEDs:
119
-
- Power off the Raspberry Pi.
120
-
- Firmly press the Sense HAT onto the 40‑pin header (common on new boards).
121
-
- Boot again and re‑run the test.
141
+
If no LEDs appear:
142
+
- Power off the Raspberry Pi
143
+
- Firmly press the Sense HAT onto the 40-pin header (common on new boards)
144
+
- Boot again and re-run the test
122
145
123
146
5) What the MagicMirror module will show
124
-
- "Loading Sense HAT data…" → Python helper hasn’t delivered any data yet.
125
-
- "Sense HAT: no sensor data (check hardware or drivers)" → helper runs, but all sensor fields are null.
126
-
- "Sense HAT error: …" → helper reported an explicit error (library missing, init failure, etc.).
147
+
- "Loading Sense HAT data…" → Python helper hasn’t delivered any data yet
148
+
- "Sense HAT: no sensor data (check hardware or drivers)" → helper runs, but all sensor fields are null
149
+
- "Sense HAT error: …" → helper reported an explicit error (e.g., library missing, init failure). Errors are per instance.
150
+
151
+
## Multiple instances
152
+
You can place MMM-SenseHat in `modules:[]` multiple times, each with different options (e.g., different LED policies or intervals). The module tags all traffic with an `identifier` and the helper maintains one polling loop per instance, so configurations are isolated.
153
+
154
+
Example with two instances (as part of your modules array):
0 commit comments