Bill Johnson
Posts: 9
Joined: Tue May 09, 2017 9:16 am

Sense HAT problem

Tue May 09, 2017 9:24 am

I’ve had my Sense HAT working before, then I removed it from the Pi a few months ago to use the Pi for something else. Now I’ve got a problem getting the Sense HAT to work.

When I power up, all the LEDs came on in the rainbow pattern. But when I try the simplest Python scripts (which used to work OK before) I either get a run-time error 'IMU Initialisation failed', or nothing happens, e.g. when trying to light up the LEDs.

I've tried re-installing the sense-HAT software and it made no difference – same result. I also took the HAT off and put it back on again but that didn’t help either. It just seems as if the Pi can't communicate with the HAT.

Before I give up, and/or buy another sense HAT, is there any diagnostic software I can run, or anything else I can try, to make it work?

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6229
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Sense HAT problem

Tue May 09, 2017 10:23 am

The output of dmesg and i2cdetect -y 1 could be helpful. Do the lights remain on after the pi boots?

Bill Johnson
Posts: 9
Joined: Tue May 09, 2017 9:16 am

Re: Sense HAT problem

Tue May 09, 2017 10:42 am

ShiftPlusOne wrote:The output of dmesg and i2cdetect -y 1 could be helpful. Do the lights remain on after the pi boots?
No, the lights go off after about 20s. Sorry, I didn't understand the first bit?

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6229
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Sense HAT problem

Tue May 09, 2017 11:26 am

In a terminal window, what's the output if you run the command 'i2cdetect -y 1'?

Bill Johnson
Posts: 9
Joined: Tue May 09, 2017 9:16 am

Re: Sense HAT problem

Tue May 09, 2017 1:58 pm

ShiftPlusOne wrote:In a terminal window, what's the output if you run the command 'i2cdetect -y 1'?
bash: i2cdetect: command not found
and
Sudo: i2cdetect: command not found

maybe I'm doing the wrong thing?

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Sense HAT problem

Tue May 09, 2017 1:59 pm

sudo apt-get install i2c-tools
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Bill Johnson
Posts: 9
Joined: Tue May 09, 2017 9:16 am

Re: Sense HAT problem

Tue May 09, 2017 2:55 pm

ok, that got a result:

a grid, 0 to f along top, 00: to 70: on side -

all elements from 03 to 77 filled in.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6229
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Sense HAT problem

Tue May 09, 2017 3:14 pm

The actual output, placed in code tags would be helpful. Is this what you're seeing?

Code: Select all

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

Bill Johnson
Posts: 9
Joined: Tue May 09, 2017 9:16 am

Re: Sense HAT problem

Tue May 09, 2017 3:38 pm

That's exactly what I'm seeing - but with each -- replaced by 03 04 05 ..... all the way up to 77.

Sorry I'm new to this and unfamiliar with code tags.

Bill Johnson
Posts: 9
Joined: Tue May 09, 2017 9:16 am

Re: Sense HAT problem

Tue May 09, 2017 3:40 pm

NO!!!! I missed the one exception!

I have UU in place of 46

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6229
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Sense HAT problem

Tue May 09, 2017 3:42 pm

What do you get if you run 'raspi-gpio get'? You should see gpio 1 and 2 set up as SDA1/SCL1. You should also not see SDA1/SCL1 on any other pins.

timrowledge
Posts: 1348
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Sense HAT problem

Tue May 09, 2017 5:12 pm

I've recently had a similar kind of problem whilst working on a new case design that include the senseHAT; when first assembling the prototype and powering up the senseHAT less flashed white/bright and went dark. I thought I'd shorted something out on the metal case top, but eventually after much work we realised that the connections from the header to the HAT were not good. The IMU was happy, the pressure/temp readings were there but nonsensical and the frame buffer for the LEDs wasn't getting built, all very odd.

The solution appears to be to very slightly bend the header pins out in order to force them to play nice and rub up against the HAT connector sockets. I tried using a sewing needle to lever the socket bits inward a little as well, which maybe worked better; hard to tell. The good news is no shorting out :-)
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

Bill Johnson
Posts: 9
Joined: Tue May 09, 2017 9:16 am

Re: Sense HAT problem

Tue May 09, 2017 6:46 pm

ShiftPlusOne wrote:What do you get if you run 'raspi-gpio get'? You should see gpio 1 and 2 set up as SDA1/SCL1. You should also not see SDA1/SCL1 on any other pins.
Not what I get. 1 and 2 are func=INPUT, and 3 is SCL1. I don't see SDA1 anywhere.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6229
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Sense HAT problem

Tue May 09, 2017 7:13 pm

yes, I should've set gpio 2 and 3, not 1 and 2.

gpio 2 should be SDA1, so something is hijacking that pin.

Bill Johnson
Posts: 9
Joined: Tue May 09, 2017 9:16 am

Re: Sense HAT problem

Tue May 09, 2017 7:45 pm

ShiftPlusOne wrote:yes, I should've set gpio 2 and 3, not 1 and 2.

gpio 2 should be SDA1, so something is hijacking that pin.
Solution?

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6229
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Sense HAT problem

Tue May 09, 2017 8:31 pm

It seems like an issue with your particular setup. Are you using gpio for anything else? Does this happen every time you boot? Are you running anything that might be trying to use gpio?

As a test, try running 'raspi-gpio set 2 a0' as a temporary workaround. If that works, we can try to figure out what's causing problems.

Bill Johnson
Posts: 9
Joined: Tue May 09, 2017 9:16 am

Re: Sense HAT problem

Wed May 10, 2017 6:32 am

ShiftPlusOne wrote:It seems like an issue with your particular setup. Are you using gpio for anything else? Does this happen every time you boot? Are you running anything that might be trying to use gpio?

As a test, try running 'raspi-gpio set 2 a0' as a temporary workaround. If that works, we can try to figure out what's causing problems.
You've solved it, thank you. The problem was, I had a program that used gpio and it was running on startup, because the commands were still in rc.local. I just disabled that and on reboot the sense HAT now seems to be working.

Thank you for your help, one more small scramble up the learning curve for me - glad I didn't buy another Sense HAT!

Return to “HATs and other add-ons”