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- 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.
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:
- 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!
The text message covfefe! will be sent every time the button is pushed.
5. ValidationPush firmly the button and wait for the butler to bring you a drink!
Comments