Raspberry Pi + Monome


#21

Yep, I’m getting the same issue as you mentioned. Also getting a Segmentation fault when I try to run serialoscd, so something’s definitely broken.

Maybe @wrl will have some ideas about how to fix this. Which Pi distro are you using? Raspian?


#22

Alright, here’s what I had to do to get it working:

  • from the serialosc git directory, run:
    > git checkout -b stable
    > git reset --hard c46a0fa5ded4ed9dff57a47d77ecb54281e2e2ea
    This will create a new stable branch, and point it to the 1.4 release commit.
  • Run ./waf distclean && ./waf configure, then ./waf and sudo ./waf install as per the normal instructions
  • Once it’s installed successfully, where the instructions say serialosc, throw a d onto the end of it: serialoscd.
  • From here, I was able to get a device (mostly) recognized and working with a little test script

I say “mostly” above because I still ran into a couple of segmentation faults when plugging the device in or unplugging it. I had to run ps aux | grep serialosc a few times to check if there were orphaned processes, and had to kill them a few times. Some combination of "plugging the grid in, and then running serialoscd" or the other way around worked.


#23

Brilliant, that works, thanks very much.


#24

This would also depend on the power brick you’re using to power the Pi, right? Do you know how much current output it’s rated for?

Alternatively, @tehn, do you have an idea of how much current the grid typically pulls off of the USB bus?


#25

usually around 150ma, up to 600ma. all depends on how many lights


#26

The power brick i use is rated for 3A.
From one vendor site :

  • the RPi 2 has a safety (polyfuse) that limits its overall current consumption to 2A.
  • the maximum allowed current for all USB devices combined is 1.2A.

#27

wait a second… maybe my question is a bit naiv, because of my lack of knowledge of coding and raspberry pi (and there’s still the goddamn language barrier, lol), but is it possible to make MLR (yup, it’s all about MLR in my tiny microcosm) work on a raspberry pi, hook this thing up to a monome256 (and maybe even a soundcard), so that i could exclude my macbook from my setup?

anyone here with experience? has anyone tried something like this yet?


#28

I’m not sure if Max will run in the Windows Pi OS thing, but it certainly won’t run on Linux without WINE, which makes the effort pretty futile. The Pi is not terribly performant, so the added overhead of WINE, plus the general inefficiency of mlrv makes it pretty unlikely that it’ll work well enough to be useful.

That said, Raspbian will probably run puredata just fine, so you might be able to get a ported version up and running. You’ll definitely want an external soundcard, since the built-in audio is something like 12-bits, and incredibly noisy.


#29

thanks for the answer! well, maybe i’ll wait a little bit and keep my eyes open until somebody says that it works (or at least waiting until i have some money to try it myself)… but wouldnt it be awesome to just have all the lovely max apps working with the monome on this mini-computer? would be a game-changer for me! ;D


#30

monome gs128 is working here on raspberry pi 3 + supercollider headess.

i am using this image: 2016-05-27-raspbian-jessie-lite.img
and this guide: http://supercollider.github.io/development/building-raspberrypi

i just edit this line for onboard sound (-dhw:0):
jackd -P75 -dalsa -dhw:0 -p1024 -n3 -s -r44100 &

then i installed libmonome & serialosc using step 2 from this guide:
http://monome.org/docs/linux/
and step6, to load kernel modules:
$ sudo modprobe usbserial ftdi_sio
$ lsmod

i did ermina suggestion:
(and added usbserial and ftdi_sio to /etc/modules so that they are loaded on every boot.)
and rknLA corrections from this post.

also added a line to autostart.sh, after
/usr/local/bin/jackd -P75 -dalsa -dhw:0 -p1024 -n3 -s -r44100 &
i added
/usr/local.bin.serialoscd &
for serialoscd autostart…

then used putty to move supercollider monome classes (monom-master)
(from https://github.com/catfact/monom/archive/master.zip)
to /home/pi
and after
sudo mv monom-master /usr/local/share/Supercollider/SCCassLibrary/.
(putty didnt wanted to move right away, something with permissions…)

i am running a modversion of grid-studies-3-5.scd
(for non varibright models, see http://archive.monome.org/community/discussion/comment/213275#Comment_213275),
using top(linux cmdline app) i measure CPU 21%…

i tried also Switch to use my gs128 with rpi and WW without luck.
so switching between modules and computer only works with mac? doesnt work with my windows also…

thx for all help here, thx ermina e rknLA!
:slight_smile:


#31

What are the chances of making a bootable image from your SD card in its current state? I use Pi Filler (http://ivanx.com/raspberrypi/) to restore from back ups (made from Pi Copier) and was thinking of how much easier it might be to such a process. I apologize in advance if there is an obvious obstical that would prevent such an endeavor, I’m a noob to Linux and maker boards. I am also, however, the proud owner of two raspberry pi 3’s!


#32

the first thing i tried to do after running mycode.scd was a backup image.
i did one with win32DiskImage, but i am using a 16gb microsd!
does anyone knows how to backup only 2gb?
(i am not using 16gb at all!)

maybe with sudo raspi-config to resize partition?


#33

if you have a mac around try pi copier: http://ivanx.com/raspberrypi/


#34

I second pi copier, as well as the other utilities from Ivan x, but I do believe they are limited to OSX.


#35

Hello, this is my first time posting to lines (though I used to be a monome.org forum regular)!

Just want to share a recent project involving a 128 and a raspberry pi:

Not an original concept, but I thought I’d try it this time with pure python (using pyserial) in a pi. The servos are driven by an arduino uno.

I wrote my own monome python library (at the time I wrote it, pymonome didn’t exist yet), which is functional but not really meant for general use.

Also, I’m a python novice so the code is kinda messy :slight_smile:


Fyi: embedded raspberry pi, monome, gate inputs – sequencer – tutorial :)
#36

are those the regular kind of servos you’d find in a remote control car? Also could I pick your brain about the raw monome serial protocol if you already hand-rolled a monome driver?

There are a couple of things about libmonome that seem to not sit super-well with my current software project (codename serial-hub) - already wrote my own raw midi drivers for lisp (no FFI), a module specially for boomerang pedal, and did hostside aleph serial protocol the same way. In that context it’s kinda clunky bolting on libmonome rather than having the monome interface work like the 3 other supported serial protocols…


#37

very nice!

(You could probably get away with the servo driver talking serial direct to your Pi’s GPIO ports - if the servo driver is a SPI/I2C device.)


#38

I pretty much depended on this spec while I was writing my monome library:

http://monome.org/docs/serial.txt

I don’t have experience with libmonome, but I do recommend trying out the raw serial route. I find it wasn’t too difficult to write for it (though it was a huge barrier for me at first as I started with zero python/serial knowledge).

And yes, those servos are the regular 9g ones you can get off RC shops.


#39

Thanks! I think did consider using GPIO (can’t remember exactly as I planned this thing many years ago), but ultimately decided it would be cooler to use an arduino to handle servo movements. Yep, it’s pretty much the cool factor haha :slight_smile:


#40

ha yea I think @tehn pointed me in that direction at some point last time I was thinking/asking about this. Must’ve got more computer-literate in the meanwhile - message descriptions actually making 100% sense this time around, very clear document…

Still stuck at the same point as last night though, not able to simply print all the bytes coming in off /dev/ttyUSB0 …

EDIT:

Bah - sorry to rubber-ducky the forum - I found the answer to my own question immediately after asking… It’s a gotcha I already ran into with the aleph, you first have to call stty -F /dev/ttyUSB0 raw before opening the file.

Still seeing something strange though… If I run my finger along a line of buttons pretty fast whilst reading from /dev/ttyUSB0 the monome will go crazy, light a bunch of random leds & stop responding to the input commands. Zoinks! this bug is intermittent (totally gone now) and possibly usb cabling-related. All is well, back to building fun stuff!

EDIT:
slept, rebooted, back to buggy… I have now solved the intermittent bad behaviour with furious button-mashing (hopefully once & for all). For the record a UNIX incantation for a well-behaved monome grid goes thusly:

stty -F /dev/ttyUSB0 115200 sane -brkint -icrnl -opost -onlcr -isig -icanon -iexten -echo -echoe

after that, one’s programming language of choice can just read/write raw bytes to/from /dev/ttyUSB0. Kind of wondering now whether some of the weird hangs/craziness I saw running serial comms stress tests flat out on the aleph could be attributed to some missing stty options???