Access your aws instance data with out logging in to the AWS console

I love amazon aws cloud service. I love how it allows me to experiment with things without upfront payment for infrastructure and also the fact that the pay-per-use price is a fraction of what a infrastructure investment would’ve been. With this love, I started tinkering with it and started doing a lot of setups. But every time I need some basic information about my aws instances(like dhcp ip & run status), I need to open the aws console in browser and navigate to AWS console & EC2 Dashboard.

If you are like me, you probably don’t like this browser business while showing your commandline-fu either! So I decided to create a small script to run on command line to help me with this chore and here is how it works when I type lsaws (short form for List AWS instances) in linux terminal,…

Outpu Screenshot

As you can see, there are no login prompts and it usually takes a second or two to complete. It can list ec2 instances in your aws account in a tabular form along with ip addresses and running state. Purpose of this is to get the details that you usually need frequently (like ip and state) with out logging in to aws console every time. please read on to find out more on how to install this tool in your system.

Note : all these instructions are tested on ubuntu 16.04 but they should work for other flavors of linux without no significant changes. But if you want to set this up on windows, the js code should work as it is but the

Installation process

  • Prerequisite Steps
    • Install git client
    • Setup nodejs & aws javascript sdk for nodejs AWS Docs
    • configure aws credentials in ~/.aws/credentials file
  • Clone this project in to your home directory , build & configure
    Note : Type below commands in a linux terminal & dont forget to replace “your_region” with your actual aws region Ex: us-east-1
cd ~ 
mkdir git 
cd git 
git clone
cd aws_scripts 
npm install

#Update your ~/.bashrc to run it as a command from any directory and reload it
echo "alias lsaws='node ~/git/aws_scripts/lsaws.js'" >> ~/.bashrc 
source ~/.bashrc

#Update aws region(replace your_region with your actual region in below command )
sed -i 's/us-east-1/your_region/g' ~/git/aws_scripts/lsaws.js

Usage : open a terminal and type “lsaws (with out quotes 😛 )

As usual, please feel to get in touch with me if you notice any issues or if you need any help.

Nodemcu esp8266 : Driving a 28BYJ-48 stepper using ULN2003


I needed a simple LUA module (with callbacks) that I can use to drive the cheap 28BYJ-48 & ULN2003 Combo for automating a Candy Jar. I did search online around to see if there is a readymade one available. when I couldn’t find any exact matches, Just wrote a Lua module based on bits and pieces I found online. Hope you find it useful. Feel free create an issue in Github project or get in touch with me for any feature requests.


With this Lua module, you can drive a stepper motor in 3 lines like this

stepper  = require ('stepper')
stepper.init({5,6,7,8}) --pin numbers to which the uln2003 is connected
stepper.rotate(stepper.FORWARD,2500,5,0,function () print('Rotation done.') end)

As you can see, this is an async module. your code should trigger rotate and let the module asynchronously and trigger your callback after completing the rotation.


Any nodemcu gpio pins should work. here is the combination that worked for me.

D5 IN1
D6 IN2
D7 IN3
D8 IN4

Fig : Connection Diagram for 28BYJ-48 Stepper motor using ULN2003 driver with nodemcu esp8266


Here are two good links that helped me understand how to get the stepper working


Monitoring Raspberry Pi temperature over mqtt

Hello, My dear fellow Raspberry Pi fan! hope your Pi-iot-hacking is going well.

Here is one from my side, read on…

I run so many things on my poor little raspberry pies and they often get heated up with all the burden I put on them. Since they are running headless, I don’t really know if it is on the verge of getting fried till it is too late. so after a couple of overheating instances, I started thinking, … How do I solve this issue?

As a first step, I came up with this simple hack which is a short nodejs script to monitor raspberry pi CPU temperature remotely.

Here is the link : pi_temp_logger

This runs as an autostarting Linux(Raspbian) service on raspberry pi which measures CPU temperature and posts to a configured MQTT broker topic Note: you can configure your broker and topic in

I use mqtt-spy to monitor and generate the graphs. feel free to get in touch with me if you are having any issues with using this by opening an issue.

Here is a screenshot of my Pi temperature increasing because of the dd command I used to stress the CPU [ awesome plots you see here are the courtesy of mqtt-spy ].

For detailed instructions on how to install the project, you can head to the git repo.

But it is not enough to know that it is heating up. We need to act on it, so for that part, I am planning to attach a fan to the raspberry pi and run it when the temperature goes beyond a particular threshold. Apart from the temperature, I believe knowing which process is loading the CPU is might help so I am thinking it might be a good idea to add the top 3 processes by CPU usage to the MQTT message. which might look something like this …

   "temperature" : "32.2",
   "units" : "celsius",
   "processes": [
               "command":"/usr/bin/dd ...",

what do you think? any suggestions? feel free to use the comments section to let me know. thanks for stopping by.

How to teach a lesson to clickbaiters on youtube who post fake thumbnails and make a fool out of you

Relevance to the problem:

Why I care so much about fake thumbnails(or why youtube is so indispensable to me): 

I love learning IoT on youtube because it is easy(learn anywhere) and free. It is a perfect learning source for a working person like me who can’t afford to quit the job and go back to college for full-time education or doesn’t want to go through a full degree for one course that you like :). In case if you did not already, I invite you to take a look at my previous post about all the youtube channels that I subscribe to and keep watching to keep learning IoT stuff.

Problem :

That being said, nowadays youtube became very distracting place because of fake clickbait thumbnails :(. This is how it usually happens,.. you notice a video with almost porn like thumbnail pic and a title related to religion or something about family which makes you think “what the hell, how is that possible” and increases your curiosity but turns out to be totally unrelated to thumbnail once you click on the video and watch it. Since the thumbnail and video metadata are not same, once you click on one of the spam videos, youtube starts showing video suggestions relevant to spammer’s video metadata(which is not probably what you would consider productive or meaningful).After clicking on a few of these in a curiosity-driven-autopilot mode, you realize what is happening and figure how your attention and enthusiasm for learning from quality content went down the drain in a downward spiraling fashion and start feeling cheated and demotivated. this leads you to start browsing some video game channels or new movie trailers. In the end, this leads to a very unproductive use of time for someone like me who gets distracted very easy by every facebook or WhatsApp notification and intentionally avoids them. I am sure if you’ve been using youtube at the least for over a month, you know what I am talking about :).

Every time you reach the end of this vicious circle of attention hijacking, there is a click bait scammers grinning devilishly knowing how predictable and easily manipulated the audience are and how much money they can benefit from the increase in views by hundreds of thousands (if not millions) simply because of hijacking user’s train of thoughts. I guess simply the joy of making fools out of millions of people adds to their happiness.


Fear not, all is not lost! youtube has given a weapon for us to fight back. it is just that it has been hidden deep in the forest like Excalibur sword in Merlin’s story. it is called….

Youtube thumbnail reporting feature !!!

here is a simple algorithm on how to access and use it,…
Note: While reading a Comp-Sci Masters grad’s blog you should expect that I will start speaking in algorithms at some point 🙂

Step 1: Locate a video that made fool out of you and stole your valuable time which made you desperate for payback [Evil Grin]

Step 2: Locate and Click on three dots under the video to reveal  “More” menu which contains Report menu item

Click on Report option

Step 3: Click on “Spam or misleading”

Select “Spam or Misleading”

Step 4: Select “Misleading thumbnail”

Select misleading thumbnail

Step 5: Relax and wait for the flagged video to be taken out or thumbnail changed by youtube.

Here is a link to Google’s policy center on the same topic (about removing videos ) if you are more curious about the process.

Step 6: Go to step 1 and repeat till click-baiters learn their lesson not to fake thumbnails 😀

Thank you!

Hope you find it useful. Feel free to let me know your C&C using the comments section or contact form. Have a nice day.



16 IoT youtube channels for serious IoT hobbyists

Since there are not enough structured courses on IoT in universities which really focus on the practical aspects of it, after blogs, Youtube became my defacto learning source for IoT. which is almost as good as quality college education without the pain of rules and rigidity of academic institutions.

Below are some of the youtube channels I currently follow. you might want to check them out. Being a computer science masters grad, I had a lot of trouble with electronics basics and these channels are a key part of filling the gaps in my knowledge and accelerating my learning process. Please note that this is no way an exhaustive list but these are just my favorites. 

 Adafruit   Andreas Spiess  CNLohr    EEVblog           electronupdate        GreatScott!   

 Hak5    Julian Ilett    Ludic Science   MickMake      

 Make:  mikeselectricstuff  NYC CNC    Pete B        

 Roman UrsuHack   



Hope you find it useful. Feel free to let me know your C&C using the comments section or contact form. Have a nice day.


My soldering woes with esp8266 esp12

The beginning of a new era in IoT:

Like most of the IoT enthusiasts, I also got excited when I first came across esp8266 from the espressif chip maker. Like any good student, I started with the nodemcu dev boards instead of trying to DIY-ing development boards. These dev boards were simply magical when compared to AT89s52 [8051 family] or Arduino that I used in past. Don’t even get the wrong impression that I don’t love Arduino but the fact that turnaround time for trying out things got greatly reduced with nodemcu made me get addicted to this platform.

Nodemcu dev boards v0.9(left) v1.0 (right)

This huge gain in productivity is partially due to the crisp documentation of the platform and modules available and also due to the fact that coding in Lua language is pure fun compared to C. One of the main reasons for that is the asynchronous event-driven programming model needed for Lua nodemcu whereas good old C language puts me in procedural auto-pilot mode which IMO, is not at all suitable for embedded system development. You can take my word when I say “it becomes very easy to learn async model in nodemcu Lua if one got used to similar event-driven async programming paradigm in past in any other language” ( like nodejs or any desktop or web UI programming Ex: Java AWT or something so common as js ajax).

Believe it or not, it simply brought tears of joy to write an internet-controlled-led program and get it working in a few minutes compared to blinking a led in 8051 which took a few days the first time [When I started learning 8051].

For example, this is how much code it takes to run a “Hello, World!” HTTP server on the wifi microcontroller!

    conn:send("<h1> Hello, NodeMcu.</h1>")

Source: Nodemcu website

Harsh Reality of economics:

But now comes the moment of truth,… you cannot go beyond blinking LEDs and few other fancy tricks with dev boards due to their size, cost and power requirements. which triggered my quest to find a suitable replacement minimal microcontroller circuit for prototypes. something that has below qualities

  1. small enough to fit on a PCB or prototype board without adding too much thickness
  2. cheap enough to leave in a project
  3. easy enough to write code for [I used nodemcu]

esp8266 has several variations based on the size and shape esp01 to esp12, 13, 32… the list goes on. I tried esp01 as it looked like a standalone dev board but

  • it was too sensitive to any interference and would reset very frequently.
  • not breadboard friendly

The infamous esp01 [$2 wifi mcu] from espressif that rocked IoT maker world

Lovely ray of the sunshine:

Finally, then I found the lovely ray of the sunshine in a dark realm of hobby electronics ………  Bang!  esp12 !!! which fits my previous list of requirements very nicely…


A hindering Problem:

but one thing I always found hard was soldering esp12 as its 2mm pin spacing is much less than that of a breadboard or prototype board (usually 2.54mm).

Here is how my initial attempts looked like…

Note: I am aware of my lousy soldering skills .. please don’t trouble yourself talking about it again 😛

The Solution that I stumbled upon:

Then came to my rescue the “ESP 07 and 12 Adapter plate” ….. TADA! available for 22 cents a piece ( which is RS 15 for me when I bought from India) in Ali express.  It made life so much easier and happy when I did not have to solder esp on a prototype board and it felt just like when became old enough in childhood and realized that killer clowns from outer space most likely are not a real thing and I can stop worrying about 😀

Adapter plate front face


Adapter plate back face

Final Result: Esp12 soldered on the adapter plate

Want to give it a try?

Here is the product link if you want to give it a try…

on a second thought, have you done anything similar and found any better alternative ? can you please graciously share it in below comments to reduce future trial and error frustration time for me. 🙂

My future plans:

Next thing I want to try is to create a proper PCB with SMD components for situations where I get into space constraints and this adapter proves to be too space consuming.

Have a nice day!