Introduction: Tweet Using Arduino, ESP and Keypad
This instructable will go through We have made an project of evive under which you can tweet from your twitter account using the keypad by which you enter the text you want to tweet. This project is totally dedicated to thingspeak website. you can visit it here-
This website is built for IoT related stuff. It has several good apps and out of those we took the ThingTweet app.
In this you can tweet anything you, it may be any sensor reading, temperature etc.
Step 1: Components Required
Following are the components required to build the project:
- 4X4 Keypad
- Jumper Cables
- ESP8266 (ESP-12E)
- WiFi router or any internet source
Step 2: Make an ID on Thingspeak.com
First of all you need to make an user id on thingspeak.com . Just open the website and go to signup.
- In User ID option type your username you want for the thingspeak.
- In email type your email id of any domain you want.
- Then your time zone where you are living it is for synchronization of the time of your time zone and server.
- Then enter the password twice and signup.
Step 3: Steps to Link Your Twitter Account
Now you have to link your twitter account with your thingspeak ID. After logging in go to apps and select thingtweet app.
Now, click on the link twitter account tab -> authorize the app by clicking on its tab
Now if are already logged in to twitter in your browser then your account will be automatically linked otherwise you have to enter your twitter user id and password.
Now your twitter account has been linked.
Step 4: Learn Some Necesaary Stuff About ESP8266
As we are using the ESP8266 WiFi module, so you should have some knowledge about ESP8266. You can learn about ESP in our chatting with evive instructable.
evive have a dedicated adapter for ESP-12E version.
For this tweet you need to have an internet access via WiFi in your surrounding.
The ESP will connect to the internet and hence to thingspeak.com.
Step 5: Using 4X4 Keypad
The 4X4 keypad is a keypad similar to those in old mobile phones. With the Keypad.h library you can use it to input numbers and some special characters(A,B,C,D,* and #).
You can download the keypad library from our github link given above.
Step 6: Getting Multiple Text From One Button
The main task is to input text from the numpad.
Since there are 26 alphabets but only 10 numbers (0-10) on our keypad, we will have to assign multiple letters to a single key.
So we will keep a count of how many times a particular key is pressed consequetively within 500 ms. According to this data we will judge the required input.
Suppose we press 2 once. It should output 'a'. Pressing twice should output 'b', thrice 'c' and so on.
For storing the message we will use an empty string msg = '' and add all characters to it.
For using space we just have to add a blank space ' '. We have assigned button 0 for it.
However, backspace is a little different. For showing backspace on the tft, we have readjusted the index x and y to that of the previous character and replaced the character by a blank space.
In the stored message, we insert a \0 at the previous index and make it our current index.
Similarly, we have assigned some frequently used special characters (#,@,.) to the '1' button.
Step 7: Writing an Arduino Code for the Tweet
Now, you have your tweet to be tweeted as the text, now you have to tweet it to the twitter using thingspeak.com.
In your arduino code you need to give the data about where you will send the data lot more.
For this we have taken help from this link . You can also refer to it.
First of all you need to connect on the WiFi internet. ESP connects to the WiFi via AT command "AT+CWJAP=IP,PASS " where IP is name of your WiFi and pass is password of your WiFi.
Then you have to connect to the thingspeak site and you have to copy your API Key from thingspeak.
You have to send your data to this API , the above tutorial link has made the work a lot easier.
You can get the code from github repository from here .
Please note that in our code, we have set the wifi name and password and the thingspeak api key as global variable strings at the top of our code. You just need to change them there for the code to work.
Step 8: Finaly Start Tweeting
We have a be nice policy.
Please be positive and constructive.