Here is a report on some hacking / modding experiments I’ve made on the 5 Moons, in case it is useful to others. Please note that these are my own incomplete experiments, and there is no guarantee that these ‘features’ are fully stable and usable. DIY at your own risk, back up your data, keep a copy of the OS image in handy in case you need to restore it.
(This is not meant to be a ‘how-to’ guide, just a report on some successful proof-of-concept explorations.)
Enter the 5 Moons orbit (wifi + ssh access)
Just like the Pocket Piano 201 (I don’t have one, but I hear it’s nice), I found it’s possible to plug in a wifi adapter to the 5 Moons USB-A port and gain ssh access over a network.
I followed the general guidelines here and was able to connect my 5 Moons using ssh over wifi.
Here is my take:
- I ejected the 5 Moons SD card, and I used an Ubuntu VM on my Mac to mount the 5 Moons OS partition on the card and edit the
/etc/wpa_supplicant.conf
file directly to provide my local network details. - Since my network uses a WPA passphrase for authorization, I used the
wpa_passphrase ssidname plaintextpassphrase
command in Ubuntu to generate the hex value for the passphrase (instead of simply using the plaintext passphrase in the wpa_supplicant.conf file). - On the 5 Moons I am using the little USB wifi adapter that came with my Organelle M.
- After editing the wpa_supplicant.conf file, I put the sd card back in the 5 Moons, connected the wifi adapter, and started it up. After the startup procedure, and a few more seconds, I could see the light on the wifi adapter flashing to indicate that it was passing data to a wifi network.
- I had to use the network scanner app (mentioned in the post above) to find the IP address of my 5 Moons.
- I was able to ssh to it from my mac using:
ssh root@x.x.x.x
(where x.x.x.x is the IP address found in the previous step). - Username: root, password: organelle
Establish communications from orbit (ethernet over USB)
This is an incomplete experiment, but I want to report on it since it could lead to a more convenient way to connect to the 5 Moons.
The 5 Moons can behave as a “USB Gadget”, in that it can look like a USB peripheral to a computer connected to its USB-C port. This is how it can look like a mass storage device in ‘file access’ mode. There are a couple other types of devices that seem to work, and one I found to work is “Ethernet Gadget” mode.
- Connect the 5 Moons to a mac using a USB C cable (don’t enable file-access mode)
- Connect via SSH to the 5 Moons over wifi.
- On the command line run:
modprobe g_ether
- Then run:
ifconfig usb0 192.168.0.100 netmask 255.255.255.0
- On your mac, the 5 Moons will show up as an ethernet adapter. I used System Information.app to find out the device name for my 5 Moons (e.g. for me it was ‘en7’).
- In Terminal on your mac, configure an ip address on the new adapter:
sudo ifconfig en7 192.168.0.101 netmask 255.255.255.0
- Now you can ssh to the 5 Moons over USB:
ssh root@192.168.0.100
As it stands this isn’t very useful, since if you restart the 5 Moons, this configuration will be lost and you’ll need to set it up over wifi again. But I could see the possibility of setting it up so that these commands run automatically at powerup.
Note that g_ether cannot run at the same time as the mass storage (file access) module, since they would compete for access to the USB port. You need to unload g_ether for any other USB gadget configuration to work (and vice versa). You an unload it with the command:
rmmod g_ether
(or just reboot the 5 Moons)
Establish base camp (compile code on 5 Moons)
- The 5 Moons OS includes your basic compiler tools.
- I was able to build one of my gen~ -based pd externals see here
- I haven’t actually tested it yet to see if it runs in pd. All I know so far is that it compiled with warnings but not errors.
- To compile it I had to get a copy of m_pd.h from the pd(v51.4) source and copy it to /usr/include on my 5 Moons.
Send back audio from the surface (audio over USB)
Just like with the Ethernet Gadget mode, I was able to enable an Audio Interface Gadget Mode, which can make the 5 Moons appear to a computer (mac) attached via the USB-C port as an audio input/output device. (2in/2out)
Note: with anything related to audio, please be very careful. It’s super easy to create damaging feedback, or full-strength signals, especially with PureData in the mix. Note in particular that the ‘volume’ knob on the 5 Moons is just a ‘control’ knob for pd, not a direct control of an onboard amplifier. This means that if pd is not explicitly using the value of this knob to attenuate audio within a patch, the audio could be output on the main out at 100% volume. Proceed with caution.
Like I mentioned with the Ethernet gadget experiment above, you can only enable one of these ‘gadgets’ at a time.
- Command to enable USB audio:
modprobe g_audio c_srate=48000
This creates a new audio ‘device’ on the 5 Moons, alongside the built-in hardware one. Anything sent to ‘out’ (playback) on this device on the 5 Moons becomes ‘input’ (capture) on your host laptop. Anything ‘captured’ (in) on this device, comes from the ‘output’ (playback) on your host laptop (or iPad, etc.).
On my mac & iPad, this audio interface is called ‘Playback Inactive’ and ‘Capture Inactive’. I have no idea why they are called “Inactive”, but it has been working for me.
There are a lot of possibilities here; I think an audio card with embedded pd could do some interesting things! Just trying to think through different kinds of routing really makes my head spin
Note that the stock ‘pd’ process on the 5 Moons will just use the built-in hardware in/out ports. To use audio over USB, you need to tell pd to attach to the alternative device when it starts up.
The hardware and USB endpoints for audio operate as two completely separate devices, so to mirror audio from one to the other, you need some software to make a connection.
As an experiment I was able to get audio in (to the 5 Moons) from its hardware port (as usual), but send the 5 Moons audio output directly over USB to my laptop, instead of to its output audio port, then listen to it on my laptop speakers, by explicitly telling the pd process to use device 1 (hardware) for ‘input’ and device 3 (usb) for ‘output’:
killall pd
cd /sdcard/pd
pd -nogui -rt -audioindev 1 -audiooutdev 3 -audiobuf 8 main.pd &
(I was also able to get the 5 Moons to behave as a full ‘sound card’ (stereo in / out) for my iPad, along with its standard looping functions, but that required creating a separate ‘passthrough’ pd patch and running a second pd process for the output side of things.)
This thing has been pretty solid so far in my brief experiements with USB audio, but I haven’t been listening closely for glitches etc. So I don’t know how reliable ultimately this would be.
To unload the USB audio gadget driver:
rmmod g_audio
(or restart the hardware)
Sample return mission (file transfer over network)
Of course, with ssh, it’s possible to copy files to & from the 5 Moons over a network with scp
, as expected.
Current mission status
So, anyway, after about one day with my 5 Moons, I’ve been able to try some interesting things with the hardware. I love this little device, and much respect to C&G for leaving the door open for experimentation. Hopefully all this is useful to others. Cheers.