Hello. I’m helping setup a low-power FM radio station on a very tight budget. Right now I’m working on a curse delay system. I found changeling and got it running on Ubuntu 16.04. I really like it and I want to make it more user-friendly for the DJs. changeling uses MQTT (Mosquitto, specifically) to receive published commands. changeling has three commands:
# To enter delay, which creates a several second buffer of audio from the PC mic jack and
plays it out through the speaker jack on a delay.
mosquitto_pub -t changeling-commands -m ENTER
# To exit delay, which eliminates the buffer and plays the audio coming in from the mic jack out
through the speaker jack in real time.
mosquitto_pub -t changeling-commands -m EXIT
# To dump delay buffers, which empties the buffer while playing an audio file to cover a curse
word spoken on air then continues to output sound to the speaker jack on a delay.
mosquitto_pub -t changeling-commands -m DUMP
I want to create a wired remote that will sit on the DJ table and publish one of the three commands above to changeling via a serial connection over USB when a button on the Arduino is pressed. I found Ardulink as a method for interfacing the Arduino with MQTT using Ardulink-MQTT. I installed the relevant Java scripts on the Ubuntu PC/MQTT broker, loaded ArdulinkProtocol.ino onto the Arduino Uno, connected them over USB, fired up the Ardulink Console and got them to interface. Right now I can connect to the Arduino from the console and remotely operate, for example, a blinking LED. I can also connect to the MQTT broker through the console, subscribe to the console and see changes I make on the console in the terminal window.
But now I want to connect the serial connection to MQTT directly to publish the above commands. I figure I have two options to do that:
OPTION 1:
A digital pin set to HIGH tells the Arduino to publish the text string of a changeling command to Ardulink-MQTT and on to Mosquitto.
PRO: I might be able to avoid writing an additional Java script that runs on the computer and stick with Ardulink software that’s already written.
CON: Those three changeling commands are long and I know how quickly I can use up the Arduino Uno’s SRAM with long strings.
OPTION 2:
A digital pin set to HIGH is received by a custom Java script based on Ardulink-MQTT, which translates the pin # to the corresponding changeling command and publishes the command to Mosquitto.
PRO: No worry of maxing out the Arduino Uno’s memory with long strings.
CON: I will have to write a custom Java script from the Ardulink-MQTT source code and compile it, which I haven’t done with Java in a very long time.
I know I could do keybinding or write a Perl/Python/etc script to send UNIX commands from a keystroke to operate changeling, but for reasons that are beyond the scope of this post I want to stick with MQTT. Basically, I also want the Arduino to subscribe to changeling over MQTT to operate an LED when the commands are run. But that’s for another post.
Any help would be much appreciated.
Thank you,
Jeremy