Using XinaBox with BeagleBone Black

Project to show how to use xChips with a BeagleBone Black through a XinaBox bridge on the interface found on the SBC.

Categories: Intermediate


This project will take you through the steps on how to use the XinaBox xChips with a BeagleBone Black. The BeagleBone Black is a great SBC that has a Linux OS loaded on the eMMC memorry straight out of the box. The main focus of this article is to show how to communicate with an xChip that uses I2C as communication protocol.

What you will need

  • XinaBox BB01
  • XinaBox SW10 (used for demonstration)
  • BeagleBone Black

Adding a sensor to the BeagleBone Black

The XinaBox platform makes this step very easy, the modular platform uses simple connectors to click boards together.

The first thing you need to do is plug the BB01 bridge xChip into the BeagleBone so it resembles the picture below.

Next you can connect the sensor we will use as an example for this project, the SW10 from XinaBox, which is a LM75B temperature sensor. Simply use a XC10 connector and click it into the BB01 board as indicated in the picture below.

The only thing to bare in mind, the small XinaBox logos with chip name must all face the same direction, the bus at the top and bottom of the board are NOT the same. Usually the boards have a large logo at the bottom.

Once connected you can power the BeagleBone up!

Connecting SSH to the BeagleBone

I will not cover this in detail, you can view the link below on how to connect to your BeagleBone through SSH.

As a side note, if the user and password in the link does not work, you can use:
user: debian password: temppwd

May save you a lot of head scratching time and grey hairs!

Connecting to a sensor through I2C

You will want to make sure your install of Debian is up to date first. In the terminal window on your SSH connection run the following command.

sudo apt-get update && sudo apt-get upgrade

This will download all the updates and install the latest dependencies for your OS.

Once this has finished, which may take a while, you can make things a bit easier on yourself on this variant of Debian, you will want to establish yourself as a super user so that you won’t be requested for a password every time you try to do literally anything. Do this with the command below.

sudo su 

Once you’ve done this you need to install the necessary I2C dependencies by running the following.

apt-get install i2c-tools

Now that this is installed we can start doing some I2C operations. First thing to do is ensure your SBC can see the sensor by checking for the I2C address. This is easy to do by doing an I2C Scan. You can run the following command to do this.

i2cdetect -r -y 2

You should see the following result if it works correctly.

    0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00:          -- -- -- -- -- -- -- -- -- -- -- -- --

10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --

50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --

60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

70: -- -- -- -- -- -- -- --

The scan shows that we have detected address 0x48 connected to I2C, which is the default address of the LM75B on the SW10.

Reading the temperature

This is as simple as running a single line now that everything is set up. Simply run the following.

printf "%d\n" $(i2cget -y 2 0x48 0x00)

As easy as that you will get a temperature reading in Celsius output such as below.


Reading the temperature a bit more practically

So now that you have gotten a single temperature reading from the sensor, you probably want to put it to use or at the very least read it continuously and display it on the console.

We will need a script to do this for us on Debian. To create a script you will need to create a file in the location you are currently in on the console. You can create a file by running this.


This has created a shell script that we can edit with some code that we want to execute. We can edit the script file by running the following command.


The console screen will change to the contents of the file, which should be empty at this point in time. Copy and paste the following code into the file.


while true;


printf "%d\n" $(i2cget -y 2 0x48 0x00)

sleep 1


The script above will read the temperature and write it out to the console and then sleep for 1 Second then repeat. Once you have edited the file you will need to save it by pressing CTRL+X to exit and then agree to overwriting the contents of the file to save it.

Now you can run the script file you just created by running the following command.


The temperature will now be written out the the console once per second like this.







That’s it! No wires needed to use a sensor, just a little bit of coding. This script file can be changed to do many other things, but that’s outside the scope of this article. You can read any of the XinaBox sensors over I2C with this method, but will vary in coding complexity to get the data from the respective registers. Enjoy coding your BeagleBone with XinaBox!

Comments are not currently available for this post.