Sunday, 28 July 2013

Okay.. So.. We failed.

It's been a while since we updated the blog, mostly because we were procrastinating like crazy.


Because we failed to complete the Quadcopter project. Or even begin to do it.

Reasons why I think we failed:

  • We got really excited by the project and did zero research on the topic, and the parts. We ordered some very cheap speed controllers, and later realized from the forums that that was a bad idea. 
  • We hugely underestimated the amount of work we would have had to put in. HUGELY. 
  • The course load of college caught up with us. 
  • And we were lazy. 
And like we told our mentors and the contest organizers, this was a good lesson learnt in under-promising and over-achieving. 

BUT there is a silver lining here. 
We have a lot of stuff to build a quadcopter and we also plan to team up with a group in college that have been doing some really good work on the topic! More on that later.

And while we were procrastinating to update the blog, a few things happened:

1. We participated in the awesome Design and Innovation workshop conducted by the awesome people from MIT Medial labs.
We worked on a tiny project called Beat Feet with the awesome Priyans M and Rishemjit Kaur.
 It basically involved a pressure sensor on my shoe to detect a tempo and play a pre-programmed beat. 
The project was featured on the official Arduino blog!

2. Our college required us to submit a 'mini-project' for our 6th semester. 
Akshay and I decided to make a guitar tuner along with Anjana Shekhar
We went with Amanda Ghassaei's Instructable on Arduino Frequency Detection.
We really wanted it to work on the autocorrelation concept, but that didn't work for some reason.
Maybe we can fix it with an RTOS implementation?
But anyway, read about it on our project report!

3. We participated in the Freescale Cup for 2013! And lost.
More on that when we have something useful to post. :(
Control systems is evil.

And that's it for now.
We are working on some crazy things for our college satellite project and I really hope we get some time off to work on more tiny yet awesome projects.

Until next time!
- Bhargav 

Wednesday, 14 November 2012

MSP430-ing for TI's Analog Design Contest

Hey everyone! So in the previous blogpost, we showed you the Mastodon video and also promised you details about a quadcopter build.
And guess what?
Well, sort of.

The quadcopter is for Texas Instruments' Analog Design Contest that's being held in India. We've already finished Phase 1A, where we had to work on their Analog Lab Starter Kit and solve a problem statement.
You can find our answer here. I'm sure that most of it is wrong, and if you know the right answer, please let us know.

So moving on, for the quadcopter, we did a little bit of preliminary research. We have no idea about the physics and everything. We wanted to build one that can be used for surveillance, reconnaissance and search and rescue during disaster time and otherwise, simply because it will add more value to the project.
Our first stop.

While looking for quadcopter parts online, we immediately found out that hobbyking was the place to acquire all our parts. 
So we ordered our BLDC motors, a frame, batteries, electronic speed controllers, the FPV gear and other knick-knacks. We'll get to those later when we actually start to build the thing. 
Patience, my friend. 

Pretty shiny, right?

And we also needed an Inertial Measurement Unit that contains the accelerometer, gyro and compass, so that we get the state of the quadcopter in flight and allow the algorithm to use the readings in order to stabilize and do other cool stuff. We used DIYDrones ArduIMU+ V3.

Texas Instruments was generous enough that they gave each team participating in the competition (and there are around 300 plus teams) 200USD worth TI components for free! 

So we asked for a couple of MSP430 Launchpads, an EZ430-RF2500, a CC2500EMK(it's just a RF module) some LED drivers, Li-Ion battery management chips(just to see if we can try to build a charger ourselves). 

So while we wait for the stuff from HobbyKing to arrive, we thought we should get started on learning about the MSP430 launchpad and all it's functions like PWM, I2C, SPI and OTHER THINGS THAT WILL BLOW YOUR MIND. 

MSP430 Launchpad, just like an Arduino, except, well, redder. 
The MSP430 launchpad is basically a really inexpensive target board for MSP430 microcontrollers. You place a MSP430G2xx microcontroller in the socket, select the right device and write all your code in Code Composer Studio (or any of the other software tools), and you can flash program and debug your MSP430! :D
It's pretty awesome, and in construction seems very similar to an Arduino? But I wouldn't recommend it for the absolute beginner. If you have an idea and you want stuff blinking or moving within a matter of minutes, go for an Arduino. 
But if you want to take your time then you can buy around three Launchpads for the price of one Arduino.
Or you can try this(Which is pretty awesome. I need to check it out).
It actually took me quite some time to understand the code that blinks the on-board LED's. But as we're learning, we'll talk about everything and if you're as stumped as we are about learning about the Launchpad from the internet, then hopefully our blogpost/tutorial things will help you out.

See you soon! 

Sunday, 29 July 2012

Mastodon 1.0 - The Movie

Finally, the movie is done! 
There are a couple of things in the video that we left in intentionally, lets see if you get both of them! =P

If you want to know anything about the build, do let us know. There were a few problems we faced with it, mostly because the platform was a rat's nest of wires on top of a breadboard which was held down by a rubber band and a whole lot of tape. And if you do that on a moving platform where almost nothing is held down with solder, stuff is bound to come flying out.

Also, we're planning to post more regularly, and keep checking this spot, because a HUGE quadcopter build is on it's way!!

So until next time, keep making!

Friday, 13 July 2012

Mastodon 1.0 and DIY Dinner

About a week ago Bhargav started working on a bluetooth controlled car. It was inspired by this instructable. It consisted of four motors connected to a mechanix frame. If you don't already know what mechanix is, it is a kids toy used for building structures using nuts and bolts.  

If you haven't used it as a child,
you're probably nuts.

To this he attatched a 12V battery to power the motors and a L293 H-Bridge motor driver IC. And he used an Arduino Uno along with a bluetooth module for controlling it. He used a 9V battery to power the Arduino. It looked something like the picture below.

Now lets look into a few details before we proceed. First, the L293. The L293 is a motor driver used to control the direction of rotation of motor rotation using digital signals. That means that by using the digital output pins of the Arduino you can control the motor. It works with two digital inputs for each motor, and it can control 2 sets of motors independently. You can also have a separate power source for the motors (we used the 12V one).

The logic table is something like this.

A and B refer to the digital inputs.
The basic idea that shines here is the you can change direction of the motor digitally.

What we did was we tied up two motors together, both the left ones and both the right ones, so that they can be controlled simultaneously. So if we wanted to turn the vehicle to the right, we would turn only the left motors or vice versa. One limitation with this usage that we noticed was that we cannot move and turn simultaneously. It has to move, stop and only then turn. 

Now lets look into the control. We used the bluetooth module, the same one we used in Ayana '12 along with this Android app called Blue Control available for free in Google's Play store. It is a very simple app which has direction buttons and a bunch of other buttons. 

The center button actually opens a Blue portal.
The orange one is in Narnia.
When you pair your phone with the bluetooth module, it sends certain ASCII characters to the bluetooth module which can be serially recieved by the Arduino. The ASCII character which is sent depends on the button which is pressed on the app.

So what our Arduino code should basically do is receive these serial signals and send appropriate signals to the motor drivers such that they activate the right motors.

Its that time again, time for a block diagram.
A picture says a thousand words, this block diagram says sixteen.
Problems, problems and then some.
One major problem we ran into was, after a couple of minutes of neck breaking speeds the motor driver would heat up. And this would cut off supply all motors due to its automatic thermal shutdown feature.

We decided to pick up the L298 motor driver instead because it seemed to have better thermal stability and a heat sink as well. 
The only disadvantage with this was that it was only available in a Multiwatt-15 package as opposed to a dual-inline package. We took more than three hours trying to fit this thing onto a breadboard and trying to make it work without any loose connections but to no avail.
The L298 Multiwatt package, breadboard's arch nemesis.

DIY Dinner.
We decided to take a break for dinner and went out shopping for instant noodles which we usually buy on all-night soldering parties like this one.
But instead we decided to make something a little more interesting so we bought:

There is something magical about eggs.

    •  Mozzarella cheese
    • One loaf of whole wheat bread
    • Mushrooms
    • Half a dozen of eggs
    • Maggi Pizza sauce

    That is a killer knife right there.

    What kind of a hideous dinner we made from these you ask? We made some ommlettes and bread pizzas. Its quite simple actually, you just pretend your bread slices are the pizza base and top it like you would a regular pizza. We bought whole wheat bread because we are health conscious. No, really. 

    Anyways we sauted the mushrooms and some onions before putting them on the pizza. We put them in the oven for about 15 minutes and we had lovely bread pizza. 
    Don't try this at home.


    Artistic oven shot.

    We did a little experimenting with the omlettes too. We made cheese omlette with mushrooms and herbs. Check it out.
    Mushroom omlette. With Shyam's secret recipe
    that no one will know.

    Cheese omlette with herbs.

    Well we spent a good three hours in the kitchen, and we were tired and full so we decided to turn in. But Bhargav decides to try the circuit out one last time before that. And as we listened to some Color Haze we suddenly hear the whirr of the motors, it finally works!
    We are not superstitious. We really aren't.

    Anyways this got us really excited so we decided to shoot some videos of it and do a couple of test runs on the street. We taped a camera onto it to get a first person's view.
    And who doesn't love blue LEDs? So we decided to include a blue LED into the circuit, for *ahem* better vision.
    This is how it looked with the
    camera taped on it.
    You can never go
    wrong with a blue LED.

    All of this leads up to the video we are making of it. We decided to call it Mastodon 1.0. (Why? Because Mastodon is awesome). 

    You can see the trailer here.

    Stay tuned for the actual video.

    P.S. - The Arduino code we used is here.

    To a web browser near you.


    Tuesday, 1 May 2012

    Ayana12 - Hackathon idea: Android-Arduino-Bluetooth-Twitter-thing

    The open source group in our college hosted a 24 hour hackathon last week called Ayana 2012. We'd heard that they were allowing hardware hacks too, we were totally excited about it and decided to check it out! 

    After a couple of days of idea spit-balling at Akshay's place, we decided to go ahead with making an Android-controller thingy that lets us use a phone like a steering wheel or however you wanted to use it. After dabbling around with TCP, UDP, Telnet, SSH, and all those other wonderful wonderful networking protocols, we decided to go ahead with bluetooth. 
    Now again, we just couldn't figure how to send sensor data directly from the phone to the computer we were using. Until Shyam found out that we could use a bluetooth module on the arduino to receive sensor data from the phone using The Amarino App on Android. The arduino, once receiving, can send some serial message back to the computer and that in turn generates a keyboard event.  

    Now this app is amazing simply because of it's amazingly simple interface that easily connects to our bluetooth module and send sensor values serially to the computer! It's amazing! 

    So the next part we thought was pretty simple.

    1. Read sensor values.
    2. Setup a threshold to send a serial message.
    3. Convert serial message into a keyboard event.
    Not that simple. The code was still buggy even after working on it for several hours. We'll put it up once it's nice and all. But it's loosely based on This Instructable (which I think is really cool and shall definitely try out as soon as I get the time)

    And after that part was kinda down, we needed to create keyboard events. Again, not so simple. But after Google searching for several hours looking at Java libraries and all that, we came across: 


    Not many times does a google search lead you to jump around in a manic fashion cursing happily, but this did. And something about this software is kinda buggy too, or maybe we still don't know how to use it. But it's brilliant! 

    All we had to do was change the hex values in the protocol.txt file to ASCII values and we were good to go! 


    would make the cursor go up, up, up! It was awesome. 

    But the reason I keep saying it was buggy because when we tried it on a game, we'd go left, and then we'd go right and then, yeah, we'd be stuck there. It just wouldn't go the other way. But it worked fine on notepad! DAMN. 

    Pissing off, man. 

    Anyway, I went and bought a bulb from somewhere and thought we could use it to demonstrate how we can turn on and off appliances using the phone. We got it working after a while, using the proximity sensor on the phone.
    It would just toggle on and off though, we couldn't get it to stay on or off. 
    We'll post the code once we fix that. 

    We also wrote a little python code that let us turn on and off the bulb using twitter! :D The time delay was terrible though, I'll write another post about it soon, as I have a lot more to say about it. 

    Overall, Ayana12 was a terrific experience. The atmosphere was humming with creativity and laptop fans. I managed to click a few pics too! 

    Shreya, Surabhi, and Aditi. Trying to look cool. 

    They had BEAN BAGS!!!!

    Shyam hooking up the bluetooth module to the Arduino.

    Anjana and her team, Vivek and Kiran. 

    Vincent. Showing off. He single-handedly won the whole thing later anyway.  :P

    Our station. 

    This guy had wireless-ly interfaced a 3x3 array of LCD screens and  was playing Die Hard 4 on them.
    It looked awesome!


    Sunday, 11 March 2012

    Computer Controlled Light Bulb

    The first thing anyone ever does on the Arduino board is to make an LED blink. Some go even so far as to call it the ‘Hello World’ of electronics. We took it a step further and made a Light bulb blink.

    How is that different?
    An LED works fine with a 2V DC supply voltage.
    Billions of blue blistering LEDs

    A standard light bulb with a tungsten filament 
    works with the household 220V AC supply. (or 110V, whatever the local power supply is)
    How many DIY'ers does it take to screw in a lightbulb?
    This means that an LED can be directly connected to the Arduino board because the board’s digital pins are at 5V when they are in an ON state. There is no way the light bulb can be powered by the Arduino board.
    Its not JUST orange juice.

    How we solved it? 
    After some research, and a lot of Pulpy Orange, we came across these magical little things called relays. No, not the one involving the baton, but the basic philosophy still holds good.

    A relay is used when you need to control a circuit with a higher voltage with a low voltage signal.
    When you input a digital HIGH (that’s 5 Volts) it shorts the other two leads with almost no physical connection between the two circuits. Something like this.
    The circle like thing is the light bulb and the rectangle is the relay.
    A digital HIGH connects the output circuit.

    When you input a digital LOW (that’s 0 Volts) it leaves the other two leads open. This is like disconnecting the other circuit. Like this.
    A digital LOW disconnects the output circuit.
    So you can almost say the relay helps pass the baton from one circuit to the other. (You saw this coming:-P)

    The Arduino can send and receive serial data via USB to the computer. We used a simple Physical pixel code from the Arduino website available here. What it basically does is,
     if the Arduino receives an ASCII letter ‘H’ through the serial port then it sets the output pin to a digital HIGH. This eventually causes the light bulb to turn on because this HIGH is fed into the relay as shown above.
    When the Arduino receives an ASCII letter ‘L’ through the serial port it sets the output pin to a digital LOW, which in turn turns the light bulb off. 

    We wanted a way to control the light bulb with an app on the computer. We basically built a simple GUI using the Processing tool. What it does is it basically uses a Java code to generate an application on the computer through which it sends serial data to the Arduino. Note that we didn't use the mouse-over program which Physical pixel used. But they both work the same way and work equally well.

    So we used one of the example programs which creates a button and added a few things which makes it do what we want it to do. The code basically uses a
    port.write() command to send the ASCII characters to the serial port a.k.a., the Arduino.

    If you want the code we used its available here. It finally worked out in the end and you can see it in this video.

    Well, the project isn’t all that high tech. We were just experimenting with a concept, and it worked. We want to expand on this idea and eventually have a completely automated room. There is a lot more to come. So stay tuned.
     - Akshay

    Thursday, 12 January 2012

    The Arduino Air Drums Part 2

    Doing things the way you see it, going by your own heart and soul, that is pure artistic integrity. Whatever the hair is six or sixty inches long, the eyes have make-up or not, the riffs are in 'E' or 'F' sharp, the amps are Marshall or not, all those things don't matter if you are doing it for the right reason, which to me means doing it for yourself! 

    “What's the message in Metallica? There is no message,
     but if there was a message, it really should be look within yourself,
     don't listen to me,
     don't listen to James, don't listen to anybody,
    look within yourself for the answers.”
    Lars Ulrich
    - this guy -

    Although people hate Lars because he's not a great drummer and he sued Napster and can't play things right away and everything, you have to give it to the guy for being one of the most vocal drummer and speaking his mind out.
    Anyway, I wanted to start the post with a cool quote and it kinda blew out. Sorry. :P 

    The drums aren't complete without pedals, right? We need the bass pedal to play the bass and a hi-hat pedal to open and close the hi-hat. If you're unfamiliar with the awesome kit that is the drums, Google has THE picture. 

    We followed mmidgal on his concept and used two slippers, one with a ADXL335 accelerometer and one with the photocell. 
    [UPDATE: The photocell that we got wasn't very effective in changing it's resistance fast, so we decided to remove this part of the kit completely] 

    So what we did was, we made a slit in our first slipper almost 3/4th the way in the front so as to insert the accelerometer. 

    The accelerometer was connected to the USB connector
     the same way that we had done for the sticks. 

    Now that we're done with all three of our elements, the easy part was hooking the circuit up. USB cables are awesome for the job, and pretty cheap as well! 

    Now we move on to 

    The Program 

    For the impatient, you can find the code Here.

    But I'd like to take a while and explain what we tried to do with the code and the problems that we ran into:

    Firstly, a useful function to see how the Arduino is 'reporting' back changes given by the accelerometer is the analogRead(pinNum)
    along with the Serial.println(var) function, both of these when used in one program displays the reading received by the Arduino program as illustrated here. The results are then printed on the Arduino's serial monitor. 

    Using the above program we noticed that the value printed changes when the accelerometers are moved in their respective directions. So we figured our basic logic would be

    if(valueReadBySensor > someThreshold) then return (a MIDI message)

    and that's just repeated for all the other accelerometers.

    One more important thing is that we could never get our MIDI to USB converter to work with our program, after days of searching, we chanced upon a brilliant little piece of software, that reads MIDI messages directly from the USB port without the use of any DIN connectors or anything!!

    It's brilliant and so simple to use!! Just select the output port as Microsoft GS Wavesynth and you're good to go! We experimented with other softwares and virtual MIDI ports such as LoopBe and MIDIyoke but we could never get a sound out of Reaper or Audacity. 

    Alright, so now you have your simple piece of code to play a note when the accelerometer moves an appropriate amount.

    void loop()
      int threshold = 375;
      int reading = analogRead(A0);
      if(reading > threshold)
      noteOn(9, 35, 120);

    [You will find the definitions for noteOn and everything in the code.]

    This is great now, but what was happening was since there were a bunch of readings above the threshold that appeared as the drumstick was flicked, the S2MIDI software gave us a 'trrrrrrrrrrrrrk' sound. 

    So, we thought delay() was a great function, which paused the function for a certain number of milliseconds. But this still was not good enough because we could never reach a compromise between a really low delay value and the 'trrrrrrk' sound.

    After days and days of experimenting, we finally decided that the code mmidgal posted on his video was the best, although we made some modifications to make it better.

    Dave Lombardo style. Well, almost. :P 

    We used arrays along with the function millis() which really increased the response of the drum kit and allowed us to play Slayer songs. Almost.

    A few things that we wanted to add were: 
    • A button on one of the sticks that when pressed, would play a pre-recorded drum roll.
    • A crash cymbal sound when the hi-hat stick is swung a bit harder [the code was also written, but it was still a bit fickle and we could never get it right, so that one line is commented out].
    • A more responsive bass pedal.
    • A ride sound when the stick is swung in the X direction. This we could never get right because it was happening even when the stick was swung in the Z direction.  

    And that's it, so try it out and if you have any questions about the code, about the concept, criticisms on the blog or any feedback, really, please leave a post or send us an e-mail at

    Sorry I couldn't post a demonstration video.. None of us are drummers, all of us are guitarists, actually, we'll make one as soon as we get our hands on a kickass drummer. :D
    Thanks for reading and happy drumming!!!

    - Bhargav

    PS: If you have an interesting project or idea, or recommendations for our next project, do share it with us, we would love to hear it!