Audio system

Long time no see! I have been busy (surprise!).
I am thinking about what the ideal audio system is for me. I want to have music in most rooms, but I don’t have much space and my budget is tight. Good thing that is it cheaper to DIY.

I want something with the same functionality as the very popular SONOS audio system, but more customizable and of course, better sounding. The plan (which is in the works) is right now:

  • Raspberry Pi 1 or 2 B for streaming with Volumio or RuneAudio software.
  • In rooms with just this audio source: HiFiBerry Amp+ or Pi-DigiAMP+ HAT (Hardware Attached on Top) which connects to the i2s on the RPi. Direct output to speaker(s).
  • In rooms with multiple audio sources: Some sort of amplifier with multiple inputs. To connect a RPi to this I can use the HiFiBerry Digi+ HAT which has toslink s/pdif output.
  • The reasons for using these i2s boards is to get better sound quality. The built in sound output on the RPi is not very good, and many users have reported issues with USB soundcards.

I need to find suitable speakers and amplifier for living room. I would like multi-room support so I can play the same music in all rooms, but I think you can do that in Volumio.. version 2 is in development, wonder when that is out?

All input welcome

Wireless working

So I had a great deal of problems with an USB wifi adapter for the Raspberry Pi that I bought on It just wasn’t stable.

Yesterday I got another USB wifi adapter, the Edimax EW-7811Un. It works great, I can recommend it. So I now had the hardware to try out prototype #2 for my R/C car.

Right now I have my Raspberry Pi powered by a USB battery pack. It runs alright but I’m not sure how much time I will get from a full charge. Then the Arduino is plugged into one USB port on the RPi, and the Edimax adapter in the other port. A 3-cell LiPo battery (mentioned before) gives power to the H-bridge and I ended up using the switch mode adapter to get 5V for the servo, as I had problems with it drawing too much current from the Arduino board and thus resetting it, sometimes just once, sometimes many times after each other.

On the RPi I have installed: nginx, uwsgi and Flask. These make my webserver. I followed one of many guides on the web to get those 3 to work together – it took hours to figure out because my linux skills are limited at best.

Here is my python code for Flask:

from flask import Flask, render_template, request, url_for
app = Flask(__name__)
import serial

def do(action):
    port = serial.Serial("/dev/serial/by-id/usb-Arduino__www.arduino.cc__0043_5533033393035131C012-if00", baudrate=9600, timeout=3.0)

@app.route("/", methods=['POST', 'GET'])
def hello():
    if request.method == 'POST':
	return "OK"
    	return render_template('index.html')

if __name__ == "__main__":'', port=8080)

I used this long path for serial control instead of simply “/dev/ttyACM0” because it would sometimes change to “/dev/ttyACM1” and then I had to change the code every time. I didn’t have that problem with this path, so I am guessing it won’t change.

This is index.html:

<!doctype html>
<title>Hello from Flask</title>

function sendAction(action)
xmlhttp=new XMLHttpRequest();“POST”, “/”,true);
xmlhttp.send(“action=” + action);

<link rel=”stylesheet” type=”text/css” href=”static/style.css”/>

<h1>Hello World!</h1>

<div id=”buttons”>
<div id=”upleft”>
<input type=”image” onClick=”sendAction(‘M,50,S,-25’)” src=”static/upleft.gif” />
<div id=”upup”>
<input type=”image” onClick=”sendAction(‘M,100,S,0’)” src=”static/upup.gif” />
<div id=”upright”>
<input type=”image” onClick=”sendAction(‘M,50,S,25’)” src=”static/upright.gif” />
<div id=”up”>
<input type=”image” onClick=”sendAction(‘M,50,S,0’)” src=”static/up.gif” />
<div id=”stop”>
<input type=”image” onClick=”sendAction(‘M,0,S,0’)” src=”static/stop.gif” />
<div id=”down”>
<input type=”image” onClick=”sendAction(‘M,-50,S,0’)” src=”static/down.gif” />
<div id=”downleft”>
<input type=”image” onClick=”sendAction(‘M,-50,S,-25’)” src=”static/downleft.gif” />
<div id=”downdown”>
<input type=”image” onClick=”sendAction(‘M,-100,S,0’)” src=”static/downdown.gif” />
<div id=”downright”>
<input type=”image” onClick=”sendAction(‘M,-50,S,25’)” src=”static/downright.gif” />


So for each button I have a div so I can control its position with css. I am using AJAX to send the request to python without having to reload the page each time I push one of the buttons.

I remapped the serial commands, so instead of full speed being “M,255,S,0” it is now “M,100,S,0”. Seems more logical.

The css file:











As you can see, most of the buttons didn’t need to be positioned. The page now looked like this:


Pushing any of the buttons will send a POST request which will be handled by the python script and sent by serial connection to the Arduino. It worked alright until it suddenly wouldn’t run in reverse, so I sadly didn’t get to record any videos of it functioning.

IMG_20140913_135943 IMG_20140913_135950

It seems I broke my H-bridge. I don’t really know how, but I know that I won’t make another myself! I will keep it as an artifact (hmm maybe frame it? lol) and buy an IC for the project instead.

Some nice people on the subreddit /r/arduino recommended for me to add some diodes for the current to flow back from the motors to the battery, when the motors are turned off, to prevent the current from going through the transistors the wrong way. I did actually do that. So I am truly puzzled.

I guess I will also have to move away from the lunchbox as platform, and the straw and cardboard solution. Any ideas? Comments are more than welcome.


See ya