I was inspired by a question asked on RTL-SDR Facebook group. Although this question was about controlling SDR# with Arduino I decided to give a try with SDR++. I took a look at rig_ctrl plugin, but it was missing some gui functionalities. Also this plugin was designed to controll the software via network and its purpose in general was quite different from what I wanted to achieve. That's why I decided to try something by my own. Parts of the code were taken from Botland store and DRFrobot wiki. Serial initialization was googled and found in some Stackoverlow answer (hopefully). I just glued those pieces toghether. Please note: I'm not a software developer and I'm not a very big fan of C++. Yet, I manged to develop something functional,so here it is: "Arduino SDR++ Controller"
- SDR++ v1.0.6
- Ubuntu Linux 20.04
- Arduino UNO
- Arduino Leonardo - preferred
- DFRobot DFR0009 LCD Keypad Shield
- 2 * DFRobot EC11 rotary encoders
In order to build the plugin please follow the instructions from SDR++ README file. Use Arduino IDE to compile the sketch and upload to the board.
- Arduino/controller_uno/controller_uno.ino - Arduino UNO code
- Arduino/controller_leonardo/controller_leonardo.ino - Arduino Leonardo code
- Plugin/misc_modules/arduino_controller/src/main.cpp - plugin code
Rotary encoders are connected to digitial pins:
- Hole A -> Pin 13 - left turn
- Hole B -> Pin 12 - right turn
- Hole C -> Pin 11 - button
- Hole A -> Pin 3 - left turn
- Hole B -> Pin 2 - right turn
- Hole C -> Unused - because the shield was out of digital pins
Rotary encoders are connected to digitial pins:
- Hole A -> Pin 2 - left turn
- Hole B -> Pin 3 - right turn
- Hole C -> Pin 11 - button
- Hole A -> Pin 0 - left turn
- Hole B -> Pin 1 - right turn
- Hole C -> Unused (for now)
Connect Arduino with standard USB cable. It should be registered as a serial device, for example: /dev/ttyACM0
.
- Left , Right - Waterfall Zoom In / Zoom Out
- Up , Down - Tune with a step equals to device sample rate.
- Select - Cycle demodulators.
- Left knob - Tune with a step equals to "Snap interval" multiplied by 10.
- Right knob - Tune with a step equals to "Snap interval".
- Knob button - Center waterfall.
Enable the plugin with "Module Manager". Setup serial port (default: /dev/ttyACM0) and click "Start" button.
SDR++ is GPL3.0 so if someone decides to include this plugin within SDR++ then the same license should be applied. Keep in mind that I used some code snippets from Botland store and DFRobot wiki. I didn't notice any licenses there. So, to conclude: I really do not care. Take this code and Do whatever you want.
I bought everything at Botland.
Multiplatform serial communication done with Serialib by Philippe Lucidarme. Accoriding to author this library is license-free.
There is a lot of space for improments. For example I couldn't use interrupts for knobs because Arduino UNO has only two of them and I needed four. I read digital pins in a loop which is not the best practice I suppose. This issue doesn't affect Arduino Leonardo. Feel free to contribute. Greetings go to RTL-SDR Polska Facebook group and specially to Kacper for inspiring me!