DrumHAT - how?

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 (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

Hello,

in ~/drum-hat/examples
try sudo python3 drumhat.py

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

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 results in the same error as before:

pi@raspberrypi ~/drum-hat/examples $ sudo python3 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”, 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

Did you enable i2c?

curl -sS get.pimoroni.com/i2c | bash
1 Like

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

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

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.

what are you using to produce sounds?