Project tutorial
LED Displayed Twitter Sentiment Analysis

LED Displayed Twitter Sentiment Analysis © MIT

With the power of Octoblu, you can control LEDs on an Arduino, or similar boards, based on sentiment analysis performed on recent tweets.

  • 1,331 views
  • 1 comment
  • 3 respects

Components and supplies

Apps and online services

About this project

This is a simple, fun project that will introduce you to Arduino boards, as well as Octoblu's IoT platform and messaging service, Meshblu.

Twitter Sentiment to LED Demo

With this you will be able to see how positive or negative the Tweets are for a specified hashtag on Twitter. We will see either a red, blue, or green LED get powered based on the sentiment analysis performed by Octoblu.

Octoblu is an Internet of Things platform that allows you to connect your devices to it, then send messages from one device to another, using Meshblu.

Throughout this guide, we will be setting up an Arduino, creating a custom Meshblu device, and then creating an Octoblu Flow.

Arduino Setup

I recommend an Arduino Uno, however, I used a Sparkfun RedBoard and it worked pefectly.

For the setup of the LEDs on your board, please look at this Fritzing Schematic:

Now all you need to do is burn standard firmata to it!

If you are unsure about how to burn firmata to your board, here is a great guide for Arduino beginners.

Now that you have standard firmata on your board, we can control the pins via Octoblu by creating a custom Meshblu device.

Custom Meshblu Device Setup

There is a meshblu-custom-device-boilerplate, which I recently added an arduino branch to. This branch already has everything you need for this project...

Clone the repository, switch to the arduino branch, and install dependencies:

git clone git@github.com:ASteinheiser/meshblu-custom-device-boilerplate.git
cd meshblu-custom-device-boilerplate
git checkout arduino
npm install

Now we will need to create a meshblu.json file with meshblu-util. This is Meshblu's way of creating credentials for your new device.

Install meshblu-util, then register the device:

npm install --global meshblu-util
meshblu-util register -o > meshblu.json

Note: We pass the -o or --open flag, is so that it creates a v1 device in Meshblu. We are currently working on the transition to v2 devices, however, for now custom devices need to be v1.

Claiming your device with meshblu-util should open up a browser window asking you to login and then claim the device to your account:

meshblu-util claim

And with that, you have your device on your Octoblu account. Now we can design a flow to use your new device!

Note: You could also try to create your own custom Meshblu device with Johnny-Five and our Meshblu socket-io library.

Octoblu Flow Setup

I recommend importing my example Flow for this project:

So, when you hit the Trigger on this Flow, it will do a number of things:

  • Gets Tweets that contain a specified hashtag
  • Breaks the Tweets into individual messages
  • Throttles each Tweet by 3 seconds
  • Performs sentiment analysis on each Tweet
  • Decides which LED to turn on based on the results of the analysis

Note: You will also notice another instance of our custom Meshblu device, called Turn off Leds. This will do exactly that, and I made sure to connect it to the trigger and the throttle. This is so each time you trigger the flow, it will turn the LEDs off. Also, if you have, for example, two positive Tweets in a row, the LED will flicker off briefly to show that multiple Tweets were analyzed.

Code

Schematics

Arduino with 3 LEDs
Screen%20shot%202016 06 21%20at%203.36.46%20pm

Comments

Similar projects you might like

Twitter Controlled Reaper via Octoblu

Project tutorial by Octoblu Team

  • 1,526 views
  • 0 comments
  • 7 respects

Bluetooth control led with lcd led status display real time.

Project tutorial by Youssef Sabaa

  • 27,262 views
  • 4 comments
  • 52 respects

Twitter Sentiment Gadget

Project tutorial by IdiotWare Team and Rupin Chheda

  • 1,393 views
  • 0 comments
  • 2 respects

LED Emergency Lights using WS2812 RGB LED Module

Project tutorial by bigboystoys13

  • 14,744 views
  • 7 comments
  • 35 respects

4x4x4 LED cube with Arduino Uno and 1sheeld

Project tutorial by Hassan Ibrahim

  • 35,143 views
  • 7 comments
  • 64 respects

LED Cube

Project tutorial by Praditha Alwis

  • 10,109 views
  • 0 comments
  • 17 respects
Add projectSign up / Login