Getting null from from Hannah board temperature sensor and accelerometer

I got my imp and Hannah board today, and have had success getting a couple of the sample programs to work that just illuminate and flash the Hannah board’s LED.

However, I am having less success with the following two programs

Electric Impped Washing Machine
Hannah Temperature Logger

In both scenarios, I receive a value of null when I attempt to read from the I2C bus.

I am unsure of how to troubleshoot this, and whether it is more likely that this is an issue with my Hannah board, or my copy-pasting skills.

What would folk suggest…?

Found the issue - the Hannah board I have (from SmartMaker) is “Revision 3”, and the I2C addresses of the temperature sensor and accelerometer have been changed in this revision (because the actual sensors used are different in this revision).

The I2C bus addresses are all listed in the above link, and the fact that they have changed in the Rev 3 board is specifically mentioned in the Hannah.Rev3.SelfTest code by SmartMaker on GitHub (I thoroughly recommend checking out the SelfTest code by the way).

//I2C Addresses Rev3 (different from the previous Rev2!!!) const i2c_ioexp = 0x7C; const i2c_temp = 0x92; // this device is new in the Rev3 const i2c_als = 0xE8; const i2c_accel = 0x30; // this device is new in the Rev3

Note that these are 8-bit addresses so they do not need to be bit-shifted.

Still there is no code available for Accel or RGB sensor. The RGB sensor has been the same for years in Rev2! Did you find the temp code here in the forum?

The temp code came from the electric imp wiki. It’s nicely explained so should be easy to understand.

Later on I was able to get data from the accelerometer using code I found on GitHub. This code contains no comments or explanations so (at present) I don’t understand exactly how it works. Some study is required.

I have not (yet…) tried to use the RBG sensor as the project I’m thinking about doesn’t need it.

Interesting. The Accel code on Github was updated nearly a year ago. How can it possibly be Rev3? It appears to be Rev2 based on the i2C address 0x38 instead of 0x30 above. Please let me know if it works?

My apologies sbright, you are quite correct.

In order to get the accelerometer working with that code I updated the addresses as follows:

//I2C Addresses const i2c_ioexp = 0x7C; const i2c_temp = 0x92; // was 0x98; const i2c_als = 0xE8; const i2c_accel = 0x30; // was 0x38;

That’s the only change? And it works as posted? Now can you help me find some RGB sensor code? It’s the same for both versions.

I want to understand how work the i2s bus on the example of my Hannah board.
I downloaded a program Hannah (Rev3) Scan I2C bus :


Found something with address 0 ( 0), result = -4

Found something with address 48 (0x30), result = 0

Found something with address 124 (0x7c), result = 0

Found something with address 146 (0x92), result = 0

Help to understand where the error,
Thank you.

Hi sbright, I’m afraid I can’t help you with the RGB sensor at the moment - I’ve not used it.
sunhunder, I don’t understand your question. Can you add more detail?

@richev- Does your Accell code work with Rev3? Please post.