Tips for talKKonnect Building with Orange Pi Zero

Tips for talKKonnect Building with Orange Pi Zero…

For complete instructions on how to compile talKKonnect code and configure it for operation you can check talKKonnect github page. This page contains only a few practical tips for building talKKonnect devices with Orange Pi Zero boards. Before settling with any particular build design for a talKKonnect device, you will most certainly want to follow logic and priorities which are more specific to your particular use case. Information in this document are just suggestions, talKKonnect team wanted to share with you, to help you get started with building. Building a talKKonnect system is like playing with Lego bricks. Your final product could look completely different.

talKKonnect happily running with Orange Pi Zero

Orange Pi Zero can be a far better alternative for building a small size, low cost talKKonnect device from Raspberry Pi Zero.

Orange Pi Zero LTS v1.5 specification:

  • SoC – Allwinner H2+ quad-core Cortex A7 processor @ 1.2 GHz with Mali-400MP2 GPU @ 600 MHz
  • System Memory – 256 or 512 MB DDR3-1866 SDRAM
  • Storage – microSD card slot
  • Connectivity – 10/100M Ethernet + 802.11 b/g/n WiFi (Allwinner XR819 WiFi module) with u.FL antenna connector and an external antenna
  • USB – 1x USB 2.0 host ports, 1x micro USB OTG port
  • Expansion headers
    • Unpopulated main 26-pin GPIO header
    • 13-pin header with headphone, 2x USB 2.0, TV-out, microphone and IR receiver
  • Debugging – 3-pin header serial UART. 2 more serial UART’s from the main GPIO header
  • 2x onboard LED’s
  • Power Supply – 5V via micro USB port
  • Dimensions – 52 x 46 mm
  • Weight – 26 grams

Orange Pi‘s are made by Shenzhen Xunlong Software Co. Their “Zero’s” are small cost efficient single board computers, one of the many models of Single Board Computers they produced so far. They can run Armbian OS. Orange Pi manufacturer‘s web site is usually offering Raspbian OS for many of their boards, together with Android or other Linux images. However, always first consider using the latest Armbian for Orange Pi Zero from armbian.org, because it will be more up to date and better supported by a great team of Armbian developers.

Orange Pi Zero has Allwinner H2+ SoC, and comes with 256MB or 512MB RAM. It‘s H2+ Quad-core Cortex-A7 supports Neon CPU extension and therefore there will be no issues for OpenAl which we need in Mumble. At the same time, Orange Pi Zero features an onboard sound codec hardware with microphone input, unlike Raspberry Pi boards – which are traditionally lacking an audio input.

This is why we always need an additional USB sound card for Raspberry Pi talKKonnect builds, and in Orange Pi builds, we can usually circumvent this requirement and just use it’s onboard sound.

Other Orange Pi boards will also work for building talKKonnect devices. Older Orange Pi boards usually all have onboard sound with microphone input, supported in Armbian. There are newer boards like Orange Pi 3 with H6 Quad-core processor which still don’t have a working sound in Armbian, they are missing the drivers, but Xunlong somewhat older boards like Orange Pi PC, Orange Pi PC Plus, Orange Pi Plus 2E and many other will have a working onboard sound with microphone input.

Orange Pi Zero has a shorter GPIO header with only 26 pins, but there will be just enough GPIO for talKKonnect buttons and led functions.

Orange Pi Zero GPIO Map

What is required for Orange Pi Zero build?

1. Orange Pi Zero with 512 MB RAM

While talKKonnect is not memory hungry and will happily run with 256 MB of memory, the price difference between 256MB and 512MB Orange Pi Zero model is very small. You can use 512 MB board with more memory in other projects and more memory can come handy later. Allwinner H2+ Quad-core Cortex-A7 CPU is powerful enough for 48 KHz audio sampling, unlike Raspberry Pi Zero‘s 1GHz single-core ARMv6 CPU (BCM2835) which will be struggling to do the processing.

The Orange Pi Zero version you will most certainly be able to find on the market is Orange Pi Zero “LTS” with board version v1.5 (end of 2019 / early 2020).

2. Orange Pi Zero Expansion Board

While you should be able to access the audio input and output from Orange Pi Zero main header, you will need to add resistors and capacitors for bias voltage and microphone. For a few more dollars you can buy USB Expansion board. At the same time you will get 2 additional USB 2 ports and IR receiver. You will be able to control talKKonnect with IR remote.

However, we don’t recommend stacking up expansion board on top of Orange Pi Zero. Orange Pi Zero should preferably use a larger than usual heat-sink. To facilitate mounting of a heat-sink, consider mounting USB expansion board side by side. More on this modification later. But if you are trying to miniaturize your build then try your best shot to control CPU heat and wire as required for your use case.

You can use the onboard microphone with talKKonnect or rewire the USB expansion board for external radio type microphone. Or flip a switch or jumper between the two to change between microphones? For planning such modifications, please consult Orange Pi Zero schematic:

Orange Pi Zero USB Expansion Board Schematic

Orange Pi Zero LTS v1.5 Schematic

3. OLED 1.3 inch SSD1306 Display

talKKonnect can work with Hitachi HD44780 20×4 parallel or I2Cdisplay, or OLED 1.3 inch or 0.96 inch I2C display. For Orange Pi Zero build it makes sense to use OLED I2C display.

OLED 1.3 inch 130×64 Display

Once you wire the display and assign a correct decimal address in talKKonnect config file, display should work.

If your display communicates over I2C over 0x3C hex address (position of a resistor at the back of the display) this is decimal number 60. 0x3C is the default I2C hex address for most OLED displays when working with Raspberry Pi or other similar boards.

Why do we then see 0x78 address printed at the back of such displays? This is because they are mostly produced for Arduino which uses 8-bit addressing for I2C and that is a correct address for Arduino. Addressing for working with I2C in Linux is 7-bit and this is why we use address: 0x3C.

<oleddefaulti2caddress>60</oleddefaulti2caddress><!-- define the decimal value of the i2c hex address for your display -->

Pin-out on displays from different makers can be different. Be careful not to mix Vcc (Vdd) and ground. Display can be powered from 3.3V or 5V. LDO regulator in the display can tolerate voltage only up to 6.3 Volts. We recommend running OLED display from 3.3 Volts.

In case you cannot find 1.3 inch display, you can use 0.96 inch OLED. There are two types of chips used in these displays – with SSD1306 chip and SH1106 / SH1107 chips. Both should work. 1.3 inch display can show 130 x 64 characters, while 0.96 inch show 128 x 64, and therefore small adjustments in how the characters are printed may be required in talkkonnect.xml config file.

To check I2C communication with OLED display, after connection use i2c-tools

root@tk-demo:~#apt-get install i2c-tools

root@tk-demo:~# i2cdetect -y 1
or
i2cdetect -y 0

root@tk-demo:~# i2cdetect -y 0

0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

talKKonnect in action

4. Bigger than usual heat-sink. CPU Heat Control in Orange Pi Zero

Orange Pi Zero and Armbian OS can do CPU throttling (Dynamic CPU Frequency Scaling) to conserve energy and you can select how to work with CPU Scaling Governor. CPU speed can vary depending on the processing requirements. Allwinner H2+ processor can create considerable heat. If the temperature runs off over 90 °C then the CPU will shut down to prevent damage. There are various production versions of Orange Pi Zero v1.1 to v1.5 and depending on a version and OS, CPU temperature was in some cases reading higher from the actual, in other cases CPU temperature was really getting too high, depending on the processing. The latest Orange Pi Zero LTS board version 1.5 is maybe even reporting CPU temperature much lower from actual. There is not a single solution how to best manage heat across the different versions of Orange Pi Zero and in different use cases. Run your own tests and make a decision. This should not discourage you from building talKKonnect with Orange Pi Zero. Many people use Orange Pi Zero successfully in thousands of projects with or without heat-sinks. Some people even use active cooling with a fan, but for running talKKonnect active cooling won’t be required.

In any case, we recommend using a bigger than usual heat-sink, especially if talKKonnect device will go transmitting for longer periods of time, if it is used as a gateway or if you do audio streaming. Heat-sink should be at least 20x20x15 mm size. Just for testing and occasional use you can probably avoid using a heat-sink, but run your own CPU temperature tests and decide for yourself. In order to mount a heat-sink use a 2-3 mm cooper shim to raise a heat-sink over the board nearby SMD components. Use heat-sink adhesive to glue it in place.

20x20x15mm heat-sink

2-3 mm copper shims

heat-sink plaster

You can monitor CPU temperature with command:

armbianmonitor -m

Start streaming from talKKonnect with F11 shortcut key,

[ info ] 2020/04/19 11:32:57 F11 pressed Start/Stop Chimes Stream into Current Channel Requested
[ info ] 2020/04/19 11:32:57 File https://voa28.akacast.akamaistream.net/7/325/437810/v1/ibb.akacast.akamaistream.net/voa28 Playing!

and check CPU temperature over a period of time. Is it constantly growing or does it stay within some moderate range? If a temperature stays within 50-60 °C range then the CPU heat management is good enough for running talKKonnect and transmitting even continually without having to worry about stability.

root@tk-demo:~# armbianmonitor -m

Stop monitoring using [ctrl]-[c]
Time CPU load %cpu %sys %usr %nice %io %irq CPU C.St.
09:44:27: 960MHz 0.41 12% 3% 8% 0% 0% 0% 46.9°C 0/6
09:44:32: 240MHz 0.46 13% 4% 8% 0% 0% 0% 45.9°C 0/6
09:44:38: 240MHz 0.82 12% 4% 8% 0% 0% 0% 46.6°C 0/6
09:44:43: 240MHz 0.92 17% 5% 11% 0% 0% 0% 46.7°C 0/6
09:44:48: 240MHz 0.84 24% 7% 16% 0% 0% 0% 46.2°C 0/6
09:44:53: 240MHz 0.86 23% 6% 16% 0% 0% 0% 46.3°C 0/6
09:44:58: 240MHz 0.79 23% 6% 16% 0% 0% 0% 45.9°C 0/6
09:45:04: 240MHz 0.81 24% 7% 16% 0% 0% 0% 46.6°C 0/6
09:45:09: 480MHz 0.74 23% 6% 15% 0% 0% 0% 46.0°C 0/6
09:45:14: 480MHz 0.68 23% 6% 16% 0% 0% 0% 47.2°C 0/6
09:45:19: 240MHz 0.72 24% 7% 16% 0% 0% 0% 46.7°C 0/6
09:45:25: 480MHz 0.75 22% 6% 15% 0% 0% 0% 46.6°C 0/6
09:45:30: 240MHz 0.69 23% 7% 15% 0% 0% 0% 46.6°C 0/6
09:45:35: 240MHz 0.79 22% 6% 15% 0% 0% 0% 46.2°C 0/6


You can also check CPU temperature by reading

root@tk-demo:~# cat /sys/class/thermal/thermal_zone0/temp

45859

Adjust CPU Governor settings and preferably never run Allwinner H2+ CPU at full speed above 1 GHz without a good heat management. Use 960 MHz or 816 MHz as a maximum instead.

root@tk-demo:~# armbian-monitor

Instead of going through armbian-config CPU options, you can also edit file

/etc/default/cpufrequtils


root@tk-demo:~# nano /etc/default/cpufrequtils

# WARNING: this file will be replaced on board support package (linux-root-...) upgrade

ENABLE=true
MIN_SPEED=240000
MAX_SPEED=960000
GOVERNOR=conservative

Modifications to USB Expansion Board

After mounting 20x20x15mm heat-sink on Orange Pi Zero (with 2 mm copper shim), USB Expansion Board was modified. Direction of 13 pin accessory header was changed, so that two boards could be mounted side by side, leaving space for the heat-sink. SMD TRRS connector was removed from USB Expansion Board and 2.54 mm header was used in its place. On board mic from USB Expansion board was removed and mounted in the front panel, so that talKKonnect can be used as intecom or conference device. A switch is used to select between internal mic and external radio microphone. IR receiver from USB Expansion Board was moved to the front panel for IR control of talKKonnect. You might also be able to find a use for TV out from the board.

5. Microphone

To add an external microphone to talKKonnect build, a very good low cost microphone from Baofeng can be used.

Baofeng microphone. Replace “Kenwood type” 3.5/ 2.5 mm jack with another, easier to work with, connector type

For convenience, just cut the “Kenwood type” microphone plug off and use RJ-45, RJ-11 or GX-16 / M-16 “aviation“ type connectors which are easier to work with for mounting against a box panel. Bringing 5V from Orange Pi Zero power source to microphone connector is not necessary, but you could possibly use it for a microphone preamplifier, if you find that your microphone electret capsule is not sensitive enough. To make a microphone more sensitive, you can try to widen the tiny hole in Baofeng microphone fron cover, or lower the value of microphone bias resistor R365 on the USB Expansion Board from 2K to 1.5K or 1K.

Microphone connector options: GX16, RJ-45 (8p8c), RJ-11/12 (6p6c), TRRS (3.5 mm) connectors

Using basic electronic skills and tools identify mic and PTT leads from Baofeng or other similar condenser microphone, then crimp or solder cable to your preferred microphone connector type for

a connection to your talKKonnect build. Use any pin map you prefer for the wiring, as long as you lead the correct wires to where they are supposed to go for microphone and PTT to work. PTT contacts from microphone must go to GPIO pins for talKKonnect PTT and microphone “plus” and “ground” to the sound card audio input. Baofeng speaker-microphone includes a small 0.25W speaker, which you can wire to “left” or “right” audio output from a sound card or leave it unconnected. Audio level coming to the speaker directly from a sound card will be very low. Use PAM8403 2x3W amplifier and a better speaker for higher quality sound. You could also connect 0.25W speaker to PAM8403 audio amplifier output if you must, it just won’t work very well.

You may need to modify bias resistors or capacitors on USB Expansion Board for external microphone to work.

For excellent introduction to Orange Pi Zero USB Expansion you can check an article from:

http://codelectron.com/intro-to-orange-pi-zero-interface-board

Orange Pi Zero USB Expansion Board modification for working with an external microphone

This is the schematic of onboard microphone connection in Orange Pi Zero USB expansion board. It’s microphone bias and filtering works flawlessly for onboard electret microphone to provide an excellent sound. However, if you want to use an external microphone, you can remove the onboard microphone to connect an external one or engineer a flip switch to choose between the two. In case of using external microphone with different bias and a minus pin of the mic electret capsule on the ground, you will notice a noise, unlike when using onboard microphone. To resolve a noise problem with the external microphone, we removed R364 and left a blob of solder in its place and C327 had been removed. Perhaps there will be different other workarounds that can be applied to this problem. If you are not planning to connect an external radio type microphone, no tweaks are necessary.

6. Audio Amplifier

You can use any audio amplifier. We recommend low cost D class 2x3W stereo amplifier PAM8403 on a board like this:

You just have to mount the board against your box front panel, connect to 5V power, bring input audio signal and connect the speakers. You need 2-3W speakers if you want to achieve a better quality of sound and for this you must provide sufficient DC power to the amplifier. This amplifier output does not share a common ground between the speakers. You can use just one speaker or two. It is important NOT to connect “minus” of the speakers together, neither to shorten the speaker output or it may lead to burning of the PAM8403 chip.

7. GPIO wiring

Pull-up resistors for GPIO button operation

When wiring the buttons in talKKonnect builds on Raspberry Pi, pull-up resistors are not required. Internal pull-up resistors in Raspberry Pi are sufficient for reliable button operation. However, Orange Pi’s are usually lacking internal pull-ups and for reliable button presses external pull-up resistors should be added to the buttons.

https://camo.githubusercontent.com/a67562ca21031ef3ede8961e6882d16bbb64c734/687474703a2f2f7777772e657370383236362d7365727665722e64652f4f72616e676550692f6461746569656e2f4f72616e67652d50692d5a65726f2d50696e6f75742e6a7067

Any GPIO pins can be used for input or output. This is just a recommendation.

We are encouraging you to make your own GPIO wiring plan based on the functionality of talKKonnect you consider essential for your particular use case.

You may be 1-2 GPIO pins short in Orange Pi Zero build to support all the functions in talKKonnect. Some of these functions are optional. Make up a mind what function you can live without (comment button, panic button, PTT toggle)? Orange Pi Zero has 3 tty UART connections. Serial connection can also be established over “g_serial” USB OTG connection. Some of the tty can perhaps be repurposed for input/ output GPIO.

If you are used to working with excellent WiringPi library from Gordon Henderson for testing and controlling GPIO in Raspberry Pi, to use it with Orange Pi you will need a modified Orange Pi H2/H3 version of WiringPi from here:

http://www.orangepi.org/Docs/WiringPi.html

or https://github.com/zhaolei/WiringOP

or https://github.com/xpertsavenue/WiringOP-Zero

or https://github.com/wdmomoxx/WiringOP-Zero

“gpio readall” command after installing WiringPi will print a GPIO map

8. DC Power

While you can power Orange Pi Zero over its micro USB port, we recommend that you power it directly over the main header connector, to minimize potential problems with a voltage drop in USB cable. Orange Pi Zero is picky about it’s power. Use a well filtered. good quality power supply. 12V power supplies are more commonly found from 5V and chances are you might just have some 12V / 2A or better power supply left from previous projects or an obsolete product. Then use a DC / DC step down converter to deliver 5V to Orange Pi.

12V to 5V – 5A / 25W Step down DC-DC  converter

You can add a simple thermal fuse or some reverse polarity protection to your Orange Pi Zero, if powered through a DC-DC adapter. Otherwise be careful about correct polarity and voltage level you are bringing to the board. Such mistakes can be only made once.

9. What else can you add to your parts shopping list for building talKKonnect?

Some suggestions

20 PCS 40 Pin 2.54mm Single Row Straight Male + Female Pin Header Strip VDY

20PCS 2.54mm 40 Pin Male Single Row Pin Header Strip GOOD QUALITY

Potentiometer Knobs

2.54mm 2×20 Pin Double Row Female Pin Headers

2.54mm 1×20 Pin Single Row Female Pin Headers

2.54mm 1×20 Pin Single Row Male Straight Pin Headers

RCA Audio Female Panel Connector

RCA Audio Male Connector

3.5 mm Stereo Female Panel Audio Connector

3.5 mm Stereo Male Audio Connector

4-8 Ohm, 2-3W Speaker

Momentary Push Buttons

Power Buttons

LED Lights

Resistors

Ribbon and other wires

Heat shrink various sizes

USB A Male Connectors

3Pcs Double Side Prototype PCB Board 40*60 mm 4*6 cm 1.6mm for Arduino DIY 1PCS Infrared IR Wireless Remote Control Module Kits for Arduino

USB A Female Connectors

Prototype PCB’s

PCB hex standoff screws / spacers. Nylon or metal Arduino type remote control

Wiring the talKKonnect device for rich options it is offering can take some time. There is no right or wrong way to wire your talKKonnect build. Use material on hand and just be creative as usual. Use shielded audio coax for making audio connections.

LED’s

Buttons

talKKonnect Orange Pi Zero Build Front Panel

talKKonnect Orange Pi Zero Build Back Panel

GPS Module u-blox  Neo-6M. talKKonnect can work with Traccar.

10. Sound Settings

Many new builders, first time encountering with Orange Pi’s, or Linux sound system might have an issue when trying to make audio output work or they experience audio “feedback” between microphone and speaker after playing with ALSA.

Audio outputs “Line out” and “DAC” both have to be unmuted first to get an audible sound. The easiest way to do this by pressing “M” to toggle muting/ unmuting in alsamixer ncurses utility program. alsamixer is a part of alsa-utils package, which should come preinstalled in Armbian OS. If you are missing it within your system, just install or reinstall alsa-utils package.

Call /usr/bin/alsamixer program. Mic1 has to be “captured”. This is done by pressing a “tab” key under “Mic1” control. We don’t want Mic1 to be “M” pressed or “unmuted”, unless we are just testing the mixer to monitor ourselves speaking… or it can obviously produce a noisy feedback. “M” key toggles muting and unmuting for audio device controls. This is sometimes useful for testing.

or the same picture once again…

For everything else, how to work around ALSA mixer settings, press F1 in alsamixer, it explains functions like F3, F4, F5, F6, etc.

You need to press F4 to be able to see the captured devices.

Mic2 is not working. It is not connected to SoC.

The only controls we care about are “Line Out”, “DAC”,”Mic1” and “Mic1 Boost”.

talKKonnect – Frequently Asked Questions

talKKonnect – Frequently Asked Questions…

Q: I am an experimenter getting ready to build talKKonect trying to make up my mind – what board to use? Should it be Raspberry Pi model 2B, 3B, 3B+, 4B, 3A+, Zero or other boards?

A: Any Raspberry Pi model from 2 to 4 can be used, depending on the availability and budget. talKKonnect performs well on Raspberry Pi 3B+. Orange Pi boards will work well too and possibly any other ARM boards. talKKonnect can run on x86 or x86-64 PC’s. talKKonnect can also be built as a virtual machine.

Q: Can Raspberry Pi Zero board be used for building talKKonnect?

Raspberry Pi Zero

Orange Pi Zero

A: Conditionally yes, but you are on your own to make it work above Raspbian Jessie. There are reasons why Raspberry Pi Zero, presently, is not such a good pick. Here are some of the reasons why not to use Raspberry Pi Zero, but if you think you can successfully resolve the challenge, by all means give it a try.

1. talKKonnect and talkiepi are based on Gumble, excellent work of Tim Cooper who did a truly revolutionary work to create Mumble client for Golang. Gumble and talKKonnect use 48 kHz audio sampling. This is very demanding for a single core ARMv6 CPU in Raspberry Pi Zero resulting with a nearly 100 % CPU utilization. Talkiepi use 16 kHz audio sampling.

2. Why dont we use a lower audio sampling in talKKonnect to decrease the CPU load then, like in talkiepi? Well, there are some unresolved issues remaining between gumble/ talkiepi/ talKKonnect clients and Plumble, (Mumble Android client) and to a smaller extent official Mumble client and they are affecting the audio quality. This results with sound breaking up between gumble/ talkiepi/ talKKonnect and Plumble/ Mumble clients if a lower than 48 kHz audio sampling is used. Audio won’t be breaking up if all your clients are gumble/ talkiepi/ talKKonnect. You can set them for any other Opus audio sample rate (8/12/16/24/48 kHz) and the quality between them will be near perfect. But if you operate Plumble and official Mumble in your channel, then use 48 kHz sound on gumble/ talkiepi/ talKKonnect side.

If all your Mumble clients in the channel are going to be based on Gumble, use Raspberry Pi Zero if you absolutely must and adjust audio sampling to your preference. You can change audio sample rate to lower the CPU utilization, as it had been done in talkiepi. To do this adjust audio sample rate in gumble audio.go file.

/home/talkkonnect/gocode/src/github.com/talkkonnect/gumble/gumble/audio.go

But keep in mind, a lower audio sample rate will almost certainly result with audio breaking up when talking to Plumble and official Mumble clients.

3. There is also another problem to overcome if building talKKonnect on Raspberry Pi Zero is attempted.

Mumble depends on OpenAl library for positional audio. OpenAl packages in Linux are built with Neon support. OpenAl audio won’t work with Raspberry Pi Zero, where ARMv6 processor does not have support for Neon extension. As a result OpenAl needs to be compiled from source without Neon support. You will find a workaround, OpenAl package compiled without Neon support in Daniel Chote‘s talkiepi project, but they were created for Raspbian Jessie and might work on Raspbian Stretch and Buster. If you build talKKonnect on older Raspbian Jessie and use Daniel Chote‘s OpenAl packages without Neon, both talkiepi and talKKonnect will work on Raspberry Pi Zero. But keep in mind, 48 kHz audio sampling in talKKonnect on Raspberry Pi Zero results with nearly 100 % CPU on transmission, and if you use 16 kHz sampling rate (from talkiepi) you will have audio breaking up problems when talking to Plumble and Mumble. This problem is not  yet resolved. Until the problem can be resolved, avoid Raspberry Pi Zero builds and enjoy using talKKonnect with Raspberry Pi 3B and above or other boards that perform much better.

Q: Can talKKonnect work on Orange Pi Zero?

A: Yes. Orange Pi Zero is a good alternative to Raspberry Pi Zero, offering many advantages.

Anyone already familiar with Raspbian and Raspberry Pi boards should not assume working with Orange Pi is identical. Plan some time for building a learning curve with Orange Pi boards and familiarization with Armbian OS.

Q: I would like to use a smaller board like Raspberry Pi Zero or Orange Pi Zero to create a portable device operated from battery. Is this possible?

A: Powering single board computers from a battery is certainly possible, but shutting down the system controllably and battery management are additional problems that you need to resolve. First, you need to be able to power off Raspbian or Armbian OS in a controllable way with a button when needed. On Raspbian you can use gpio-shutdown or gpio-poweroff overlays and do not need additional software.

To power up the system by button, depending on a board, you may need to explore what method to apply. Connecting the power to the board will usually start the booting. If the device is turned off, then battery should be cut-off from the board to prevent discharge during storage. Usually mosfets are used for this. Then to ensure a reasonable life of a battery, you should never allow battery, especially Li-ion to go completely flat. You need to constantly monitor battery state of charge or voltage and ensure the Linux system can be powered down before battery can go flat or fall bellow some level. Otherwise the battery life will be greatly diminished. For doing this you need ADC (analog to digital conversion) for such measurement to take place. Raspberry Pi or Orange Pi‘s do not have ADC inputs. But Arduino has. So you are looking at Arduino coding and a program that can manage the battery. If the battery is discharged, the same battery management system needs to ensure a battery can receive enough charge first before the battery power can be reconnected back to the device. In essence, you are looking at creating a controllable UPS for your build. Decide how you then manage the power while charging the battery or using battery charger and main power? Do you bypass the battery to deliver power to a device directly during battery charging? Can your type of a battery be charged and discharged at the same time and how will that affect power availability and battery life? There are a lot of questions to consider in designing a reliable and efficient UPS for Raspberry Pi like boards. There are many commercial UPS boards for them and some are better than other.

It is certainly possible to operate talKKonnect builds from Li-ion battery with an UPS controlled by micro-controller, maybe an Arduino. Building an Arduino UPS for talKKonnect might become a separate project.

Q: Can I use talKKonnect in a car instead of a conventional radio?

A: Yes. You can add a 3G/4G modem or use your smart phone as a portable Wifi hotspot for delivering the Internet connectivity to talKKonnect device on the road. Add a DC/DC converter from 12V to 5V and power talKKonnect from a cigarette lighter adapter. But bear in mind cigarette lighter adapter voltage is usually controlled with an ignition key. In order to prevent uncontrollable shut down of talKKonnect (Linux), you need to add a shutdown button to the device and / or power it through some sort of a UPS. If your mobile network provider has a footprint in the area where you will be driving to, you can expect a similar user experience to using a conventional mobile radio, only over IP network, possibly with a much better coverage. There are other advantages in using talKKonnect compared to conventional radios.

Q: I heard talKKonnect can be used as Radio over IP gateway? How is this working?

A: Yes, talKKonnect can be used for creating a bridge between IP network and radio-network. You can link up two radio repeaters in a radio-network over the Internet. Or you can extend an existing radio-network to add more users with smart phones, tablets, PC’s, Raspberry Pi’s, thus creating a “hybrid” network consisted of conventional radios and IP devices. To turn talKKonnect into a radio gateway, you need a “donor” radio from the radio-network where you will be connecting to. You will need to connect and adjust audio input/ output between talKKonnect and donor radio. talKKonnect will provide an activation signal from Mumble channel for radio PTT to be triggered. Radio needs to provide COS/ COR (Carrier Operated Switch / Carrier Operated Relay) – busy signal from radio network for talKKonnect PTT control. You will have to create an interface from a few transistors, opto-couplers, relays or other electronic components to manage these signals. If you are an experimenter from a HAM radio community you will find this easy to do. Low cost Baofeng radios are easy to modify for gaining access to a COS signal. Many amateur radio operators have been building their own radios with NiceRF od Dorji radio boards lately where it’s easy to engineer a COS signal from a squelch pin. If you are looking to create a radio-gateway with commercial Motorola radios, analog, DMR, P25 or other commercial radios like Kenwood or ICOM, then you should explore options for getting a COS signal from them. Motorola base stations will usually have an “accessory” connector with microphone input, audio output, PTT pins and some of the additional pins are programmable through CPS (Customer Programming Software) for “high” or “low” level, on certain conditions. One of such pins should be programmed “high” when the radio channel is busy. Motorola portable radios do not have this option. You can try to use VOX (voice activation) in the radio or engineer your own VOX circuit, but it is difficult to ensure a proper operation of gateway every time with VOX. Use VOX only if you are absolutely not able to engineer a reliable COS signal in the first place.

Q: Can I use talKKonnect as a GPS tracker?

A: Yes. talKKonnect can work with Traccar server. talKKonnect acts as a Traccar client. You will need to build a Traccar server. talKKonnect can use low cost GPS / GNSS modules from Neo Switzerland, like Neo-6M, Neo-7M, Neo-M8, VK-172 or almost any other GPS module supported in Linux and working over UART.

GPS Reciever Ublox NEO-6M MOD35 - Faranux Electronics

Neo-6M

Neo-7M

Neo-M8

VK-172

Q: Do I need to use pull-up resistors for GPIO buttons?

A: Pull-up resistors are not needed for Raspberry Pi build. They are required for Orange Pi builds. Try something like this:

 

Q: I built talKKonnect on Raspberry Pi but my audio is noisy with a lot of hum. What can I do to fix this problem?

A: Check filtration in the power supply. Use shielded cable for audio connections.

 

 

Martin Builds talkkonnect

Martin from Germany builds talkkonnect using a custom 3D printed box. Pictures below.

3D Design of talkkonnect housing
Top View talkkonnect with OLED Screen

Recording Function

talKKonnect Audio Recording Function…

talKKonnect framework has an audio recording function. With this function you can record the incoming Mumble channel traffic, sound from microphone input, or both at the same time. To accomplish this, talKKonnect is working together with SoX sound processing program.

SoX is an amazing sound processing package that talKKonnect is calling for audio recording.

You can save the recorded audio files on your Single Board Computer SD card, but preferably you should mount a more durable external media device and use it for recording, in order to minimize wear and tear on a highly imperfect SD card technology.

Assuming you mastered the fundamentals of working with talKKonnect framework so far, here is what you need to do to add audio recording function to talKKonnect.

1. Install SoX Package

apt-get update

apt-get install sox libsox-fmt-mp3 mpg321

2. Load snd-aloop ALSA Loopback Module

In it’s basic configuration talKKonnect is using a very simple ALSA config. Only one program has access to ALSA audio system at one time. ALSA stands for Advanced Linux Sound Architecture (ALSA). It is a basic sound system in Linux. You could also use PulseAudio to have multiple programs access audio hardware simultaneously, if needed. Before working with PulseAudio, you will need to dedicate some time to building a learning curve for working with more complex sound system. talKKonnect may support working with PulseAudio, as it keeps developing. At this time, we recommend working with more simple ALSA sound system in talKKonnect, for less “moving parts” and lower complexity.

2.1 Load Loopback Kernel Module

Check if snd-aloop kernel module is installed and loading correctly.

modprobe snd-aloop

Check if snd_aloop is listed as loaded.

lsmod | grep snd_aloop

Module snd_aloop should be reported as loaded, among other modules.

snd_aloop 24576 1

snd_pcm 102400 2 snd_usb_audio,snd_aloop

snd 73728 12 snd_hwdep,snd_usb_audio,snd_timer,snd_rawmidi,snd_usbmidi_lib,snd_seq_device,snd_aloop,snd_pcm

In order to start snd-aloop module on reboot, add a line to /etc/modules file.

echo 'snd-aloop' >> /etc/modules

Another option is to load snd_aloop from within /etc/rc.local or create a configuration file in /etc/modprobe.d .

3. Create ALSA Config File

We are going to need to use ALSA plugins to create virtual audio devices to give both talKKonnect and SoX access to ALSA sound system. talKKonnect will access the default audio device directly and SoX will record audio from a loopback. There will also be a “snoop” device created, so that SoX can use a microphone simultaneously with talKKonnect and “dmix” device to allow playing of audio, if needed from other programs (to play the recorded audio files).

Copy to your home directory .asoundrc config file, with all the appropriate plug devices defined or the config fine tuned for your application.

File can look like this,

# dmix multi ALSA config for talKKonnect
# Requires snd-aloop module loaded
# record from hw:Loopback,1,0 as loopback output
# capture to device dsnoop or plug:dsnoop
# Other programs play to device plug:dmixer

ctl.!default { # default control; alsamixer will use this
type hw
card 1
}

pcm.usbsound { # the usual usb sound card
type hw
card 1
}

# software mixer for sound card
pcm.dmixer {
type dmix
ipc_key 1024
ipc_perm 0666 # allow other users
slave.pcm "usbsound"
slave {
period_time 0
period_size 1024
buffer_size 4096
rate 48000
channels 2 # must match bindings
}

bindings {
0 0
1 1
}
}

# software mixer for loopback device
pcm.dmixerloop {
type dmix
ipc_key 2048
ipc_perm 0666 # allow other users
slave.pcm "hw:Loopback,0,0"
slave {
period_time 0
period_size 1024
buffer_size 4096
rate 48000
channels 2 # must match bindings
}

bindings {
0 0
1 1
}
}



pcm.!default {
type asym
playback.pcm "out"
capture.pcm "dsnooper"
}

# Multi, splitting between usb soundcard and loopback
pcm.out {
type plug
slave.pcm {
type multi
slaves {
a { channels 2 pcm "dmixer" }
b { channels 2 pcm "dmixerloop" }
}

bindings {
0 { slave a channel 0 }
1 { slave a channel 1 }
2 { slave b channel 0 }
3 { slave b channel 1 }
}
}

ttable [
[ 1 0 1 0 ] # left -> a.left, b.left
[ 0 1 0 1 ] # right -> a.right, b.right
]
}

How does it work? talKKonnect will use a default sound device. SoX will record Mumble traffic from hw:Loopback,1,0 output. dsnoop or plug:dsnooper ALSA plug will be used to capture microphone input. Any other programs can play audio to a device plug:dmixer .

Instead of creating a local .asoundrc file you could also define ALSA plugs in /usr/share/alsa/alsa.conf file instead.

To find more information on ALSA and it’s many possibilities, you can check:

ALSA unofficial Wiki or ALSA Project site wiki .

If you are already used to working with Jack daemon and PulseAudio, you can easily make audio recording work through them, instead of using ALSA loopback and plugins.

4. Audio Recording Options

Specify your audio recording options in talkkonnect.xml, a configuration file for talKKonnect.

audiorecordfunction enabled
true | false
Enable audio recording function
recordonstart
true | false
Start audio recording immediately on talkkonnect launch
recordmode
traffic | ambient | combo
Record Mumble traffic (traffic), Ambient sounds from Mic (ambient), or both (combo)
recordtimeout
(seconds) Record incoming traffic timeout (seconds). “0” for continous recording
recordfromoutput
Example:

hw:Loopback,1,0
Name of the audio output device. It could be Loopback, monitor, ALSA plug, pulse, source from Jack. Depends on the exact sound system config
recordfrominput
Example:

plug:dsnooper
Device name for audio input (Microphone). Depends on the exact sound config, dsnoop, plug:dsnooper, plughw:1,0, etc
recordmictimeout
(seconds) When to stop secording from microphone (seconds). “0” for Continous
recordsoft
sox
External audio software: /usr/bin/sox, arecord, ffmpeg, other
recordsavepath
path to recording directory. Example:

/avrec/audio
Where to save the recorded audio files
recordarchivepath
path to archive directory. Example:

/avrec/archive/audio
Where to archive the recorded audio files
recordprofile
standard |

vox-trimsilence |

vox-trimsilence-

chunks | chunks
Recording mode. Just record (standard); With Vox and trimming silence (vox-trimsilence); With Vox, trimming silence and file chunks (vox-trimsilence-chunks); With file chunks (chunks).
recordfileformat
mp3 | wav
Recording format (wav, mp3, ogg, etc)
recordchunksize
(seconds) Size of audio file chunks in seconds

5. Audio Recording Config Example

Audio recording segment of talKKonnect configuration file talkkonnect.xml can look like this.

<audiorecordfunction enabled="true">
<recordonstart>true</recordonstart>
<recordmode>traffic</recordmode>
<recordtimeout>0</recordtimeout>
<recordfromoutput>hw:Loopback,1,0</recordfromoutput>
<recordfrominput>plug:dsnooper</recordfrominput>
<recordmictimeout>0</recordmictimeout>
<recordsoft>sox</recordsoft>
<recordsavepath>/avrec/audio</recordsavepath>
<recordarchivepath>/avrec/archive/audio</recordarchivepath>
<recordprofile>standard</recordprofile>
<recordfileformat>mp3</recordfileformat>
<recordchunksize></recordchunksize>
</audiorecordfunction>


How does it work?

In this example, recording of Mumble traffic will start immediately upon talKKonnect launch. Recording will be continuous, with no time out. SoX program does the recording. Audio files will be saved to /avrec/audio folder. On new audio recording start, any old audio files, if any were previously recorded, will be archived to /avrec/archive/audio folder.

A USB stick or other external media can be mounted, in order to minimize wear and tear on SD card. If USB stick is identified as /dev/sda in the system, format it with ext3 or ext4 file system

mkfs.ext4 /dev/sda

Optionally, format USB stick with FAT32 or NTFS if you want to read the files later on a Windows computer.

Then mount it,

mkdir /avrec

mount /dev/sda /avrec

“Standard” recording mode means – just record without any additional SoX options like voice activation, trimming the silence or breaking the recording to audio chunks. Audio format will be mp3.

To save disk space, useful option can be recording with voice activation and silence trimming.

<recordprofile>vox-trimsilence</recordprofile>

For better file management, recordings can also be broken to “chunks”. For voice activated recording, silence trimming and breaking file to chunks select an appropriate SoX recording mode.

<recordprofile>vox-trimsilence-chunks</recordprofile>

Chunk size is defined in seconds. For 10 minute chunks,

<recordchunksize>600</recordchunksize>

Note: If using a “combo” recording mode where SoX is mixing the recording from Loopback (Mumble traffic) and dsnoop (microphone) to the same file, an audio sampling rate for OpenAl and ALSA needs to be identical. If sampling rate for recording device in ALSA is set to 48000 Hz, then sampling rate in

/etc/openal/alsoft.conf

should be set to the same value,

frequency = 48000

in order to prevent potential rate conversion problems.

If you want to play the recorded mp3 files, you can use mpg321. But specify that you want to play to plug:dmixer device.

mpg321 --audiodevice plug:dmixer /avrec/audio/<filename>.mp3

6. Audio Recording Keyboard Shortcuts

talKKonnect keyboard shortcuts for recording (if not starting automatically) are:

Ctrl-I => Traffic Recording

Ctrl-J => Ambient (Mic) Recording

Ctrl-K => Combo Recording (Traffic and Mic)