Random news reader on Linkit 7688

Using the MediaTek Linkit smart 7688, we will be building a simple news reader application. A USB sound card and IR proximity sensor will be connected to the Linkit smart. The IR proximity sensor will be used to trigger the system for fetching RSS feed from one of the 5 pre defined RSS links and using"eSpeak", the incoming text is converted to speech and spoken through the speakers connected to the USB sound card.

Step by Step Introduction

Introduction

RSS stands for"Really simple syndication". This is a web technology that provides a really simple way of collecting frequently changing data such as the news, stock prices etc...

In this recipe, we will be building a simple RSS news reader using the awesome Linkit smart 7688. Linkit smart 7688 is a tiny compute module that brings in the versatility of the Linux (this one runs on Open wrt) combined with on board wifi and plenty of GPIOs in a small package at a price point that is very hard to resist.

For the TTS (text to speech synthesis) we will be using the eSpeak program. USB sound card will be used to provide the audio capabilities to 7688. The human machine interface part of this build is going to be an IR proximity sensor. This sensor will be used to trigger the news reading event.

Preparing the Linkit smart 7688

You need to put the Linkit in station mode where it can connect to the net refer to this link to put the 7688 in station mode and to connect to the Internet.

Once the Linkit smart 7688 is connected to the Internet, it might be difficult to get hold of the IP address of the Linkit smart 7688. One easy method could be to use your router's (that you use to connect to the Internet) control panel served at the IP address as assigned by the manufacturer of the router. In this interface you should find the DHCP client list. Here you can find all the leased out IP address and that should help you guess the IP address of the linkit (usually, it appears as"unknown client"in the list).

Below is the screen shot from my router's DHCP client list menu:

or you can use the serial port to gain access to the console and use"ifconfig"to get the IP address assigned to the board as listed here.

Once you know the IP address, use putty to gain access to the console over the SSH.

Then when login screen appears, enter"root"for user and for password, enter the password that you specified in the web UI while configuring the board for station mode while referring to the wiki entry.

opkg update

and install the kernel module for USB audio

opkg install kmod-usb-audio

Now connect the USB sound card via the USB host cable.

Enter the following command to list all the audio devices connected

aplay -l

You should see your USB sound card listed. Note down the card number, in below screen shot, it is 1. This will be used to tell the application what sound card to use. (The default sound card, card0, by the looks of it works on I2S codec IC, if connected to the Linkit smart, maybe would work, but is not connected by default and would not work and will cause the system to freeze if used)

Install the espeak program

opkg install espeak # This is the TTS

Install the required Python packages:

pip install feedparser # The RSS feed parserpip install cherrypy # Will be used to host a web page that let's you configure RSS links

Hardware connections

The hardware connections are quite simple. It involves only three external connections are to be made. The below picture depicts it:

pin on Linkit 7688 pin on IR proximity sensor

5v <----------------> Vcc

Gnd <----------------> Gnd

P10(GPIO2) <----------------> O/P

Connect the USB OTG cable to the USB port labeled"USB host"on Linkit 7688 and USB sound card to the OTG cable. Connect speakers to the sound out on the USB sound card.

Using the system

First, you need to get the project files from github. In the console, type following command:

In the console, type the following command to start the execution of the python script:

python App.py

It is very easy to use this system, just trigger the IR proximity sensor by bringing your hand in the proximity of the sensor. This should trigger the system to fetch the news and read it out.

To exit the application, press"ctrl+c"

Configuring the system

You can add up to 5 RSS links to be picked by the system when the IR sensor is triggered using the web interface provided. Point your browser to the Linkit 7688's IP address followed by":8181"(192.168.0.100:8181, for example). This should take you to following page:

Here you can specify the RSS links and say submit to set these links. You can lookout for RSS links that you are intrested in by doing a google search. For example, if you are interested in knowing world news from BBC, you might google"world news BBC RSS"click on the result and look out for RSS links. Usually, these links will be accompanied by this image:

Other configuration parameters are stored in the"config.py"file of the project. Here you can set the speed with which the text is spoken by specifying a numerical value for variable"TTS_SPEED". You can also set the sound card number that you discovered from the output of"aplay -l"in previous step. If the sound card is other than"1"by setting the variable"AUDIO_CARD_NUMBER"