Go Back   Home > Forums > > >
Home Forums Rules Articles diyAudio Store Blogs Gallery Wiki Register Donations FAQ Calendar Search Today's Posts Mark Forums Read

Twisted Pear Superior quality electronic kits

Thread Tools Search this Thread
Old 11th November 2015, 12:48 PM   #11
francolargo is offline francolargo  United States
diyAudio Member
Join Date: Mar 2007
Location: Twin Cities, MN
After sleeping on the question, I have changed my mind and will use the PCA9544 for the first attempt at DAC control. ...better to be able to write directly to the ES9018s because then all the registers are available for 'play'...
  Reply With Quote
Old 11th November 2015, 02:20 PM   #12
BrianDonegan is offline BrianDonegan  United States
diyAudio Member
BrianDonegan's Avatar
Join Date: Dec 2004
Location: TPA HQ (The Basement)
Control of BBB-based audio appliances
Originally Posted by smanz View Post
If you mount PCA9544 in Buffalo chassis, you only need two wires, SDA and SCL. You can obtain 3,3v Vdd from buffalo, and Vss is common ground between buffalo and clean side of hermes.

You will need a common ground as well.
  Reply With Quote
Old 11th November 2015, 07:42 PM   #13
francolargo is offline francolargo  United States
diyAudio Member
Join Date: Mar 2007
Location: Twin Cities, MN
Thanks Brian! I'll wire serial clock, serial data, and Hermes ground back to the Buffalo chassis - 1 meter of 24 ga solid ribbon wire. Ground will be shared with the BIII from which 3.3v is drawn. Add a 0.1 uF bypass cap just before the PCA9544?
  Reply With Quote
Old 13th November 2015, 03:16 AM   #14
francolargo is offline francolargo  United States
diyAudio Member
Join Date: Mar 2007
Location: Twin Cities, MN
I have been investigating the NetIO utility for iOS as a way to make custom remote controllers for the BBB. A TCP socket server in Python is published for the RPi. I am hopeful it will be not too much work to adapt this python server script from RPi to the BBB. I believe the BBB version will require that a port be opened and bound to the IP. ...but I have yet to maintain a connection to the iOS app.

Any thoughts on adapting the above-linked netIO server script to communicate with the BBB?
  Reply With Quote
Old 14th November 2015, 12:22 AM   #15
francolargo is offline francolargo  United States
diyAudio Member
Join Date: Mar 2007
Location: Twin Cities, MN
Default NetIO Remote Control - proof of concept

Notwithstanding how much work has already been done to make the BBB a stunning little audio renderer, I think significant potential remains untapped. Even if only in terms of flexibility and convenience. That's mostly what this thread is about. I am a noob with both Linux and Python. Undeterred, I just started hacking with the NetIO remote control application and the demo script that was written for RPi GPIO control. ...partial success! As I see it, the potential seems more than enough to continue developing this avenue to wirelessly and remotely control a BBB-based audio appliance.

What: NetIO is an iOS/Android app that can control smart digital hardware via a TCP or web interface from a smartphone or tablet. It can use either Python or Java server code, but it has been applied mostly to the RPi rather than the BBB. In addition to sending commands, the mobile device can display status messages from the remote server (the BBB).

Why: The app is very well conceived for flexibility, power, and convenience. In addition, the open-source Python server script can be customized to eliminate bloat - just run the code that is essential to your tasks.

A modest start adapting the server script to the BBB: OK, I have not gotten two-way communications working yet, just control from my iPad to the BBB. But the needed configuration for two-way can't be thaaat difficult, and the app developer supports a help forum. As mobile apps go, $9 is a bit pricey, but the amount of work in this system is significant and once 'we' have clean server modules running under Botic/BBB, it will literally take only minutes to construct a kick-butt remote.

The steps to make a remote are:
A) There is no free demo - buy the app.
B) Use the web based interface configuration tools to create the remote's screen. There are many widgets to choose from that include options for the properties and configuration parameters of your choosing. Save that to your account and...
C) Open the mobile app and synch your saved remote(s) to the device.
D) Program the server script on the BBB to respond appropriately on the various commands &/or interrupts.

My demo: From my iPad I asked the BBB to do three things using a simple button press - 1) control GPIO outputs on the BBB P8 header, 2) execute a shell script, and 3) write control values to an I2C slave. Piece of cake for all 3. The GPIO control was visible as an LED circuit turning on or off. The shell script was one of a few that I am writing to act as subroutines for the overall control of my audio appliance - it showed up on the terminal. The I2C slave device is a 5K digital potentiometer that I am playing with but ultimately will not use - I'll send I2C directly to each of my Buffalo boards. ...no matter - this is just proof of concept for the control app. The attached photos show a screen grab of the web-based UI designer, how the 2-button screen looks on my iPad, the 5K digipot on the breadboard, and the evidence that the Python server script in the BBB was executing correctly. Pretty fun for a couple hours of pure hacking.

The rough/unfinished server script adaptation: Again, this is the modified product of the NetIO developer, available online for use in the RPi. Your improvements & suggestions very much appreciated! You will want/need to install the Adafruit_BBIO.GPIO library, which makes working with the GPIO header much simpler. I will continue working with it and learning about this app and control system, and will post any significant advances here.

All the best,


#!/usr/bin/env python
# -*- coding: utf-8 -*-
import asyncore
import socket
import select
import Adafruit_BBIO.GPIO as GPIO
import time
import subprocess  # will be used in the future to call 'subroutine' scripts
import smbus

# misc. GPIO setup as needed to address pins
GPIO.setup("P8_19", GPIO.OUT)  # render problem?
GPIO.output("P8_19", GPIO.LOW)  # render problem? 
GPIO.setup("P8_18", GPIO.IN)  # render problem? 

# setup to test I2C control of digipot
bus = smbus.SMBus(1)
bus.write_byte_data(0x2e, 0x04, 0xff)
bus.write_byte_data(0x2e, 0x00, 0x00)

SWITCH1 = "P8_18"

class Client(asyncore.dispatcher_with_send):
    def __init__(self, socket=None, pollster=None):
        asyncore.dispatcher_with_send.__init__(self, socket)
        self.data = ''
        if pollster:
            self.pollster = pollster
            pollster.register(self, select.EPOLLIN)

    def handle_close(self):
        if self.pollster:

    def handle_read(self):
        receivedData = self.recv(8192)
        if not receivedData:
        receivedData = self.data + receivedData
        while '\n' in receivedData:
            line, receivedData = receivedData.split('\n',1)
        self.data = receivedData

    def handle_command(self, line):
        if line == 'LED1 on':
            # GPIO.output("P8_19", GPIO.HIGH)
            subprocess.call("./BBB_in.sh", shell=True)
            bus.write_byte_data(0x2e, 0x00, 0xff)
        elif line == 'LED1 off':
            GPIO.output("P8_19", GPIO.LOW)
            bus.write_byte_data(0x2e, 0x00, 0x00)
            print 'set led 1 off'
        elif line == 'get status':
      #      print 'Input Status:', GPIO.input(SWITCH1)
      #      if GPIO.output("P8_19", GPIO.HIGH):
      #          self.send('on\n')
      #          print 'Read GIOP 0 result On'
      #      else:
      #          print 'Read GIOP 0 result Off'
                # ende if
            self.send('unknown command\n')
            print 'Unknown command:', line

class Server(asyncore.dispatcher):
    def __init__(self, listen_to, pollster):
        self.pollster = pollster
        self.create_socket(socket.AF_INET, socket.SOCK_STREAM)

    def handle_accept(self):
        newSocket, address = self.accept()
        print "Connected from", address

def readwrite(obj, flags):
        if flags & select.EPOLLIN:
        if flags & select.EPOLLOUT:
        if flags & select.EPOLLPRI:
        if flags & (select.EPOLLHUP | select.EPOLLERR | select.POLLNVAL):
    except socket.error, e:
        if e.args[0] not in asyncore._DISCONNECTED:
    except asyncore._reraised_exceptions:

class EPoll(object):
    def __init__(self):
        self.epoll = select.epoll()
        self.fdmap = {}
    def register(self, obj, flags):
        fd = obj.fileno()
        self.epoll.register(fd, flags)
        self.fdmap[fd] = obj
    def unregister(self, obj):
        fd = obj.fileno()
        del self.fdmap[fd]
    def poll(self):
        evt = self.epoll.poll()
        for fd, flags in evt:
            yield self.fdmap[fd], flags

if __name__ == "__main__":
    pollster = EPoll()
    pollster.register(Server(("",8192),pollster), select.EPOLLIN)
    while True:
        evt = pollster.poll()
        for obj, flags in evt:
            readwrite(obj, flags)
Odd! Lines 12 and 14 are not reading correctly on my screen. Correct syntax inside parenthesis is: quote - pin number - quote - comma - space - GPIO - period - direction/value
Attached Images
File Type: jpg webapp.jpg (100.5 KB, 270 views)
File Type: jpg IMG_2640.jpg (443.5 KB, 259 views)
File Type: jpg breadboard.jpg (979.9 KB, 255 views)
File Type: jpg IMG_2643.jpg (581.4 KB, 245 views)

Last edited by francolargo; 14th November 2015 at 12:40 AM. Reason: errors in display of code
  Reply With Quote
Old 14th November 2015, 01:55 AM   #16
francolargo is offline francolargo  United States
diyAudio Member
Join Date: Mar 2007
Location: Twin Cities, MN
Yikes, don't copy the above code! The code is being altered by the 'code box'! Without the box the critical indentations are lost. If you want the script, PM me and I'll send it a different way.

Last edited by francolargo; 14th November 2015 at 02:02 AM.
  Reply With Quote
Old 15th November 2015, 10:19 PM   #17
francolargo is offline francolargo  United States
diyAudio Member
Join Date: Mar 2007
Location: Twin Cities, MN
Originally Posted by smanz View Post
Itīs easy. You can use this IC 4 Channel I2C Multiplexer
@smanz, thanks again for another great suggestion! Because I have to learn everything as I go, it seemed like too much trouble to multiplex the bus. But now I see it is an elegant solution and it is working perfectly with all 3 DACs at address 0x48. The PCA9544 is on the 5th board layer in this tightly organized chassis.

Because I have a separate BIIIse for the bass, midrange, and tweeter channels, it will be fun to experiment whether controlling the digital volume of each DAC sounds similar to old-style bass, mid, and treble preamp controls! ...much to do still on this project but it is all rewarding. When Botic 6 is released (thanks in advance for your continued work, Miero!) there will be even more fun in the area of implementing and controlling new sources for the BBB and the digital crossover that it runs.

Attached Images
File Type: jpg FullSizeRender.jpg (610.7 KB, 233 views)
  Reply With Quote
Old 17th November 2015, 03:46 AM   #18
francolargo is offline francolargo  United States
diyAudio Member
Join Date: Mar 2007
Location: Twin Cities, MN
Default Muting the s9018

Question for Miero or Brian or whomever:

I'm making progress with the NetIO controller programming. The volume slider in NetIO is nicely done!

In configuring an I2C mute function, is there any reason NOT to set bit one of register 10 (to cf)? It gives full silence, of course, and nicely returns to the original volume when returned to value ce. However, I don't recall reading that others have programmed that register in their controllers. Are there any 'unadvertised' disadvantages of truly muting vs. lowering the volume registers to 0? I want to be nice to these chips!


  Reply With Quote
Old 17th November 2015, 06:18 AM   #19
francolargo is offline francolargo  United States
diyAudio Member
Join Date: Mar 2007
Location: Twin Cities, MN
Here is a prototype wifi remote control for the BBB that I made in NetIO. It is on the same iPad that will control the music library. Most of it is proving easy to code, though the cute little 'Source Freq.' gauge will require some patience... And of course, the spdif input controls must await Botic 6.
Attached Images
File Type: png IMG_0283.PNG (132.5 KB, 134 views)

Last edited by francolargo; 17th November 2015 at 06:30 AM.
  Reply With Quote
Old 17th November 2015, 06:44 AM   #20
miero is offline miero  Czech Republic
diyAudio Member
Join Date: Jun 2011
Location: Prague
hi francolargo,

in botic6 with enabled i2c control of es9018 within kernel driver the dac will be muted (by using mute flag in that register) everytime unless it is playing or muted by user request. so it will be unmuted just before start of play and muted right after the end of playback.

but I have to figure out how to integrate control of multiple DACs into ALSA control system.
BeagleBone Black with I2S, DSD and SPDIF interface (Linux driver)
  Reply With Quote


Control of BBB-based audio appliancesHide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a volume control to a TPA3122-based audio kit i336 Class D 2 9th June 2015 06:50 AM
How do I use my appliances on a Furman PL8CE? Akins Equipment & Tools 21 20th May 2015 05:24 PM
Powering non-speaker appliances with an amp cspirou Everything Else 4 4th November 2014 10:34 AM
Household Appliances repair forum Tarzan Everything Else 7 22nd August 2012 07:54 PM
Transformer-based volume control wboyd Analogue Source 4 18th August 2004 04:57 PM

New To Site? Need Help?

All times are GMT. The time now is 04:57 AM.

Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 14.29%
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
Copyright ©1999-2019 diyAudio