the clock is a very important part in everyday life.whit the development of technologe,Ordinary clock can not meet the current society.eventually,I successfully embed avs in the clock so that the clock can not only look at the time but also the weather, listen to news, etc.
In order to make the alexa clock's compact,the main controller choose raspberry-zreo W that can connect to wifi
The sound is collected and played using the ReSpeaker 2-Mics Pi HAT from Seeed.
Time display using the Grove provided by Seeed - 4-Digit Display
Very unfortunately I don't have [wiki] (http://wiki.seeedstudio.com/Grove-4-Digit_Display/) above for the Raspberry Pi expansion board, so I rewrote the arduino driver code to be suitable for my hardware.python driver code on my [github] (https://github.com/hansonCc), execute the following command to drive Grove - 4-Digit Display
cd ~
git clone https://github.com/hansonCc/alexa_clock.git
cd ~/alexa_clock/TM1637/
python 47digitclock.py
Among them, the SetBrightnes
function for setting the 'Grove - 4-Digit Display' brightness is specifically described. We can determine whether the current time is night or day by the brightness of the Grove - 4-Digit Display
.
For the convenience of operation, I integrated the installation of avs
and ReSpeaker 2-Mics Pi HAT
drivers into 2018-08-06-raspbian-4GB-for-respeaker Inside the image file, download and burn this file to raspberry-zreo W
, run alexa-auth
in the terminal, and then log in to get the authorization of alexa. The authorized file is saved in / Home/pi/.avs.json
.
Thank you very much seeed for our technical support, we just need to run the following command to experience hand-free alexa
.
cd ~/
git clone https://github.com/respeaker/mic_hat.git
cd mic_hat
python alexa.py
It’s a very important step for a complete application to boot up.After we have completed the first authorization, we will not need to authorize it later, so we will not operate the authorization again after booting.command is as follows:
cd ~/alexa_clock
chmod 777 alexa_startup.sh
./alexa_startup.sh
Find exit 0
in the open text, the code added before this will be executed at startup, add the following code before exit 0
.
sudo -u pi /home/pi/alexa_startup.sh
I found that it is not a good idea to judge whether the boot is successful or not by each reboot. then,by querying the relevant information on the network, it is found that executing the following command can completely replace the restart operation.
systemctl restart rc-local.service
And,you also can use systemctl status
to view the rc-local.service
.
systemctl status rc-local.service
Designing a beautiful case is a very importantand The case is as follows:
Finally, we print out through the upbox3D printer and install the various components:
More perfect after closing the lid