Controlling ESP8266 with Twitter

I want to make a little device that can be controlled by members of the public without installing any specialist software on their phones. Something like changing the colour of an rgb led.

From an interface point of view Twitter makes sense - instructions would be to tweet @ a particular address.

Unfortunately I’m finding it hard to do my usual and copy something someone else has done before because my google skills are turning up things where the ESP8266 sends tweets rather than reacts to them.

Firstly, am I missing a better way to do this? Secondly, has anyone ever done anything like this before?

Recent example is the panic sign

I got a Raspberry Pi to host its own web page as a control panel for the installation I made last year. Abandoned that approach in the end for other reasons, but got plenty of tutorials for ‘Python embedded web server’ search or something similar.

But making a request to the Twitter API is perhaps more straightforward, it’s at least one single conceptual thing, rather than the melange of stuff needs to make and host a webpage. Start by looking at the API equivalent of twitter.com/search. I’ve got an implementation, but it’s in objective-c.

See https://dev.twitter.com/rest/public/search or at least use the key word there for a search of stack overflow / hackaday etc.

1 Like

Have a vague idea that Node Red works on the ESP8266?

Might make it simple?

1 Like

ESP8266 can host a web page really easily if you just want some simple commands. these commands could be RED, GREEN etc or you could do simple buttons to then control the LED

It Should be able to use the twitter API, like you say I’ve seen Writes but not Reads…

I’ve been using the ESP8266 a lot recently and it still amazes me how good it is for a couple of $ !

Courty

The need for authorization is making my head hurt…

It’s relatively simple, but it is a bit of a dance… You should be able to get the tokens from the developer console…

In https://apps.twitter.com go to your app, then Keys and Access Tokens, then Create my access token.

For one off installs like this it bypasses the need for oauth.

Sigh. I couldn’t get my head around the authorisation thing. Brit I’m not giving up on it just yet - I’ll file it under ‘things if need to look up properly later’.

I did get the project working though. But maybe not in a very elegant way…

I have use d IFTTT ( if this then that ) to set up a recipe using the maker channel. This does the Twitter search for me, and posts a web request to thinger.io when it finds a particular hashtag. My ESP8266 talks to thinger.io and receives the data and acts on it.

Except IFTTT Twitter searches only happen every 15 minutes or so which is too long to wait.

So then I find out that SMS triggers are instant(ish) so now the IFTTT recipe forwards any texts to my phone with a particular hashtag in them to thinger.io and thence to the ESP8266. Phew. So I have a text controlled RGB led instead.

Next time we’re in the space together we can look at it. It’s totally doable, but yeah, not lego-like.

1 Like