Rainbow Hat not working


#1

I tried to test my new Rainbow Hat on Android Things, but only the weather sensor are working.

I can’t use the LED, visor, buttons…
I tested using all google samples, and it won’t work

Eg: (testing on WeatherStation google project sample)

07-09 20:43:26.533 1634-1634/com.example.androidthings.weatherstation E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.androidthings.weatherstation, PID: 1634
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.androidthings.weatherstation/com.example.androidthings.weatherstation.WeatherStationActivity}: java.lang.RuntimeException: Error initializing BMP280
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: java.lang.RuntimeException: Error initializing BMP280
        at com.example.androidthings.weatherstation.WeatherStationActivity.onCreate(WeatherStationActivity.java:206)
        at android.app.Activity.performCreate(Activity.java:7010)
        at android.app.Activity.performCreate(Activity.java:7001)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6494) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
     Caused by: com.google.android.things.pio.PioException: android.os.ServiceSpecificException: I/O error (code 5)
        at com.google.android.things.pio.I2cDeviceImpl.readRegByte(I2cDeviceImpl.java:86)
        at com.google.android.things.contrib.driver.bmx280.Bmx280.connect(Bmx280.java:215)
        at com.google.android.things.contrib.driver.bmx280.Bmx280.<init>(Bmx280.java:193)
        at com.google.android.things.contrib.driver.bmx280.Bmx280.<init>(Bmx280.java:180)
        at com.google.android.things.contrib.driver.bmx280.Bmx280SensorDriver.<init>(Bmx280SensorDriver.java:55)
        at com.example.androidthings.weatherstation.WeatherStationActivity.onCreate(WeatherStationActivity.java:200)
        at android.app.Activity.performCreate(Activity.java:7010) 
        at android.app.Activity.performCreate(Activity.java:7001) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6494) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 

It’s the same error when I try to use the display/led, but I can see the weather sensor working


#2

I don’t know enough about AndroidThings to know what might be going on here- are you saying you can get readings from the weather sensor- the BME280? The error you posted seems to suggest there’s something up with it, which might be preventing other things from working.

Do you have a Raspbian SD card handy to do any poking about with?

It might be worth running this (I’ve no idea if it will work or not!) and seeing if it finds the BME280 i2c address: https://www.hackster.io/dennis-geurts/android-things-i2c-address-scanner-932cba


#3

I tested on my raspberry B and 3 using raspian, on the B the red led (button A) are on, but on rasp 3 not…

I tried to execute a python script following this: https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-rainbow-hat-in-python

But it are not working too…

When rainbow hat start all the button led light up? Because here this does not occur…

And I tried to test your link, but the project won’t run witouth errors


#4

Button LEDs only light up if you tell them to (with rainbowhat.lights.rgb(1,0,0) or similar)- sometimes they might light up because the Pi’s GPIO pins aren’t in a known state.

What Python code are you running- can you post it here?

What do you see if you run i2cdetect -y 1 on the Raspbian Pi?


#5

I executed this python code:

#!/usr/bin/python
import rainbowhat as rh
import time

while True:
    for pixel in range(7):
        rh.rainbow.clear()
        rh.rainbow.set_pixel(pixel, 255, 0, 0)
        rh.rainbow.show()
        time.sleep(0.1)

i2cdetect -y 1 on raspberry B+: (A red light on)

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

on Raspberry 3: (A red light off)

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

#6

I tried to run the python code on terminal (python file.py) and on Thonny IDE… Same result

UPDATE:
Now I can make the B and C light up, but the A light are only working on raspberry B+, not on rasp 3!

rh.lights.rgb(1, 1, 1)


#7

Are you using a different SD card in your Pi 3? It could be that some software is running that’s conflicting pin BCM6 (A/Red LED).


#8

No it’s the same sd card.
Sandisk class 10, 16gb.

I tested on the same sd card and same SO :(


#9

What is that?
I don’t understand that result


#10

The output of i2cdetect shows a table of all the possible i2c addresses- with the address in hexadecimal notation at each location where there’s a detected device.

I’ve just realised you should be seeing 0x70 and 0x77, (the display and temperature sensor respectively) but you’re only seeing 0x77

There might be a fault with your Rainbow HAT!


#11

This is very frustrating, I paid a very high importation tax to have problems with the product…


#12

Sorry about that- all of our products are tested before shipping out, and I’m still not 100% sure if the issue is with the Rainbow HAT itself since you claim the A/B/C lights all work fine on a B+ but not on the 3- it could very well be an issue with your Pi itself.

However it’s clear on both that the HT16K33 isn’t showing up- it should be appearing as 0x70.

Could you possibly take a photo of both sides of your board and see if I can get an idea of what may be wrong?


#13

The lights are not working very well, some times the 3 lights light up, but some times anyone light up…
Now the red light are not up on raspberry B+ and only blue light are up on raspberry 3.

I maked a video:

Raspberry B+:

Raspberry 3:

I tested all tools now. Display, color hat (it’s that name?) are not working, temperature sensor are working great, sound, button click listener are not working very well (some times the listener work, some times not, when the light are up, he work).

Code:
rh.lights.rgb(1, 1, 1)


#14

Adafruit delivery me a replacement… And my replaced rainbow hat are 100% working, thanks for the help!