Introduction: Random News Reader on the Linkit Smart 7688
Linkit smart 7688 is a tiny open source hardware Linux capable compute module that can be used in any of your IoT application from Seeed studio.
It is powered by the MT7688 which is based on the MIPS (MIPS24KEc) architecture.
The Linkit smart 7688 features wifi, SD card slot, some GPIOs, SPI, I2C, etc... and sports 32 MB flash and 128 MB RAM.
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 1: 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.
Following things will be required to complete this Instructbale:
Step 2: Preparing the Linkit Smart 7688
You need to put the Linkit in station mode where it can connect to the Internet 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).
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.
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
You should see your USB sound card listed.
Note down the card number, in the "aplay -l" 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 parser pip install cherrypy # Will be used to host a web page that let's you configure RSS links
Step 3: Hardware Connections
The hardware connections are quite simple. It involves only three external connections are to be made.
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.
Step 4: Using the System
First, you need to get the project files from github.
In the console, type following command:
git clone https://github.com/navin-bhaskar/NewsReader-on-Linkit7688.git cd NewsReader-on-Linkit7688/
In the console, type the following command to start the execution of the python script:
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"
Step 5: 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 page similar to one in the screenshot attached in this step.
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.
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".
You can use "vi" program to edit these parameters, like so:
Press 'i' to start editing and change any parameter that you wish to edit. Save changes and exit by hitting 'esc' key followed by ":wq"