Software apps and online services
Hand tools and fabrication machines
The clock is a very important part in everyday life. With the development of technology, ordinary clocks cannot meet the current society. Eventually, I successfully embedded the Alexa Voice Service in a clock so that the device not only looked at the time but also the weather, listen to news, etc.
In order to make the smart clock compact, the main controller is a Raspberry Pi Zero W that can connect to WiFi.
The sound is collected and played using the ReSpeaker 2-Mics Pi HAT from Seeed.
Time is shown on the Seeed's Grove 4-Digit Display.
Grove - 4-Digit Display
I don't have the Raspberry Pi expansion board in wiki, so I modified the C++ library for Arduino to be a Python library for my current hardware.python driver code in my GitHub. 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.
ReSpeaker 2-Mics Pi HAT
For the convenience of operation, I integrated the installation of
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
Thank you very much Seeed for our technical support. We just need to run the following command to experience
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 bootup. 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
exit 0 in the open text, the code added before this will be executed at startup, add the following code before
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
systemctl status rc-local.service
Designing a beautiful case is a very importantand The case is as follows:
Finally, we 3D-printed the case and installed the various components:
It looks even more perfect after closing the lid!
You can put it on table or bedside table. It is cute, and even looks like a cat. There are two mics under the cat's ears. So it can capture voice and perform the Alexa interaction. There is a speaker at back side and USB power supply cable as well. Hope you like this smart clock!