# Display-O-Tron HAT i2c problem

**URL:** <https://forums.pimoroni.com/t/display-o-tron-hat-i2c-problem/981>\
**Category:** Raspberry Pi\
**Created:** [September 14, 2015, 2:22pm UTC](https://forums.pimoroni.com/t/display-o-tron-hat-i2c-problem/981 "2015-09-14T14:22:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![suzukieng](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/suzukieng/32/420_2.png) [@suzukieng](https://forums.pimoroni.com/u/suzukieng)\
**Post date:** [September 14, 2015, 2:22pm UTC](https://forums.pimoroni.com/t/display-o-tron-hat-i2c-problem/981/1 "2015-09-14T14:22:44Z")

</div>

Hi everybody,

I got my Display-O-Tron HAT up and running in no time using the setup script. So far so good, but now I am experiencing problems when using the backlight and graph LEDs. From the output there seems to be a problem with the I2C bus. Usually the problem is not recoverable, and I have to power cycle the PI.

Some of the stack traces I’m seeing:

```
Python 2.7.3 (default, Mar 18 2014, 05:13:23)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from dothat import backlight
>>> backlight.set_bar(0, 255)
>>> backlight.set_bar(1, 255)
>>> backlight.set_bar(2, 255)
>>> backlight.update()
>>> backligh.set_graph(1.0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'backligh' is not defined
>>> backlight.set_graph(1.0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/dothat/backlight.py", line 64, in set_graph
	cap._write_byte(cap1xxx.R_LED_POLARITY, set_polarity)
  File "/usr/local/lib/python2.7/dist-packages/cap1xxx.py", line 477, in _write_byte
	self.i2c.write_byte_data(self.i2c_addr, register, value)
IOError: [Errno 5] Input/output error

```

In another session, after a power cycle:

```
>>> backlight.graph_off()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/dothat/backlight.py", line 34, in graph_off
	cap._write_byte(cap1xxx.R_LED_POLARITY, 0b00000000)
  File "/usr/local/lib/python2.7/dist-packages/cap1xxx.py", line 477, in _write_byte
	self.i2c.write_byte_data(self.i2c_addr, register, value)
IOError: [Errno 5] Input/output error

```

And another one:

```
>>> backlight.rgb(255, 0, 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/dothat/backlight.py", line 221, in rgb
	update()
  File "/usr/local/lib/python2.7/dist-packages/dothat/backlight.py", line 233, in update
	sn3218.output(leds)
  File "/usr/local/lib/python2.7/dist-packages/sn3218.py", line 95, in output
	i2c.write_i2c_block_data(address, CMD_SET_PWM_VALUES, [channel_gamma_table[i][values[i]] for i in range(18)])
IOError: [Errno 5] Input/output error

```

Any ideas, pointers on how to debug this? The LCD seems to work fine.

Kind Regards, Alex

---

<div class="post-metadata">

**Author:** ![suzukieng](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/suzukieng/32/420_2.png) [@suzukieng](https://forums.pimoroni.com/u/suzukieng)\
**Post date:** [September 14, 2015, 3:06pm UTC](https://forums.pimoroni.com/t/display-o-tron-hat-i2c-problem/981/2 "2015-09-14T15:06:35Z")

</div>

Oh yeah, I’m running the latest Raspbian.

```
pi@raspberrypi ~ $ uname -a
Linux raspberrypi 3.18.11-v7+ #781 SMP PREEMPT Tue Apr 21 18:07:59 BST 2015 armv7l GNU/Linux 
pi@raspberrypi ~ $ cat /etc/debian_version
7.8
```

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [September 14, 2015, 3:15pm UTC](https://forums.pimoroni.com/t/display-o-tron-hat-i2c-problem/981/3 "2015-09-14T15:15:57Z")

</div>

Looking into it!

What happens if you run one of our examples? Such as ( if you used the one line installer ):

`sudo ./home/pi/Pimoroni/dot3k/dothat/basic/backlight.py`

---

<div class="post-metadata">

**Author:** ![suzukieng](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/suzukieng/32/420_2.png) [@suzukieng](https://forums.pimoroni.com/u/suzukieng)\
**Post date:** [September 15, 2015, 4:32am UTC](https://forums.pimoroni.com/t/display-o-tron-hat-i2c-problem/981/4 "2015-09-15T04:32:24Z")

</div>

Right now the HAT seems to be happy again, both [backlight.py](http://backlight.py) and [graph.py](http://graph.py) work fine. If I can get back into the error state, I’ll run them again and see what happens.
