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”.

3 Replies to “Tips for talKKonnect Building with Orange Pi Zero”

  1. Thanks for this guide. I wonder if you could explain how to get GPIO working for a non root user. I’ve installed with a user of ‘talkkonnect’. If I run as root then GPIO works. If I run as non root
    user I get the error ‘GPIO Error, open /dev/gpiomem: no such file or directory’ and the GPIO doesn’t work.

    I’m also having an odd audio issue when I stop transmitting. It’s hard to describe so I’ve posted a video here https://youtu.be/MoMy-pNLUXk . The music is being sent via another computer onto the mumble system. You can hear the issue after stopping transmitting.

  2. Rob,

    – please check Armbian forum, “GPIO access from user space”:
    https://forum.armbian.com/topic/1886-gpio-access-from-user-space

    – Are you stopping the other station stream when you transmit with your talkkonnect? There is an option in talkkonnect.xml to enable canceling of the other station stream with your PTT. For this to work, in the unit doing the streaming, you need to set: “cancellablestream” to true.

    1. Thanks for that. I’d already been through that forum topic. I’ve just tried changing the permissions on /sys/devices/platform/soc/1c2000-pinctrl/gpio too and that hasn’t helped.

      I’m not stopping the other stream (don’t really want to for this use case) and can’t find that option on the transmitting unit (currently using mumble.app on a Mac) but I have the same issue if the other device isn’t transmitting. i.e. if there’s nothing on the network and I connect the talkkonnect device, tell it to transmit, then stop transmitting, anything else that appears on the mumble network sounds broken up and pitch shifted.

Leave a Reply

Your email address will not be published. Required fields are marked *