Hannah Rev3 (smARtMAKER's) release notes

As the Rev3 of Hannah is getting in the wild, I want to share some release notes, waiting to have the full docs published on the devwiki.

As we said several times, there are few differences between the previous Rev2, released last year, and the Rev3 that now we produce and distribute.

All the examples and codes actually available on the devwiki are related to the Rev2 and some can’t work properly.

The information related to the Hannah Rev2 are available from the devwiki:

http://devwiki.electricimp.com/doku.php?id=hannah

The new Rev3 is available from smARtMAKER’s website and in stock in the warehouses in USA, Europe and China:

http://smartmaker.com/en/31-electric-imp

A list of local resellers is planned and will be published when available (if you know some that could be interested in carry it let me known by PM).

What’s new

There are not many differences between the Rev2 and this new Rev3. Waiting for the official page on devwiki to be ready, I’ve published the design here:

https://github.com/smartmaker/tutorials/tree/master/ElectricImp/Hannah/Rev3

and I attach the schematics to this message as well.

The size is the same of the Rev2 and most of the components used are same as well.

The two main differences are the temperature sensor and the accelerometer.

For the temperature sensor, the new choice is a TI’s TMP112 that’s more precise and less power consuming than the SA56004ED used previously.

This means that the example program published for the Rev2 will not work with this new Rev3, because the sensor is different. We’ll try to have a new working example ready asap. Here is possible to get the datasheet for the new temperature sensor:

http://www.ti.com/lit/ds/symlink/tmp112.pdf

The other new entry in this Rev3 is a better accelerometer. Compared to the Rev2’s LIS331DL from ST, the new (still from ST) LIS3DH used in the Rev3 is a great improvement. While the old sensor was capable of up to 8g of scale, this new one offers up to 16g and the output data rate that was maximum 400Hz in the old one now can be increased up to 5Khz. You can test a race car now! :slight_smile:

Almost any single line of code used with the Rev2, related to the accelerometer, will not work with the new Rev3.

This because the whole sensor is different. Not only the registers’ address. The old sensor offers an output based on 8 bits but the new one offers double resolution, on 16 bits with endian chosen by the coder. The whole thing is different.

We are working on a clear example.

The datasheet for this new sensor is available here:

http://www.st.com/web/en/resource/technical/document/datasheet/CD00274221.pdf

and also ann application note is available for download from ST:

http://www.st.com/web/en/resource/technical/document/application_note/CD00290365.pdf

Self Test Code

We have a self test code that can be useful to check that everything in your Hannah is working fine and it can be also used as starting point to write new code.

This is more or less the code that we use during the QA in the manufacturing process.

You can get the code here:

https://github.com/smartmaker/tutorials/blob/master/ElectricImp/Hannah/Rev3/SelfTest/Hannah.Rev3.SelfTest

The comments at the beginning of the code explain how it works. Basically the program check the different I2C devices to be connected and working and handle the many inputs and outputs available on the board based on the I/O expander (2 buttons, 1 pot, 1 RGB LED, 2 headers for servo).

In the next days I will post more examples of code working with the Rev3, both as stand alone and connected to Xively.

Dimitri

can anyone give a hint in advance, how to display an actual temperature reading in the test code?

@DolfTraanberg,

I didn’t have time to try but the code from Jane should work:

`
function poll()
{
//Poll the temperature every n seconds
imp.wakeup(60,poll);

local result = i2c.read(i2c_temp, "\\x00", 2);

if (result == null) {
    server.log("I2C Read Fail: Result == Null");
    return -1;
}else if(result[0] == null){
    server.log("I2C Read Fail: Result[0] == Null");
    return -1;
}else if(result[1] == null){
    server.log("I2C Read Fail: Result[1] == Null");
    return -1;
}

local t = ((result[0] << 4) + (result[1] >> 4)) * 0.0625;


tempOut.set(t);
tempOutStr.set(format("%.1f",t));
server.show(format("Temp: %.1f",t));

}
`

Dimitri

Thanks so much, works after commenting out

tempOut.set(t); tempOutStr.set(format("%.1f",t));

(sent you a PM)

@DolfTraanberg,

if you have a code working as stand alone example, please share with us.

Thanks,

Dimitri

I will, but still ripping apart your code :wink:

FYI, on my Hanna (rev3), the TMP112 is at I2C address 0x49

… which is, of course, 0x92 >> 1.

For reference:

Device: 8bit I2C address / 7bit I2C address

IOExpander: 0x7c / 0x3e
Temp sensor: 0x92 / 0x49
Color sensor: 0xeb / 0x75
Accelerometer: 0x30 / 0x18

@jmcmullan,

we basically use the 8bit address because we include in the last bit the read/write command (usually in write mode) as the code is for QA purposes.

Dimitri

I had a play with the earlier code and turned it into a standalone program… and fixed the overflow bug (thanks @sbright33)…

`// see http://forums.electricimp.com/discussion/1241/hannah-rev3-smartmakers-release-notes/p1

imp.configure(“Hannah Rev 3 (TMP112) Temperature”, [],[]);

server.log(“Hannah Rev 3 (TMP112) Temperature Started”);

//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

//----------------------------------------
//-- Configure I2C
//----------------------------------------
hardware.configure(I2C_89);
local i2c = hardware.i2c89;

// poll interval in seconds.
local n = 10;

function poll()
{
//Poll the temperature every n seconds
imp.wakeup(n, poll);

local result = i2c.read(i2c_temp, "\\x00", 2);

if (result == null) {
    server.log("I2C Read Fail: Result == Null");
    return -1;
}else if(result[0] == null){
    server.log("I2C Read Fail: Result[0] == Null");
    return -1;
}else if(result[1] == null){
    server.log("I2C Read Fail: Result[1] == Null");
    return -1;
}

local t = ((result[0] << 4) + (result[1] >> 4)) * 0.0625;

// Overflow fix http://forums.electricimp.com/discussion/1332#Item_3
if (result[0]>128) t-=256;

// tempOut.set(t);
// tempOutStr.set(format("%.1f",t));
server.log(format("Temp: %.1f °C",t));
server.show(format("Temp: %.1f °C",t));

}

poll();`

Tony.

There is a bug in your code when temp is < 0C. See other thread. It’s an easy fix.

Still no code for RGB color sensor or Accelerometer v3?

Hi!

I haven’t finished transcribing the ALS calibration routine.

Here’s a simple example that lets you read the X/Y/Z immediate axis data.

https://gist.github.com/aleksandyr/81757bc418e687755b50

Also maybe of note, here’s a temperature example that can use the high (13 bit, not 12 bit) accuracy mode of the TMP112:

https://gist.github.com/aleksandyr/5920627

Done spamming the thread after this, I promise - here’s my Hannah logging to Xively using the Agent API (thanks imp team!)

https://xively.com/feeds/2105978250

@aleksandyr

Very nice TMP112 code.
Stole it right away

Wonderful Alek! Best Temp code so far. Still no light sensor.
Anyone else have it?

@DolfTraanberg - https://github.com/smartmaker/tutorials/issues/1 :slight_smile:

For the record, I make no claim of copyright or license with the above examples - everything above is a very literal transcription of the relevant manual - as far as I’m concerned it’s public domain.

I’ve started to transcribe one of the ALS calibration examples. If nothing else I think I can get the “clear” (e.g. brightness) sensor working fairly soon.

STILL no light sensor code?

it’s a development board…
:slight_smile: