Christopher Konopka
Published © GPL3+

Saying Happy Birthday to My Grandma with #TwilioIoT

Press a button and a text-to-speech voice will call my grandmother with a birthday message.

BeginnerProtip513
Saying Happy Birthday to My Grandma with #TwilioIoT

Things used in this project

Hardware components

Programmable Wireless
Twilio Programmable Wireless
×1
Wio LTE US Version - 4G, Cat.1, GNSS, JavaScript(Espruino) Compatible
Seeed Studio Wio LTE US Version - 4G, Cat.1, GNSS, JavaScript(Espruino) Compatible
×1
LTE Antenna
×1
Lithium battery
×1
Micro-USB to USB Cable (Generic)
Micro-USB to USB Cable (Generic)
×1

Software apps and online services

Twilio - TwiML
Arduino IDE
Arduino IDE

Story

Read more

Schematics

Complete Wio LTE setup

Code

TwiML - Call with Text-to-Speech message

XML
Route phone number to call
<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Dial callerId="YOUR_TWILIO_NUMBER">
        <Number url="TWIML_BIN_URL">{{To}}</Number>
    </Dial>
</Response>

TwiML - Text-to-Speech Message

XML
<?xml version="1.0" encoding="UTF-8"?>
<Response>
        <Say voice="Polly.Joey" language="en-US">Happy Birthday Gram! I love you.</Say>
</Response>

Arduino IDE - Wio

Arduino
#include "wio_tracker.h"

#define BUTTON_PIN  (D38)

WioTracker wio = WioTracker();
int counter = 0;

void setup()
{
  // Grove Button Setup
  pinMode(BUTTON_PIN, INPUT);

  // Wio LTE Setup
  SerialUSB.println("Wait for power on...");
  wio.Power_On();
  SerialUSB.println("Power On O.K!");

  // Wio LTE Initialization
  while (!wio.init()) {
    delay(1000);
    SerialUSB.println("Accessing network...");
  }
  SerialUSB.println("Initialize done...");

  // Connect to the network
  bool ret = wio.waitForNetworkRegister();
  if (true == ret) {
    SerialUSB.println("Network accessed!");
  } else {
    SerialUSB.println("Network failed!");
    return;
  }
  SerialUSB.println("Ready!");
}

void loop()
{
  // Define Grove Button state
  int buttonState = digitalRead(BUTTON_PIN);

  // Define the counter functionality
  if (buttonState == 0) {
    // Zero counter
    counter = 0;
  } else {
    // Continue counter
    counter++;
    // Catch only 1 press, no duplicate calls
    if (counter == 1) {
      SerialUSB.println("Happy Birthday sent!");
      wio.callUp("GRANDMA_PHONE_NUMBER");
    }
  }
  delay(100);
}

Github

https://github.com/cskonopka/TwilioIoT

Github

https://github.com/Seeed-Studio/Wio_LTE_Arduino_Library

Credits

Christopher Konopka
10 projects • 20 followers
I love connecting things
Contact

Comments

Please log in or sign up to comment.