Industrial manufacturing
Industrial Internet of Things | Industrial materials | Equipment Maintenance and Repair | Industrial programming |
home  MfgRobots >> Industrial manufacturing >  >> Manufacturing Technology >> Manufacturing process

Build a Remote Text‑Messaging Button with Sigfox & Twilio

Components and supplies

Build a Remote Text‑Messaging Button with Sigfox & Twilio
Arduino MKR Fox 1200
×1

Apps and online services

Build a Remote Text‑Messaging Button with Sigfox & Twilio
Sigfox
Build a Remote Text‑Messaging Button with Sigfox & Twilio
Twilio SMS Messaging API

About this project

Introduction

We have all heard about the button used by Trump to order a Diet Coke right? (http://time.com/4758059/donald-trump-coke-nuclear-button/)

Well we thought we could build a better version using Sigfox network. All you need is a bulky button, an Arduino MKRFox1200 board and a Twilio account to send the text message.

What is Sigfox?

Sigfox provides a global, simple and energy-efficient network for the Internet of Things. Sigfox network is currently available or being rolled-out in 32 countries. The network complements existing high-bandwidth systems by providing economical, low-power, two-way transmission of small quantities of data over long distances. Sigfox technology is supported by hundreds of hardware and solution partners.

1. Hardware requirements

  • Arduino MKRFox1200
  • A big button
  • LiPo battery or 2xAA/AAA batteries
  • A pushbutton switch
  • thethings.io sticker
  • And of course a Trump mask

We are using a pushbutton switch connected to pins 7 and GND of the Arduino. In normal state, the switch is closed. When pushing the button it opens the switch. The switch state can easily be reversed in the Arduino code.

Build a Remote Text‑Messaging Button with Sigfox & Twilio
Build a Remote Text‑Messaging Button with Sigfox & Twilio
Build a Remote Text‑Messaging Button with Sigfox & Twilio
Build a Remote Text‑Messaging Button with Sigfox & Twilio
Build a Remote Text‑Messaging Button with Sigfox & Twilio
Build a Remote Text‑Messaging Button with Sigfox & Twilio
Build a Remote Text‑Messaging Button with Sigfox & Twilio

2. Arduino code

You can retrieve the Arduino code on GitHub: https://github.com/aureleq/TrumpButton

We use the low power library to put the board in deep sleep. An interrupt is used to wake-up the board and send a Sigfox message:

// attach switch pin and enable the interrupt on voltage rising event
 pinMode(SWITCH_PIN, INPUT_PULLUP);
 LowPower.attachInterruptWakeup(SWITCH_PIN, buttonPressed, RISING); // switch is closed by default, open when pushing the button
void loop()
{
 // Sleep until an event is recognized
 LowPower.sleep();
 // if we get here it means that an event was received
 Serial.println("Button pushed!");
 delay(100);
 sendString(payload);
}

3. Twilio

  • Sign up for free here
  • Add a new number in the "Verified Caller IDs" (phone number to receive the notification)
  • Take note of your generated Twilio Phone Number, ACCOUNT SID and Auth TOKEN:
Build a Remote Text‑Messaging Button with Sigfox & Twilio

4. Sigfox callback configuration

  • Connect to your Sigfox backend account. If you haven't registered your Arduino board, you can activate it here: https://backend.sigfox.com/activate/
  • Select the Device Type of your Arduino device. Link to the Device Type is available under the Information category.

Create a new custom callback with the following parameters:

  • Type: DATA UPLINK
  • Channel: URL
  • URL pattern: https://[AccountSID]:[AuthToken]]@api.twilio.com/2010-04-01/Accounts/[AccountSID]/Messages.json
  • Use HTTP Method: POST
  • Content-Type: application/x-www-form-urlencoded
  • Body: From=[YourTwilioPhonenumber]]&To=[PhoneNumber]&Body= covfefe!
Build a Remote Text‑Messaging Button with Sigfox & Twilio

The text message covfefe! will be sent every time the button is pushed.

5. Validation

Push firmly the button and wait for the butler to bring you a drink!

Build a Remote Text‑Messaging Button with Sigfox & Twilio

Code

  • Arduino source code
Arduino source codeArduino
/*
 * @aureleq
 *
 * Description: Sends a Sigfox message when pushing a button
 * Button needs to be wired between GND and pin 7 by default
 * Interrupts are being used to enable low power mode.
 * As board with be in sleeping mode most of the time, a board reset needs to be performed to upload a new sketch (double tap on reset button)
*/

#include <SigFox.h>
#include <ArduinoLowPower.h>

const uint8_t SWITCH_PIN = 7;
const String payload = "COKE NOW!";
const uint8_t debug = false;

void setup() {

  if (debug == true) {
    Serial.begin(9600);
    while (!Serial) {};
  }
  
  if (!SigFox.begin()) {
    Serial.println("Shield error or not present!");
    return;
  }
  // Enable debug led and disable automatic deep sleep
  // Comment this line when shipping your project :)
  //SigFox.debug();

  Serial.println("Sigfox shield detected");
  String ID = SigFox.ID();
  Serial.println("ID  = " + ID);
  delay(100);

  // Send the module to the deepest sleep
  SigFox.end();

  // attach switch pin and enable the interrupt on voltage rising event
  pinMode(SWITCH_PIN, INPUT_PULLUP);
  LowPower.attachInterruptWakeup(SWITCH_PIN, buttonPressed, RISING); // switch is closed by default, open when pushing the button

}

void loop()
{
  // Sleep until an event is recognized
  LowPower.sleep();

  // if we get here it means that an event was received
  Serial.println("Button pushed!");
  delay(100);
  sendString(payload);
}

void sendString(String str) {
  // Start the module
  SigFox.begin();
  // Wait at least 30mS after first configuration (100mS before)
  delay(100);
  // Clears all pending interrupts
  SigFox.status();
  delay(1);

  SigFox.beginPacket();
  SigFox.print(str);

  int ret = SigFox.endPacket();  // send buffer to SIGFOX network
  if (ret > 0) {
    Serial.println("No transmission");
  } else {
    Serial.println("Transmission ok");
  }

  Serial.println(SigFox.status(SIGFOX));
  Serial.println(SigFox.status(ATMEL));
  SigFox.end();
}


void buttonPressed() {
}
Github
https://github.com/aureleq/TrumpButton

Manufacturing process

  1. Capture Water Droplets in Action Using Arduino Nano – DIY High-Speed Photography
  2. Giftduino: The Ultimate Arduino Gift Set for Hobbyists and Educators
  3. Create a Custom Punchable Keyboard Button with Arduino: A Step-by-Step Guide
  4. Build a SmartThings‑Enabled IR Bridge with Arduino UNO & ThingShield
  5. Arduino MKR FOX 1200 Sigfox Weather Station – Low‑Power IoT Solution
  6. Build Your Own RC Monster Truck: The Badland Brawler Powered by Arduino
  7. WALTER: An Arduino‑Powered Photovore Insect Robot
  8. Control Your Robot with Brainwaves: A Comprehensive Arduino Project
  9. Custom Arduino HID CNC Pendant – DIY, Cost‑Effective Control
  10. Ultrasonic Smart Glasses: Enhancing Mobility for the Visually Impaired