# DrumHAT - how?

**URL:** <https://forums.pimoroni.com/t/drumhat-how/1521>\
**Category:** Raspberry Pi\
**Created:** [January 3, 2016, 2:19pm UTC](https://forums.pimoroni.com/t/drumhat-how/1521 "2016-01-03T14:19:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kalakuta](https://avatars.discourse-cdn.com/v4/letter/k/6a8cbe/32.png) [@Kalakuta](https://forums.pimoroni.com/u/Kalakuta)\
**Post date:** [January 3, 2016, 2:19pm UTC](https://forums.pimoroni.com/t/drumhat-how/1521/1 "2016-01-03T14:19:40Z")

</div>

Hi,

Completely new to all this HAT stuff - bought a DrumHAT thinking “great, I’ll install it and in no time I’ll be tapping out rhythms on it!”

Well, it’s fixed to our raspberry pi, and I followed the (brief!) instructions on the github page.

When I try to run [drumhat.py](http://drumhat.py) (is this even how I should be going about it?) I get the following:

pi@raspberrypi ~/drum-hat/library $ sudo python ./drumhat.py  
Traceback (most recent call last):  
File “./drumhat.py”, line 6, in   
alert\_pin=25)  
File “/usr/local/lib/python2.7/dist-packages/Cap1xxx-0.1.0-py2.7.egg/cap1xxx.py”, line 239, in **init**  
self.i2c = SMBus(i2c\_bus)  
IOError: [Errno 2] No such file or directory  
Exception AttributeError: “Cap1188 instance has no attribute ‘alert\_pin’” in \<bound method Cap1188. **del** of \<cap1xxx.Cap1188 instance at 0x76c38f80\>\> ignored

…and nothing happens.

Anyone out there got the DrumHat working? Or any advice as to how I might do so?

Thanks!

Paddy

---

<div class="post-metadata">

**Author:** ![darkhammer](https://avatars.discourse-cdn.com/v4/letter/d/b3f665/32.png) [@darkhammer](https://forums.pimoroni.com/u/darkhammer)\
**Post date:** [January 3, 2016, 2:52pm UTC](https://forums.pimoroni.com/t/drumhat-how/1521/2 "2016-01-03T14:52:51Z")

</div>

Hello,

in ~/drum-hat/examples  
try sudo python3 [drumhat.py](http://drumhat.py)

---

<div class="post-metadata">

**Author:** ![Kalakuta](https://avatars.discourse-cdn.com/v4/letter/k/6a8cbe/32.png) [@Kalakuta](https://forums.pimoroni.com/u/Kalakuta)\
**Post date:** [January 3, 2016, 3:17pm UTC](https://forums.pimoroni.com/t/drumhat-how/1521/3 "2016-01-03T15:17:31Z")

</div>

Thanks, Darkhammer.

Unfortunately I get the message ‘no module named caplxxx’

And pip cannot find the module for me to install in python3 (it’s there in pyuthon 2.7…):

pi@raspberrypi ~/drum-hat/examples $ pip install caplxxx  
Downloading/unpacking caplxxx  
Could not find any downloads that satisfy the requirement caplxxx  
No distributions at all found for caplxxx  
Storing complete log in /home/pi/.pip/pip.log

---

<div class="post-metadata">

**Author:** ![Kalakuta](https://avatars.discourse-cdn.com/v4/letter/k/6a8cbe/32.png) [@Kalakuta](https://forums.pimoroni.com/u/Kalakuta)\
**Post date:** [January 3, 2016, 3:35pm UTC](https://forums.pimoroni.com/t/drumhat-how/1521/4 "2016-01-03T15:35:59Z")

</div>

Have managed now to install cap1xxx - when I realised that it was the digit 1 rather than the letter l in the middle…

Unfortunately running [drumhat.py](http://drumhat.py) results in the same error as before:

pi@raspberrypi ~/drum-hat/examples $ sudo python3 [drumhat.py](http://drumhat.py)  
[‘drums2/000\_base.wav’, ‘drums2/001\_cowbell.wav’, ‘drums2/002\_clash.wav’, ‘drums2/003\_whistle.wav’, ‘drums2/004\_rim.wav’, ‘drums2/005\_hat.wav’, ‘drums2/006\_snare.wav’, ‘drums2/007\_clap.wav’]  
Traceback (most recent call last):  
File “[drumhat.py](http://drumhat.py)”, line 28, in   
alert\_pin=25)  
File “/usr/local/lib/python3.2/dist-packages/cap1xxx.py”, line 239, in **init**  
self.i2c = SMBus(i2c\_bus)  
IOError: [Errno 2] No such file or directory  
Exception AttributeError: “‘Cap1188’ object has no attribute ‘alert\_pin’” in \<bound method Cap1188. **del** of \<cap1xxx.Cap1188 object at 0x216e930\>\> ignored

---

<div class="post-metadata">

**Author:** ![RogueM](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/roguem/32/311_2.png) [@RogueM](https://forums.pimoroni.com/u/RogueM)\
**Post date:** [January 3, 2016, 10:18pm UTC](https://forums.pimoroni.com/t/drumhat-how/1521/5 "2016-01-03T22:18:54Z")

</div>

Did you enable i2c?

```
curl -sS get.pimoroni.com/i2c | bash
```

---

<div class="post-metadata">

**Author:** ![Kalakuta](https://avatars.discourse-cdn.com/v4/letter/k/6a8cbe/32.png) [@Kalakuta](https://forums.pimoroni.com/u/Kalakuta)\
**Post date:** [January 3, 2016, 10:43pm UTC](https://forums.pimoroni.com/t/drumhat-how/1521/6 "2016-01-03T22:43:48Z")

</div>

I enabled it via raspi-config, but on running the script you suggested I get:

I2C Already Enabled

Adding

i2c-dev  
to /etc/modules

Adding  
i2c-bcm2708  
to /etc/modules

And, that does the trick! Thank you very much RogueM!

Paddy

---

<div class="post-metadata">

**Author:** ![RogueM](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/roguem/32/311_2.png) [@RogueM](https://forums.pimoroni.com/u/RogueM)\
**Post date:** [January 3, 2016, 11:38pm UTC](https://forums.pimoroni.com/t/drumhat-how/1521/7 "2016-01-03T23:38:23Z")

</div>

Great (though I’m not sure why you had trouble earlier)!

---

<div class="post-metadata">

**Author:** ![claire](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@claire](https://forums.pimoroni.com/u/claire)\
**Post date:** [March 2, 2016, 7:58am UTC](https://forums.pimoroni.com/t/drumhat-how/1521/8 "2016-03-02T07:58:13Z")

</div>

Hi,  
I’m doing something wrong, haven’t worked out what with Drumhat.  
Have enabled i2c and I know the speaker works as I’ve swapped over with my piano hat. When I try drum sounds I get lights on the Drumhat but no sound.  
I’ve tried it on Pi3 and Pi2. I’ve shutdown to add the hat before rebooting :)  
Any ideas appreciated.

---

<div class="post-metadata">

**Author:** ![RogueM](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/roguem/32/311_2.png) [@RogueM](https://forums.pimoroni.com/u/RogueM)\
**Post date:** [March 2, 2016, 9:43am UTC](https://forums.pimoroni.com/t/drumhat-how/1521/9 "2016-03-02T09:43:28Z")

</div>

what are you using to produce sounds?
