I2C tutorial required

Is there a tutorial for using the I2c nodes? I admit to being a complete newbie on XOD and am finding it extremely difficult to get going. I’ve done the beginner tutorial and that’s fine as far as it goes, but as soon as I tried to set up what to me was a simple project - getting the temperature from an I2c temperature/pressure module and displaying it on an I2c 16x2 LCD I crashed and burned.

Yes, the 16x2 LCD has a node and it works great, but I need to read two bytes from the sensor. Choosing various I2C nodes, they all seem to end with ‘ready to go on’, but go on where, how, to what?

I assume ‘I2C request bytes 6’ asks for 6 bytes from the module at the given address, but what happens to the reply? I thought the bytes would populate the six ‘numbers’, but that doesn’t seem to happen.

XOD looks really interesting, but I really need more in the way of instructions.

If your sensor can only return 2 bytes, it is probably returning an error when you try to request 6 bytes. You should be able to copy the code to a new i2c-request-bytes-2 and change the code that asks for 6 bytes to only ask for 2 bytes and process the returned data appropriately.

You will also need to use the correct address for the sensor. Many sensors will give the address in hexadecimal, but the XOD nodes only take decimal, so you may need to convert.

1 Like

Strangely all this is very actual for me! Thanks!

‘Copy the code…’ if you can tell me where the code is to copy, I’ll give it a try.

Thank you for the prompt response.


Actually, I am making progress to the extent that I now realise how much I don’t know, so feel free to close this thread while I back-up my ambitions with XOD.

I am also trying to use the I2C library, but it’s unclear how to use some of the provided nodes. For instance, what is the i2c node? How and when should it be used? And why read-byte seems to always fail (even after a successful request)? In my specific case I am trying to put together a patch to read a DS18b20 temperature sensor so I need to essentially implement the whole handshaking to initiate a conversion and then read the scratchpad.
An example would be very useful


The i2c node is an I2C interface constructor which by default refers to hardware I²C number 0. There potentially might be hardware I²C’s #1, #2, etc (if a board supports it) or bit-banging software I2C.

Well, you’re right a tutorial is necessary. I’ll try to write it down in the current month.

1 Like

A short video-story will do.

Here it is https://xod.io/docs/guide/i2c/

1 Like