Communicating with xChip SW01 on Raspberry Pi

Communicating with xChip SW01 on Raspberry Pi

In this blog post, we will be configuring the RasPi to access the XinaBox SW01 xChip weather sensor, SL01 xChip light sensor, and OD01 xChip LCD display using the I²C bus.

 

Contents

  1. What you need
  2. Installations
  3. To do
  4. When things don't work as expected
  5. Next steps

 

1. What you need

  • a RasPi Zero or RasPi 3 B, connected and set up as per the RasPi Setup document
  • the XinaBox BR01 and SW01 devices

RasPi 3 B with XinaBox BR01 and SW01, power, HDMI, keyboard, and mouse

XinaBox BR01 plugged into RasPi 3 B

 

2. Installations

  • follow the configuration instructions given below in order to ensure that the RasPi is able to communicate with I²C compatible devices

 

3. To do

  • read through the first 4 pages of the UM10204.pdf document in order to gain an overview of I²C
  • open a command terminal by clicking the Terminal icon  from the RasPi Desktop, or use an SSH application such as Putty if this is preferred
  • run the cat /etc/modprobe.d/raspi-blacklist.conf command
  • if the raspi-blacklist.conf file contains a line of text which reads blacklist i2c-bcm2708 , it needs to be changed to read #blacklist i2c-bcm2708 using a text editor
  • run the sudo raspi-config command, follow the interface menu option to "I2C Enable/Disable", and enable I2C
  • run the ls /dev/i2c* command to check for the presence of the i2c-1 file, "/dev/i2c-1" will be returned if I2C is enabled
  • run the sudo i2cdetect -y 1 command in order to check whether the RPi detects the XinaBox SW01 board

  • the XinaBox SW01 board uses I²C address 76 (this is the hexadecimal number 0x76)
  • optionally, additional I²C enabled XinaBox boards can be connected and then the sudo i2cdetect -y 1 can be run again in order to check for their presence on the I²C bus - below is the command result after adding the XinaBox SL01 and OD01 boards, which use I²C address 0x29 and I²C address 0x3c respectively

  • a few additional i2c related commands exist, such as i2cset, i2cget, and i2cdump - the use of these commands is documented in the 'man' pages which can be accessed by entering man i2cget for information on the i2cget command, for example

 

4. When things don't work as expected

  • the internet is the best source of answers to any questions arising from 'unexpected' behaviour on the RasPi

 

5. Next steps

  • try a few other i2c related commands on I²C enabled XinaBox boards

 

Please see our Raspberry Pi XK03 kit, and especially the online instructions for other useful links to getting started, sample code and projects.

Previous article Programming XinaBox using Python on Raspberry Pi
Next article XinaBox collaborates with Microsoft to accelerate Internet of Things solutions

Leave a comment

Comments must be approved before appearing

* Required fields