Motion sensing with a PIR sensor (FreeBird - Part 3)

Passive Infrared detectors are used to sense motion. I am right now experimenting with such a device from Parallax. For once, this is a sensor which works with 3.3V, so the interface with the AVR32 processor is simple. Whenever movement is sensed, the output of the device goes HIGH and then LOW. Placing an LED on the output pin (buffered by a transistor) makes this `sensing' visible! Watching the LED light up and go off in a dark room as you move around the sensor is kind of spooky! Now, what kind of application can this have on a FreeBird?

Watch the PIR sensor in action!


Line sensing with QRD1114 (FreeBird - Part 2)

The FreeBird now has `1-bit' vision! I am experimenting with the QRD1114 reflective object sensor. It's a small IR LED and a phototransistor combined in a single 4-pin package. Light reflected from an object placed close to the sensor controls the conductivity of the transistor.

Things to do immediately: (a) Start working with gEDA once again; create PCB's for line sensor and ultrasound module (b) Clean up the code (c) get Python working (d) Integrate with Pyro

Some of my students are working on a sort of `Mini FreeBird' based on an Atmega controller and locally available components. This will be the version which we hope to use in schools.


Save Kannada!

Bangalore: The Letter of Intent signed by the Karnataka government with Microsoft to establish paperless offices is drawing criticism from advocates of Free and Open Source Software (Free as in freedom). They have started a campaign against it on the web page, savekannada.googlepages.com


Microsoft is not aware of using language appropriately. It strings together different words in an absurd fashion and describes them as directions to perform different actions. These mistakes have been pointed out several times but the mistakes have remained. These mistakes were found in XP’s LIP also. The same mistakes are now found in Vista also. Many Kannada software engineers have spent considerable time and energy in pointing out the errors and have made efforts to make sure that correct Kannada language reaches consumers. Appallingly, Microsoft has refused to acknowledge the blunders and has retained all the mistakes.



Ullrich Drepper Writes about "Memory"

The title of this paper is an homage to David Goldberg's classic paper “What Every Computer Scientist Should Know About Floating-Point Arithmetic” [goldberg]. Goldberg's paper is still not widely known, although it should be a prerequisite for anybody daring to touch a keyboard for serious programming.

Read What every programmer should know about memory - part 1 and part 2

Read the comments too, they are interesting.

You may wonder whether you need to understand stuff like how a DRAM cell is implemented using a capacitor and a transistor or how a SRAM cell is implemented using six transistors. Here is what one reader says:

There are programmers out there, who write memory controller configuration code for boot loaders. I have done it and knowing the electrical design of memory cells really helped to answer simple questions like why the hell does DRAM need a configurable controller while the onchip SRAM is nicely ready for use right after powerup.

Another reader suggests:

Personally, I think it is useful to have a reasonable knowledge one level of abstraction down, and one level of abstraction up. There are a number of reasons for this:

  • You can often find optimizations that cross abstraction barriers. It is difficult to predict what you'll need to know to do this, so you really need to have a deep understanding of both layers. In some cases, you can also influence the hardware design.
  • You can predict how the technology may evolve.
  • You gain intellectual depth.

This is especially important for systems programmers -- the target of this article. If I'm designing a kernel, or a virtual machine (as in JVM, or .net runtime), or a high-performance systems library, I want to design it in such a way that it can take advantage of possible future underlying technologies.

It's not too difficult get a feel of the impact of memory architecture - here is a simple experiment.


The Song of the FreeBird!

Visit the Bird's Home!

See the bird in action! (Google video)

The board is running on a single 9V `Energizer' (similar to Duracell) battery. It works even when the voltage drops to about 7.7V! Some u-boot environment variables have been set so as to make it boot from the SD card and run an init script which loads the PWM driver and sings the following song:

#include "robolib.h"
#include <stdlib.h>

        int i;

        while(1) {
                i = 1 + (int)((4.0 * rand())/(RAND_MAX + 1.0));
                if(i == 1) {
                else if(i == 2) {
                else if(i == 3) {
                else if(i == 4){


Experiments with the ATNGW100 - Part 10

And finally, it moves!

final1 final2


The servo's are powered by four 1.5V batteries. The main board is still not battery powered - have to test with two 9V batteries after the kernel is recompiled to disable as many power draining units as possible (according to the manual, the ethernet interfaces are the most power hungry - they can be safely disabled).


With Love, from Lua! [Experiments with ATNGW100 - Part 9]

C, for example, ia a beautiful language in the category of "portable assemblers". In that category C is powerful thanks to its libraries, simple and easily implementable thanks to its syntax and semantics, portable due to very clever and clean hardware abstraction.

I think that Lua is to "high level scripting languages" is what C is to "portable assemblers". Lua has both OO and functional programming very naturally represented in its semantics. All objects are first class (including functions). Lua is small, very fast (in fact fastest scripting language according to http://shootout.alioth.debian.org/ [debian.org]), has very good Virtual Machine, incremental Garbage Collector. As far as fundamantals are concerned, Lua is light-years ahead of Ruby. It still lags behind in library support, but the recent progress is very encouraging.


From first impressions, I think I am going to like this language! I got it cross-compiled for the AVR32 cleanly. The statically linked binary is only 200kb in size and still the language supports stuff like coroutines, closures, iterators ...It also does tail call optimization. I feel we have in Lua a Scheme/Lisp with human-friendly syntax! My decision is almost made - I will test drive my robot with Lua instead of Python.

This is The Book to read if you want to know more about Lua ... Some reviewers have even compared it to K&R!

My ATNGW100 now boots from an image on the SD card and runs Lua scripts!



The story of PING))) [Experiments with the ATNGW100 - Part 8]

Well, this is a different kind of ping; and I have been playing with it for the past two days - the last technical issue to be resolved before I integrate everything and can start dreaming of this!

The Parallax PING sensor has a simple `one-wire' interface - you send a LOW-HIGH-LOW TTL pulse (HIGH around 10us) on its signal line (SIG) and it will wait for some time (about 750us) and then sends a burst of ultrasound. During this wait period, the sensor pulls SIG down to LOW - as soon as it transmits the ultrasound burst, SIG is made HIGH. SIG becomes LOW only when the echo is received. Thus, the width of the HIGH level on SIG gives you the round trip time. The problem here is that the AVR32 IO pins are not 5V tolerant (HIGH is 3.3V and absolute max voltage on an i/p pin is 3.9V). So what is essentially a zero-component connection between an I/O line and SIG becomes a bit more complicated ... Anyway, things are working fine now and I am able to get good measurements.


Imagine how exciting it would be for beginning students if they get to play with a simple robot - studying both its hardware and software - instead of writing `find factorial of N' programs in the programming lab and `inventing' data to fit equations in the electronics lab! Imaginative teaching/learning is not something which only a Stanford or MIT can do - we too can do it. One of my `grand' objectives with this series of experiments is to finally produce enough freely available (GPL'd) course materials for something similar to MIT 6.01: Introduction to EECS 1 - but the trouble is, its going to consume a *lot* of my time. Will any University in India accept such a course? Assuming that I am going to spend a good amount of time on this, is there any chance of getting some funding?


Story of Free Software in Kerala - Software Freedom Day Celebrations

Software Freedom Day celebrations in Thrissur began with a meeting of Free Software Enthusiasts at the Chamber of Commerce. Before I write more about today's events, let me share with you a great document written by Dr.Sasi Kumar:

Story of Free Software in Kerala

To add a bit more history to Dr.Sasi Kumar's story - Prof. Jyothi John was instrumental in creating perhaps the first group of GNU/Linux enthusiasts in an engineering college in Kerala when he gave us (1992 - 96 batch of CS students, Model Engg College) a bunch of floppies containing this `new' OS! A small bookshop under the north overbridge in Ernakulam, `Mindstorm' gave us our first GNU/Linux books (basically a compilation of some HOWTO's) long before bookshops in India started stocking `Linux' books! A bookshop in Trichur, Cosmo books, started using a small network of GNU/Linux machines (with some s/w written by I believe the River Valley people) when the techies in Bangalore were still cleaning viruses from their Windows PC's! (And, a young commerce graduate working in this bookshop - an absolute computer illiterate - was merrily configuring NFS and setting up GNU/Linux networks when `Software Engineers' were still using M$-Windows because it was more `user-friendly')

Here is yet another great news:

In the largest such simultaneous deployment of ‘free-and-open’ software in India, over 15 lakh Kerala schoolchildren on Friday start taking their quarterly practical tests in Information Technology on personal computers using a special Linux version.


Coming back to todays events, the meeting was held at the `chamber of commerce', Palace road. Besides the usual gang, there were a few distinguished personalities from the field of language studies and journalism.

sfd1 sfd3

sfd4 sfd2

sfd7 sfd5

One of the objectives of the meeting was to take stock of the activities going on as part of the `Swathanthra Malayalam Computing' effort for the past one year. SMC was started by Baiju M when he was a student at REC Calicut. The project was dormant for a long time until it was woken up by Praveen and friends. A major push came in the form of the project being selected for the Google Summer of Code (I believe it is the only Indian project participating in SoC). A total of seven or eight projects coming under the SMC umbrella had their formal `release' today.

The Malayalam Unicode font, designed by Hussain and Suresh, was released at the function.


Santhosh Thottingal released a spell-checker (based on GNU Aspell) for Malayalam. Santhosh is also behind several other interesting language projects including adding Malayalam support for the text-to-speech engine `Dhwani'. He spoke about some of the challenges involved in designing the spell checker, one of which was the creation of a sufficiently large list of `correct' words.


Shyam, a student of MES Engg college Kuttippuram, released his Malayalam speech recognition s/w (done as part of SoC).


Mobin and friends released Malayalam-enhanced Tux-Type, a typing tutor (SoC project)


There are people who doubt the logic behind creating a computing environment with support for a language like Malayalam. After all, almost all of us can read and understand basic English, so what's the point in putting in so much of effort? The answer is to look from a much wider angle. As one of the speakers pointed out, a language has to continuously evolve if it is to be alive. A language like Sanskrit is virtually dead - few people use it. A society and a culture is identified by its language - once the language is dead, the society starts losing its identity. A good way to keep a language alive is to take it to the digital world - the world of the PC/Communication devices and the Internet. This is one context in which developing regional language computing environments and popularising them has great significance.

SFD celebrations will continue tomorrow (Sep 15).


I was able to attend only the morning session today (Sep 15). But it was very interesting. There was a demonstration of all the packages developed by SMC. Anivar gave a historical sketch of the Malayalam computing effort. Praveen and Hussain sir gave a tutorial introduction to Unicode and the issues behind introducing Malayalam language support. Vimal was distributing GPLv3 buttons to everybody - I couldn't get one because I came to know of it only later :-(. Shyam showed me his Malayalam speech recognition program - the noise in the hall was making it difficult for the tool to work properly. I listened to Santhosh's TTS system reading out Malayalam text in a `robotic' manner. Then there was Sarath Lakshman hacking up a Python program improptu so that he could gather the address/mail id/phone number of all the meeting particpants! Mahesh and Kishore were also there. A good number of S3 CS students were running around enthusiastically ... these guys/girls are our hope!