{"id":6663,"date":"2021-04-18T19:01:49","date_gmt":"2021-04-18T18:01:49","guid":{"rendered":"http:\/\/mathscitech.org\/articles\/?p=6663"},"modified":"2024-07-23T02:18:51","modified_gmt":"2024-07-23T01:18:51","slug":"talking-sensors","status":"publish","type":"post","link":"https:\/\/mathscitech.org\/articles\/talking-sensors","title":{"rendered":"Voice-controlled Hardware: Making Sensors Talk for Under \u00a35"},"content":{"rendered":"<p>Voice controlled hardware requires four capabilities: (1) vocal response to trigger events (sensors\/calculations-to-brain), (2) speech generation (brain-to-mouth), (3) speech recognition (ear-to-brain), and (4) speech understanding (brain-to-database, aka learning).  These capabilities can increasingly be implemented using off-the-shelf modules, due to progress in advanced low-cost silicon capable of digital signal processing (DSP) and statistical learning\/machine learning\/AI.  <\/p>\n<p>In this article we look at the value chain involved in building voice control into hardware.  We cover highlights in the history of artificial speech.  And we show how to convert an ordinary sensor into a talking sensor for less than \u00a35.  We demonstrate this by building a Talking Passive Infra-Red (PIR) motion sensor deployed as part of an April Fool&#8217;s Day prank (jump to the <a href=\"#design-video\">design video<\/a> and <a href=\"#demo-video\">demonstration video<\/a>).  <\/p>\n<p>The same design pattern can be used to create any talking sensor, with applications abounding around home, school, work, shop, factory, industrial site, mass-transit, public space, or interactive art\/engineering\/museum display.<\/p>\n<div id=\"attachment_6707\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/03-TalkingPIRsensor_06b_2021-04-03.jpg\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6707\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/03-TalkingPIRsensor_06b_2021-04-03-300x186.jpg\" alt=\"\" width=\"300\" height=\"186\" class=\"size-medium wp-image-6707\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/03-TalkingPIRsensor_06b_2021-04-03-300x186.jpg 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/03-TalkingPIRsensor_06b_2021-04-03-800x497.jpg 800w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/03-TalkingPIRsensor_06b_2021-04-03-768x477.jpg 768w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/03-TalkingPIRsensor_06b_2021-04-03-150x93.jpg 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/03-TalkingPIRsensor_06b_2021-04-03-400x248.jpg 400w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/03-TalkingPIRsensor_06b_2021-04-03.jpg 850w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-6707\" class=\"wp-caption-text\">Bringing Junk Model Robots to life with Talking Motion Sensors (April Fools Prank, 2021)<\/p><\/div>\n<p><!--more--><\/p>\n<hr>\n<h3>1. The rise of low-cost voice controlled hardware<\/h3>\n<p>Three technology streams have converged in the past 10 years to enable low-cost voice-controlled devices:<\/p>\n<p>(1) An explosion of highly capable silicon for sensors and data processing.  Mass-produced application-specific integrated circuits (ASICs) and ultra low-cost microcontrollers (including multimedia processors required for voice generation) now cost 3-30 cents apiece at scale (typically 10k+ pieces).  This has led to the creation of <a href=\"https:\/\/mathscitech.org\/articles\/electronics#sensors\" rel=\"noopener noreferrer\" target=\"_blank\">dozens of niche sensors available for 50p to \u00a35.00 ea<\/a> at retail cost.    <\/p>\n<p>(2) Full stack WiFi has been added to hobbyist microcontrollers while retaining a cost-per-unit between $3-$5.  Integrated WiFi allows devices to transfer input data into the cloud and let cloud servers handle the computationally intensive DSP\/AI tasks, collecting and executing the outputs.  This computational load sharing allows sophisticated voice capability on low-cost devices that are able to maintain continuous connection.<\/p>\n<p>(3) Advances in statistical learning\/machine learning\/AI have enabled more effective approaches to voice processing and speech understanding including using deep learning models to boost training\/accuracy.  Digital voice assistants have been embedded into a slew of devices, initially phones and computers, and then smart speakers, TVs, home appliances, and <a href=\"https:\/\/www.amazon.com\/alexa-auto\/b?ie=UTF8&#038;node=17744356011\" rel=\"noopener noreferrer\" target=\"_blank\">even cars<\/a>: Apple&#8217;s Siri (2011), Amazon&#8217;s Alexa and Microsoft&#8217;s Cortona (2014), Google&#8217;s Assistant (2016), and Samsung&#8217;s Bixby (2017).  We&#8217;ve gotten used to interacting with technology through voice.<\/p>\n<p>These trends above have been amplified by four additional developments: (a) the rise of the Maker movement since 2005 (Dale Dougherty), (b) the widespread adoption of Arduino since 2005 to become the world&#8217;s largest open source hardware platform, (c) the acceleration of e-commerce in consumer electronics and components (Amazon and Ebay), and (d) the flattening of global supply chains and greater pricing efficiency with manufacturers selling directly to consumer (B2C) via the e-commerce outlets.  The result is that voice integration and voice control are now within reach using low-cost devices.  <\/p>\n<p>Let&#8217;s take a look at how this has come about.<\/p>\n<hr>\n<h3>2. A Short History of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Speech_synthesis\" rel=\"noopener noreferrer\" target=\"_blank\">Speech Synthesis<\/a><\/h3>\n<p>The artificial generation of speech has gone through five stages: (0) mechanical generation of sounds pre 1930s, (1) electromechanical generation through combination of hisses and buzzes passed through various filters and pitch adjustors from 1939 to 1970s, (2) the digital combination of pre-recorded phonemes stored in databases and combined to form speech, kicking off a genre of toys-that-talk, alongside other talking devices (3) <a href=\"https:\/\/www.soundonsound.com\/techniques\/formant-synthesis\" rel=\"noopener noreferrer\" target=\"_blank\">formant synthesis<\/a> in the late 1990s in which 3 frequencies are mixed to create speech elements and to control pitch, prosody, and duration (formants are the spectral patterns making up the sounds of human speech), (4) machine learning \/ AI \/ neural networks \/ deep learning models applied to speech technology.  <\/p>\n<p>Below are some highlights:<\/p>\n<ul>\n<li> <a href=\"https:\/\/en.wikipedia.org\/wiki\/Speech_synthesis#History\" rel=\"noopener noreferrer\" target=\"_blank\">1779-1930s<\/a> &#8211; Prior to 1939, advances in mechanical speech were in 1779 when Kratzenstein built a system capable of producing the 5 long vowel sounds, followed by a bellows-operated device in 1791 by von Kempelen which added consonants.  Advances continued with 1837 device by Wheatstone, and 1846 the Euphonia talking machine by Faber, and 1923 by Paget.\n<li>1939 &#8211; Homer Dudley of Bell Labs produced the Voder, an electromechanical keyboard that combined hissing and buzzing through 10 filters and 2 energy sources capable of producing 20 independent sounds which a trained operator could use to generate sound sequences resembling speech.  <a href=\"https:\/\/youtu.be\/5hyI_dM5cGo?t=172\" rel=\"noopener noreferrer\" target=\"_blank\">Demonstration of singing Auld Lang Syne<\/a>.  Voder operator <a href=\"https:\/\/youtu.be\/5hyI_dM5cGo?t=210\" rel=\"noopener noreferrer\" target=\"_blank\">Helen Harper explains how the sounds are made<\/a>: &#8220;to produce the word &#8216;concentration&#8217;, I have to form 13 different sounds in succession, make 5 up\/down movements of the wrist bar, and vary the pitch using 3-5 presses of the foot pedal to provide intonation\/expression.&#8221;  Because the Voder models the human vocal tract, any spoken language is possible to generate, and additionally animal sounds.  High-school student Vaughn Rhinehart <a href=\"https:\/\/youtu.be\/gv9m0Z7mhXY?t=145\" rel=\"noopener noreferrer\" target=\"_blank\">built a working replica system<\/a> which he <a href=\"https:\/\/youtu.be\/gv9m0Z7mhXY?t=306\" rel=\"noopener noreferrer\" target=\"_blank\">demonstrates here<\/a>\n<div id=\"attachment_6740\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2043.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6740\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2043-800x253.png\" alt=\"\" width=\"640\" height=\"202\" class=\"size-large wp-image-6740\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2043-800x253.png 800w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2043-300x95.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2043-768x243.png 768w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2043-150x48.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2043-400x127.png 400w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2043.png 1086w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><p id=\"caption-attachment-6740\" class=\"wp-caption-text\">1939 &#8211; The Voder, Bell Labs, Schematic Illustrating how the synthetic modal of the human vocal tract were to be preserved, with only the mechanism for operating them changing.  On the Left, the human brain causes the muscles in the human vocal tract to adjust and sound comes out of the mouth, which is analyzed into constituent parts, and the reconstructed on the right with switches and pedals.<\/p><\/div>\n<div id=\"attachment_6739\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2042.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6739\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2042-800x299.png\" alt=\"\" width=\"640\" height=\"239\" class=\"size-large wp-image-6739\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2042-800x299.png 800w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2042-300x112.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2042-768x287.png 768w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2042-150x56.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2042-400x150.png 400w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2042.png 834w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><p id=\"caption-attachment-6739\" class=\"wp-caption-text\">1939 &#8211; The Voder, Bell Labs, an operator would train for a year or more, and then could create 20 sounds from which, with perfect timing, could form words, and then sentences, and songs.<\/p><\/div>\n<li>1961 &#8211; John Kelly and Carol Lochbaum of Bell Labs <a href=\"https:\/\/youtu.be\/wQjTgvUEOrY?t=94\" rel=\"noopener noreferrer\" target=\"_blank\">programmed the IBM 704 mainframe computer to speak and to sing &#8216;Daisy Bell&#8217;<\/a>.  This was heard by Arthur C. Clarke who made that the final scene of his epic Space Odyssey featuring HAL, the futuristic computer.\n<p>The next phase was using <a href=\"https:\/\/en.wikipedia.org\/wiki\/Linear_predictive_coding\" rel=\"noopener noreferrer\" target=\"_blank\">Linear Predictive Coding<\/a> and then in the 1990s <a href=\"https:\/\/www.soundonsound.com\/techniques\/formant-synthesis\" rel=\"noopener noreferrer\" target=\"_blank\">Formant synthesis<\/a> which built upon earlier <a href=\"https:\/\/en.wikipedia.org\/wiki\/Frequency_modulation_synthesis\" rel=\"noopener noreferrer\" target=\"_blank\">FM (frequency modulated) synthesis<\/a> and other synthesis models.<\/p>\n<li>1978 &#8211; Larry Brantingham of Texas Instruments develops the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Texas_Instruments_LPC_Speech_Chips\" rel=\"noopener noreferrer\" target=\"_blank\">TMS5100 IC chip<\/a> which generated speech on-the-fly using a 10-pole Linear Predictive Coding (LPC) filter with a lattice filter as its Vocal Tract Model (VTM).  This earned the chip the distinction of marking the first time that the human vocal tract has been modeled on a single piece of silicon.  The chip was used in the educational toy &#8216;Speak &#038; Spell&#8217;.  Pre-recorded phonemes stored on a separate ROM were combined through the chip.  In 2013, <a href=\"https:\/\/github.com\/going-digital\/Talkie\" rel=\"noopener noreferrer\" target=\"_blank\">&#8216;Talkie&#8217;, a software emulator for the TMS5100&#8217;s speech capability<\/a>, was developed for Arduino.  <a href=\"https:\/\/www.unige.ch\/medecine\/nouspikel\/ti99\/speech.htm\" rel=\"noopener noreferrer\" target=\"_blank\">Technical details<\/a> in the TI99 speech synthesizer using the TMS5200.  The TMS chips were used in various versions to 1986 when an on-chip 8-bit microcontroller was added, which culminated in the MSP50C6xxx line of low data rate speech synthesis chips which were <a href=\"https:\/\/www.webcitation.org\/65WOqYC8t?url=http:\/\/www.eetimes.com\/electronics-news\/4102385\/TI-will-exit-dedicated-speech-synthesis-chips-transfer-products-to-Sensory\" rel=\"noopener noreferrer\" target=\"_blank\">sold to Sensory Inc. in 2001.<\/a>\n<div id=\"attachment_6741\" style=\"width: 236px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2044.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6741\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2044.png\" alt=\"\" width=\"226\" height=\"209\" class=\"size-full wp-image-6741\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2044.png 226w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2044-150x139.png 150w\" sizes=\"auto, (max-width: 226px) 100vw, 226px\" \/><\/a><p id=\"caption-attachment-6741\" class=\"wp-caption-text\">1978 &#8211; Texas Instruments TMS5100 chip that modelled speech using phonemes to be strung together to form words and sentences.<\/p><\/div>\n<li>1980s &#8211; Competing LPC based speech synthesizer ICs were developed by competitors, eg General Instruments&#8217; <a href=\"https:\/\/en.wikipedia.org\/wiki\/General_Instrument_SP0256\" rel=\"noopener noreferrer\" target=\"_blank\">SPO256 IC<\/a>.\n<li>1984 &#8211; <a href=\"https:\/\/en.wikipedia.org\/wiki\/DECtalk\" rel=\"noopener noreferrer\" target=\"_blank\">DECtalk<\/a> was a famous speech synthesizer and text-to-speech system developed in 1984 by DEC corporation.\n<li>1994 &#8211; <a href=\"https:\/\/en.wikipedia.org\/wiki\/Gnuspeech\" rel=\"noopener noreferrer\" target=\"_blank\">gnuspeech<\/a> released containing the research from Steve Jobs NeXT corporation (before Apple) and Trillium corporation, which incorporated the research from University of Calgary.\n<li>1998 &#8211; Yamaha produces the <a href=\"https:\/\/www.soundonsound.com\/reviews\/yamaha-fs1r\" rel=\"noopener noreferrer\" target=\"_blank\">first Formant based Synthesizer, the FS1R<\/a>.  Example of a <a href=\"http:\/\/www.javelinart.com\/fs1r-human-voices.html\" rel=\"noopener noreferrer\" target=\"_blank\">female voice patch on the FS1R<\/a>.  This is after the GS-1 and DX7 FM synthesizer releases in 1980 and 1983 respectively.  (The <a href=\"https:\/\/www.musicradar.com\/news\/fem-is-touted-as-one-of-the-most-powerful-fm-synths-ever\" rel=\"noopener noreferrer\" target=\"_blank\">latest FM synth is F&#8217;em.<\/a>)\n<p>The current stage is focused on statistical learning techniques (neural networks, AI, machine learning, deep learning), and the delivery of voice interactive digital assistants.<\/p>\n<li>1995 &#8211; <a href=\"https:\/\/www.sensory.com\/?cn-reloaded=1\" rel=\"noopener noreferrer\" target=\"_blank\">Sensory Inc<\/a>. produced <a href=\"https:\/\/www.imagesco.com\/speech\/rsc-164.pdf\" rel=\"noopener noreferrer\" target=\"_blank\">RSC-164 (databook PDF)<\/a> the first commercially successful speech recognition IC.  The chip featured an integrated 8-bit microcontroller and used neural networks to recognize speech with 96% accuracy in speaker independent mode (any speaker) and 99% accuracy in speaker dependent mode (a voice on which the system has been pre-trained) using onboard processing.  The RSC-164 was used in the <a href=\"https:\/\/www.webcitation.org\/65WOidUMK?url=http:\/\/www.planetary.org\/programs\/projects\/planetary_microphones\/mars_microphone.html\" rel=\"noopener noreferrer\" target=\"_blank\">Mars Microphone project<\/a> deployed on the Mars Polar Lander which lost contact with the Earth during descent into Mars orbit in 1999.\n<li>2000s &#8211; Human realistic computer generated voices appear in Windows 2000 and Windows XP: <a href=\"https:\/\/youtu.be\/wQjTgvUEOrY?t=362\" rel=\"noopener noreferrer\" target=\"_blank\">Microsoft Mike, Microsoft Mary<\/a>\n<li>2009 &#8211; Sensory Inc. produces smallest text-to-speech (TTS) system\n<li>2011 &#8211; Apple introduces Siri\n<li>2014 &#8211; Amazon launches Alexa.  <a href=\"https:\/\/www.forbes.com\/sites\/rachelarthur\/2018\/10\/12\/amazon-alexas-founder-on-how-voice-tech-will-impact-retail\/\" rel=\"noopener noreferrer\" target=\"_blank\">William Tunstall-Pedoe<\/a> and his company <a href=\"https:\/\/en.wikipedia.org\/wiki\/Evi_(software)\" rel=\"noopener noreferrer\" target=\"_blank\">Evi founded in 2005<\/a> developed the underlying AI to enable speech understanding.  It was acquired by Amazon in 2012, and Alexa was released in 2014.\n<li>2016 &#8211; Adobe experiments with <a href=\"https:\/\/en.wikipedia.org\/wiki\/Adobe_Voco\" rel=\"noopener noreferrer\" target=\"_blank\">Voice Conversion (VoCo)<\/a>, dubbed <a href=\"https:\/\/youtu.be\/wQjTgvUEOrY?t=410\" rel=\"noopener noreferrer\" target=\"_blank\">the photoshop of speech<\/a>, and allows with 20 minutes of training on a person&#8217;s speech, to produce any speech through a text-to-speech (TTS) interface, using their voice.  <a href=\"https:\/\/rigorousthemes.com\/blog\/best-adobe-voco-alternative\/\" rel=\"noopener noreferrer\" target=\"_blank\">AI-based methods for generating speech to match human samples<\/a>.\n<li>2016 &#8211; Google&#8217;s Deep Mind produces <a href=\"https:\/\/en.wikipedia.org\/wiki\/WaveNet\" rel=\"noopener noreferrer\" target=\"_blank\">WaveNet<\/a> that uses convolutive neural networks (CNN) to learn how to speak by being trained by human speech.\n<li>2018 &#8211; <a href=\"https:\/\/web.archive.org\/web\/20190521102721\/https:\/\/www.resemble.ai\/\" rel=\"noopener noreferrer\" target=\"_blank\">Resemble AI<\/a> (<a href=\"https:\/\/www.resemble.ai\/\" rel=\"noopener noreferrer\" target=\"_blank\">current website<\/a>) develops voice-cloning capability, picking up where Adobe&#8217;s VoCo stopped.  Once the voice is cloned, text-to-speech can be used to generate arbitrary speech.  There are ethics concerns on the ability to create voice clones that are unable to be distinguished from the real voices\/utterances.  Resemble AI embeds technologically detectable markers into the voice signal to tag them as manufactured.  The concerns at the capability remain nonetheless, joining similar concerns at the <a href=\"http:\/\/www.mathscitech.org\/gplus\/20140814%20-%20Image%20Manipulation%20fuses%203D%20library%20to_.html\" rel=\"noopener noreferrer\" target=\"_blank\">ability to make hyper-realistic 3D edits to objects in photos<\/a>.\n<\/ul>\n<hr>\n<h3>3. Converting Ordinary Sensors to Talking Sensor for under \u00a35<\/h3>\n<p>Vocal response to trigger events can be added to an existing sensor for less than \u00a35 using off-the-shelf modules that offer record\/playback functionality in either single-track (e.g. <a href=\"https:\/\/www.ebay.co.uk\/itm\/30s-Sound-Voice-Module-Recordable-Music-for-DIY-Card-Musical-Box-with-Speaker\/293888018440\" rel=\"noopener noreferrer\" target=\"_blank\">YS41F<\/a>) or multi-track (e.g. <a href=\"https:\/\/www.ebay.co.uk\/itm\/1PCS-ISD1700-Series-Voice-Record-Play-ISD1760-Module-For-AVR-Arduino-PIC\/191819205853\" rel=\"noopener noreferrer\" target=\"_blank\">ISD1760<\/a>) mode.  There are also modules to which <a href=\"https:\/\/www.amazon.co.uk\/gp\/product\/B07KLZXJ4B\/\" rel=\"noopener noreferrer\" target=\"_blank\">pre-recorded MP3s can be uploaded for play<\/a>, again single-track or multi-track variants (e.g. <a href=\"https:\/\/cdn.sparkfun.com\/assets\/7\/c\/0\/c\/6\/WT2003S-16S_Chip_V1.03.pdf\" rel=\"noopener noreferrer\" target=\"_blank\">WT2003S multi-message MP3 chip<\/a>).  Typical cost for record\/playback modules is \u00a33-\u00a34 ea., with <a href=\"https:\/\/www.alibaba.com\/product-detail\/DIY-Sound-Chip-Module-Recordable-Sound_62276369204.html?spm=a2700.details.maylikeexp.10.368f5f26sdmrLO\" rel=\"noopener noreferrer\" target=\"_blank\">prices dropping to 50p ($0.85) ea at scale (100,000+ units)<\/a>.  There are also OTP (one-time programmable) systems commonly found in talking plush toys (e.g. <a href=\"https:\/\/www.amazon.co.uk\/Be-My-Bear-Recordable-Voice\/dp\/B00D6DP67A\/\" rel=\"noopener noreferrer\" target=\"_blank\">this one for \u00a38.75, 20s record time)<\/a>, or <a href=\"https:\/\/www.amazon.co.uk\/Be-My-Bear-Recordable-Voice\/dp\/B00D6DP67A\/\" rel=\"noopener noreferrer\" target=\"_blank\">2pc for \u00a312.25 (\u00a36.12 ea)<\/a>), cars, action figures, dolls, and greeting cards, and feature pre-recorded material that can be played back following a trigger event.  The price at scale for OTP chips drops to <a href=\"https:\/\/www.alibaba.com\/product-detail\/35-seconds-65-seconds-otp-voice_62031576539.html\" rel=\"noopener noreferrer\" target=\"_blank\">$0.15-$0.22 per unit<\/a> (500-10,000 units).<\/p>\n<div id=\"attachment_6842\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2080.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6842\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2080-800x373.png\" alt=\"\" width=\"640\" height=\"298\" class=\"size-large wp-image-6842\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2080-800x373.png 800w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2080-300x140.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2080-768x358.png 768w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2080-150x70.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2080-400x187.png 400w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2080.png 892w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><p id=\"caption-attachment-6842\" class=\"wp-caption-text\">Record\/playback chips offer single-track and multi-track modes which can be used to turn ordinary sensors into talking sensors for less than \u00a35 ea (less than 50p at scale).<\/p><\/div>\n<h3>4. Examining the Value Chain, from Vocal Response to Voice Generation, Voice Recognition and Voice Understanding<\/h3>\n<p><strong>Vocal Response<\/strong><br \/>\nThe YS41F module can record up to 30s of high quality audio recording and play it back with hi-fidelity on an 8R 0.5W speaker integrated into the module.  What enables the sophisticated functionality cheaply is the ultra-low cost 16-bit multimedia processor Shenzhen <a href=\"https:\/\/www.avrfreaks.net\/sites\/default\/files\/forum_attachments\/TR16F064_0.pdf\" rel=\"noopener noreferrer\" target=\"_blank\">TR16F064B (datasheet)<\/a>, which functions as a mini voice recorder with the ability to reprogram the recording.  This highly capable microprocessor costs <a href=\"https:\/\/www.alibaba.com\/product-detail\/-Electronic-Components-Supplier-TR16F064B_1600156392061.html\" rel=\"noopener noreferrer\" target=\"_blank\">$0.25-$0.35 per unit at scale (500-10,000 units)<\/a> and provides built-in DSP operations, 10-bit ADC, I2C\/SPI, Audio PWM output support, 64K of SRAM memory (for data) and 1MB of Flash ROM memory (for program).  (What&#8217;s cool about this controller chip is that it&#8217;s a von Neumann, not Harvard architecture, meaning all memory spaces are visible to program counter, which means it is possible to implement a real 3-instruction Forth without wearing out Flash memory, or requiring pre-compiled instructions as with my 3iForth for Arduino.  But of course, all of the low cost MCUs have more complicated development systems requiring specialized hardware for their programming.)<\/p>\n<p>If we needed to play multiple tracks, we could use the ISD1760 chip (pictured above right) with a programmer module that has microphone and buttons to individually record the tracks into onboard Flash memory.  The programmer board conveniently has a socket (DIP-28) so that an ISD1760 chip can be physically inserted just for the recording to sounds, and then removed for installation as a bare chip into the application circuit, which allows the chips to be bought independently (\u00a33 ea in single quantities, 40% cheaper than with the programming module).  The special capability of the ISD1760 provides an SPI interface for a microcontroller to select at runtime which of the multiple tracks will be played.  See Nuvoton&#8217;s <a href=\"https:\/\/www.nuvoton.com\/products\/smart-home-audio\/isd-chipcorder\/\" rel=\"noopener noreferrer\" target=\"_blank\">ISD ChipCorder range<\/a> and <a href=\"https:\/\/www.nuvoton.com\/products\/smart-home-audio\/audio-speech-controllers\/nuvoice-series\/?tab=1\" rel=\"noopener noreferrer\" target=\"_blank\">NuVoice range<\/a>.<\/p>\n<p><strong>Speech Generation on the Cheap<\/strong><br \/>\nThe ISD1760 multi-track recorder with SPI playback interface is perhaps the simplest approach to speech synthesis\/generation using a technique called concetenative speech synthesis.  The user pre-records phonemes and the microcontroller creates speech by seleting dynamically which phonemes to play, at what pitch, and for how long.  With more memory space, one could in principle record whole words or phrases.  Examples are talking clocks and other number readers.  <\/p>\n<p><strong>Text-to-Speech parsing front-ends<\/strong><br \/>\nA step-up in capability would have a Text-to-speech front-end parsing user inputted text into phonemes and annotating for pitch, intonation (prosody) and duration, and then generating speech waveforms using the pre-recorded phonemes.  This is how the more expensive <a href=\"https:\/\/hackaday.com\/2012\/07\/11\/emic2-text-to-speech-module\/\" rel=\"noopener noreferrer\" target=\"_blank\">EMIC2 module (c.\u00a365)<\/a> works (<a href=\"https:\/\/www.youtube.com\/watch?v=JcaezclC8lo\" rel=\"noopener noreferrer\" target=\"_blank\">demo video<\/a>), or the <a href=\"https:\/\/www.mikroe.com\/text-to-speech-click\" rel=\"noopener noreferrer\" target=\"_blank\">latest S1V30120 from Epson, at \u00a339<\/a><\/p>\n<p><strong>Formant Synthesis for ultra-low memory requirements<\/strong><br \/>\nTo get away from pre-recorded phonemes, the next step is so-called Formant Synthesis, which creates the phonemes of human speech through mixing frequencies and judiciously selecting the band-pass filters.  Vowels and consonants can be created.  More sophisticated control is required to generate the speech, but only frequency data and lookup tables need to be stored instead of waveforms, significantly reducing the amount of memory needed.<\/p>\n<div id=\"attachment_6745\" style=\"width: 1303px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2045.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6745\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2045.png\" alt=\"\" width=\"1293\" height=\"547\" class=\"size-full wp-image-6745\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2045.png 1293w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2045-300x127.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2045-800x338.png 800w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2045-768x325.png 768w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2045-150x63.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2045-400x169.png 400w\" sizes=\"auto, (max-width: 1293px) 100vw, 1293px\" \/><\/a><p id=\"caption-attachment-6745\" class=\"wp-caption-text\">Formant Synthesis &#8211; using 3 or more frequencies passed through band-pass filters of varying widths (Q factors) to shape sound and create vowels (left).  Adding control over gain (volume) and Q (filter width) makes the sound more human (right).<\/p><\/div>\n<p><strong>Speech Understanding through the Cloud<\/strong><br \/>\nThe above sections have been about speech generation.  But what about the other end of the value chain, speech understanding?  The most advanced approach is to leverage the cutting edge statistical\/machine learning\/AI available in the cloud which underpins high performance voice processing, speech understanding, and speech generation capabilities (think <a href=\"https:\/\/www.wired.co.uk\/article\/amazon-alexa-ai-evi\" rel=\"noopener noreferrer\" target=\"_blank\">Alexa&#8217;s vocal clarity, exceptional speech recognition and understanding<\/a>).  This is now accessible using low-cost WiFi-enabled microcontrollers that can be continuously connected to the cloud, e.g. <a href=\"https:\/\/mathscitech.org\/articles\/electronics#ESP-wifi\" rel=\"noopener noreferrer\" target=\"_blank\">Espressif&#8217;s ESP family of WiFi capable microcontrollers<\/a> intended for internet-of things devices.  Building in <a href=\"https:\/\/developer.amazon.com\/en-US\/docs\/alexa\/alexa-voice-service\/get-started-with-alexa-voice-service.html\" rel=\"noopener noreferrer\" target=\"_blank\">Alexa integration<\/a> via <a href=\"https:\/\/developer.amazon.com\/en-US\/docs\/alexa\/smarthome\/understand-the-smart-home-skill-api.html\" rel=\"noopener noreferrer\" target=\"_blank\">Alexa&#8217;s cloud-based Skills API<\/a> gives true voice-controlled hardware.  Example: <a href=\"https:\/\/www.microsemi.com\/product-directory\/connected-home\/4628-zlk38avs\" rel=\"noopener noreferrer\" target=\"_blank\">Microchip&#8217;s Alexa Development Kit<\/a> sold for <a href=\"https:\/\/www.arrow.com\/en\/products\/zlk38avs2\/microsemi\" rel=\"noopener noreferrer\" target=\"_blank\">\u00a3480ea (MOQ20)<\/a><\/p>\n<p><strong>Offline Speech Understanding<\/strong><br \/>\nCan acceptable speech understanding be performed offline?  There are a few off-the-shelf low-cost ASICs that do offline speech recognition and speech understanding and appear to have reasonable performance.  Examples:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.electrodragon.com\/w\/LD3320_Datasheet\" rel=\"noopener noreferrer\" target=\"_blank\">LD3320<\/a>, avail <a href=\"https:\/\/uk.banggood.com\/Speech-Recognition-Module-Voice-Board-VRM-LD3320-ASR-5V-Power-p-1007594.html\" rel=\"noopener noreferrer\" target=\"_blank\">for c.\u00a318<\/a>\n<li><a href=\"https:\/\/www.eetimes.com\/isd-set-to-launch-simon-speech-recognition-chip\/\" rel=\"noopener noreferrer\" target=\"_blank\">ISD-3000<\/a>\n<li><a href=\"https:\/\/www.mikroe.com\/speakup-click\" rel=\"noopener noreferrer\" target=\"_blank\">Speak-up Click board from Mikroelectronika (\u00a339)<\/a> which does <a href=\"https:\/\/www.mikroe.com\/speakup-click\" rel=\"noopener noreferrer\" target=\"_blank\">offline speech recognition<\/a> by running a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Dynamic_time_warping\" rel=\"noopener noreferrer\" target=\"_blank\">Dynamic Time Warping (DTW) comparison algorithm<\/a> against up to 200 pre-recorded keywords with <a href=\"https:\/\/medium.com\/electronza\/arduino-speech-controlled-neopixels-d2fc36f0315d\" rel=\"noopener noreferrer\" target=\"_blank\">instant recognition, high accuracy, and immediate response<\/a>.  The core engine are the <a href=\"https:\/\/global.epson.com\/products_and_drivers\/semicon\/products\/speech\/voice_guidance_index.html\" rel=\"noopener noreferrer\" target=\"_blank\">Epson voice chips<\/a>, e.g. the S1V30120 chip.\n<\/ul>\n<p>One especially interesting example is <a href=\"https:\/\/www.instructables.com\/Speech-Recognition-With-an-Arduino-Nano\/\" rel=\"noopener noreferrer\" target=\"_blank\">Peter Balch&#8217;s speech understanding experiments using an Arduino Nano<\/a>.  The Nano is an 8-bit microcontroller with up to 32kB of FLASH RAM and processing of up to 10 MIPS, whichi s akin to that of a 1970s mainframe computer (2-32KB, 0.5 &#8211; 1 MIPS).  Using this, <a href=\"https:\/\/hackaday.com\/2021\/05\/26\/speech-recognition-on-an-arduino-nano\/\" rel=\"noopener noreferrer\" target=\"_blank\">he was able to obtain a recognition rate of 90-95%<\/a> on simple single words uttered by a single speaker against a training set of the same words from the same speaker.  This is comparable to capabilities of 1970s speech recognition.<\/p>\n<p>Several microcontroller design and manufacturing companies are bringing to market <a href=\"https:\/\/www.sensory.com\/partners\/\" rel=\"noopener noreferrer\" target=\"_blank\">voice solutions on chip<\/a>.  With the price of custom ASICs continuing to fall, the next few years may see these state-of-the-art devices that currently retail from \u00a315-\u00a340 follow the same trend and reach the sub \u00a310 and sub \u00a35 price points.<\/p>\n<hr>\n<h3>5. Building a Talking PIR Motion Detection Sensor<\/h3>\n<p>In the last part of this article, we&#8217;ll look at implementing the first step: pre-recorded vocal response to event triggers.  Let&#8217;s build!<\/p>\n<p>What we&#8217;re after is a talking version of a Passive Infra-Red (PIR) motion detection sensor.  Here&#8217;s what we need:<\/p>\n<p><strong>Bill of Materials (<a href=\"https:\/\/mathscitech.org\/articles\/electronics#LED\" rel=\"noopener noreferrer\" target=\"_blank\">catalog here<\/a>)<\/strong><br \/>\n<strong>Total: \u00a38.55<\/strong><\/p>\n<ol>\n<li>HC-SR501 PIR motion sensor (\u00a31.10)\n<li>Record\/Playback Module: YS41F or ISD1760 (c.\u00a33.50)\n<li>Boost Converter: Super Micro CE012 provides regulated 5VDC (\u00a31.30)\n<li>AAA battery &#038; holder (65p)\n<li>ATTiny85 8-bit microcontroller provides decision logic and good usability (\u00a31.30)\n<li>a dozen or so auxilliary electronic components, resistors, caps, etc. (30p)\n<li>solderless breadboard, 170 tie-points (40p)\n<\/ol>\n<p>Notice that, at scale, the price could be reduced by \u00a33 (on the record\/playback module), and \u00a31 (on the boost converter), dropping the prototype price to \u00a34.55.<\/p>\n<p>Making and testing the talking PIR motion sensor should take approx. 2 hours (excluding tool setup) assuming intermediate electronics experience (breadboarding components, some light <a href=\"#solder\" rel=\"noopener noreferrer\" target=\"_blank\">soldering<\/a>, and a little <a href=\"#arduino\" rel=\"noopener noreferrer\" target=\"_blank\">Arduino programming<\/a>).<\/p>\n<p><strong>Schematics and Prototype layout.<\/strong> [link]<\/p>\n<p>Let&#8217;s step through the key components for the build.<br \/>\n<a id=\"design-video\"><\/a><br \/>\n<strong>Design Video<\/strong><br \/>\n<iframe loading=\"lazy\" title=\"MathSciTech.org - Building a Talking Motion Sensor for under \u00a310\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/uKIcg4EsggE?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<h4>5.1. Infra-Red Motion Sensor<\/h4>\n<p>We start with a low-cost but effective PIR motion sensor, the <a href=\"https:\/\/mathscitech.org\/articles\/electronics#PIR-motion\" rel=\"noopener noreferrer\" target=\"_blank\">HC-SR501, available for \u00a32.45, or \u00a31.10 ea. in a 10-pack<\/a>.<\/p>\n<p>PIR Motion sensors are complicated devices but easy to interface to.  Simply provide 5V DC power (60mA of continuous current, 300mW), and after 60 seconds of painting the IR background, the sensor begins real-time signal processing, differentially comparing IR levels received on its A and B sensors.  When the pattern suggests motion (left-to-right or right-to-left), the sensor outputs an active HIGH signal (3.3V logic level).  <\/p>\n<div id=\"attachment_6690\" style=\"width: 645px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1986.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6690\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1986.png\" alt=\"\" width=\"635\" height=\"339\" class=\"size-full wp-image-6690\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1986.png 635w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1986-300x160.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1986-150x80.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1986-400x214.png 400w\" sizes=\"auto, (max-width: 635px) 100vw, 635px\" \/><\/a><p id=\"caption-attachment-6690\" class=\"wp-caption-text\">Building a Passive Infra-Red (PIR) Motion Sensor interfaced through Arduino Nano &#8211; Sep 13th, 2020<\/p><\/div>\n<p>Especially note the left-right axis of the sensor to ensure positioning for maximum detection sensitivity.<\/p>\n<div id=\"attachment_6691\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1993.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6691\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1993-800x425.png\" alt=\"\" width=\"640\" height=\"340\" class=\"size-large wp-image-6691\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1993-800x425.png 800w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1993-300x159.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1993-768x408.png 768w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1993-150x80.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1993-400x212.png 400w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1993.png 1044w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><p id=\"caption-attachment-6691\" class=\"wp-caption-text\">HC-SR501 Passive Infra-Red (PIR) Motion Sensor Detail.  The directions for turning the potentiometers are when they viewed from the top, i.e. facing you and ready to be turned.  Critical one to adjust is the timing delay &#8211; maximum CCW turn sets to 3 seconds delay.<\/p><\/div>\n<p>How can such a sensor be made so cheaply?  Ultra low-cost ASICs, in this case the heart of the PIR sensor is the BISS0001 dedicated PIR controller which does all the DSP handling the detection, processing, and signalling.  It is available from <a href=\"https:\/\/www.alibaba.com\/trade\/search?fsb=y&#038;IndexArea=product_en&#038;CatId=&#038;SearchText=biss0001&#038;selectedTab=product_en\" rel=\"noopener noreferrer\" target=\"_blank\">$0.01 to $0.10 in volume<\/a>, or for experimentation in a DIP16 package for <a href=\"https:\/\/www.ebay.co.uk\/itm\/141938586187\" rel=\"noopener noreferrer\" target=\"_blank\">\u00a31.20 (single qty)<\/a>.  The HC-SR501 PIR sensor consumes 60mA of power.<\/p>\n<hr>\n<h4>5.2. Boost Converter to 5VDC for portable power<\/h4>\n<p>The next step is powering the sensor.  To keep things portable, we will use a boost converter to provide regulated 5VDC from a battery.  The <a href=\"https:\/\/mathscitech.org\/articles\/electronics#CE012-power\" rel=\"noopener noreferrer\" target=\"_blank\">Super Micro DC-DC Converter CE012<\/a> is compact (approx 1.1cm x 1.1cm), cheap (less than \u00a31 in pack-size of 10), has no parasitic LED indicator to draw power, and can readily provide the required 60mA output current from a single AAA 1.5V battery on which it can run 8 hours or more, boosting sufficiently down to input of 0.75V, i.e. to 50% charge on the battery, at which point the boosted output is insufficient to keep the PIR sensor&#8217;s detections reliable.  Soldering a right-angle 3-pin header allows the CE012 to be inserted vertically into the breadboard for minimum space usage.<\/p>\n<div id=\"attachment_6808\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/CE012_photo_screenshot.2074.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6808\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/CE012_photo_screenshot.2074-300x207.png\" alt=\"\" width=\"300\" height=\"207\" class=\"size-medium wp-image-6808\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/CE012_photo_screenshot.2074-300x207.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/CE012_photo_screenshot.2074-150x103.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/CE012_photo_screenshot.2074-400x276.png 400w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/CE012_photo_screenshot.2074.png 502w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-6808\" class=\"wp-caption-text\">5V DC to DC boost converter, supplies 60mA down to 0.75V<\/p><\/div>\n<p><strong>Sizing the battery<\/strong><br \/>\nWhat battery to use?  I used a single 1.5V AAA battery (550mAh) to ensure at least a full night&#8217;s reliable detection (9hrs = 550mAh\/60mA), but could also have used a 3V CR2032 coin cell battery (225mAh) if a few hours was required. Reference: (<a href=\"https:\/\/mathscitech.org\/articles\/electronics#battery-power\" rel=\"noopener noreferrer\" target=\"_blank\">battery power table<\/a>)  <\/p>\n<div id=\"attachment_7078\" style=\"width: 704px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/06\/battery_power_comparison.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-7078\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/06\/battery_power_comparison.png\" alt=\"\" width=\"694\" height=\"273\" class=\"size-full wp-image-7078\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/06\/battery_power_comparison.png 694w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/06\/battery_power_comparison-300x118.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/06\/battery_power_comparison-150x59.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/06\/battery_power_comparison-400x157.png 400w\" sizes=\"auto, (max-width: 694px) 100vw, 694px\" \/><\/a><p id=\"caption-attachment-7078\" class=\"wp-caption-text\">Electrical capacity of common battery types.<br \/>Source: https:\/\/daycounter.com\/LabBook\/Battery-Capacity-Comparison.phtml<\/p><\/div>\n<hr>\n<h4>5.3. Microcontroller for better usability<\/h4>\n<p>It is possible to use the PIR motion sensor in stand-alone mode, but a microcontroller (uC) enables a better user experience.  For instance, the PIR sensor requires 60 seconds of background scanning before entering detection mode.  The uC can indicate when scanning is complete and the sensor is active with a timer and red\/green LEDs.  Similarly, it can run more complex response decisions taking inputs from other sensors or context.  For instance, if it is dark (via input from photoresistor), turn on light, otherwise ignore (this is the logic behind motion-sensing security lights).  Alternatively, if detections are within seconds of each other, the warnings could be escalated, culminating in sounding a <a href=\"https:\/\/mathscitech.org\/articles\/electronics#100dB-alarm\" rel=\"noopener noreferrer\" target=\"_blank\">100dB ear splitting alarm<\/a>  (though be warned, this alarm consumes 40mA by itself).<\/p>\n<p>Which microcontroller to use?  <\/p>\n<div id=\"attachment_7184\" style=\"width: 1070px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/01\/Electronic_uC_Chip_List-1.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-7184\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/01\/Electronic_uC_Chip_List-1.png\" alt=\"\" width=\"1060\" height=\"512\" class=\"size-full wp-image-7184\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/01\/Electronic_uC_Chip_List-1.png 1060w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/01\/Electronic_uC_Chip_List-1-300x145.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/01\/Electronic_uC_Chip_List-1-800x386.png 800w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/01\/Electronic_uC_Chip_List-1-768x371.png 768w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/01\/Electronic_uC_Chip_List-1-150x72.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/01\/Electronic_uC_Chip_List-1-400x193.png 400w\" sizes=\"auto, (max-width: 1060px) 100vw, 1060px\" \/><\/a><p id=\"caption-attachment-7184\" class=\"wp-caption-text\">Microcontroller Comparison table: Arduino Nano, Attiny, ESP, etc.<\/p><\/div>\n<p>I typically start with the Arduino Nano based on the Atmel328P processor.  This has a small form factor (4.32 x 1.78cm), is breadboard-able (DIP-30 package), relatively economical at c.\u00a33.70 per unit, consumes 20mA without load, has 18 GPIO lines (not counting Rx\/Tx and A6\/A7 which are analogRead only), and is easy to prototype software applications with using my Arduino 328P version of Frank Sergeant&#8217;s <a href=\"http:\/\/pygmy.utoh.org\/3ins4th.html\" rel=\"noopener noreferrer\" target=\"_blank\">3-instruction Forth<\/a>. <\/p>\n<p>But for this application, the Arduino Nano is overkill.  We need at most 5 I\/O lines: 1 for the sensor, 2 more for independently triggering red\/green LEDs, 1 for the triggering the YS41F voice alert module, and 1 more optionally for the 100dB alarm.  Given that we will want to run it continuously for many hours, 20mA without load for the Nano is an additional 30% drain on the battery.  <\/p>\n<div id=\"attachment_6696\" style=\"width: 664px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2008.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6696\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2008.png\" alt=\"\" width=\"654\" height=\"293\" class=\"size-full wp-image-6696\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2008.png 654w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2008-300x134.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2008-150x67.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2008-400x179.png 400w\" sizes=\"auto, (max-width: 654px) 100vw, 654px\" \/><\/a><p id=\"caption-attachment-6696\" class=\"wp-caption-text\">Shrinking the PIR Sensor Footprint by moving from Arduino Nano to ATTiny 85.<\/p><\/div>\n<p>The ATTiny85 is just right.  It has a tiny form factor (1.40 x 0.76cm), is breadboard-able (DIP-8 package), less than half the cost of the Nano (c.\u00a31.50 ea with MOQ10), has no parasitic LEDs consuming power, consumes less than 1mA (300uA), and in most cases can use Arduino Nano code with almost no modification (apart from pin definitions and library inclusion).  The downside?  Only 5 I\/O pins, but for our application, this is as much as we need (and if we needed more, we could trade up to the ATTiny84 DIP-14 packages with 11 I\/O lines).<\/p>\n<p><strong>The Code<\/strong><br \/>\nThe code for the Arduino Nano can be as simple as <a href=\"http:\/\/www.mathscitech.org\/code\/avr\/003e_HC-SR501_PIR_human_detection_motion_sensor.avr\" rel=\"noopener noreferrer\" target=\"_blank\">30 lines of C code<\/a> to demonstrate the functionality of a PIR sensor.  But we want to do a bit mor so <a href=\"http:\/\/www.mathscitech.org\/code\/avr\/003e2_HC-SR501_PIR_human_detection_sensor_4_gpio_pins_Tiny85.avr\" rel=\"noopener noreferrer\" target=\"_blank\">our final code is 60 lines of C code<\/a> (twice the size 60).  Measured in size of executable, the code occupies 1.3kB of flash memory, and uses just 9 bytes (yes bytes) of SRAM for data\/variables.  It&#8217;s pretty small.  <\/p>\n<p>Arduino Nano&#8217;s are programmable from the Arduino IDE in the usual way: select Board (Nano) and Processor (Atmel328P Old Bootloader), set COM port, don&#8217;t worry about the programmer (none needed) and then Upload (Ctrl+U).<\/p>\n<p>What does the code do?  We instruct the microcontroller (uC) to wait a minute (60,000 ms) while the PIR sensor completes its background scan, and we flash the red LED every 6 seconds to give a visual cue that scanning is underway.  When background scanning is complete, we turn on the green LED (turn off red LED).  The PIR sensor is now active and in a continuous loop checking the PIR sensor&#8217;s signal line for a detection.  Any infra-red differential detection, typically caused by body heat movement, will trigger the PIR sensor to raise the signal line which the uC detects and runs alarm(ON) code.  We have configured the uC to toggle the LEDs (red now ON, green OFF) and activate a buzzer (later we will hack the buzzer signal to trigger the voice alert).  More complex response behaviour could be programmed if desired.<\/p>\n<p><strong>Programming the ATTiny85<\/strong><br \/>\nMigrating code from Nano to ATTiny85 is in most cases simply a matter of replacing pin definitions; the rest is the same.  It is best to use preprocessor definitions (#define, #ifdef\/#endif) to encapsulate the different pin definitions (e.g. #define NANO and #define Tiny85 or #define Tiny84)  This allows maintaining one source file and avoids duplicating source code.<\/p>\n<p>It is easiest to program ATTiny controllers if you use a programmer, e.g. the <a href=\"https:\/\/mathscitech.org\/articles\/electronics#TinyAVR\" rel=\"noopener noreferrer\" target=\"_blank\">TinyAVR USB Programmer board<\/a> which uses SPI to program the Tiny chips.  The programmer has an onboard DIP-8 socket for the Tiny85 uC, but I find it easier to externalize the connections to a breadboard where they can be mapped to either Tiny85 or Tiny84 (see wiring diagram below).<br \/>\n<div id=\"attachment_6697\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2011.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6697\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2011-800x412.png\" alt=\"\" width=\"640\" height=\"330\" class=\"size-large wp-image-6697\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2011-800x412.png 800w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2011-300x155.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2011-768x396.png 768w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2011-150x77.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2011-400x206.png 400w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2011.png 1075w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><p id=\"caption-attachment-6697\" class=\"wp-caption-text\">Physical Wiring of the ATTiny 85\/84 Microprocessor to the TinyAVR USB Programmer<\/p><\/div><\/p>\n<p>Additionally you&#8217;ll need <\/p>\n<ul>\n<li>Device Driver for TinyAVR USB Programmer (Windows) for ATTiny chips: <a href=\"https:\/\/cdn.sparkfun.com\/assets\/learn_tutorials\/2\/1\/4\/zadig_v2.0.1.160.zip\" rel=\"noopener noreferrer\" target=\"_blank\">Zadig Device Driver: libusb-win32 (v1.2.6.0)<\/a>.\n<li>Install Board files for Arduino IDE to enable uploading code: <a href=\"https:\/\/github.com\/damellis\/attiny\" rel=\"noopener noreferrer\" target=\"_blank\">download ATTiny 85\/84 board files<\/a> by David Mellis for Arduino.  Download ZIP, and unzip the attiny archive.  Then copy attiny\\ to ..\\arduino\\hardware\\ folder.\n<\/ul>\n<p>After restarting the Arduino IDE, the Board Menu should show some new boards at the bottom. Select Board ATTiny85 and Processor (ATTiny85), set the Programmer to USBTinyAVR, and then Upload using Programmer (Ctrl+Shift+U).<\/p>\n<div id=\"attachment_6815\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/arduino_compile_attiny85_00.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6815\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/arduino_compile_attiny85_00-800x284.png\" alt=\"\" width=\"640\" height=\"227\" class=\"size-large wp-image-6815\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/arduino_compile_attiny85_00-800x284.png 800w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/arduino_compile_attiny85_00-300x106.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/arduino_compile_attiny85_00-768x273.png 768w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/arduino_compile_attiny85_00-150x53.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/arduino_compile_attiny85_00-400x142.png 400w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/arduino_compile_attiny85_00.png 1034w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><p id=\"caption-attachment-6815\" class=\"wp-caption-text\">Programming ATTiny85\/84 bare chips from Arduino IDE using Tiny AVR USB Programmer.<\/p><\/div>\n<h4>5.4. Hacking the YS41F record\/playback module to trigger off the sensor<\/h4>\n<p>The <a href=\"https:\/\/mathscitech.org\/articles\/electronics#YS41F\" rel=\"noopener noreferrer\" target=\"_blank\">YS41F recordable voice alert module<\/a> is powered by 3x LR1130 button batteries in series (providing 4.5V).    There are several variations available on Amazon\/Ebay with different trigger events, including press-button-to-play, photoresistor (when light shines), reed switch or other mechanical sensor.  You&#8217;ll need to snip off the triggering functionality and replace with a trigger from the PIR sensor or, in our case, the microcontroller which is monitoring the PIR for a detection.<\/p>\n<div id=\"attachment_6855\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2087.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6855\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2087-300x209.png\" alt=\"\" width=\"300\" height=\"209\" class=\"size-medium wp-image-6855\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2087-300x209.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2087-150x105.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2087-400x279.png 400w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2087.png 657w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-6855\" class=\"wp-caption-text\">Hacking the YS-41F module to trigger playback when the sensor detects an event.<\/p><\/div>\n<p>The key is that the sensor&#8217;s detection trigger is wired to pin 4 of the TR16F and receives some small current when a detection event occurs.  We wire this (black dot\/wire) to the emitter end of a transistor whose base is connected to the PIR sensor&#8217;s detection line and whose source (red dot\/wire) is the 4.5V power from the YS41F module itself.  <\/p>\n<h3>6. Demonstrating the Talking Sensor with an April Fool&#8217;s Prank!<\/h3>\n<p>The final sensor package consists of three parts shown below: <\/p>\n<ul>\n<li>the &#8220;eye&#8221; (PIR sensor) is on an 20cm umbilical allowing it to be positioned optimally for detection.\n<li>the small breadboard holding the Tiny85 microcontroller (centre), CE012 DC to DC converter (top right), AAA battery with holder (bottom), transistor for the YS41F hack, and the green\/red LEDs signalling background data collection state (flashing red), active monitoring (green), and detection (red).\n<li>the YS41F record\/playback module, which is powered independently through its 3x LR1130 1.5V button batteries (4.5V total), and directly drives the 0.5W speaker (the volume is surprisingly loud!).\n<\/ul>\n<div id=\"attachment_6713\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/03-TalkingPIRsensor_17b_2021-04-03.jpg\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6713\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/03-TalkingPIRsensor_17b_2021-04-03-300x287.jpg\" alt=\"\" width=\"300\" height=\"287\" class=\"size-medium wp-image-6713\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/03-TalkingPIRsensor_17b_2021-04-03-300x287.jpg 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/03-TalkingPIRsensor_17b_2021-04-03-150x143.jpg 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/03-TalkingPIRsensor_17b_2021-04-03-400x382.jpg 400w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/03-TalkingPIRsensor_17b_2021-04-03.jpg 741w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-6713\" class=\"wp-caption-text\">Talking Sensor: HC-SR501 Passive Infra-Red (PIR) Sensor triggering YS41F Recordable Alert Module via ATTiny85 microcontroller, powered by 1 AAA battery boost converted using CE012 DC-DC converter<\/p><\/div>\n<p><strong>April Fool&#8217;s Day &#8212; A little fun with the Talking Motion Sensor<\/strong><\/p>\n<p>Ahead of April Fool&#8217;s Day this year, my daughter (9yo) had been cajoling me to come up with some pranks as she was planning some of her own.  For my part, I though to catch her and her brother (5.5yo) by surprise by bringing their <a href=\"https:\/\/www.pacey.org.uk\/news-and-views\/pacey-blog\/2016\/february-2016\/benefits-of-junk-modelling-and-non-directive-play\/\" rel=\"noopener noreferrer\" target=\"_blank\">junk-model robots<\/a> to life&#8230;  <\/p>\n<p>After the kids went to bed, I wired up the Talking PIR motion sensor described above.  I had previously written some compact Arduino Nano code for the PIR sensor, c. 30 lines of Arduino C-code which compiled down to a mere 900kB.  But the Nano while relatively small (compared to the Uno or Raspberry Pi), has nonetheless a bigger form factor than I wanted for this stealthy mission.  In addition, with its built-in LEDs always on and many more peripherals than I needed, it was consuming a hefty 100mW of power (20mA @5VDC) continuously on top of the thirsty PIR sensor&#8217;s 200mW current draw (couldn&#8217;t do anything about the latter).  With <a href=\"https:\/\/mathscitech.org\/articles\/electronics#battery-power\" rel=\"noopener noreferrer\" target=\"_blank\">a typical AAA battery holding approx 500mAh of power<\/a>, or 750mW over its life, a Nano would drain the battery after 3-4 hours.  I wanted this to run comfortably all night on a single AAA battery.  Porting to the ATTINY85 8-bit microcontroller takes a few minutes, and the 980 compiled bytes fits easily into the Tiny85&#8217;s 8KB flash memory (12% usage), requiring just 9 bytes (0.5%) of SRAM.  The 5 GPIO lines on the Tiny85 are more than enough to read the data signal from the PIR, toggle RED and GREEN status LEDs and trigger the voice alert module (one line left over).  Nicest, the Tiny85 is a small form factor (DIP-8) chip, which allows the whole device to be put together onto a 170 tie-point solderless breadboard, with a little hot glue holding the AAA battery holder.  The result is a lower power sensor, consuming just 90mW all-in (60mA * 1.5VDC), microcontroller + PIR sensor, which should be able to run continuously for 8 hours on a single AAA battery.  (The YS41F is separately powered through 3x LR1130 1.5V batteries in series.)<\/p>\n<p>Where to hide the sensor?  This was the most fun part.  The previous weekend, Jasmine (9yo) and Adam (6yo) had built some 2-foot high junk-modeling robots and we had been talking about how cool it would be if they could see and talk.  After a bit of testing and fixing (nothing ever goes right first time!), I set up their now enhanced seeing-and-talking robots at the bottom of the stairs and turned off the lights and went to bed.  <\/p>\n<div id=\"attachment_6699\" style=\"width: 625px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2024.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6699\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2024.png\" alt=\"\" width=\"615\" height=\"434\" class=\"size-full wp-image-6699\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2024.png 615w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2024-300x212.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2024-150x106.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2024-400x282.png 400w\" sizes=\"auto, (max-width: 615px) 100vw, 615px\" \/><\/a><p id=\"caption-attachment-6699\" class=\"wp-caption-text\">Adhesive on the backs of the YS41F and the 170 tie-point breadboard allow both to be mounted easily and (if desired) out of sight.  In the photo we deployed the system conspicuously on the shoulder of the junk model robot which is being animated (eyes and voice).<\/p><\/div>\n<p>The next morning, I heard the them excitedly chattering in the hallway.  Apparently, Jasmine had been caught red-handed as she crept down the stairs in the darkness to set up her gags before the rest of us awoke.  To her surprise, she was being called out by her own robot.  Mission accomplished \ud83d\ude42<\/p>\n<div id=\"attachment_6700\" style=\"width: 559px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2025.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-6700\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2025.png\" alt=\"\" width=\"549\" height=\"445\" class=\"size-full wp-image-6700\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2025.png 549w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2025-300x243.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2025-150x122.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2025-400x324.png 400w\" sizes=\"auto, (max-width: 549px) 100vw, 549px\" \/><\/a><p id=\"caption-attachment-6700\" class=\"wp-caption-text\">Success! Talking Motion Sensor runs all night and make the critical detections on April Fools morning.<\/p><\/div>\n<p><a id=\"demo-video\"><\/a><br \/>\n<strong>Demonstration Video<\/strong><br \/>\nWatch the video to see the Talking PIR Sensor in action on April Fool&#8217;s Day!<br \/>\n<iframe loading=\"lazy\" title=\"MathSciTech.org - April Fools Prank with Talking PIR Motion Sensor Alarm (ATTiny85, HC-SR501, YS41F)\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/2xI7lzWoR4I?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<hr>\n<h3>7. Epilogue: Looking Ahead<\/h3>\n<p>The potential for voice control in low-cost devices is not yet market saturated.  At scale, the electronics for the talking PIR sensor could likely be manufactured onto a surface mount PCB for \u00a32-\u00a33 ea.  Are there comparable products available on the market?  Not at this price point or ease of use.  Comparable products start at \u00a320.  They are more bulky (though with nice plastic housing), and remove the ability to aim the sensor and hide the electronics discretely, which this prototype allows.<\/p>\n<ul>\n<li>Talking Products makes a <a href=\"https:\/\/www.amazon.co.uk\/Motion-Multi-Track-feature-download-effects\/dp\/B00GJQGG66\" rel=\"noopener noreferrer\" target=\"_blank\">\u00a325 PIR motion sensor that plays a pre-recorded MP3 sound file<\/a> upon detection.\n<li>Another with an <a href=\"https:\/\/www.amazon.co.uk\/dp\/B08X6B517B\/\" rel=\"noopener noreferrer\" target=\"_blank\">outdoor housing for \u00a323<\/a>.\n<li><a href=\"https:\/\/www.amazon.co.uk\/dp\/B07PHXZ5XF\/\" rel=\"noopener noreferrer\" target=\"_blank\">Another for \u00a318<\/a>.\n<li><a href=\"https:\/\/www.talkingproducts.com\/products\/motion-sensor?variant=31454899339334\" rel=\"noopener noreferrer\" target=\"_blank\">Also here \u00a318<\/a>.\n<li><a href=\"https:\/\/www.heyimhome.co.uk\/all-products\/smart-motion-sensor\" rel=\"noopener noreferrer\" target=\"_blank\">smart motion sensor \u00a316<\/a>.\n<\/ul>\n<h4>Application ideas<\/h4>\n<ul>\n<li>Unmanned reception desk or check-out station plays a welcome\/greeting message as you approach and a human is sent.\n<li>Information\/instructions as you approach a vending machine or elevator.\n<li>A Halloween display where spooky sounds or a blood-curdling shriek sound as you approach pumpkin or door.\n<li>Cuddly toy &#8220;wakes up&#8221; and speaks as child approaches\n<li>COVID-safe Bathroom reminds you to wash your hands\n<li>Eco-friendly Light switch reminds you to shut off the light.\n<li>Security Gate\/Door reminds user please shut it.\n<li>Sound effects for a game (shooting, dodging, running, I&#8217;m hit!, different types of weaponry, car\/motorbike\/helicopter\/cannon).  Or sounds based on game\/simulation state e.g. acceleration\/deceleration\/skid\/crash.\n<li>Child-minding sensor that checks time when detecting child, and if it&#8217;s not morning says Go back to bed.\n<li><a href=\"https:\/\/www.sensory.com\/featured-products\/\" rel=\"noopener noreferrer\" target=\"_blank\">Sensory&#8217;s list of favorite Voice products (these are not cheap)<\/a>\n<\/ul>\n<h4>Other ideas?  Feel free to share yours, and your designs\/builds\/applications, in the comments below.<\/h4>\n<p><!-- 3 photos not included\nArticle started at: Apr 2, 2021 at 21:35\nArticle completed at: Apr 18, 2021 at 19:02\n\n[caption id=\"attachment_6698\" align=\"aligncenter\" width=\"640\"]<a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2017.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2017-800x533.png\" alt=\"\" width=\"640\" height=\"426\" class=\"size-large wp-image-6698\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2017-800x533.png 800w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2017-300x200.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2017-768x512.png 768w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2017-150x100.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2017-400x267.png 400w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.2017.png 840w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a> Integrating the YS41F Recordable Voice Alert module from the Motion Sensor to get the Talking Motion Sensor.[\/caption]\n\n[caption id=\"attachment_6688\" align=\"aligncenter\" width=\"640\"]<a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1983.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1983-800x247.png\" alt=\"\" width=\"640\" height=\"198\" class=\"size-large wp-image-6688\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1983-800x247.png 800w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1983-300x93.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1983-768x238.png 768w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1983-150x46.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1983-400x124.png 400w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1983.png 1083w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a> Junk Modeling - Jasmine & Adam Building Junk Model Robots, March 28th, 2021[\/caption]\n\n[caption id=\"attachment_6689\" align=\"aligncenter\" width=\"616\"]<a href=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1984.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1984.png\" alt=\"\" width=\"616\" height=\"269\" class=\"size-full wp-image-6689\" srcset=\"https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1984.png 616w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1984-300x131.png 300w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1984-150x66.png 150w, https:\/\/mathscitech.org\/articles\/wp-content\/uploads\/2021\/04\/screenshot.1984-400x175.png 400w\" sizes=\"auto, (max-width: 616px) 100vw, 616px\" \/><\/a> Junk Model Robots - standing watch outside the house.[\/caption]\n--><\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>Voice controlled hardware requires four capabilities: (1) vocal response to trigger events (sensors\/calculations-to-brain), (2) speech generation (brain-to-mouth), (3) speech recognition (ear-to-brain), and (4) speech understanding (brain-to-database, aka learning). These capabilities can increasingly be implemented using off-the-shelf modules, due to progress in advanced low-cost silicon capable of digital signal processing (DSP) and statistical learning\/machine learning\/AI. <\/p>\n<p> [Read More&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"categories":[192,7,132,188,18,12],"tags":[],"coauthors":[112],"class_list":["post-6663","post","type-post","status-publish","format-standard","hentry","category-building-technology","category-education","category-electronics","category-life-hacks","category-programming","category-technology","odd"],"views":9213,"_links":{"self":[{"href":"https:\/\/mathscitech.org\/articles\/wp-json\/wp\/v2\/posts\/6663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mathscitech.org\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mathscitech.org\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mathscitech.org\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mathscitech.org\/articles\/wp-json\/wp\/v2\/comments?post=6663"}],"version-history":[{"count":172,"href":"https:\/\/mathscitech.org\/articles\/wp-json\/wp\/v2\/posts\/6663\/revisions"}],"predecessor-version":[{"id":11974,"href":"https:\/\/mathscitech.org\/articles\/wp-json\/wp\/v2\/posts\/6663\/revisions\/11974"}],"wp:attachment":[{"href":"https:\/\/mathscitech.org\/articles\/wp-json\/wp\/v2\/media?parent=6663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mathscitech.org\/articles\/wp-json\/wp\/v2\/categories?post=6663"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mathscitech.org\/articles\/wp-json\/wp\/v2\/tags?post=6663"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/mathscitech.org\/articles\/wp-json\/wp\/v2\/coauthors?post=6663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}