Sense Hat support on Raspberry Pi


I am also interested in this


I would also be really interested in this. Any chance that might be done before school year starts again?


I can order one tonight and come up with some MQTT support. Might take me a week or two to post back. For anyone looking for support is this what you have?


Yes that looks correct. Thank you in advance!


Thanks for confirming, I’ll order one tonight.


Has anything come of the yet?
There still seems to be very little out of the box support.

So I still see little use for me with Cayenne, which is a shame as I keep trying every few month. Even the Pimoroni Enviro pHAT doesn’t work as it has (newer?) sensor version than the few supported. Bmp180 doesn’t work for bmp280 on that pHAT for example etc. So that is out of the question too.

I see you moved to alternative boards and setups so I guess have moved to a make you own sensor compatible route. Must read around some more and hope I find plugins for sensors or something like that.


I’ve had it hooked up to my pi for a couple weeks, but no I haven’t actually taken any time to get it working. What features of the sense hat are you looking for? I’ll start with those first.


Temperature, humidity and air pressure would be on my priority list :+1:


Hi Mr Cayenne, what’s up with the integration with Pi Hat ?

Thank you


I’m failing pretty hard here… I need to get that back out and just do it.


I also I am a big fan of the Raspberry PI 3 & Sense HAT and with the mini keyboard, the best-in-class microcontroller that can be used strait from the box. I will use these tools in the STEM (Science Technology Engineering Mathematics) 3 year curriculum I am currently developing for kids from 9-18 year.
In a school environment we need HW & SW that can be installed by PLUG & PLAY approach.
So that they can focus on the main task: prepare our kids for the 4th industrial revolution.
We do not need to focus on programming, but on system thinking, problem solving, system modelling design, IoT, big data, 3D printing, etc.
The Cayenne is one of the nice tools to display data, graphics . together with Scratch2 , NODE RED, MATLAB, etc. will be the STEM TOOL KIT of the future!!
Looking forward to test it.:sunglasses:

NOTE: The Astro sense hat is used also in the International space station.
not yet with Cayenne: shame :man_student:


Just wondering before I go through installing it on another Pi, since I’m updating to V2

Two and a bit years later, is the SenseHAT now supported ?


pi agent 2.0 wont support sense hat, but you can use
to send sense hat value to cayenne,


There are a couple of ways we are exploring when adding SenseHat support, but we believe we will be able to include support this year. We don’t have a time frame until we decide which avenue to take to enable support, but once we do, we will update the community.


Well after getting an EnviropHAT and SDS021 sensor working as my go at MQTT and Bring Your Own in Python (pref Python3)
It worked, so I’m plodding through the SenseHAT as it is easy enough once it allowed me to connect (I assume my bombarding with as fast as it could go updates blocked me for a few minutes).
Now added a few seconds delay :slight_smile:
But I’m using virtualWriter(#,device_reading,“icon”,“unit”)
etc which works nicely for the simple ones as listed in the python API source code.
But how do I get it to automatically select the correct icon for yaw, pitch, roll etc (I can see them there on the website list).
The last part (e.g. “degrees” nicely put the wording there, but I cannot find the list for all the icons) ?


Have a look at this


Thanks, that covers a few more of the basics :-), but they are none specific… i’ll post on that thread


For anyone wanting to try this out (you don’t even need a SenseHat) just a RaspberryPi
The interface and widgets are not quite ready, but that just needs time.
follow the quick and simple PythonAPI setup on Raspbain

though use
sudo pip3 install cayenne-mqtt
so you can use it in Python3

from sense_hat import SenseHat #switch to sense_emu to use the built in emulator
from time import sleep
import cayenne.client

##### Logging Settings #####
#True/False to enable or disable logging
TEMP_H=True             #Temperature from Humidity sensor (-40C to +120C)
TEMP_P=True             #Temperature from Pressure sensor (-40C to +120C)
HUMIDITY=True           #Relative Humidity (%) % actual water vapour to max possible for temp.
PRESSURE=True           #millibar (hPa)
ORIENTATION=True        #yaw/pitch/roll degree's
ACCELERATION=True       #Gs (range -2g to +2g or could be wider , need to check)
MAG=True                #µT
GYRO=True               #degrees/second
DELAY=5                 #Time between measurements (seconds)

# Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
MQTT_USERNAME  = "username"
MQTT_PASSWORD  = "password"

##### Functions #####

def get_sense_data():
    #virtualWrite(channel, value, dataType="", dataUnit="")

    if TEMP_H:
        client.virtualWrite(1, sense.get_temperature_from_humidity(), "temp", "c")

    if TEMP_P:
        client.virtualWrite(2, sense.get_temperature_from_pressure(), "temp", "c")

    if HUMIDITY:
        client.virtualWrite(3,sense.get_humidity(), "rel_hum", "p")

    if PRESSURE:
        client.virtualWrite(4, sense.get_pressure(), "bp", "hpa")
        yaw,pitch,roll = sense.get_orientation().values()
        client.virtualWrite(5, yaw, "yaw", "dps")
        client.virtualWrite(6, pitch, "pitch", "dps")
        client.virtualWrite(7, roll, "roll", "dps")
    if MAG:
        mag_x,mag_y,mag_z = sense.get_compass_raw().values()
        client.virtualWrite(8, mag_x, "mag", "ga")
        client.virtualWrite(9, mag_y, "mag", "ga")
        client.virtualWrite(10, mag_z, "mag", "ga")
        x,y,z = sense.get_accelerometer_raw().values()
        client.virtualWrite(11, [x,y,z], "accel", "g")
    if GYRO:
        gyro_x,gyro_y,gyro_z = sense.get_gyroscope().values()
        client.virtualWrite(14, gyro_x, "g", "dps")
        client.virtualWrite(15, gyro_y, "g", "dps")
        client.virtualWrite(16, gyro_z, "g", "dps")

# The callback for when a message is received from Cayenne.
def on_message(message):
    print("message received: " + str(message))
  # If there is an error processing the message return an error string, otherwise return nothing.

##### Main Program #####
sense = SenseHat()

client = cayenne.client.CayenneMQTTClient()
client.on_message = on_message
# For a secure connection use port 8883 when calling client.begin:

while True: