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?

2 Likes

Yes that looks correct. Thank you in advance!

1 Like

Thanks for confirming, Iā€™ll order one tonight.

1 Like

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:

2 Likes

Hi Mr Cayenne, whatā€™s up with the integration with Pi Hat ?

Thank you
H.B.

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:
SENSE HAT KEYBOARD

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 GitHub - myDevicesIoT/Cayenne-MQTT-Python: Python Library for Cayenne MQTT API
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

1 Like

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"
MQTT_CLIENT_ID = "id"

##### 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")
    
    if ORIENTATION:
        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")
    
    if ACCELERATION:
        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
client.begin(MQTT_USERNAME, MQTT_PASSWORD, MQTT_CLIENT_ID)
# For a secure connection use port 8883 when calling client.begin:
# client.begin(MQTT_USERNAME, MQTT_PASSWORD, MQTT_CLIENT_ID, port=8883)
sleep(5)


while True:
    client.loop()
    get_sense_data()
    sleep(DELAY)

Hello! I am new to Raspberry Pi, SenseHat, and Cayenne. I am trying to figure out how to control the 8x8 LED screen using Cayenne. Once I connected the SenseHat there is the SenseHat Analog Actuator that prints the value you position the slide at across the screen and a button that when pressed displays the Cayenne icon. I am hoping to display my own icons when the temperature, humidity, and pressure reach certain levels. Any help would be greatly appreciated!

there are two ways for this:

  1. you edit the code in sense-hat plugin. you can add lines in the temperature, humidity and pressure function to display the images.
    or
  2. you use cayenne python library GitHub - myDevicesIoT/Cayenne-MQTT-Python: Python Library for Cayenne MQTT API along with sense-hat api API Reference - Sense HAT