Sony Arouje

a programmer's log

Archive for September 2015

My modified Royal Enfield Electra 5s

with 30 comments

Last couple of months my Royal Enfield was in Kerala with my friend Shibin, a highly creative Mechanic. I better call him an Artist, his eye for details is highly remarkable. Also he is very passionate about his job.

The restoration was a lengthy process. Almost all the parts has been replaced. The major modifications are.

 

bulle1_copyright

Crank Weight: Added 6kg more, now the crank weight is around 11.7kg. The increased crank weight allow me to ride slow speed in higher gear without knocking. Now the riding is smooth without much gear shifting. Also the kind of beat the machine produce is awesome. I need to get accustomed to a new riding habit. Increased weight also need a good bearing, I used SKF bearing. The cost of the bearing is higher but I don’t want to sacrifice quality over cost.

Matte Black Paint: I am a hardcore fan of Black. So I decided to paint my RE with Black. I loved the Matte colors of Harley, so asked Shibin to use the same kind of Black in my RE. He did an awesome job.

Buffing: This is the idea of Shibin to buff the Engine section. I asked to paint Engine as well, he advised me not to. So he went ahead and buffed it, after seeing the result, I realized that my idea of painting was not good.

Delco: My RE was fitted with Electronics timing system (CDI). Shibin decided to replace it with old mechanical Delco. The Engine has slot to fit it but he had to drill some holes and customize the engine to suit the Delco.

Front Suspension: From the beginning I didn’t like the design of the Suspension in my Electra. I always admire the look of old RE. So I asked Shibin to replace the front suspension with the Classic one.

Mudguards: I didn’t like Electra’s mudguards either. The mudguards are replaced with the Standard model.

Fixed some other major Issues:

I was complaining about the burning color in my silencer but no service centers could fix it. Shibin had a look and said it’s the issue with the timing system. When he dismantled the engine, he told me that Carburetor was irrecoverably damaged. I assumed this should have been captured in the prior service 3 months before that. Also a lot of issues with the timing system.

One of the Oil pump holes where closed with some Engine sealer. From the beginning I had these Engine leakage, I complained it several times as well. So they might have added the sealer more and some how it went into the oil pump. Some say that it’s not leakage, it’s marking the territory but for me it’s a mess, also I am social being no need to mark the territory :).

A Word to Eicher motors: Royal Enfield is a great machine but the major issues are with the Authorized service centers. The service persons are not at all experienced. Because of high demand service centers are employing very less skilled persons. These guys are learning from the mistakes, but unfortunately our bullets are bearing their mistakes. Every one is jumping to buy an Enfield but they are not realizing the trouble they have to face in the future from these so called Authorized centers. I am pretty sure none of the issues in your Enfield could be fixed in any Authorized service centers. Try and find a good mechanic in your area or pack your RE to Shibin :).

 

Happy riding…

Written by Sony Arouje

September 16, 2015 at 6:09 pm

Posted in Misc

Tagged with , ,

MQTT Protocol for Internet of Things (IoT)

with 8 comments

I was thinking about how to control my Aeroponic system remotely via internet. The Raspberry Pi controlling the system is connected to internet via a router. I could access RaspberryPi by Port forwarding and stuff like that but it’s complicated. Next option could be using Websockets but I felt it’s an overkill for the applications running in Pi.

Recently I received a Refcard from Dzone regarding a protocol called MQTT. I was not aware of this Protocol before. So thought of doing some experiment with it. I am not going much deeper into the protocol, Dzone refcard did a great job of explaining it well.

In a nutshell, MQTT consist of three parts.

  • Broker
  • Subscribers
  • Publishers

image

 

Publisher, publish message to a specific topic and any Subscriber subscribes for that topic receives the message. Broker is the central hub, both Publishers and Subscribers are connected to the Broker and it take care of delivering the message to all the subscribers subscribed for the topic.

Brokers

We can implement our own broker using RabitMQ or Mosca plugin for Node js or any other MQTT brokers available in the market. To experiment it, I used CloudMQTT addon in Heroku. I used Heroku just to manage every thing from one central place.

Dev Environment

I created two set off Node js application, one running in my computer as a publisher and another running in my RaspberryPi as a subscriber. Both have no direct connection instead they are connected to CoudMQTT broker. Below is a test code and nothing related to my Aeroponic system.

Publisher Code

var mqtt = require('mqtt');
var client = mqtt.createClient('<<PortNumber>>', 'm11.cloudmqtt.com', {
    username: '<<UserName>>',
    password: '<<Password>>'
});

client.on('connect', function () { // When connected
    
    // subscribe to a topic
    client.subscribe('TEMPERATURE_READING', function () {
        // when a message arrives, do something with it
        client.on('message', function (topic, message, packet) {
            console.log("Received '" + message + "' on '" + topic + "'");
        });
    });
    
    // publish a message to a topic
    client.publish('SET_TEMPERATURE', '24', function () {
        console.log("Message is published");
      });
});

 

The above code act as a Publisher as well as a Subscriber. For e.g. the above code can be a piece running in Internet and the Pi’s can Publish the Temperature readings in a periodic interval and logged in a central db. We can see the readings via a webapp or which ever the way we need. Also if required we can set a temperature to all the connected RPi’s by publishing a message to topic ‘SET_TEMPERATURE’.

Subscriber Code

var mqtt = require('mqtt'), url = require('url');
var client = mqtt.createClient('<<Portnumber>>', 'm11.cloudmqtt.com', {
    username: '<<UserName>>',
    password: '<<Password>>'
});

client.on('connect', function () { // When connected
    
    // subscribe to a topic
    client.subscribe('SET_TEMPERATURE', function () {
        // when a message arrives, do something with it
        client.on('message', function (topic, message, packet) {
            console.log("Received '" + message + "' on '" + topic + "'");
           // set the temperature. 
        });
    });
    
});

 

The code is very minimal and we could achieve an easy communication to all the connected devices. In the above scenario clients are always connected. If you want to end the connection then call ‘client.end()’.

Later I implemented a Broker using Mosca, both scenarios the system worked really well.

Written by Sony Arouje

September 3, 2015 at 5:29 pm

Posted in Raspberry Pi

Tagged with ,

%d bloggers like this: