DRV 8255 vs A4988


While I went on to explore the most suitable module to control my stepper motor. Preferably for a CNC machine, and many promising contestants showed up. Contestants include l293d, TB560, DRV8255, A4988, Rees52 This blog decides the winner.

The good looking(DRV-8255) on the left is surely attractive and there doesn’t stand much difference when it comes performance with the A4988. The screw type adjustment to control the current limit is the same both the modules and might look different than yours as there are multiple chinese manufactures. Where aren’t they? Really? Handle the trim pot gently or else you might end up ruining the module

Heating was very common on both the IC’s which can be pulled down to an extent with additional usage of sink and fan cooling options. The A4988 seemed to cool off much faster when motor is not in operation. The polou IC is technically more reliable on paper. A4988 IC is tiny and might come off under intense heat and rugged usage.

On the programming front, The libraries were available combined for both of them and looked equally comfortable.

Mixing of both A4988 and DRV8255 worked fine on the CNC module. The availability of both in market is not the same, as drv8255 were found almost everywhere. And my observations below.


A4988 DRV8825
Availability very widely available widely available
Approx. price 225RS 185Rs
Max. theoretical current 2A 2.5A
Max. microsteps 16 32
PCB color Green / Red Purple
Stepper current adjust. trimpot Yes, near Dir pin Yes, near En pin
Typical Rs value 0.05 Ohm or
0.1 Ohm or
0.2 Ohm
0.1 Ohm
Vref formula (*) I_TripMax= Vref/(8*Rs) I_TripMax= Vref/(5*Rs)
Thermal Overload Protection (**) Yes Yes
PCB layers 2 4
Small heatsink included (***) Almost always Sometimes not
Active cooling required? Recommended Recommended
IC packaging 5x5mm 28-lead QFN 9.7×6.4mm 28HTSSOP

The judgement? Well . . .

A4988 wins. But, not by a fair margin.


NEXTION THE 16×2? Fancy screens for your DIY projects.


Gone are the days when I used to believe the coolest facelift for any project was 16×2 LCD display. For a 90’s kid(me duh),  It really took me years to realize the painful connections and interfacing procedures behind the 16*2 until I got my hands on it. Woeful soldering and drooping connections and missed out connections stole my precious hours on vicious projects.

While, it’s safe to say the display is still the popular choice among project doers, I urge them to look at the alternative – NEXTION 2.4” or more size if you’d like to. The 4D systems display is an alternative, but it would burn a hole in your pocket unless for an industrial grade product.


The nextion is just 4 wires with 5V,GND,Rx,Rx wires making it highly compatible to any microcontroller with UART interface. A touch screen interface to control and display all sorts of sensors, motors, leds, progress bars, virtual buttons, logos and what not? Well, definitely not videos.

Understandably, It costs 1400 and the 200 for 16×2 LCD, But it’s totally worth the looks and credibility for your projects.

GOOD NEWS!!!!!!!!

The nextion comes with an ITEAD IDE which enables the user to pick and drop components and compile it and even to emulate it before deploying it to the device. All, with the simple knowledge to C++ which you would have sufficed from your Arduino.



So? Pick up one and get started…….



My Take on Lua – The embedded language




Lua is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description.

Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting byte code with a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping. However, My first take on Lua was when I started with the esp8266 wifi module. Though, most beginners would program the module with Arduino, I’d advise to begin with Lua which is relatively easy when understood. It comes of more handy when you deal with web pages and java scripting. My observation was the arduino programs took much less memory footprint that of the Lua. Lua is more suitable when you go for higher end applications. Below are the useful commands.




  1. — Prints to the screen (Can end with semicolon)
    print(“Hello World”)
    Multiline comment
    — Variable names can’t start with a number, but can contain letters, numbers
    — and underscores
    — Lua is dynamically typed based off of the data stored there
    — This is a string and it can be surrounded by ‘ or “
    name = “Derek”
    — Another way to print to the screen
    — Escape Sequences : \n \b \t \\ \” \’
    — Get the string size by proceeding it with a #
    io.write(“Size of string “, #name, “\n”)
    — You can store any data type in a variable even after initialization
    name = 4
    io.write(“My name is “, name, “\n”)
    — Lua only has floating point numbers and this is the max number
    bigNum = 9223372036854775807 + 1
    io.write(“Big Number “, bigNum, “\n”)
    io.write(“Big Number “, type(bigNum), “\n”)
    — Floats are precise up to 13 digits
    floatPrecision = 1.999999999999 + 0.0000000000005
    io.write(floatPrecision, “\n”)
    — We can create long strings and maintain white space
    longString = [[
    I am a very very long
    string that goes on for
    io.write(longString, “\n”)
    — Combine Strings with ..
    longString = longString .. name
    io.write(longString, “\n”)
    — Booleans store with true or false
    isAbleToDrive = true
    io.write(type(isAbleToDrive), “\n”)
    — Every variable gets the value of nil by default meaning it has no value
    io.write(type(madeUpVar), “\n”)
    — ———- MATH ———-
    io.write(“5 + 3 = “, 5+3, “\n”)
    io.write(“5 – 3 = “, 5-3, “\n”)
    io.write(“5 * 3 = “, 5*3, “\n”)
    io.write(“5 / 3 = “, 5/3, “\n”)
    io.write(“5.2 % 3 = “, 5%3, “\n”)
    — Shorthand like number++ and number += 1 aren’t in Lua
    — Math Functions: floor, ceil, max, min, sin, cos, tan,
    — asin, acos, exp, log, log10, pow, sqrt, random, randomseed
    io.write(“floor(2.345) : “, math.floor(2.345), “\n”)
    io.write(“ceil(2.345) : “, math.ceil(2.345), “\n”)
    io.write(“max(2, 3) : “, math.max(2, 3), “\n”)
    io.write(“min(2, 3) : “, math.min(2, 3), “\n”)
    io.write(“pow(8, 2) : “, math.pow(8, 2), “\n”)
    io.write(“sqrt(64) : “, math.sqrt(64), “\n”)
    — Generate random number between 0 and 1
    io.write(“math.random() : “, math.random(), “\n”)
    — Generate random number between 1 and 10
    io.write(“math.random(10) : “, math.random(10), “\n”)
    — Generate random number between 1 and 100
    io.write(“math.random(1,100) : “, math.random(1,100), “\n”)
    — Used to set a seed value for random
    — Print float to 10 decimals
    print(string.format(“Pi = %.10f”, math.pi))
    — ———- CONDITIONALS ———-
    — Relational Operators : > < >= <= == ~=
    — Logical Operators : and or not
    age = 13
    if age < 16 then
        io.write(“You can go to school”, “\n”)
        local localVar = 10
    elseif (age >= 16) and (age < 18) then
        io.write(“You can drive”, “\n”)
        io.write(“You can vote”, “\n”)
    — A variable marked local is local only to this if statement
    — io.write(“Local Variable : “, localvar)
    if (age < 14) or (age > 67) then io.write(“You shouldn’t work\n”) end
    — Format, convert to string and place boolean value with string.format
    print(string.format(“not true = %s”, tostring(not true)))
    — There is no ternary operator in Lua
    — canVote = age > 18 ? true : false
    — This is similar to the ternary operator
    canVote = age > 18 and true or false
    io.write(“Can I Vote : “, tostring(canVote), “\n”)
    — There is no Switch statement in Lua
    — ———- STRINGS ———-
    quote = “I changed my password everywhere to ‘incorrect.’ That way when I forget it,it always reminds me, ‘Your password is incorrect.'”
    io.write(“Quote Length : “, string.len(quote), “\n”)
    — Return the string after replacing
    io.write(“Replace I with me : “, string.gsub(quote, “I”, “me”), “\n”)
    — Find the index of a matching String
    io.write(“Index of password : “, string.find(quote, “password”), “\n”)
    — Set characters to upper and lowercase
    io.write(“Quote Upper : “, string.upper(quote), “\n”)
    io.write(“Quote Lower : “, string.lower(quote), “\n”)
    — ———- LOOPING ———-
    i = 1
    while (i <= 10) do
      i = i + 1
      — break throws you out of a loop
      — continue doesn’t exist with Lua
      if i == 8 then break end
    — Repeat will cycle through the loop at least once
      io.write(“Enter your guess : “)
      — Gets input from the user
      guess = io.read()
      — Either surround the number with quotes, or convert the string into
      — a number
    until tonumber(guess) == 15
    — Value to start with, value to stop at, increment each loop
    for i = 1, 10, 1 do
    — Create a table which is a list of items like an array
    months = {“January”, “February”, “March”, “April”, “May”,
    “June”, “July”, “August”, “September”, “October”, “November”,
    — Cycle through table where k is the key and v the value of each item
    for k, v in pairs(months) do
      io.write(v, ” “)
    — ———- TABLES ———-
    — Tables take the place of arrays, dictionaries, tuples, etc.
    — Create a Table
    aTable = {}
    — Add values to a table
    for i = 1, 10 do
      aTable[i] = i
    — Access value by index
    io.write(“First Item : “, aTable[1], “\n”)
    — Items in Table
    io.write(“Number of Items : “, #aTable, “\n”)
    — Insert in table, at index, item to insert
    table.insert(aTable, 1, 0)
    — Combine a table as a String and seperate with provided seperator
    print(table.concat(aTable, “, “))
    — Remove item at index
    table.remove(aTable, 1)
    print(table.concat(aTable, “, “))
    — Sort items in reverse
    table.sort(aTable, function(a,b) return a>b end)
    print(table.concat(aTable, “, “))
    — Create a multidimensional Table
    aMultiTable = {}
    for i = 0, 9 do
      aMultiTable[i] = {}
      for j = 0, 9 do
        aMultiTable[i][j] = tostring(i) .. tostring(j)
    — Access value in cell
    io.write(“Table[0][0] : “, aMultiTable[1][2], “\n”)
    — Cycle through and print a multidimensional Table
    for i = 0, 9 do
      for j = 0, 9 do
        io.write(aMultiTable[i][j], ” : “)
    — ———- FUNCTIONS ———-
    function getSum(num1, num2)
      return num1 + num2
    print(string.format(“5 + 2 = %d”, getSum(5,2)))
    function splitStr(theString)
      stringTable = {}
      local i = 1
      — Cycle through the String and store anything except for spaces
      — in the table
      for str in string.gmatch(theString, “[^%s]+”) do
        stringTable[i] = str
        i = i + 1
      — Return multiple values
      return stringTable, i
    — Receive multiple values
    splitStrTable, numOfStr = splitStr(“The Turtle”)
    for j = 1, numOfStr do
      print(string.format(“%d : %s”, j, splitStrTable[j]))
    — Variadic Function recieve unknown number of parameters
    function getSumMore(…)
      local sum = 0
      for k, v in pairs{…} do
        sum = sum + v
      return sum
    io.write(“Sum : “, getSumMore(1,2,3,4,5,6), “\n”)
    — A function is a variable in that we can store them under many variable
    — names as well as in tables and we can pass and return them though functions
    — Saving an anonymous function to a variable
    doubleIt = function(x) return x * 2 end
    — A Closure is a function that can access local variables of an enclosing
    — function
    function outerFunc()
      local i = 0
      return function()
        i = i + 1
        return i
    — When you include an inner function in a function that inner function
    — will remember changes made on variables in the inner function
    getI = outerFunc()
    — ———- COROUTINES ———-
    — Coroutines are like threads except that they can’t run in parallel
    — A coroutine has the status of running, susepnded, dead or normal
    — Use create to create one that performs some action
    co = coroutine.create(function()
      for i = 1, 10, 1 do
      if i == 5 then coroutine.yield() end
      end end)
    — They start off with the status suspended
    — Call for it to run with resume during which the status changes to running
    — After execution it has the status of dead
    co2 = coroutine.create(function()
      for i = 101, 110, 1 do
      end end)
    — ———- FILE I/O ———-
    — Different ways to work with files
    — r: Read only (default)
    — w: Overwrite or create a new file
    — a: Append or create a new file
    — r+: Read & write existing file
    — w+: Overwrite read or create a file
    — a+: Append read or create file
    — Create new file for reading and writing
    file = io.open(“test.lua”, “w+”)
    — Write text to the file
    file:write(“Random string of text\n”)
    file:write(“Some more text\n”)
    — Move back to the beginning of the file
    file:seek(“set”, 0)
    — Read from the file
    — Close the file
    — Open file for appending and reading
    file = io.open(“test.lua”, “a+”)
    file:write(“Even more text\n”)
    file:seek(“set”, 0)
    — ———- MODULES ———-
    — A Module is like a library full of functions and variables
    — Use require to gain access to the functions in the module
    convertModule = require(“convert”)
    — Execute the function in the module
    print(string.format(“%.3f cm”, convertModule.ftToCm(12)))
    — ———- METATABLES ———-
    — Used to define how operations on tables should be carried out in regards
    — to adding, subtracting, multiplying, dividing, concatenating, or
    — comparing tables
    — Create a table and put default values in it
    aTable = {}
    for x = 1, 10 do
      aTable[x] = x
    mt = {
      — Define how table values should be added
      — You can also define _sub, _mul, _div, _mod, _concat (..)
      __add = function (table1, table2)
        sumTable = {}
        for y = 1, #table1 do
          if (table1[y] ~= nil) and (table2[y] ~= nil) then
            sumTable[y] = table1[y] + table2[y]
            sumTable[y] = 0
        return sumTable
      — Define how table values should be checked for equality
      __eq = function (table1, table2)
        return table1.value == table2.value
      — For homework figure out how to check if less then
      __lt = function (table1, table2)
        return table1.value < table2.value
      — For homework figure out how to check if less then or equal
      __le = function (table1, table2)
        return table1.value <= table2.value
    — Attach the metamethods to this table
    setmetatable(aTable, mt)
    — Check if tables are equal
    print(aTable == aTable)
    addTable = {}
    — Add values in tables
    addTable = aTable + aTable
    — print the results of the addition
    for z = 1, #addTable do
    — Lua is not an OOP language and it doesn’t allow you to define classes
    — but you can fake it using tables and metatables
    — Define the defaults for our table
    Animal = {height = 0, weight = 0, name = “No Name”, sound = “No Sound”}
    — Used to initialize Animal objects
    function Animal:new (height, weight, name, sound)
      setmetatable({}, Animal)
      — Self is a reference to values for this Animal
      self.height = height
      self.weight = weight
      self.name = name
      self.sound = sound
      return self
    — Outputs a string that describes the Animal
    function Animal:toString()
      animalStr = string.format(“%s weighs %.1f lbs, is %.1f in tall and says %s”, self.name, self.weight, self.height, self.sound)
      return animalStr
    — Create an Animal
    spot = Animal:new(10, 15, “Spot”, “Roof”)
    — Get variable values
    — Call a function in Animal
    — ———- INHERITANCE ———-
    — Extends the properties and functions in another object
    Cat = Animal:new()
    function Cat:new (height, weight, name, sound, favFood)
      setmetatable({}, Cat)
      — Self is a reference to values for this Animal
      self.height = height
      self.weight = weight
      self.name = name
      self.sound = sound
      self.favFood = favFood
      return self
    — Overide an Animal function
    function Cat:toString()
      catStr = string.format(“%s weighs %.1f lbs, is %.1f in tall, says %s and loves %s”, self.name, self.weight, self.height, self.sound, self.favFood)
      return catStr
    — Create a Cat
    fluffy = Cat:new(10, 15, “Fluffy”, “Meow”, “Tuna”)

Continue reading



  • Go to app inventor/thunkable to see how easy to create apps
  • Call yourself an App developer? DEFINETELY NO


For those who are on to create sample apps on third party MIT/THUNKABLE apps for arduino,raspberry, esp8066, bluetooth devices and experiments, you shall be forgiven and this post shares the crucial element of timer function below.




This is so popular that it’s even made available on the official arduino blogs DIY. Being a no brainer, This one actually teaches to to meddle with close soldering and a bit of electronics.



It seems you can’t walk down the street these days without coming across a solar panel. You can find them lighting up crosswalk signs, mobile power for construction, as well as simple little sidewalk path lights. Solar is easy to use, readily available, and inexpensive.
So why aren’t we using it to power our homes?
For the most part our common every day solar cells run at an efficiency of 18-20%, meaning they convert 18-20% of the every they receive into electricity. While this is far better than the 3-6% efficiency that most green plants end up with, it doesn’t quite meet our power needs. To bring in enough power we either need to improve the efficiency of our panels or find ways of getting more from our current solar panels.
Every panel you see in your day to day life is in a fixed position, most likely facing south at a 45 degree angle. While this approach is extremely simple and meets the needs of most small applications, it isn’t producing as much energy as it could be.
The single most simple way of getting more energy out of a solar panel is to have it track the sun. In fact solar panels that track the sun create around 30% more energy per day than a fixed panel. With that kind of power increase you’d think everyone would be doing it, but there are some good reasons why it’s not overly common. First, the initial cost of setup is higher since it requires moving parts. Second, it also require maintenance and upkeep since they’d be exposed to outdoors conditions year round. Third, you’d need to power this equipment in order to keep it running and moving which then takes away from your output.
For most applications and home use, tracking is overkill. We typically don’t see tracking used unless it’s in large industrial power generation systems. Though that doesn’t mean you can’t make your own version at home.

The mounted servo motors along with body frame is available online in few robotics marts.


//defining Servos
Servo servohori;
int servoh = 0;
int servohLimitHigh = 160;
int servohLimitLow = 20;

Servo servoverti; 
int servov = 0; 
int servovLimitHigh = 160;
int servovLimitLow = 20;
//Assigning LDRs
int ldrtopl = 2; //top left LDR green
int ldrtopr = 1; //top right LDR yellow
int ldrbotl = 3; // bottom left LDR blue
int ldrbotr = 0; // bottom right LDR orange

void setup () 

void loop()
 servoh = servohori.read();
 servov = servoverti.read();
 //capturing analog values of each LDR
 int topl = analogRead(ldrtopl);
 int topr = analogRead(ldrtopr);
 int botl = analogRead(ldrbotl);
 int botr = analogRead(ldrbotr);
 // calculating average
 int avgtop = (topl + topr) / 2; //average of top LDRs
 int avgbot = (botl + botr) / 2; //average of bottom LDRs
 int avgleft = (topl + botl) / 2; //average of left LDRs
 int avgright = (topr + botr) / 2; //average of right LDRs

if (avgtop < avgbot)  {  servoverti.write(servov +1);  if (servov > servovLimitHigh) 
 servov = servovLimitHigh;
 else if (avgbot < avgtop)
 servoverti.write(servov -1);
 if (servov < servovLimitLow)  {  servov = servovLimitLow;  }  delay(10);  }  else   {  servoverti.write(servov);  }    if (avgleft > avgright)
 servohori.write(servoh +1);
 if (servoh > servohLimitHigh)
 servoh = servohLimitHigh;
 else if (avgright > avgleft)
 servohori.write(servoh -1);
 if (servoh < servohLimitLow)
 servoh = servohLimitLow;

Other useful images below


Thanks to Vijay Karthik on helping me with this.





If you have a simple Arduino project that uses only a few pins, you might be able to shrink it down to a single 8-pin ATtiny chip. In this blog, let’s see what can be done. The best part is you can use the same Arduino code and development environment that you’re already used to.

WhatsApp Image 2017-05-10 at 10.39.42 PM

Development Board

The ATtiny85 based mini development board is similar to the Arduino, but cheaper and smaller (ofcourse a bit less powerful). With a whole host of shields to extend its functionality and the ability to use the familiar Arduino IDE, this board is a great way to jump into microcontroller electronics.

  • Support for the Arduino IDE 1.0+ (OSX/Win/Linux)
  • Power via USB or External Source
  • Onboard 5V Regulator
  • Built-in USB
  • 6 I/O Pins
  • 8k Flash Memory (about 6k after bootloader)
  • I2C and SPI (vis USI)
  • PWM on 3 pins (more possible with Software PWM)
  • ADC on 4 pins
  • Power LED and Test/Status LED

Most often this tiny 85 is shipped fully assembled with pre-burned bootloader. As the bootloader already burned, on board LED will start to blink when power up, but you must install relevant driver before first programming. If you want to install or burn the bootloader using the UNO/MEGA, There are plenty of resources available on net which I don’t want to post it here and waste my time.


attiny85 pinout


It is possible to drive relays or a H-BRIDGE motor, couple of leds, 433 Mhz transmitter, single sensor data nodes, Bluetooth connectivity and anything that has to do with RX,TX, With SPI, you can even add OLED display(But it” leave no room for GPIOS). The best part is it consumes very little power and you can run controller for month even on a button cell.

Hard to break it, It doesn’t support serial monitor when it is used as IC. However, I’m not really sure about this in the development board unit.


My encounter with religion.

Like every other human being, I too have wondered about religion at some point of life. Before you ask me “Do you believe in GOD”, I’d say I’m a believer of man created god than god created man. If you look closely, Its the best thing man has invented before money. I’d like to share my thoughts on religion through a a 19 year old common agnostic theist‘s view.


The two situations occur to almost every individual.  One, You happen to believe the presence of god someday. Two, You throw away all your stereotypes and think you’ve given up on life and say god doesn’t exist at all.

Its very similar to how you fall in love with the same person one day, You want them out of your life on another odd day. And the lesson of your life is taught somewhere between those two situations. With the world focussing on the communal riots, inter-religion marriages, and racist -terrorism activities, civil war, We fail to to realize the fundamental concept of religion. Religions are set of custom made themes created to suit your lifestyle. You have your own freedom to choose one of them. What do we need to keep us going? A certain hold on the pace of life, A little motivation when you’re down, A sense of fear that someone’s watching you, Certain right things that’s gonna keep you safe over a long run, A set of to-do list to make life complicated. Well, That’s what religion gives you in whole package which is too heavy to handle. And on top of everything, a little hope and faith to keep your head straight and believe everything you do is right. Let’s all thank religion for that.