NodeMCU talking to twitter via ThingSpeak

NodeMCU posting data to Twitter
NodeMCU posting data to Twitter
Connecting NodeMCU to twitter:

In this blog we will see how to post a tweet from nodeMCU (Connecting NodeMCU to twitter). Making nodeMCU talking to twitter server is difficult , we will use ThingSpeak to do the heavy lifting we will simply post some thing to ThingSpeak and things speak will take care forwarding it to twitter.

First you need to login in to thingspeak.com -> Apps-> ThingTweet (you need to link you twitter account with ThingTweet and ThingTweet will give you API_KEY which we need to post data to the ThingSpeak)

ThingTweet

 

You need to get a build for your nodeMCU, that includes HTTP module. you can build a custom image form here. You can follow this blog to update the ROM.

The operation itself is very simple , we will post our update to ThingTweet and ThingTweet will relay the same to twitter.

config.lua -> In this file we will store the wifi details (update your WiFi connection details in this file)
setup.lua -> This script is responsible for making the wifi connection
app.lua -> This file contains the actual application logic,Make sure you upadate API_KEY in this file
init.lua -> NodeMCU will execute this file on startup, we will use this script to bootstrap our application

You need load all this files to nodeMCU and reset the nodeMCU. The init.lua will automatically  start executing.

The code is available in GitHub

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *