[Blogging Intensifies]

Technology, Projects, Linux, Coding, Internet of Things, Music, Books, Life...

  • About
  • Privacy Policy

CHIP

Next Thing CHiP as a Twitter Bot

September 27, 2016

twitter-logoThere was a post that came across on Medium recently, How to Make a Twitter Bot in Under an Hour.  It’s pretty straight forward, though it seems to be pretty geared towards non “techie” types, mostly because it’s geared towards people making the bot on a Mac and it uses something called Heroku to run the bot.  Heroku seems alright, except that this sort of feels like an abuse of their free tier, and it’s not free for any real projects.

I already have a bunch of IOT stuff floating around that’s ideal for running periodic services.  I also have a VPS is I really wanted something dedicated.  So I adapted the article for use in a standard Linux environment.  I used one of my CHiPs but this should work on a Raspberry Pi, an Ubuntu box, a VPS, or pretty much anything running Linux.

The first part of the article is needed, set up a new Twitter account, or use one you already have if you have extras.  Go to apps.twitter.com, create an app and keys, keep it handy.

Install git and python and python’s twitter extension.

sudo apt-get install git

sudo apt-get install python-twitter

This should set up everything we’ll need later.  Once it’s done, close the repository.

git clone https://github.com/tommeagher/heroku_ebooks.git

This should download the repository and it’s files.  Next it’s time to set up the configuration files.

cd heroku_ebooks

cp local_settings_example.py local_settings.py

pico local_settings.py

This should open up an editor with the settings file open.  It’s pretty straight forwards, you’ll need to copy and paste the keys from Twitter into the file, there are 4 of them total, make sure you don’t leave any extra spaces inside the single quotes.  You’ll also need to add one or more accounts for the bot to model itself after.  You’ll also need to change DEBUG = TRUE to DEBUG = FALSE as well as adding your bot’s username to the TWEET_ACCOUNT=” entry at the bottom.

Once that is all done do a Control+O to write out the file and Control+X to exit.  Now it’s time to test out the bot with the following…

python ebooks.py

It may pause for a second while it does it’s magic.  If you get the message ” No, sorry, not this time.” it means the bot decided not to tweet, just run the command again until it tweets, since we’re testing it at the moment.  If it worked, it should print a tweet to the command line and the tweet should show up in the bot’s timeline.  If you get some errors, you may need to do some searching and troubleshooting, and double check the settings file.

Next we need to automate the Twitter Bot Tweets.  This is done using Linux’s built in cron.  But first we need to make our script executable.

 chmod 755 ebooks.py

Next, enter the following….

sudo crontab -e

Then select the default option, which should be nano.  This will open the cron scheduler file.  You’ll want to schedule the bot to run according to whatever schedule you want.  Follow the columns above as a guide.  For example:

# m h  dom mon dow   command

*/15 * * * * python /home/chip/heroku_ebooks/ebooks.py

m = minutes = */15 = every 15 minutes of an hour (0, 15, 30, 45)

h = hour = * (every hour)

dom = day of month = * = every day and so on.  The command to run, in this case, is “python /home/chip/heroku_ebooks/ebooks.py”.  If you’re running this on a Raspberry Pi, or your own server, you will need to change “chip” to be the username who’s directory has the files.  Or, if you want to put the files elsewhere, it just needs to b e the path to the files.  For example, on a Raspberry Pi, it would be “python /home/pi/heroku_ebooks/ebooks.py”.

If everything works out, the bot should tweet on schedule as long as the CHIP is powered on and connected.  Remember, by default the bot only tweets 1/8th of the time when the script is run (this can be adjusted in the settings file), so you may not see it tweet immediately.

This is also a pretty low overhead operation, you could conceivably run several Twitter Bots on one small IOT device, with a staggered schedule even.  Simply copy the heruko_ebooks directory to a new directory, change the keys and account names and set up a new cron job pointing to the new directory.

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Reddit (Opens in new window)
Posted in: CHIP, Coding Tagged: CHIP, Projects, Python, Raskberry Pi, Twitter

Internet of Things, Internet of Stuff

June 21, 2016

I wanted to take some time to touch on my every changing collection of Internet of Things style devices.  Honestly, it’s kind of iffy what constitutes an “IOT” device, but for the most part I’m sticking with “cheap” and “non traditional computing devices”.

The chief player among these are of course…

The Raspberry Pi

I’m up to 5 Raspberry Pis, a B+, two B2s, one B3, and one Pi Zero.  I have already discuss these quite a bit so they don’t need a ton of additional discussion.  The B+ still operates my DNS/DHCP server, one B2 still runs my IRC stuff, one B2 still runs a Minecraft server.  I actually have not yet come up with a good use for the B3 and Zero yet.  I’ve started messing with Windows 10 IOT on the B3 a bit and there is a Retro Gaming GameBoy project using the Pi Zero floating around on Reddit I may have a go at.

Arduino

If Raspberry Pi is the king of IOT, then Arduino is definitely the Queen. I’ve kind of dropped out of doing Arduino projects a bit and dismantled most of the ones I had built.  Other than adding a WiFi enabled board to my set (by mistake, I thought I was ordering a Shield not a board), not much has changed on my Arduino library.

i did try to build a little digital hourglass project I found online but it’s not going super great.  Stay Tuned for More

Next Thing’s CHIP

CHIP is still one of the most annoying and impossible to search for terms online.  I’m up to three CHIPs now, I’ve received my second Kickstarter CHIP and my VGA DIP.  I’ve still been having some bad luck getting my CHIPs to do much of anything.  I tried to build an Amazon Alexa with no luck in the end after a ton of troubleshooting.  I’ve been trying to get Synergy combined and running on one to let it work with my multi monitor set up.

Now that the Kickstarter campaign is more or less finished and the CHIP is reaching a wider audience I’m hoping it starts to get more support online.

Remix Mini

Another kickstarter product, the Remix Mini is a small computer that runs Android as a desktop.  It works pretty well, I mostly used it last year while traveling for work in the Hotel Room.  I have not touched it since, for one simple, stupid reason.  The HDMI output doesn’t support any of my HDMI to DVI cables.  I can’t plug it into a regular monitor, so I just have… not used it.  I could plug it into a TV but it’s effectively a simple desktop machine and doesn’t work as well for a “lean back” experience.  Maybe if I had a wireless KB and Mouse it would work better.

It’s a shame to because I was really looking forward to this one and it runs a lot of my apps surprisingly well.

ChromeCast

I picked up a Chromecast last year on Black Friday. I used it a bit but in the end, it’s ended up in a drawer.  It’s just too much of a hassle and it caused too many problems.  First off, the hassle.  My crappy old Nexus 7 is partially to blame here but in general the lack of any built in interface is just a flat out pain.  Having to dig out my tablet to use it is a pain.

Worse yet, it was causing problems with the Wireless in the house.  I disabled guest mode which eliminated the problem (eliminating the interference) but it’s still kind of lame that it was an issue to start with.

Kindle Fire Stick

A more recent addition to the network, I added a Kindle Fire Stick.  This is effectively the same as the Chromecast, without the hassle and bull shit of needing a separate device to use it.  It’s not completely without it’s issues but it works pretty well.  The main problem I’ve had is that it loses signal, a lot.  It doesn’t work as all directly hooked to my HDMI switch and at this point it’s cabled out and laying out on the floor behind everything to get it away from any interference.

It runs Amazon videos, which I don’t really use, it runs Netflix, which is used a lot.  It also works well with the fact that I buy my MP3s primarily through Amazon.  Another nice bonus, I use Amazon Cloud to backup all of my Photos, so they are all available through the Fire Stick now to view on the TV.

SteamBox

 Another newer addition is the SteamBox.  Specifically, the cheap streaming box.  It works pretty nicely.  I haven’t had a chance to really put it through the loops yet but my first tests worked well.  I’ll probably do a more in depth write up at some point on it.

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Reddit (Opens in new window)
Posted in: Arduino, CHIP, Devices, Raspberry Pi Tagged: Arduino, Chromecast, FireStick, IOT, NextThing CHIP, Raspbery Pi

NextThing CHIP and Raspberry Pi Zero

May 10, 2016

Raspberry Pi Zero and Next Thing's CHIPI’ve already briefly discussed my NextThing CHIP computers before. A few weeks ago I was purchasing a Raspberry Pi 3 and found that the store had Pi Zeros in stock as well, so I tossed one on because, hey, $5, and they are apparently hard to find.

These two little devices are pretty similar, but at the same time so different.

Both are small computers, not just microcontrollers like an Arduino, but little Linux machines. Both have GPIO pins, both can be used as a regular “desktop” if you wanted, both cost less than $10… Mostly…

Raspberry Pi ZeroThe cost is where things get tricky, especially for the Raspberry Pi Zero. Upfront, the Pi Zero is only $5, which looks great on paper, and it’s still pretty cheap. That five dollars gets you a small flat circuit board with a few low profile ports on it. Chances are you’ll need a power supply, if you want to be able to configure it at all you’ll also need a way to plug a standard USB hub for keyboard and mouse into a micro USB port. The display out is a mini HDMI port, which you’ll likely also need an adaptor for. The Pi Zero also doesn’t have any sort of case on it. All of this is stuff that you may or may not need, you might have on hand, or, if you’re programming many Zeros, you can reuse the adapters and parts on all of the Pi Zeros you want, once configured.

The point is, after picking up even some cheap accessories, you’re probably looking at closer to $15 for a Pi Zero. Still cheap, just not quite AS cheap.

Next Thing CHIPThe CHIP on the other hand, is $9. It has built in WiFi and Bluetooth, it comes with a little plastic case for the underside of the board, and it comes with an RCA adapter. The RCA isn’t ideal and an HDMI or VGA attachment are both coming (for $10-$15) but the RCA is usable for setting up WiFi easily for SSH or VNC access. It even has built in storage. For $9, you’re pretty much up and running right out of the box. The Pi Zero is actually kind of useless all on it’s lonesome.

That doesn’t necessarily mean the CHIP is better.

Both The Raspberry Pi Zero and Next Thing’s CHIP run an arm based version of Debian (by default, but this could be changed), thus both have a lot of common in terms of what sorts of software can be used. The CHIP however seriously lacks the Raspberry Pi’s strong community. I’ve not been able to find any decent resources for how to even use the GPIO pins, for example. I had hoped to use one of my CHIPs for a project in the garage but I’ve hit some roadblocks.

chipdesktopI’ve actually had lots of roadblocks with the CHIP. Initially they were unstable, requiring a firmware update. I’ve had many strange problems getting software packages to work properly, even when following tutorials put out by others. The closest I’ve come to finishing a project is making a homemade Alexa clone. Even after buying identical parts (Mic and Button really), after trying many fixes and even wiping the thing out and starting from scratch, I still get errors with the Audio about “Period too large”.

Everything being built in is really convenient though. I honestly haven’t come up with any ideas yet for what to do with my Pi Zero. It ends up with some goofy dongles all over it to make it functional and I have 4 full sized Raspberry Pis at my disposal for other projects. I’ve seen an interesting Game Boy emulator build using the Zero I will probably try but so far, it’s pretty much just been running quietly on my workspace counter.

Personally, I think that ultimately it comes down to there is a point where these things become too cheap or small to be useful, at least for my needs. The sorts of projects a smaller board like this may be useful for feel like they would be better suited for an Arduino. Most of the projects I use my Pis for amount to “Hardware VMs”. Single task servers that can easily be repurposed or swapped out (using SD cards).

 

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Reddit (Opens in new window)
Posted in: Arduino, CHIP Tagged: CHIP, NextThing, PiZero, Raspberry Pi, RaspberryPi Zero
1 2 Next »
Mastodon LinkedIn email
Instagram Instagram GitHub
JoshMiller.net
Lameazoid.com

Categories

  • collapsCat options: Array ( [title] => Categories [showPostCount] => 1 [inExclude] => exclude [inExcludeCats] => [showPosts] => 0 [showPages] => 0 [linkToCat] => 1 [olderThan] => 0 [excludeAll] => 0 [catSortOrder] => ASC [catSort] => catName [postSortOrder] => ASC [postSort] => postTitle [expand] => 0 [defaultExpand] => [debug] => 1 [postTitleLength] => 0 [catfeed] => none [taxonomy] => category [post_type] => post [postDateAppend] => after [postDateFormat] => m/d [showPostDate] => 1 [useCookies] => 1 [postsBeforeCats] => 1 [expandCatPost] => 1 [showEmptyCat] => 1 [showTopLevel] => 1 [useAjax] => 0 [customExpand] => [customCollapse] => [style] => kubrick [accordion] => 1 [title_link] => [addMisc] => 1 [addMiscTitle] => [number] => 3 [includeCatArray] => Array ( ) [expandSym] => ► [collapseSym] => ▼ ) postsToExclude: Array ( ) CATEGORY QUERY RESULTS Array ( [0] => WP_Term Object ( [term_id] => 486 [name] => Advent of Code 2020 [slug] => advent-of-code-2020 [term_group] => 0 [term_taxonomy_id] => 486 [taxonomy] => category [description] => [parent] => 172 [count] => 12 [filter] => raw ) [1] => WP_Term Object ( [term_id] => 156 [name] => Android [slug] => android [term_group] => 0 [term_taxonomy_id] => 156 [taxonomy] => category [description] => [parent] => 155 [count] => 3 [filter] => raw ) [2] => WP_Term Object ( [term_id] => 135 [name] => Arduino [slug] => arduino [term_group] => 0 [term_taxonomy_id] => 135 [taxonomy] => category [description] => [parent] => 153 [count] => 8 [filter] => raw ) [3] => WP_Term Object ( [term_id] => 438 [name] => Books [slug] => books [term_group] => 0 [term_taxonomy_id] => 438 [taxonomy] => category [description] => [parent] => 436 [count] => 4 [filter] => raw ) [4] => WP_Term Object ( [term_id] => 368 [name] => CHIP [slug] => chip [term_group] => 0 [term_taxonomy_id] => 368 [taxonomy] => category [description] => [parent] => 153 [count] => 5 [filter] => raw ) [5] => WP_Term Object ( [term_id] => 172 [name] => Coding [slug] => programming [term_group] => 0 [term_taxonomy_id] => 172 [taxonomy] => category [description] => [parent] => 153 [count] => 13 [filter] => raw ) [6] => WP_Term Object ( [term_id] => 247 [name] => Copyright and You [slug] => copyright-and-you [term_group] => 0 [term_taxonomy_id] => 247 [taxonomy] => category [description] => [parent] => 154 [count] => 3 [filter] => raw ) [7] => WP_Term Object ( [term_id] => 155 [name] => Devices [slug] => devices [term_group] => 0 [term_taxonomy_id] => 155 [taxonomy] => category [description] => [parent] => 166 [count] => 4 [filter] => raw ) [8] => WP_Term Object ( [term_id] => 523 [name] => Feeds [slug] => feeds [term_group] => 0 [term_taxonomy_id] => 523 [taxonomy] => category [description] => [parent] => 0 [count] => 0 [filter] => raw ) [9] => WP_Term Object ( [term_id] => 366 [name] => Hardware [slug] => hardware [term_group] => 0 [term_taxonomy_id] => 366 [taxonomy] => category [description] => [parent] => 153 [count] => 1 [filter] => raw ) [10] => WP_Term Object ( [term_id] => 373 [name] => Hardware [slug] => hardware-what-i-use [term_group] => 0 [term_taxonomy_id] => 373 [taxonomy] => category [description] => [parent] => 159 [count] => 0 [filter] => raw ) [11] => WP_Term Object ( [term_id] => 243 [name] => Home Security [slug] => home-security [term_group] => 0 [term_taxonomy_id] => 243 [taxonomy] => category [description] => [parent] => 153 [count] => 2 [filter] => raw ) [12] => WP_Term Object ( [term_id] => 446 [name] => Language [slug] => language [term_group] => 0 [term_taxonomy_id] => 446 [taxonomy] => category [description] => [parent] => 436 [count] => 1 [filter] => raw ) [13] => WP_Term Object ( [term_id] => 524 [name] => Letterboxed [slug] => letterboxed [term_group] => 0 [term_taxonomy_id] => 524 [taxonomy] => category [description] => [parent] => 523 [count] => 124 [filter] => raw ) [14] => WP_Term Object ( [term_id] => 436 [name] => Lifestyle [slug] => lifestyle [term_group] => 0 [term_taxonomy_id] => 436 [taxonomy] => category [description] => [parent] => 0 [count] => 2 [filter] => raw ) [15] => WP_Term Object ( [term_id] => 224 [name] => Linux & Open Source [slug] => linux [term_group] => 0 [term_taxonomy_id] => 224 [taxonomy] => category [description] => [parent] => 279 [count] => 2 [filter] => raw ) [16] => WP_Term Object ( [term_id] => 153 [name] => Maker [slug] => maker [term_group] => 0 [term_taxonomy_id] => 153 [taxonomy] => category [description] => [parent] => 0 [count] => 1 [filter] => raw ) [17] => WP_Term Object ( [term_id] => 530 [name] => Micro Blog [slug] => microblog [term_group] => 0 [term_taxonomy_id] => 530 [taxonomy] => category [description] => [parent] => 0 [count] => 2 [filter] => raw ) [18] => WP_Term Object ( [term_id] => 437 [name] => Music [slug] => music [term_group] => 0 [term_taxonomy_id] => 437 [taxonomy] => category [description] => [parent] => 436 [count] => 14 [filter] => raw ) [19] => WP_Term Object ( [term_id] => 395 [name] => My DIY Projects [slug] => my-diy-projects [term_group] => 0 [term_taxonomy_id] => 395 [taxonomy] => category [description] => [parent] => 153 [count] => 6 [filter] => raw ) [20] => WP_Term Object ( [term_id] => 154 [name] => Opinion/Editorial [slug] => articles [term_group] => 0 [term_taxonomy_id] => 154 [taxonomy] => category [description] => [parent] => 0 [count] => 3 [filter] => raw ) [21] => WP_Term Object ( [term_id] => 491 [name] => Organizing [slug] => organizing [term_group] => 0 [term_taxonomy_id] => 491 [taxonomy] => category [description] => [parent] => 436 [count] => 5 [filter] => raw ) [22] => WP_Term Object ( [term_id] => 279 [name] => OS [slug] => os [term_group] => 0 [term_taxonomy_id] => 279 [taxonomy] => category [description] => [parent] => 166 [count] => 0 [filter] => raw ) [23] => WP_Term Object ( [term_id] => 242 [name] => PCs [slug] => pcs [term_group] => 0 [term_taxonomy_id] => 242 [taxonomy] => category [description] => [parent] => 155 [count] => 6 [filter] => raw ) [24] => WP_Term Object ( [term_id] => 384 [name] => Photography [slug] => photography [term_group] => 0 [term_taxonomy_id] => 384 [taxonomy] => category [description] => [parent] => 159 [count] => 2 [filter] => raw ) [25] => WP_Term Object ( [term_id] => 527 [name] => Photos [slug] => photos [term_group] => 0 [term_taxonomy_id] => 527 [taxonomy] => category [description] => [parent] => 0 [count] => 0 [filter] => raw ) [26] => WP_Term Object ( [term_id] => 146 [name] => Privacy [slug] => privacy [term_group] => 0 [term_taxonomy_id] => 146 [taxonomy] => category [description] => [parent] => 154 [count] => 3 [filter] => raw ) [27] => WP_Term Object ( [term_id] => 142 [name] => Raspberry Pi [slug] => raspberry-pi [term_group] => 0 [term_taxonomy_id] => 142 [taxonomy] => category [description] => [parent] => 153 [count] => 9 [filter] => raw ) [28] => WP_Term Object ( [term_id] => 136 [name] => Social Media [slug] => social-media [term_group] => 0 [term_taxonomy_id] => 136 [taxonomy] => category [description] => [parent] => 154 [count] => 2 [filter] => raw ) [29] => WP_Term Object ( [term_id] => 160 [name] => Software [slug] => software [term_group] => 0 [term_taxonomy_id] => 160 [taxonomy] => category [description] => [parent] => 159 [count] => 6 [filter] => raw ) [30] => WP_Term Object ( [term_id] => 241 [name] => Synology NAS [slug] => synology-nas [term_group] => 0 [term_taxonomy_id] => 241 [taxonomy] => category [description] => [parent] => 155 [count] => 4 [filter] => raw ) [31] => WP_Term Object ( [term_id] => 166 [name] => Technology [slug] => technology [term_group] => 0 [term_taxonomy_id] => 166 [taxonomy] => category [description] => [parent] => 0 [count] => 11 [filter] => raw ) [32] => WP_Term Object ( [term_id] => 424 [name] => The Basement [slug] => the-basement [term_group] => 0 [term_taxonomy_id] => 424 [taxonomy] => category [description] => [parent] => 153 [count] => 6 [filter] => raw ) [33] => WP_Term Object ( [term_id] => 413 [name] => The Cloud [slug] => the-cloud [term_group] => 0 [term_taxonomy_id] => 413 [taxonomy] => category [description] => [parent] => 153 [count] => 3 [filter] => raw ) [34] => WP_Term Object ( [term_id] => 1 [name] => Uncategorized [slug] => uncategorized [term_group] => 0 [term_taxonomy_id] => 1 [taxonomy] => category [description] => [parent] => 0 [count] => 0 [filter] => raw ) [35] => WP_Term Object ( [term_id] => 159 [name] => What I Use [slug] => what-i-use [term_group] => 0 [term_taxonomy_id] => 159 [taxonomy] => category [description] => [parent] => 436 [count] => 1 [filter] => raw ) [36] => WP_Term Object ( [term_id] => 280 [name] => Windows [slug] => windows [term_group] => 0 [term_taxonomy_id] => 280 [taxonomy] => category [description] => [parent] => 279 [count] => 2 [filter] => raw ) [37] => WP_Term Object ( [term_id] => 207 [name] => Windows Phone [slug] => windows-phone [term_group] => 0 [term_taxonomy_id] => 207 [taxonomy] => category [description] => [parent] => 155 [count] => 3 [filter] => raw ) ) POST QUERY: POST QUERY RESULTS
  • ►Feeds (124)
    • Letterboxed (124)
  • ►Lifestyle (35)
    • Books (4)
    • Language (1)
    • Music (14)
    • Organizing (5)
    • ►What I Use (9)
      • Hardware (0)
      • Photography (2)
      • Software (6)
  • ▼Maker (66)
    • Arduino (8)
    • CHIP (5)
    • ►Coding (25)
      • Advent of Code 2020 (12)
    • Hardware (1)
    • Home Security (2)
    • My DIY Projects (6)
    • Raspberry Pi (9)
    • The Basement (6)
    • The Cloud (3)
  • ►Micro Blog (2)
  • ►Opinion/Editorial (11)
    • Copyright and You (3)
    • Privacy (3)
    • Social Media (2)
  • ►Photos (0)
  • ►Technology (35)
    • ►Devices (20)
      • Android (3)
      • PCs (6)
      • Synology NAS (4)
      • Windows Phone (3)
    • ►OS (4)
      • Linux & Open Source (2)
      • Windows (2)
  • ►Uncategorized (0)

Hosted on…


Help support hosting with our referral link!

Copyright © 2022 [Blogging Intensifies].

Me WordPress Theme by themehall.com