Create your open source report card (From github)

shantanubhadoria 14-04-2014 20:09:30

Found this interesting tool to generate a funny but cool story for your developer habits and preferences. It seems to pull the developer profile data from github. Anyone can enter their github profile name to generate their own story.

http://osrc.dfm.io/shantanubhadoria

Playing with FreeSwitch

shantanubhadoria 28-01-2014 01:10:24

Today I have started playing around with freeswitch to explore the possiblity of using it as a tool for secure audio routing.

Wikipedia: 

FreeSWITCH is free and open source communications software for the creation of voice and messaging products. It is licensed under the Mozilla Public License (MPL), a free software license. Its core library, libfreeswitch, is capable of being embedded into other projects, as well as being used as a stand-alone application.

More updates soon . . .

  • FreeSWITCH

Setting up ArchLINUX on BeagleBone Black - Part 3 - Setting up I2C and PWM controller

shantanubhadoria 14-12-2013 19:50:51

This Article is a placeholder for work in progress and I will log my success as I go forward.

ArchLINUX has proven to be the lightest of all the distros that I have installed yet on Beaglebone Black. I have already got all the basics up and running and now I am setting up my perl stack and I2C and PWM interfaces. Make sure you have followed my previous instructions for ArchLINUX here.

List of Instructions for Archlinux

Install base devel and include all the sub packages. This is needed for installing XS modules and its roughly equivalent to build-essential package on Ubuntu

$ pacman -S base-devel

Install i2c-tools

$ pacman -S i2c-tools

Now we can go ahead and install Device::SMBus. This is the interface that I released to CPAN for connecting to I2C devices, in the last release Device::SMBus 1.05 I removed some dependencies on board and distribution specific differences in i2c-dev installations, so it works without issues on both Raspberry Pi and BeagleBone Black , ubuntu,armstrong and archlinux installations.

$ cpan Device::SMBus

I use the LSM303DLHC for my work with LSM303DLHC Altimeter and Magnetometer

$ cpan Device::LSM303DLHC

Installing module for using LPS331AP Altimeter Barometer

$ cpan Device::LPS331AP

Installing module for using L3GD20 Gyroscope

$ cpan Device::L3GD20

My two ways of controlling PWM on Beagelbone Black:

External I2C PWM Generator like PCA9685:

I have already implemented this method before on Raspberry Pi, Since we have already setup I2C on ArchLINUX above, using PCA9685 is quiet simple, and while I have not lokked into the fact if the BeagleBone Black has a seperate microcontroller with a clock for controlling PWM or it generate a "software PWM", if its the latter, there are obvious benefits to using a external PWM generator like PCA9685. Since I already bought this PWM microcontroller when I was building a quad on the Raspberry Pi, I might go ahead and use it again with BeagleBone Black if it proves to be a better option for performance.

TO use PCA9685 with perl simply install Device::PCA9685 on your BB and connect your PCA9685 to the I2C Pins like I do. There are other ways to do it without using perl but I won't go into that unless I need it. To look into syntax details of how to use Device::PCA9685 look up the documentation for Device::PCA9685 on metacpan

$ cpan Device::PCA9685

Onboard PWM Pins on Beaglebone Black:

BeagleBone black uses a internal clock in its arm335x CPU to generate a PWM on its 8 or so PWM pins. The way to use this is to set the internal registers in the CPU using /dev/mem to trigger the high and low in the PWM signal at the correct moment as required. I will probably write a perl library to maipulate these registers directly from perl for using OMAP335x CPU to achieve the desired PWM signal. 

Stay Tuned . . .

UPDATE: All PWMs are not created equal

I have done my research and I realised that all PWM outputs are not created equal when it comes to the Beaglebone Black. Essentially the black has 

  • Two independent PWM outputs with dual-edge symmetric operation
  • Two independent PWM outputs with single-edge operation
  • One independent PWM output with dual-edge asymmetric operation

So no two similar PWM output which makes me edgy, because having rotors running on different clocks is a bit dodgy especially if I hope to have finer tuned control on my quad so I have dropped the idea to write the perl driver for BBB CPU controlled PWM.

I haven't gone into details of different types of PWM but from a brief read up on the web, a dual edge symmetric PWM provides better quality signal for running Brushless DC motor, in a X config quad that I have, I am not sure I want to have different quality signals running the four motors.

  • ArchLinux
  • Beaglebone Black
  • Device::L3GD20
  • Device::LPS331AP
  • Device::LSM303DLHC
  • Device::SMBus
  • GNU
  • Linux

Setting up ArchLINUX on BeagleBone Black - Part 2

shantanubhadoria 14-12-2013 07:20:59

so I have been trying to get my usual environment up on archlinux.first comes vim

$ pacman -Syq vim
$ pacman -Syq perl-moose

There is a cpan package for easily maintaining CPAN packages on arch linux CPANPLUS::Dist::Arch, its a CPANPLUS backend for ArchLINUXhttps://metacpan.org/pod/release/JUSTER/CPANPLUS-Dist-Arch-1.28/lib/CPANPLUS/Dist/Arch.pod

$ cpan CPANPLUS::Dist::Arch

setup cpan to use us automatically

$ setupdistarch

Install Device::SMBus as a pacman package

$ cpanp -i Device::SMBus

 

  • ArchLinux
  • Beaglebone Black
  • GNU
  • Linux

Setting up ArchLINUX on BeagleBone Black - Part 1

shantanubhadoria 14-12-2013 06:15:56

Today I decided to give Archlinux a whirl with my BeagleBone Black board. Its a little more complicated to get it up and running compared to default suppported Angstrom distribution and generic GNU/LINUX distros, but it helps me save a lot of space. Instructions are listed on arch linux arm website at http://archlinuxarm.org/platforms/armv7/ti/beaglebone-black but I noticed that the download links go  down quiet often so you might have to try a couple of times to get the download complete.

The Initial install occupies 28% of mmc storage compared to around 65% for angstrom, leaving lot of space for me to play around in! :) As long as I can find a good wifi driver for the tiny usb wifi dongle I bought, I will stick to this distro for my UAV project.

More on the adventures if things go as planned.

  • ArchLinux
  • Beaglebone Black
  • GNU
  • Linux

No space left on Beaglebone Black Angstrom!!

shantanubhadoria 07-12-2013 20:49:28

Few minutes back I just realised that space on my Beaglebone Blackis full!! Wow 2GB occupied on a tiny linux install that I made yesterday!! As it turns out the default Angstrom distribution is set in debug mode, which fills up the logs like crap! so the space on my black is full now. If you face the same issue here is the quick fix!

edit the /etc/systemd/journald.conf and change the following settings:

SystemMaxUse=16M

MaxLevelStore=info

MaxLevelSyslog=info

Reboot with:

init 6

edit the /etc/systemd/journald.conf and change the following settings: SystemMaxUse=16M MaxLevelStore=info MaxLevelSyslog=info
  • Angstrom Linux
  • Beaglebone Black
  • GNU
  • Linux

Setting up perl and cpan the usual way on Angstrom Linux

shantanubhadoria 07-12-2013 08:44:56

I have gotten so used to using super convenient the default setups on ubuntu  for perl that other flavours of linux are feeling increasingly user-unfriendly. After I have been forced to switch to Angstrom on my Beaglebone Black, I have been trying to get it up like I usually like my Linux.

There are tons of things missing in stock Angstrom distribution of perl and it just doesn't do things right. So I decided to write a little guide on how to remove the existing perl distro and build a fresh version from the source:

$ opkg remove perl --force-depends --force-remove

$ wget http://www.cpan.org/src/5.0/perl-5.18.1.tar.gz 

$ tar -xvf perl-5.18.1.tar.gz

$ cd perl-5.18.1

Update system time, Configure can cause problems if you don't do this step 

$ date -s "7 DEC 2013 22:47:00"

$ ./Configure -d prefix=/usr/local/perl

Go get some cofffee, this will take a while.

$ make

Mix it up get some hot chocolate this time :)

$ make install

 That will get you your usual cpan app on command line.

 Now if you want to install cpanminus there are few more step than usual. Upgrade your wgt as Angstrom on BB ships with a version of wget older than what is supported by cpanminus.

Specifically the option --retry-connrefused used by cpanm is not supported by older versions of wget.

$ opkg wget

$ cpan App::cpanmius

This should get your cpanm working.

  • Angstrom Linux
  • Beaglebone Black
  • GNU
  • Linux
  • Perl

Reverting back to Angstrom Linux on my Beaglebone Black

shantanubhadoria 07-12-2013 05:49:42

Today I flashed back the Angstrom Kernel on my Beaglebone Black Board. Ubuntu arm Linux kernel caused me some issues with my realtek rtl8192cu wifi dongle, I was not keen to spend much time resolving this so I switched to Angstrom linux. I am quiet used to the process now. Its basically the same process as installing ubuntu on the BB except in this case I burn angstrom on to the SD card instead.

This is all a part of the hung up process for me moving my Perl Autopilot development for my quadrotor drone over to my Beaglebone Black Board since my Raspberry Pi is now busy serving as the media center for my TV. However good thing is that I don't need to use the PCA9685 chipset for generating the PWM signals since the Beaglebone black has its own GPIO Pins which can generate the right Pulse for controlling the DC motors. I can also get rid of the the breadboard for the moment, which might even help me remove a portion of the frame I was using for mounting all these extras. This means I will have some weight reduction, yippee :)

I am still working with the algorithms for Getting the right orientation values, I am some distance away from getting all the sensor data for achieving a straight hover capability. Most of this because I had to suspend this project first for all my trips to Macau and Hong Kong and then for my trip to Canada and later all the work committments. 

I hope I can get something going by the end of this month. Atleast I should be able to achieve control of the brushless motors using onboard processing.

  • Angstrom Linux
  • Autopilot
  • Beaglebone Black
  • GNU
  • Linux
  • Perl
  • Raspberry Pi
  • Ubuntu

Oh Canada!! Quebec City and L'Anse-Saint-Jean

shantanubhadoria 12-11-2013 18:21:58

So last week after my business trip to macau, I took the flight from hongkong to Montreal via Toronto to hang out with Karine and her folks in Montreal and around. After finishing of the meeting people business, Yesterday we took the rental car south to this tiny village in north of quebec called L'Anse-Saint-Jean. Its been snowing heavy since a while and most of this place is covered in snow. I drove throught the heaviest snow storm of my life during the day.. Karine warned me about the black ice, so called because it is snow that has turned into ice on the road and hence is not easily visible when driving on the road. This can cause serious accidents as a car at high speed can slip a few feet when driving through on black ice. Luckily I didn't slip much during the drive.

Yesterday we drove to Quebec city and spent the rest of the day visiting the Chateau Fontenac, Citadel de Quebec, Parliament house of Quebec(Hôtel du Parlement, literally: parliament hotel),We even brushed by the governor of Quebec near the parliament house. We finished off with a nice meal at Aux Anciens Canadiens. A highly recommended restaurant if you want to try the game meat like wild boar, bison, deer etc. and local Qubecois cuisine. Later on we met Karine's friend Elysa and then retired for the day at the hotel(It gets dark early over here in winter). This morning we drove down to L'Anse Saint Jean, A charming village far north in Quebec Province. We are going to spend the evening here today. More updates soon . . .

  • Canada
  • L'Anse-Saint-Jean
  • Montreal
  • Quebec
  • Quebec City
  • Travel
  • Travelogues

Talking to LSM303DLHC Accelerometer and Compass using perl and Device::LSM303DLHC

shantanubhadoria 25-10-2013 19:14:38

I bought a pololu's AltIMU inertial measurement unit that includes among other things a onboard Accelerometer and Magnetometer in the form of the LSM303DLHC chipset.

I decided to write down the steps I take to get it working with my Beaglebone Black and Raspberry Pi boards using perl, to help those who are trying to achieve the same.

First follow the instructions to install Device::SMBus on Beaglebone Black if you have a Beaglebone Black, or instructions to install Device::SMBus on a raspberry Pi if you are using a Raspberry Pi board

Then install Device::LSM303DLHC from cpan

sudo apt-get install Device::LSM303DLHC

then put this code in a file and save it as lsm303dlhc.pl :

#!/usr/bin/perl

use strict;
use warnings;

use Device::LSM303DLHC; 

my $dev = Device::LSM303DLHC->new(I2CBusDevicePath => '/dev/i2c-1');
$dev->Magnetometer->enable();
$dev->Accelerometer->enable();
while(){
  my $accelerometer = $dev->Accelerometer->getRawReading();
  my $compass = $dev->Magnetometer->getRawReading();

  print "\tACCELEROMETER: $accelerometer->{x}\t$accelerometer->{y}\t$accelerometer->{z}\t\tCOMPASS: $compass->{x}\t$compass->{y}\t$compass->{z}\t\n" ;

}

 Run this file now, you will get the following result:

 

The code and these modules have been tested to work on both Raspberry Pi models and on Beaglebone black, and there is no reason why it wont work in other dev boards as long you have perl and the other dependencies for Device::SMBus on them.

  • Autopilot
  • Beaglebone Black
  • Debian
  • Device::LSM303DLHC
  • Device::SMBus
  • GNU
  • I2C
  • Linux
  • Perl
  • Raspberry Pi
  • SMBus