element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Upcycle It
  • Challenges & Projects
  • Design Challenges
  • Upcycle It
  • More
  • Cancel
Upcycle It
Blog [Upcycle It] Nixie Display #12 - Making the display speak
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: gpolder
  • Date Created: 29 May 2017 8:15 PM Date Created
  • Views 2200 views
  • Likes 8 likes
  • Comments 12 comments
  • bluetooth
  • upcycle_it
  • upcycleit
  • pulseaudio
  • Espeak
  • sound
  • nixie_tube
  • upcycled_nixie
  • intel edison
Related
Recommended

[Upcycle It] Nixie Display #12 - Making the display speak

gpolder
gpolder
29 May 2017

<< Previous

Blog IndexNext >>

Inspired on blog posts from my fellow challengers sakthi.1260, carmelito and Workshopshed, as well as mcb1 comment on my first blog:

When I saw the application, my first thought is how does someone know what the numbers represent ... they are numbers.

I'm sure as you progress that will be sorted.

I decided to let my display speak the different functions when changed with the button.

The problem mcb1 mentioned was already solved by the menu system and the one second function number display, but I decided it is much more fun to let the display speak for itself.

Another goal of my project is to keep the display as original as possible. Therefore I didn't like to add a loudspeaker, or even a connector to add one. In stead I decided to connect a wireless speaker over bluetooth.


Connecting the bluetooth speaker

Connecting the bluetooth speaker was not a big issue with the help of the intel documentation: https://software.intel.com/en-us/articles/play-audio-from-your-intel-edison-via-bluetooth-using-advanced-audio-distribut…

First we need to pair the device:

 

root@edison_nixie:~# rfkill unblock bluetooth

root@edison_nixie:~# bluetoothctl

[bluetooth]# scan on

 

[NEW] Controller 98:4F:EE:04:A7:E4 edison_nixie [default]

[NEW] Device 00:1D:DF:CD:2F:DB JBL Flip

[bluetooth]# pair 00:1D:DF:CD:2F:DB

[bluetooth]# quit

 

This needs to be done just once. Later each time we boot the Edison, the speaker needs to be connected again:

 

root@edison_nixie:~# rfkill unblock bluetooth

root@edison_nixie:~# bluetoothctl

[NEW] Controller 98:4F:EE:04:A7:E4 edison_nixie [default]

[NEW] Device 00:1D:DF:CD:2F:DB JBL Flip

[bluetooth]# connect 00:1D:DF:CD:2F:DB

Attempting to connect to 00:1D:DF:CD:2F:DB

[CHG] Device 00:1D:DF:CD:2F:DB Connected: yes

Connection successful

[JBL Flip]# quit

[DEL] Controller 98:4F:EE:04:A7:E4 edison_nixie [default]

root@edison_nixie:~# pactl list sinks

Sink #0

  State: SUSPENDED

  Name: alsa_output.platform-merr_dpcm_dummy.0.analog-stereo

  .....................

Sink #2

  State: SUSPENDED

  Name: bluez_sink.00_1D_DF_CD_2F_DB

  Description: JBL Flip

  ............................

root@edison_nixie:~# pactl set-default-sink bluez_sink.00_1D_DF_CD_2F_DB

 

And we are done. This gives a pulse audio connection to the speaker. Sound files can be played using:

 

root@edison_nixie:~# gst-launch-1.0 filesrc location= /home/root/sound.wav ! wavparse ! pulsesink

Setting pipeline to PAUSED ...

Pipeline is PREROLLING ...

Pipeline is PREROLLED ...

Setting pipeline to PLAYING ...

New clock: GstPulseSinkClock

Got EOS from element "pipeline0".

Execution ended after 0:00:00.919603573

Setting pipeline to PAUSED ...

Setting pipeline to READY ...

Setting pipeline to NULL ...

Freeing pipeline ...

root@edison_nixie:~#

 

Espeaking the functions

Then I installed espeak and also alsa-utils in order to speak the function names.

 

opkg install espeak

opkg install alsa-utils

 

Unfortunately espeak is based on port audio, while my bluetooth connection uses pulseaudio. So I didn't get any audio out when running:

espeak "Louder please!"

In stead of putting a lot of effort in getting speak to run with pulse audio, I decided to take a shortcut by making sound files for all my functions:

espeak --stdout "Time" > time.wav

espeak --stdout "Date" > date.wav

espeak --stdout "Temperature" > temperature.wav

espeak --stdout "Humidity" > humidity.wav

espeak --stdout "Pressure" > pressure.wav

espeak --stdout "Rain" > rain.wav

espeak --stdout "Views and likes" > viewsandlikes.wav

 

Node.js code

Finally playing the function names is added to the code. For this I downloaded the node-cmd module:

root@edison_nixie:~# npm install node-cmd

node-cmd@3.0.0 node_modules/node-cmd

root@edison_nixie:~#

 

Each time the button is released the edison will speak the selected function name:

 

var cmd=require('node-cmd');

   button.on("release", function () {
        speakFunction();
        setTimeout(function () {
            switch_function = false;
        }, 1000);
    });

 

SpeakFunction just calls the pulse audio play function with the appropriate sound file:

 

function speakFunction() {
        switch (display_function) {
            case 0:
                cmd.run('gst-launch-1.0 filesrc location= /home/root/time.wav ! wavparse ! pulsesink');
                break;
            case 1:
                cmd.run('gst-launch-1.0 filesrc location= /home/root/date.wav ! wavparse ! pulsesink');
                break;
            case 2:
                cmd.run('gst-launch-1.0 filesrc location= /home/root/temperature.wav ! wavparse ! pulsesink');
                break;
            case 3:
                cmd.run('gst-launch-1.0 filesrc location= /home/root/humidity.wav ! wavparse ! pulsesink');
                break;
            case 4:
                cmd.run('gst-launch-1.0 filesrc location= /home/root/pressure.wav ! wavparse ! pulsesink');
                break;
            case 5:
                cmd.run('gst-launch-1.0 filesrc location= /home/root/rain.wav ! wavparse ! pulsesink');
                break;
            case 6:
                cmd.run('gst-launch-1.0 filesrc location= /home/root/viewsandlikes.wav ! wavparse ! pulsesink');
                break;
        }
    }

 

Demonstration video

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

One more thing!

In order to automatically connect the speaker to the Edison at boot time, I wrote the following shell script:

 

#!/bin/sh  
rfkill unblock bluetooth  
sleep 1  
echo -e 'connect 00:1D:DF:CD:2F:DB\nquit' | bluetoothctl
sleep 1  
pactl set-default-sink bluez_sink.00_1D_DF_CD_2F_DB
gst-launch-1.0 filesrc location= /home/root/connected.wav ! wavparse ! pulsesink

 

Modified the execute permissions and made a connected sound file:

 

root@edison_nixie:~# chmod 755 startbtspeaker.sh

root@edison_nixie:~# espeak --stdout "Bluetooth speaker connected!" > connected.wav

 

And finally installed it as system service:

 

#!/bin/sh  
[Unit]  
Description=Sets up the Edison's Bluetooth interface and connects it to a paired device.  
[Service]  
ExecStart=/home/root/startbtspeaker.sh  
Type=idle  
[Install]  
WantedBy=basic.target 

 

Put the file above in /lib/systemd/system/startbt.service and:

systemctl enable startbt.service

 

Now each time the display is turned on, the speaker assuming it is on will be connected and "Bluetooth speaker connected!" is spoken.

 

Thats it for now, stay tuned for the wrap up later this week!

  • Sign in to reply

Top Comments

  • gpolder
    gpolder over 8 years ago in reply to Workshopshed +2
    gst-launch is part of gstreamer ( https://gstreamer.freedesktop.org/ ), which is used to play sound using pulseaudio. I got the pointer from https://software.intel.com/en-us/articles/play-audio-from-your…
  • mcb1
    mcb1 over 8 years ago +2
    I decided to let my display speak the different functions when changed with the button. You cheated ... Well done, elegant solution to one of the issues I wondered about from Day1. I can still see the…
  • balearicdynamics
    balearicdynamics over 8 years ago +2
    I should add here to my #12 comment: thank to *** project and the detailed stapes I had the opportunity to know better the small board. And I should specially thank you the script for self-connecting to…
Parents
  • Workshopshed
    Workshopshed over 8 years ago

    Very nice add-on it works well. What is the gst-launch command, I've not seen that one before?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • Workshopshed
    Workshopshed over 8 years ago

    Very nice add-on it works well. What is the gst-launch command, I've not seen that one before?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • gpolder
    gpolder over 8 years ago in reply to Workshopshed

    gst-launch is part of gstreamer (https://gstreamer.freedesktop.org/ ), which is used to play sound using pulseaudio.

    I got the pointer from https://software.intel.com/en-us/articles/play-audio-from-your-intel-edison-via-bluetooth-using-advanced-audio-distribut… .

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • nandohila
    nandohila over 8 years ago in reply to gpolder

    This is cool!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube