SenseHAT with PyBoard

Showroom for MicroPython related hardware projects.
Target audience: Users wanting to show off their project!
Post Reply
User avatar
marfis
Posts: 168
Joined: Fri Oct 31, 2014 10:29 am
Location: Zurich / Switzerland

SenseHAT with PyBoard

Post by marfis » Wed Mar 23, 2016 10:25 pm

Uses the Custom interface board (described http://forum.micropython.org/viewtopic.php?f=5&t=1268) to connect a Pyboard with a SenseHAT board (https://www.raspberrypi.org/products/sense-hat/).

But you can of course also manually wire the I2C bus, 3V3 and 5V to the SenseHat and avoid the interface board.

The SenseHAT contains a lot of sensors, so most of the work was to write drivers for the LED matrix, joystick, pressure, humidity, and temperature sensors... see an example of displaying all those values on the LED matrix:
https://www.youtube.com/watch?v=PeZRtHPF3iU

And lastly the 9 DOF (gyro/accel/magnetometer) IMU sensor which was the most complex one.

Using @pythoncoders fusion.py I was able to calcualte the pitch, roll, yaw angles. I show a simple example of this in the video
https://www.youtube.com/watch?v=LYzvXsxPtbw.

Here goes a big thanks to @pythoncoder - using the fusion algorithm worked without problems!

All the code used can be found on my github page:
https://github.com/hoihu/projects/tree/master/raspi-hat

User avatar
marfis
Posts: 168
Joined: Fri Oct 31, 2014 10:29 am
Location: Zurich / Switzerland

Re: SenseHAT with PyBoard

Post by marfis » Thu Aug 17, 2017 9:22 pm

I updated this with a fritzing wiring diagram:
https://github.com/hoihu/projects/blob/ ... ard_bb.png

5 wires are necessary to connect a SenseHAT to a pyboard.

I updated the hts221 and lps25 drivers to work with the machine API and tried to make them as compatible as possible to the proposal in https://github.com/micropython/micropython/issues/2093. Both drivers support fixed and floating point platforms.

The gyro sensor LSM9DS1 driver was only marginally updated (so that it works with the machine API, but not including any of the features of the sensor API).

Note that for correct fixed point support you'll need a fairly recent version of uPy because there was a bug when negative powers and big-ints were used: https://github.com/micropython/micropython/issues/3237

One driver is a pending pull request and discussion base for the sensor API:
https://github.com/micropython/micropython/pull/3256

feel free to comment there.

User avatar
marfis
Posts: 168
Joined: Fri Oct 31, 2014 10:29 am
Location: Zurich / Switzerland

Re: SenseHAT with PyBoard

Post by marfis » Thu Aug 17, 2017 9:39 pm

Just for the sake of completness:

I thought I could use the frambuf module for the 8x8 LED display. But no luck - each pixel occupies 3 byte of color data (24 bit RGB mapping) and that is apparently not yet supported by the framebuf module.

Would that be a useful addition? I guess there must be other displays around which have a 24bit RGB mapping?

User avatar
pythoncoder
Posts: 3130
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: SenseHAT with PyBoard

Post by pythoncoder » Fri Aug 18, 2017 6:30 am

Sounds like a good idea. @deshipu has done a lot of work on modframebuf.c - it might be worth asking for his view.
Peter Hinch

Post Reply