Update: March 22, 2018
This post is just like a ubiquitous YouTube "mailbag" video only without a video feed and without a sound track. In the space of a few days, I have received, from far, far away, five 8G micro SD cards, two ReSpeaker 2-Mics Pi HATs and a Xiaomi Mi WiFi 3G router. Here are my first impressions.
Table of Contents
- Micro SD Cards
- ReSpeaker 2-Mics Pi Hat
- Xiaomi 3G Router
Recently I tested some Verbatin 16G micro SD cards and was disappointed with the results. The information found on the web, when searching for test software, made it sound like the market was flooded with cheap cards of dubious quality which did not reach the advertised read and write speeds. Worse, some cards apparently did not even have the stated capacity. I felt a bit sheepish because I had just ordered cheap "off brand" 8G cards. I was prepared to write off this purchase thinking that I deserved what I got for trying to pinch a few pennies.
Here are representative results of the F3 write and read tests as performed on all five cards.
This is not as bad as I feared. There appears to be no capacity problem and these cards are truly class 10 although the read speed is definitely inferior to the Verbatim cards I have been using. Based on write speed, these BiNFUL cards would be better in a camera but I have not tested that. I am using one card in my Raspberry Pi 3 currently without problems.
The cards come with SD card adapters. They felt more flimsy than the adapters that came with the Vertabim micro SD cards. However, the micro card fits snugly inside the adapter and the latter fits well in the SD card reader on my desktop computer. No complaints here either.
Of course only usage over some time will tell if these cards are dependable. Nevertheless, I have ordered a few more 8G cards as well as some 16G cards from the same vendor and I am crossing my fingers hoping that this will work out.
Product: BiNFUL 8GB Class 10 Micro SD Card
Ordered: Jan. 30 2018
Received: March 13 2018
Cost: 5.48 $ CDN/piece free shipping
Source: AliExpress Store BESTHINKING
This does not constitute an endorsement. I just don't know enough. As I said, all five cards passed the test but the Verbatim cards were just as good initially but have now become unreliable.
The main source of information when I set up Google Assistant on an Orange Pi Zero was an article by CNXSoft. I was surprised that a USB microphone dongle was used instead of the built-in microphone which I found quite adequate. I should point out that CNXSoft gave instructions for using the built-in microphone. Later, when I wanted to do voice recognition on a Raspberry Pi, I decided to try the same type of microphone. I found the results wanting to say the least. So I turned to the ReSpeaker 2-Mics Pi HAT over at seeed, which seemed to offer an interesting solution. The Raspberry Pi Zero sized card has a reasonable price, but shipping was almost one and a half time more which seems way too much given that it took more than 7 weeks for the product to arrive. It took almost a month for the package to travel by air to Canada! The long three weeks to get to me within the country is probably down to my fault because there was an extraneous digit in the postal code.
Installing the driver
So after installing and updating Raspbian (Stretch, server version) on a new 8GB micro SD card, I followed the instructions on the seeed site to install the drivers.
I then powered down the Raspberry Pi, connected the ReSpeaker hat and plugged in a powered set of speakers to the 3.5 mm jack on the hat and another set of powered speakers to the 3.5 mm jack on the Raspberry Pi.
After powering up and starting an
ssh session, it was then a
simple matter to verify that the installation was done correctly by listing
capture and playback devices.
There is only one capture device, the two microphones of the ReSpeaker, which is card 1. There are three playback devices. Two are on card 0 which is the audio output of the Raspberry Pi. They are the 3.5 mm analogue output (device 0) and the digital HDMI output (device 1). Card 1, the ReSpeaker, has one device, the WM8960 DAC connected to the 3.5 mm jack.
If you do the suggested audio test
wavfile and then playing it back.
alsamixerin a parallel
sshsession before hearing anything.
I learned from Lex that the "... alsa configuration [file /etc/asound.conf] uses dmix plugin and dsnoop plugin to support multiple applications to play and record simultaneously." Here is the content of the file.
As can be seen, card 1, the ReSpeaker, is defined as both default capture
device and default playback device. So the
-D hw:1 command
line parameter was not necessary in the
aplay examples above.
Testing the Onboard LEDS
There are 3 RGB leds, type APA102, on the card. These are controlled over
an SPI bus. To test them, I enabled the SPI bus with
and then installed another
git repository from seeed and the Python SPI bus bindings.
mkvenv creates and updates a Python 3 virtual
ve activates it. This is documented in a
previous post: Python 3 virtual environments.
Working with Google Assistant
One of the developers working on Raspberry Pi based Google Assistant (GA) was rather negative about using ReSpeaker hats back in December of last year. I think that was rather too pessimistic. I managed to get GA running. As before, I will not go into the tedious details of creating a project and getting the appropriate credentials. For one thing, this is a moving target as Google is constantly changing the GA SDK and the required steps in registering and then accessing projects. Suffice it to say that I followed the instructions at Configure a Developer Project and Account Settings. Here is the information about the project I created on the site:
Project name: ga-Respeaker2It is weird that our DIY Google Home like device has to be given a device type that can only correspond to an actuator. That is one of the new things in this newest version of the SDK. The
Project ID: ga-respeaker2
Product name : mics
Manufacturer name : mycomp (never used)
Device type: Light (skip defining traits)
Device model ID: ga-respeaker2-mics-cab8un
Device model IDwas proposed by the project console and is clearly composed of the
Project ID, the
Product nameand a random code. I did not bother trying to change it. The two items in bold are needed later on.
A couple of packages (development libraries) have to be installed in the system before the Python libraries are added to the Python virtual environment.
That should complete the setup; it is now possible to try to use Google Assistant. Note that a local
file was not created. To be candid, I did make one following the SDK
instruction, but that only resulted in no audio output. It took a while to
figure out that I had to get rid of that configuration file. What finally
helped me was trying to run the program
googlesamples-assistant-audiotest. As can be seen below, nothing
was working when the configuration file was in place.
I removed the file and rebooted to be sure and then the program worked.
googlesamples-assistant-audiotest is passed, I
tested two of the applications installed:
which uses hotword detection (OK Google) to start a conversation and
googlesamples-assistant-pushtotalk where the conversation is
launched by pressing the Enter key.
As can be seen, both worked albeit slightly differently. First of all
google-assistant-demo is obviously linked with my Google Home account which explains why the output was in
French. I was surprised that I could query GA in either English or French and
get a correct answer. That prompted me to check, and it turns out that the
same thing is true of my Google Home mini. I had
never tried but it does answer my English language queries in French.
Furthermore, my IFTTT rules can be invoked (see Google Home Mini with
Domoticz using IFTTT) with
but, of course, only in the language in which the rules are written.
googlesamples-assistant-pushtotalk. As the following shows, it is also multilingual.
googlesamples-assistant-pushtotalk did not pick
up the language settings of my Google Home account as
can be seen above. However if I specify a language parameter then it
behaves more like
Again I could invoke IFTTT rules that I had set up for my use with my Google Home Mini.
For unfathomable reasons, both applications have the same command line model and project id, there is an exchange of underscores and dashes in their names:
google-assistant-demo: --device_model_id --project_id googlesamples-assistant-pushtotalk: --device-model-id --project-id
This is a good beginning. I think it will be possible to create something useful with this device. Since I bought two hats (to amortise the shipping costs), there is enough cash expended on them to motivate me to use them.
Product: ReSpeaker 2-Mics Pi HAT v1.0
Ordered: Jan. 17 2018
Received: March 9 2018
Cost: US$ 9.90 x 2 + US$ 14.08 shipping = CDN$ 43.37
Some time ago, I replaced the firmware of an old Rosewill 300M Wireless N Router (a rebranded TP-Link TL-WR841N/ND v7) with OpenWrt 15.05.1. Later I updated to LEDE 17.01.4 (which was then a fork but is now merged back into OpenWrt). At the time, I was musing about running Domoticz on the router. I more or less gave up when I realised that there was just not enough flash memory.
When I saw that the Xiaomi 3G Router has 128MB of flash memory and 256MB of RAM and noticed that some had managed to replace its Chinese language firmware with OpenWrt, I decided to purchase one with the ultimate goal of trying to run Domoticz on it.
The long and the short of it is that the home automation software is not installed even though, I managed to replace the firmware with OpenWrt. While work is going on to add a Domoticz/Open-ZWave package to OpenWrt but it is not yet available for installation. I will wait a bit before continuing on this project.
If you are trying to install OpenWrt on the router or even just trying to set it up, I suggest using Google's web browser, Chromium, because of its built-in translation mechanism (or install something equivalent in your favourite web client). Also, you will find that the Android app is in English, and presumably so is the IOS app.
Product page (Chinese)
Product FAQ (Chinese)
Hardware Device Wiki
How to Flash Xiaomi Mi WiFi 3G Router Firmware
LEDE - MiWiFi 3G - UniFi Ready
LEDE Project Forum - Xiaomi WiFi Router 3G
OpenWrt - Xiaomi Mi WiFi R3G
OpenWrt - Image files for the ramips/mt7621 target
I followed the instruction found in the above references. Here is some
additional information that could be useful. At one point, you have to
download the developer version of the router firmware. The instructions say
to look for it at
it now seems to be found on http://www1.miwifi.com/miwifi_download.html. Here are
direct links to the firmware from Xiaomi:
ROM for R3G stable version Version 2.26.3 (updated on November 8 http://bigota.miwifi.com/xiaoqiang/rom/r3g/miwifi_r3g_firmware_0a271_2.26.3.bin ROM for R3G development version Version 2. 25. 122 (August 24 update http://bigota.miwifi.com/xiaoqiang/rom/r3g/miwifi_r3g_firmware_c2175_2.25.122.bin
I had a hard time in getting another needed file:
miwifi_ssh.bin. I am not too sure how I managed it. But it is
necessary to open an account (using the Android/IOS app) and I think it was
necessary to use the router itself to connect to the web. As I recall, I was
using both Chromium and Firefox at the same time. Perhaps things would be
simpler on a Windows computer.
Since LEDE has been merged back into OpenWrt the two files making up the firmware to flash on the router have been renamed:
lede-ramips-mt7621-mir3g-squashfs-kernel1.bin ==> openwrt-ramips-mt7621-mir3g-squashfs-kernel1.bin lede-ramips-mt7621-mir3g-squashfs-rootfs0.bin ==> openwrt-ramips-mt7621-mir3g-squashfs-rootfs0.bin
I found that the radios were not enabled and not even defined once the
OpenWrt firmware had been flashed. Although there are instructions on how to
go about defining the interfaces and enabling the radios, the easiest
solution turned out to be installing LuCI and then upgrading the OpenWrt firmware. It is a simple point and click
procedure in the router admin web GUI at http://192.168.1.1. The upgrade
file is named
openwrt-ramips-mt7621-mir3g-squashfs-sysupgrade.tar. Do not worry
that it is not named
*-sysupgrade.bin. As confirmed in upgrading from a sysupgrade.tar the
utility will handle the
tar archive correctly.