Webradio

Download a RPI image, in this case, I choose : pipaOS A lighweight, fast, Raspbian based distro for the Raspberry PI

Once the image unziped, copy to a fresh high performance micro SD card

sudo dd bs=4M if=./pipaos-tamarillo-4.7.img of=/dev/mmcblk0

in order to boost performances, I use a Samsung EVO+ for high performance for a very fast boot

 

ssh sysop@192.168.1.84 (password posys)

Connect to WIFI network

Rpi 3 rev B and Zero W have integrated wifi

Edit WIFI credentials

The file  /etc/network/interfaces should NOT be modified, as it’s overwritten at start.

Edit the file

sudo nano /boot/network.ini

To add your credential:

#
 # interfaces - setup your networking devices here
 #

auto lo
 iface lo inet loopback

allow-hotplug eth0
 iface eth0 inet dhcp

allow-hotplug usb0
 iface usb0 inet dhcp

# pipaOS Will automatically try to connect
 # to wireless ESSID "pipaos" passphrase "pipa123pass"
 allow-hotplug wlan0
 iface wlan0 inet dhcp
 wpa-ssid YOUR_SSSID
 wpa-psk YOUR_WIFI_KEY

High quality sound

Rasberry Pi have 3.5mm stereo jack output but the quality is pure crap, wondering why they even bother populate a jack.

So lets connect a cheap UBS sound card and check what appends

dmesg

sould display something like

[ 106.865142] usb 1-1.2: new full-speed USB device number 5 using dwc_otg
 [ 107.006372] usb 1-1.2: New USB device found, idVendor=0d8c, idProduct=0102
 [ 107.006387] usb 1-1.2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
 [ 107.006395] usb 1-1.2: Product: USB Sound Device

[ 107.042816] input: USB Sound Device as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.3/0003:0D8C:0102.0002/input/input1
 [ 107.105630] hid-generic 0003:0D8C:0102.0002: input,hidraw0: USB HID v1.00 Device [USB Sound Device ] on usb-3f980000.usb-1.2/input3

and

lsusb

will output:

 Bus 002 Device 009: ID 0d8c:0102 C-Media Electronics, Inc. CM106 Like Sound Device
 Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

Create startup service : webradio

sudo apt-get install mplayer
mplayer `curl -w "%{url_effective}\n" -I -L -s -S http://direct.fipradio.fr/live/fip-midfi.mp3 -o /dev/null`

Webradio player script

create non returning script:

sudo nano /home/sysop/webradio.sh
while true
 do mplayer http://chai5she.cdn.dvmr.fr:80/fip-midfi.mp3
 sleep 1
 done

create init.d service: webradio

#!/bin/bash
 #webradio daemon
 # chkconfig: 345 20 80
 # description: mwebradioapp daemon
 # processname:webradio

DAEMON_PATH="/"

DAEMON=/home/sysop/webradio.sh
 DAEMONOPTS=""

NAME=myapp
 DESC="My daemon description"
 PIDFILE=/var/run/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME

case "$1" in
 start)
 printf "%-50s" "Starting $NAME..."
 cd $DAEMON_PATH
 PID=`$DAEMON $DAEMONOPTS > /dev/null 2>&1 & echo $!`
 #echo "Saving PID" $PID " to " $PIDFILE
 if [ -z $PID ]; then
 printf "%s\n" "Fail"
 else
 echo $PID > $PIDFILE
 printf "%s\n" "Ok"
 fi
 ;;
 status)
 printf "%-50s" "Checking $NAME..."
 if [ -f $PIDFILE ]; then
 PID=`cat $PIDFILE`
 if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then
 printf "%s\n" "Process dead but pidfile exists"
 else
 echo "Running"
 fi
 else
 printf "%s\n" "Service not running"
 fi

Install startup service

update-rc.d webradio defaults

Start service manually

sudo service webradio start

Check startup time and performance

Startup time with RPI 3 B: Startup finished in 2.602s (kernel) + 4.386s (userspace) = 6.988s

Not bad at all for a full featured computer with wifi and usb audio

Plastic part surface finish: please stop making mirror products

They are simply dust, fingerprint and scratch magnet, everything is summarised in the amazing book The Hardware Hacker: Adventures in Making and Breaking Hardware from Andrew ‘bunnie’ Huang

“My world is full of small frustrations like this. For example, most customers perceive plastics with a mirror finish to be of a higher quality than those with a satin finish. There is no functional difference between the two plastics’ structural performance, but making something with a mirror finish takes a lot more effort. The injection-molding tools must be pains-takingly and meticulously polished, and at every step in the factory, workers must wear white gloves. Mountains of plastic are scrapped for hairline defects, and extra films of plastic are placed over mirror surfaces to protect them during shipping. For all that effort, for all that waste, what’s the first thing users do? They put their dirty fingerprints all over the mirror finish. Within a minute of a product coming out of the box, all that effort is undone. Or worse yet, the user leaves the protective film on, resulting in a net worse cosmetic effect than a satin finish. Contrast this to satin-finished plastic. Satin finishes don’t require protective films, are easier for workers and users to handle, last longer, and have much better yields. In the user’s hands, they hide small scratches, fingerprints, and bits of dust. Arguably, the satin finish offers a better long-term customer experience than the mirror finish. But that mirror finish sure does look pretty in photographs and showroom displays!”

Linux/Ubuntu: Speaking clock with online TTS

As a followup of my previous article:

Ubuntu: talking clock every hours

4 years after the previous article, I still need this tool, but I wanted a more “natural” TTS.

So I’m using Voxygen, a natural TTS provider (very good for French), retrieving the generated voice with wget and the following command:

wget --quiet --no-check-certificate -O /tmp/clock_`date +\%-1H`.mp3 "https://www.voxygen.fr/sites/all/modules/voxygen_voices/assets/proxy/index.php?method=redirect&text=il est exactement `date +\%-1H` heures.&voice=Loic"

Here is the script to run every hours:

if [ ! -e /tmp/clock_`date +\%-1H`.mp3 ]; then wget --quiet --no-check-certificate -O /tmp/clock_`date +\%-1H`.mp3 "https://www.voxygen.fr/sites/all/modules/voxygen_voices/assets/proxy/index.php?method=redirect&text=il est exactement `date +\%-1H` heures.&voice=Loic"; fi ; mpg321 /tmp/clock_`date +\%-1H`.mp3 --gain 200

We will be using gnome schedule taks:

screenshot-from-2017-01-05-100935

Portable soldering fumes extractor fan DIY (battery operated and USB rechargeable)

Here is a very simple fume extractor fan, to put an halt to apnea soldering.

Made of:

  • DC/DC buck boost converter (3€ on ebay)
  • USB battery pack 5€
  • scrapped fan
  • scrapped switch
  • scrapped potentiometer
  • Hammond prototype case (1€, same as my USB motion sensor)
  • nice labels
  • double side tape

Enough talk, a picture:

And in action, can suck up to 15cm at medium speed:

This “hack” took me 30min, and costs close to nothing, while some have been down to build a DC/DC converter for this!

Thing to add in the future:

  • active carbon filter for better filtering, but usable as is for small jobs: you don’t get fumes in your face anymore.
  • USB light for soldering in the dark

My favourite use: in the freezer/fridge, when you forgot to chill beers for an unexpeted party, it takes only 10min to have freezing beer instead of 1h. (remove the carbon filter first…)

Mes trouvailles du jour : 6 July 2016

  • A Parent’s Guide Chapter 5: Teaching Adolescents: from Twelve to Eighteen Years
    Ce qui est merveilleux avec le cerveau humain, c’est qu’on peut arriver à des conclusions diamétralement opposées sans aucune difficulté…

    "Teach your children that the prophets have condemned it as a sin throughout the ages and that they can choose not to do it."

    "The sin of masturbation occurs when a person stimulates his or her own sex organs for the purpose of sexual arousal. It is a perversion of the body’s passions. When we pervert these passions and intentionally use them for selfish, immoral purposes, we become carnal."

    "Your teenagers will also be tempted to have sexual relations with others before they are married."
    (Permalink)