Working Principle of the Voice Control Version 1

Update as of 6 July: There was a problem with Particle.io, and we changed our service to Adafruit.io. The latest version, version 2 can be found here.

In this page, we will go into detail about how the voice control works. Figure 4 shows a brief overview of the working principle of the voice control. Disclaimer: This page is not meant as a tutorial, and the order of the explanation does not follow the order of creation. In fact, the order of creation is reversed, meaning the Raspberry Pi was set up with Particle.io before the IFTTT applet was created, etc.

Figure 4: A brief overview of the working principle of the voice control.
Part 1: Using a smartphone’s built-in speech recognition

For Apple users, the “Shortcuts” application introduced in iOS 12 allows for the addition of custom commands that can be activated through Apple’s voice assistant, Siri. IFTTT’s Webhooks were used as triggers. In simple terms, by setting up Webhooks, if a URL is pinged, it acts as a trigger for the Applet in IFTTT, which runs whatever logic is in the Applet. This means that in Shortcuts, we need to create a shortcut that automatically accesses the correct URL whenever we say “Hey Siri, <Shortcut name>”. An example is shown in Figure 5a-5c below.

 

 

Part 2: Connecting IFTTT Applet with Webhooks and Particle.io
Figure 6: An IFTTT Applet was created. The trigger is from Webhooks. When the correct URL is pinged, a function will be called on a device that was connected to the Applet. In this case, the function “speed_0” was called.

The name of the IFTTT Applet that was created is turn_off, which corresponds to the name of the Applet connected in Part 1. When the URL is pinged, this applet will run.

Part 3: The code in Particle.io

In the Particle.io IDE, we have written a code that

  1. Connects to IFTTT and subscribes to the events
  2. Activates certain output pins when the appropriate event is registered
1. Connecting to IFTTT

In the void setup() section of the code, which only runs once, Particle.subscribe("turn_off", speed_0) runs the function speed_0 in the code when the event "turn_off" is triggered.

2. Activating the output pins

In the void loop() section of the code, which runs forever, a few if-else statements were used to check whether any of the buttons should be pushed. The full code can be viewed here.