Tail ID


Is there a way to get the tail’s device id? (not the imp’s, so not hardware.getdeviceid()
Also, if I needed to hook up several separate sensors, and I wanted to get the metrics from these sensors along with the id of each to differentiate between them, how can I get the id of these?


I think you mean the tail that connects to the April board?
The tail does not have an ID … the April board has the ID.

What sensor in particular?

Yes, the tail not the April board. And also when I have several sensors hooked to the board (not through a tail), I need their IDs

If they’re all on the i2c bus you can do a bus scan and identify devices (from a limited subset, not totally uniquely) by looking at the addresses that respond on the bus?

How many sensors, and what sensor is it?

Here’s code to scan an I2C bus for connected devices and their addresses, as @Hugo suggested: https://electricimp.com/docs/troubleshooting/tips/i2c/.

As @mlseim says, a Tail doesn’t have a unique ID. Individual sensors don’t have IDs as such. I2C-connected sensors have unique addresses on the bus, which each sensor’s datasheet will list, allowing you to talk to them specifically in code. Other buses work in different ways, sometimes without addresses, so how you proceed will depend on which sensors you want to use and how those sensor expect to connect to the host (ie. the imp’s breakout board). Again, the info you need will be in the datasheet.

I need to connect 3 temperature sensors, digital most probably, and they will be measuring the temperature of 3 different things.
I still didn’t get the HW to test the bus scanning code but will update the thread when I do.

Again, there are so many different temperature sensors. Not knowing what sensor it really is, or the temperature range required …

Here is an example of a sensor that can have up to 4 breakout boards on a single bus. Addressable.

So you solder the address points differently on each breakout board and use one i2c bus. In this breakout board, the temp range is -25°C to +85°C

If your temperature measurements require a thermocouple, like a stainless type-k probe in a tank or some process, you would need a different breakout board.

We’ll be experimenting with different types. The ones I’m getting for now are like this https://www.sparkfun.com/products/10988 but I will most probably need a probe as well

In that case, they will not be addressable unless they are part of a breakout board that supports i2c (addressable bus). You will have to use an imp003 (imp001 won’t have enough pins). Each sensor will be it’s own analog input. Accuracy is +/- 2C.

For thermocouples you would be using something like this:

Specifically Type-K. Also, that breakout board is not addressable.

Going back to temp sensors that are addressable …
Here’s a breakout board that will allow 8 on a single i2c bus:

So you can see that price, accuracy, physical construction, temp ranges, etc will all be part of your decision, along with how many physical imp inputs you need. Anything that is analog only will require proper shielding, grounding, wire length specs, etc.

The biggest decision is cost vs accuracy. If you want really accurate measurements, you’ll be spending a lot of money. Analog stuff is always more expensive.

I can use digital sensors, no?

Yes, you can use digital sensors too. You should read the Imp Pin Mux to get an idea as to which pins have which capabilities – this will help you plan out your sensor circuit(s), as will ‘How to Assign Roles to imp Pins’.

If you are using our standard Dev Kit, check out our April GPIO chart desktop reference.

This sample code for multi-sensors worked great for me


Splendid! I’m glad the code and guide worked out for you.