Algorithmic Music and Lights

I dropped in at Workbench Projects the other day, and met Pavan, who was working on an LED-covered jar. The entire jar was lined with RGB LED strips, and we were just wondering what to do with the jar to make it fun.



We had some time on our hands, and a pair of speakers. So of course, we decided to make sweet music together with the lights.

There is a one-line algorithmic music thread on the Arduino forums, and I thought it would be a fun experiment to see what that did to the lights. Using three TIP122 for the LED strips (one for R,G,B each), an Arduino Uno and some jumper cables, the video below is what we managed to achieve. All in an hour !


Hacking MP3 Players – Adding sound to Arduino

I’ve been wanting to add sound to quite a few of my projects, and have always found it way too cumbersome, too expensive or too expensive to add sound to my installations / projects, so a little while ago, I decided to try and hack a cheap MP3 player ( purchased from a roadside vendor) and trigger it from my Arduino to play pre-recorded MP3 tracks in sequence.

Here’s a picture of the MP3 player I am talking about, and what it looks like when opened up :

MP3 Player MP3 Player MP3 Player hacked

How the MP3 player works :

The MP3 player has 5 buttons: Play/Pause, Next, Previous, Volume Up and Volume Down.

As shown in the image below, each button consists of two pads, an inner pad and an outer pad. There is a metallic contact like a dome, covering the two pads, but not making contact. When you press the button, the metallic dome touches both path simultaneously and causes them to “short”. A short lasting for about 70 milliseconds will cause the action associated with that button to trigger. Note that a “short” of a small duration will not cause any trigger, and one of very long duration will cause multiple triggers, so it is important to time the delay right.


Each of the 5 buttons therefore has two pads, which must be shorted to trigger the five actions available. However, note that the pads on all the buttons are not unique i.e. there aren’t 10 unique pads, but merely 4 unique pads, scattered in different unique combinations. These 4 pads lead to 4 pins on a 16 pin IC, which I have drawn in the illustration above. The pins used are 6,7,8 and 16. To begin hacking the MP3 player, we must first solder 4 wires, either from the pads or from the pin on the IC (I find the latter easier), and extend them into multiple pinouts, so we can use them later.

In the illustration above is a table, which is a mapping of the combinations of wires which must be shorted for each action. So, to cause the MP3 player to pause/ play, we must short the pads / wires linking to pin 7 and 8 on the MP3 IC.

When we touch the buttons, those actions are easy enough to trigger. The question is, how do we short two pins (of which none might be ground), so as to simulate the MP3 function ? The solution is simple, really, we use relays. A relay is nothing but a mechanical switch that flips one way when powered on, and flips back when powered off. This is because each relay (drawn in the illustration) has a coil that creates a magnetic field when powered on, which flips a switch mechanically. The “COM” terminal which is normally connected to the “NC” (normally closed) flips and makes a connection to “NO” (Normally Open) when powered on, and we can use this to short a wire connected to COM with a wire connected to NO. Thus, each relay will short _two_ pads when powered, and will correspond to one pin on the Arduino that will power it on.

So, we’ll use a digitalWrite call from an Arduino to switch “ON” the Relay coil, thereby causing the wires to short. There is a slight problem, though. Chances are, your relay won’t trigger with the 5V that the Arduino supplies on its digital pin, and you’ll need to raise it to a level of 9V or 12V to trigger the relay coil. So, we’ll need to a buffer in between, here I have used the ULN2003. The complete arrangement for one MP3 function is mentioned in the illustration above.

This should mainly cover how to go about hacking the hardware of an MP3 player to work with an Arduino Uno. However, to make things a little easier on the Arduino side, I also wrote a simple library that lets you control the MP3 player just by specifying the pins on the Arduino that are connected to each relay.

Here is the link to the Github for the MP3 player library :

In the call to MP3Player, you just need to specify in the brackets which pins are connected to the relays corresponding to (Play , Next, Previous, Volume Up, Volume Down ) in order, and you should be up and running in no time !

If you are using only one button, you might want to skip the ULN2003 and use a simple transistor as switch instead as shown here (, but if you are going to use more than one button that is not advisable, since one of the pins that are shorted go to ground of the Arduino, and if you use another button with a different pad going to ground, those two will continuously trigger, messing up with your flow and possibly messing up the player itself.

If you have any questions, you can write to me at and I’ll be happy to help you out !

If you want to go get some Arduino supplies, you can get it from here :

Cheers, until the next hack !

A Map Of A Year in Bangalore

Here’s a link for seeing it in a bigger window : Interactive Map

I’m moving on from my position as an Interaction Designer at Arduino India , and I’ll be heading to Mumbai for a while before I figure things out about what to do next.

I’ve had attended some cool meetups, met a lot of interesting people and made some great friends, visited some joints with delicious food and all in all had a great time in Bangalore. I’ve been tracking where I have been via GPS, and embedded here is a map of how much of Bangalore I’ve traversed.

A Year In Bangalore

P.S. If you know of a cooler way to show this, write to me !

Arduino, Open-Source and Licenses

Important note :

The below treatment is in no way written by a lawyer or an expert. It is just an overview and is not intended to be complete or comprehensive. Please be very thorough when finalising licensing for your projects.

This guide is by no means an official document, merely a compilation of publicly available information, as observed by me.

The open source movement gives great power to everyone. It allows people to take advantage of existing work and share, modify, collaborate and build on top of it. Using content off the Internet is immensely useful, it helps you get started with projects rather quickly and helps you through most hitches along the way. Creating content is very very rewarding too, and not only financially. It helps you find others who are passionate about something as much as you are, who can help you along the way, and fill in where you lack.

However, with great power comes great responsibility, and this applies to the case of open source as well. It wouldn’t be fair if you used existing work without giving due credit to the creator, and you wouldn’t appreciate it either if a candy-gun you hacked up were weaponised. There are many considerations to be made when it comes to “open-sourcing” or “releasing the source”, some of which are :
– Credit for the original work
– Permission for reusing and modifying the work
– Sharing of modified work
– Permission for reusing work commercially

among others.

The above considerations are highly general, be it about sharing software code, hardware designs or artwork and other creative content. Though the considerations are generic across the type of content, the nature of the content itself makes it difficult to use the same terminology across different types of content without creating confusion. For this reason, various standards and licenses were created and shared, so that content could easily be licensed by without requiring too much knowledge of legal jargon, and at the same time educating content users and contributers about legal rights to content and implications of licenses.\

The Arduino project itself is a result of a lot of work created by thousands of users over a decade, who contributed in various ways and parts to get it to its present state.
Arduino makes it really easy for users to start prototyping their projects, and a lot of them eventually walk out of labs in real world implementations, from gardens to industries, and from store shelf products to satellites. Once that starts happening though, the considerations discussed above start becoming important. Failing to take care of them can cause you to lose control of your project, business and even make you liable for legal action and fines. It’s always wiser to spend a little time before hand in order to avoid a lot of trouble later. Below, I’ll give you a brief overview of the rights and usage of Arduino and it’s components, so you can hopefully find it easier to share your next great project safely.

No License :

Generally, if you find content on the Internet that does not state a license explicitly, it means that the copyright for the work belongs to the creator, and you do not have the rights to use or modify the work, for personal or commercial use.

Arduino™ :

The name “Arduino” is trademarked i.e. it is the symbol of an organisation and the products it produces, and it cannot be used to represent or promote any other products. Trademarks are meant to provide the trademark holders from being misrepresented and from the consequences arising thereof.


Arduino Hardware Design :

The hardware circuit designs for Arduino boards are licensed under a Creative Commons Attribution Share-Alike license, which allows for both personal and commercial derivative works, as long as they credit Arduino and release their designs under the same license. This means that anybody is free to use original as well as modified designs in their own projects, for hobby projects or products that people pay money for (without paying any royalty for it), as long as they share that work under the same license. This means that if you made a really cool project that you are planning to sell, you can go right ahead, but you need to credit Arduino for the original designs and share the designs for your product under the Creative Commons Attribution Share-Alike license as well. Also, you absolutely cannot add legal terms or use technology that restrict others from doing anything that the original license lets permits the users to do. You can read more about the license here :


Arduino IDE :

The Arduino IDE was built on top of the Processing IDE, and it respects and follows the licensing of the core components of Processing that are used. The Processing code is licensed under the GNU General Public License (GPL v2 or later), the creators (and owners of copyright) are Ben Fry, Casey Reas and MIT. As the GNU website states, “Using the GNU GPL will require that all the released improved versions be free software. This means you can avoid the risk of having to compete with a proprietary modified version of your own work”. Here, the word “free” means freedom and permissions, not free as in “for no money”

More importantly, talking about using the existing IDE or part of its code, the GPL license states quite clearly that you can modify the software and use it personally or within your organisation without releasing the source code for it to the general public. However, if you release a modified version to the public, you must make the modified source code available to the public under the same GPL license.

You can read in detail about the GPL license terms and implications here :
You can also read a summary of its implications here :


Arduino Firmware :

There is code written in C / C++ running on the micro-controllers on your Arduino board. This code is licensed under the GNU Lesser General Public License (LGPL). This license is more permissive than the GPL, and one important freedom it gives is the freedom to use the code even in proprietary software released to the public, without requiring the source code to be released to the public.

Arduino Libraries :

The Arduino IDE comes bundled with a lot of different libraries, many of which you can see via the Examples in the IDE, and there are tons of other libraries out there as well. All these libraries are explicitly licensed by their creators, so it is important to check their licensing terms when using them in publicly released commercial projects.
Most of them are generally licensed under the BSD or MIT license, but this might vary. The MIT license is highly permissive, and it allows you to “use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software”, without restrictions, except that you include a clause that waives warranty and responsibility of the creators for anyone’s usage. The BSD license is very similar to the MIT license.

You can read about the BSD license here :
and the MIT license here :

User code :

You are free to license your code under the terms that best suit you, subject to the license terms of any libraries that you might be using. So, for example, if you
write code that is completely your own or if it includes a library under the MIT license, you can license the resulting project under whatever licenses you feel fit, provided you include a copy of those licenses when distributing.

Note : The above licenses and copyrights to the work are subject to fair dealing and fair use principles, and in those cases some clauses (or the entirety) of the above licenses may not apply. Copyright laws give some exclusivity rights to copyright holders, and fair use is a limitation and exception to those rights. Fair use, for example, allows for usage like reviewing, criticism, parody, research etc., which would otherwise not be permitted under copyright law without written permission of the copyright holder.

~ Ankit D

ArduDroid and Arduino Micro / Leonardo

At a recent workshop, I was teaching how to connect an Arduino to an Android device, using Bluetooth. To make things interesting, I threw in a mixture of Arduino Micro and Leonardo devices, just to make people familiar with them and get them out of the comfortable Uno habit. We decided to use ArduDroid to quickly prototype, since it seemed to be easy enough for beginners to use. Quite a few teams managed to make it work successfully, and a few teams were stuck.

While debugging, one thing I observed consistently was, that they weren’t getting any output on the serial monitor. And then it hit me, but of course ! They were using Micros and Leonardos ! Micro and Leonardo boards handle serial communication differently, they separate the USB CDC communication and the hardware UART communication. Well, I looked around, and did not really find too many people who had posted about this issue, and just a couple of them talking about fixes (the fix is pretty trivial of course) .

Anyway, I quickly put together a fix, so if you are using ArduDroid with a Leonardo or an Uno, you should be able to use it just like an Uno with the modified code.

Here’s the github link to the code for this :

Makers Of Ahmedabad

A short clip I put together while at Unbox Labs 2014 of the different making activities that happen in and around a city. Makers are everywhere, and the way the term is currently understood is rather narrow.

P.S. I am not an expert at video editing, and this is rather a crude clip quickly put together.

Social Injustices and PID

Social injustices are widespread, in every country of the world, be they in the form of economic, gender or class inequalities. Governments try to do away with some of them, and they sometimes work, but they almost always have some unintended and unfavourable consequences, documented or undocumented.

One (of the many possible) reasons why this might happen is because the intervening agencies overlook a basic principle, something that is sadly, taught mostly in engineering schools. The PID controller principle, a control system principle, is as much applicable to society as to mechanical, electronic and other engineered systems. Lost ? Let me explain.

A system is one that gets input, the input is processed to give an output. This is also called an open-loop system. A closed loop system is one that takes the output, uses it as feedback to improve the system processes, and thus improve the output, like a continuously self-improving, “closed loop” process.

So, how is any of this relevant ? Let’s get right to it, by relating PID processes to society.

PID stands for Proportional – Integral – Derivative. You don’t need to know calculus to understand, you just need to understand English to comprehend.

Imagine a social inequality, say an economic inequality between the rich and the poor. If the politicial ideology of a government in power of that country tends to be towards socialism, they might try to create “equality” in the economic conditions of the people. The measures that they take to bring this about is what we call a “process”.

Now, let’s assume that the government is smart, and understands the concept of PID. This is how they would shape their process:


P (Proportional) : The difference between the current condition and the desired condition would be what we call as the ‘difference; or the ‘error’. Now, the bigger the error, the bigger the correction you would need to bring it back on track, right ? Right. This is what is called the ‘proportional’ component. This components deals with the “immediate” nature of corrective measures required. This is good to start with, but not enough. Here’s why.

When the errors are corrected by applying “proportional” corrective action, they start going back towards the desired state. However, after they have gone back to the desired state, they will keep on going in the same direction, and start having negative consequeunces in the other direction. Why this would happen is because corrective action is taken to correct the error at that moment, and does not include the errors or corrective measures from the past, that also contribute to the present state and must also be corrected. Simply put, if you try to correct for undesired conditions, at some point it will reach the desired condition and then shoot onwards in the opposite direction, and will lead to a reversal of the initial problem.

I (Integral) : That’s where the “integral” component comes in. This components has to take corrective action based on the accumulation of previous errors. Integral basically means “a sum of all”. We corrected for instantaneous errors previously, but the errors _were_ caused, and they cannot be ignored. They must all be included, or summed up, and corrective action must be taken to fix them as well.



Sounds better ? Yes, but we’re not quite there yet. While doing all this, it’s easy to keep on going forever, because errors will always occur, and neutralizing them will contribute to some more error, and so on. However, it is necessary to keep an eye on the big picture, the overall scheme of things.


D (Derivative) : This is where the “derivative” component kicks in. Simply put, “derivative” means “rate of change of”. We must keep the results from the use of the previous components, P and I in mind, we must take a look at the overall state of the system, and the rate of change of decrease in errors, and see the rate at which the system is approaching the desired stable condition. We must then make some fine tweaks and corrections to help the system come to stability sooner, faster. The “derivative” part helps us do exactly that, by adding a component of corrective action that will help us bring equlibrium sooner using a general overview of things.

This is rather a simplistic model of things, but I believe this helps us understand a lot more about why immediate corrective action might not be good enough in itself, about what other components are involved, and what to demand of our governments and agencies. Also of course, I hope you understood PID controller ; )


So I finally got some more time to 3Doodle, and this time I quickly settled on a camera. It seemed doable enough, part by part. I got my 3Doodler ready, pulled out my black plastic sticks, and set to work. Sadly, I haven’t taken a video of the process yet (nighttime creativity costs you making videos !). Anyway, the result is a bit shabby but still pretty encouraging. I am getting a hang of the controls and the flow speeds now, and the next work should be even better.


I tried just wireframing first, but the cylinder + bodyframe were just too flimsy to support without all the filling in. I’d love to try a wireframe next, if I can manage it. I did use up all my black plastic sticks, must order some plastic soon !