Visit to the German Space Operations Centre

Visit to the German Space Operations Centre

During the first month of my summer vacation I had an opportunity to visit the DLR – Deutches Zentrum für Luft und Raumfahrt (i.e. German Aerospace Centre) at Oberpfaffenhofen near Munich in Germany. The DLR is a branch of the European Space Agency (ESA).

But before I proceed any further, a little background on how this happened.
Our first stop in Germany was Munich. The host of the place where we stayed, works at the DLR. On hearing of my interest in space and technology, he offered to show us around the department he works in (which I most enthusiastically accepted!).
And so the next day, we visited the German Space Operations Centre (GSOC) of the DLR. It is here, where communication takes place with the astronauts on board the International Space Station (ISS). GSOC has played a key role in operating a multitude of manned and unmanned spacecraft missions for the past 35 years. Currently, they are preparing for operations on the European satellite navigation system: Galileo, a constellation of 30 satellites which will be in control of the DLR for at least 20 more years.
We were also shown a scale mock-up of Europe’s module on the ISS, the construction of which, our gracious host was involved in. In the same area, was a pilot simulator mounted on a massive KUKA robotic arm.
IMG_20160508_123919IMG_20160508_124027
The highlight of our visit: a once-in-a-lifetime opportunity to see the redundant control room of GSOC. In other words, all the activity that happen in the main control room also takes place on the computers and real-time monitoring systems in the redundant room. In the eventuality that something goes wrong in the main control room, the personnel would still be able to continue operations from the redundant room. And this is where I learn’t the rule of redundancy: Everything should be redundant.
In the redundant room of GSOC, I saw the astronauts’ work time-table, current location and signal transmission status of the ISS, various communication and earth monitoring satellites’ locations, heard live communication between other control centres all over the world (like the one at NASA!) and even sat in the redundant chair of the COL FLIGHT! (Flight Director)
IMG_20160508_123640
The visit to GSOC was the best part of my vacation and I will remember it forever.
There were two major things that I learn’t on this visit:
The first, as I’ve mentioned earlier, the importance of redundancy.
The second: Pass it on. Pass on the knowledge and experience that you have, to those who share an interest in it. Help a spark of interest become a flame of knowledge. The knowledge that I have gained on this visit will be invaluable to me because it was through an experience. Fernando saw my interest and decided to pass on a part of his experience to me.
As Louis L’amor once said “Knowledge is like money: to be of value it must circulate, and in circulating it can increase in quantity and, hopefully, in value.”
Thanks for making this possible Fernando!
Quark 2016 – BITS Pilani, K.K. Birla Goa Campus

Quark 2016 – BITS Pilani, K.K. Birla Goa Campus

Quark 2016 – A Cosmic Odyssey

Days of festival: 5th, 6th & 7th February 2016

I participated in Line Following, Roborace and, for the first time, Open Showcase!

RoboRace

Objective: Design & build a remote controlled all-terrain racer that can traverse any given path with obstacles like rocks, sand, slopes, uneven ground, mud, etc.

Dates of competition: 5th & 6th

Venue: Uneven grounds outside B-Dome

Home test report: Excellent traction, thanks to the custom-made wheels (each wheel was actually a pulley with a track belt bound tightly over it) Gains speed very quickly and can even climb out of a small car tyre.

Results:

5th Feb, Round 1 – The bot completed the track without stopping, and clocked a very good timing, however, the high traction wheels turned out to be a massive hindrance while making spot turns. This factor slowed it down, but it made up for that on the straight paths.

The bot qualified for Round 2, which was to be held on Day 2, but unfortunately, due to a last minute shorting onboard the wireless module, the bot was unable to participate.

Quark_2016_RoboRace_participation_certificate

Open Showcase

Objective: Present an innovative idea that solves a problem.

Dates of competition: Day 2

Venue: CC lobby

My Idea (for the EEE category): CUA (Computer Usage Alert) is a plug-n-play USB device that alerts you to get up and stretch at 20 minute intervals. It has an ATtiny85 micro controller with a program that sends a signal to a buzzer to beep every 20 minutes, thereby alerting you to get up. This process continues until it is unplugged or the computer/laptop to which it is plugged is shut down.

The judging criteria was as follows:

  • Innovation
  • Feasibility and Sustainability
  • Cost Effectiveness
  • Social Viability
  • Discipline
  • Project Report

Quark_2016_Open_Showcase_participation_certificate

Line Following

Objective: Design, build & program a line following robot (LFR) which can traverse a black track on a white background with obstacles like acute angle, obtuse angles, right angles, dashed lines, curves and reach the finish line in shortest possible time. The track width will be 2cm to 3cm. (As per the rules mentioned online)

Screen Shot 2016-02-16 at 8.28.51 pm

Dates of competition: 6th & 7th

Venue: C-306

Home test report: Running very well. I’d say that is has an 80% chance of making a new record.

Competition day: “Holy mackerel! The track width is 4cm!“. I asked the organiser about it. He measured the track width and calmly told me that extra calibration time would be given. And as if to put salt on that wound, the track had 4 places where there were curved, dashed lines with acute turns onto more curved lines!

Results:

6th Feb, Trial 1 – The LFR started out well and then went completely cuckoo. Though it has a PID algorithm in it, the LFR seems to be in its own world. (Thanks to the extra centimetre in the width)

6th Feb, Trial 2 – I managed to fix a few turns, but the PID algorithm still seems to be completely inactive.

(Fortunately, everyone had problems running on the first day, so everyone qualified for the next round on day 2. That night, I sat coding till 1:00 A.M. and finally managed to fix it.)

7th Feb, Trial 1 – The new code is working and the PID is perfect, but a few changes still need to be made in the acute turns. Overall, it’s running well.

7th Feb, Trial 2 – This run went very well, except for the fact that it went off the track 5 times (which means that 25 seconds will be added to my total time of 38 seconds, as a penalty)

I finished my turn just after lunchtime, so I had the rest of the day to go around the campus and watch the final rounds of the other competitions.

At around 4 o’clock I received a phone call from the organiser, telling me that I had won the 2nd place.

IMG_20160207_185732

 

For all you geeks out there, here’s my LFR code. Feel free to tweak and reuse:

#include <QTRSensors.h>
//Code written by Raunak Hede
//https://raunakhede.com
#define Kp 1 // experiment to determine this, start by something small that just makes your bot follow the line at a slow speed
#define Kd 15 // experiment to determine this, slowly increase the speeds and adjust this value. ( Note: Kp < Kd) 
#define rightMaxSpeed 180 // max speed of the robot
#define leftMaxSpeed 180 // max speed of the robot
#define rightBaseSpeed 50 // this is the speed at which the motors should spin when the robot is perfectly on the line
#define leftBaseSpeed 50  // this is the speed at which the motors should spin when the robot is perfectly on the line
#define NUM_SENSORS  8     // number of sensors used
#define TIMEOUT      2500  // waits for 2500 us for sensor outputs to go low
#define EMITTER_PIN  12     // emitter is controlled by digital pin 2

#define rightMotor1 4
#define rightMotor2 11
#define rightMotorPWM 5
#define leftMotor1 3
#define leftMotor2 6
#define leftMotorPWM 10

int P, D;
int leftMotorSpeed = 50;
int rightMotorSpeed = 50;
int turn = 100;

QTRSensorsRC qtrrc((unsigned char[]) {14, 15, 16, 17, 18, 19, 7, 8}, NUM_SENSORS, TIMEOUT, EMITTER_PIN);//sensor connected
unsigned int sensorValues[NUM_SENSORS];
void setup()
{
  pinMode(rightMotor1, OUTPUT);
  pinMode(rightMotor2, OUTPUT);
  pinMode(rightMotorPWM, OUTPUT);
  pinMode(leftMotor1, OUTPUT);
  pinMode(leftMotor2, OUTPUT);
  pinMode(leftMotorPWM, OUTPUT);
  
  #define rup digitalWrite(rightMotor1, HIGH);digitalWrite(rightMotor2, LOW);
  #define lup digitalWrite(leftMotor1, HIGH);digitalWrite(leftMotor2, LOW);
  #define rdown digitalWrite(rightMotor1, LOW);digitalWrite(rightMotor2, HIGH);
  #define ldown digitalWrite(leftMotor1, LOW);digitalWrite(leftMotor2, HIGH);
  
  #define f lup;analogWrite(leftMotorPWM, 80); rup;analogWrite(rightMotorPWM, 80);
  #define l ldown;analogWrite(leftMotorPWM, turn);  rup;analogWrite(rightMotorPWM, turn);
  #define r lup;analogWrite(leftMotorPWM, turn);  rdown;analogWrite(rightMotorPWM, turn+50);
  #define b ldown;analogWrite(leftMotorPWM, 80); rdown;analogWrite(rightMotorPWM, 80);
  #define s analogWrite(leftMotorPWM, 0);  analogWrite(rightMotorPWM, 0);

  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);
  pinMode(12, OUTPUT);
  digitalWrite(12, HIGH);
  for (int i = 0; i < 500; i++)  // make the calibration take about 10 seconds
  {
    qtrrc.calibrate();       // reads all sensors 10 times at 2500 us per read (i.e. ~25 ms per call)
  }
  digitalWrite(13, LOW);// turn off Arduino's LED to indicate we are through with calibration
 
  //print the calibration minimum values measured when emitters were on
  Serial.begin(9600);
  for (int i = 0; i < NUM_SENSORS; i++)
  {
    Serial.print(qtrrc.calibratedMinimumOn[i]);
    Serial.print(' ');
  }
  Serial.println();
  
  // print the calibration maximum values measured when emitters were on
  for (int i = 0; i < NUM_SENSORS; i++)
  {
    Serial.print(qtrrc.calibratedMaximumOn[i]);
    Serial.print(' ');
  }
  Serial.println();
  Serial.println();
  delay(500);
}
int lastError = 0;

void loop()
{
  unsigned int position = qtrrc.readLine(sensorValues);
  if (sensorValues[7] < 900 && sensorValues[6] < 900 && sensorValues[5] > 900 && sensorValues[4] > 900 && sensorValues[3] > 900 && sensorValues[2] > 900 && sensorValues[1] > 900 && sensorValues[0] > 900)
  {//right
      s;delay(50);  r;delay(300); s;delay(50);
  }
  else if (sensorValues[7] > 900 && sensorValues[6] > 900 && sensorValues[5] > 900 && sensorValues[4] > 900 && sensorValues[3] > 900 && sensorValues[2] > 900 && sensorValues[1] < 900 && sensorValues[0] < 900)
  {//left
      s;delay(50);  l;delay(300); s;delay(50);
  }
  
  else if (sensorValues[7] < 900 && sensorValues[6] > 900 && sensorValues[5] > 900 && sensorValues[4] > 900 && sensorValues[3] > 900 && sensorValues[2] > 900 && sensorValues[1] > 900 && sensorValues[0] > 900)
  {//right
      s;delay(50);  r;delay(280); s;delay(50);
  }
  else if (sensorValues[7] > 900 && sensorValues[6] > 900 && sensorValues[5] > 900 && sensorValues[4] > 900 && sensorValues[3] > 900 && sensorValues[2] > 900 && sensorValues[1] > 900 && sensorValues[0] < 900)
  {//left
      s;delay(50);  l;delay(280); s;delay(50);
  }
  
  else if (sensorValues[7] < 900 && sensorValues[6] < 900 && sensorValues[5] < 900 && sensorValues[4] < 900 && sensorValues[3] < 900 && sensorValues[2] < 900 && sensorValues[1] < 900 && sensorValues[0] < 900)
  {//acute right
    f;
  }
  
  else
  {//Execute the PID algorithm
    unsigned int sensors[8];
    int position = qtrrc.readLine(sensors);//get calibrated readings along with the line position
    int error = position-3500;
    
    P = Kp * error;
    D = Kd * (error - lastError);
    
    int motorSpeed = P + D;
    lastError = error;
    
    int rightMotorSpeed = rightBaseSpeed + motorSpeed;
    int leftMotorSpeed = leftBaseSpeed - motorSpeed;
  
    if (rightMotorSpeed > rightMaxSpeed ) rightMotorSpeed = rightMaxSpeed; // prevent the motor from going beyond max speed
    if (leftMotorSpeed > leftMaxSpeed ) leftMotorSpeed = leftMaxSpeed; // prevent the motor from going beyond max speed
    if (rightMotorSpeed < 0) rightMotorSpeed = 0; // keep the motor speed positive
    if (leftMotorSpeed < 0) leftMotorSpeed = 0; // keep the motor speed positive
  
    //move forward with appropriate speeds
    digitalWrite(rightMotor1, HIGH);
    digitalWrite(rightMotor2, LOW);
    analogWrite(rightMotorPWM, rightMotorSpeed);
    digitalWrite(leftMotor1, HIGH);
    digitalWrite(leftMotor2, LOW);
    analogWrite(leftMotorPWM, leftMotorSpeed);
  }
}
Project GEIT

Project GEIT

During the last week of my Diwali vacations, I had the wonderful opportunity to be part of Project GEIT (Goans Empowered with Information Technology) and teach Scratch programming as a volunteer instructor to students at 3 village schools.

The project was divided into 10-day camps conducted at the following schools:

The aim of Project GEIT is to inculcate knowledge of computer programming and logical reasoning in village school students at an early age.

A huge advantage of using Scratch over many other development environments is:

  1. It has a very well-designed Graphical User Interface which makes it easy for even complete beginners to learn programming on their own.
  2. All the required components (if, else, print, delay, etc.) are present in the form of colour-coded blocks with specified shapes depending on what type of block it is (e.g. Input blocks are light blue, function blocks are yellow, animation blocks are deep blue, etc.) The blocks are also labelled in simple language which makes programming very simple. All the person has to do is drag & drop the blocks in the right places to make their program.
  3. And best of all, it works offline! At such schools, where there is no internet/broadband connection, Scratch was a blessing!

Ms. Sangeeta Naik (Project Lead) and Mr. Vincent Toscano (Backup Lead and Chorao School anchor) introduced me to project GEIT and asked me whether I would like to volunteer.

I jumped at the opportunity and a few days later, took my first session at Azmane High School (17th November). Following that, I went to St. Bartholomew’s High School (19th & 20th November) and Dayanand High School (21st November).

It was amazing to see so much enthusiasm in the students, many of whom share a passion for coding. The excited grins on their faces on accomplishing the challenges thrown to them, was priceless.

I thoroughly enjoyed the interactive sessions at all the schools and met some wonderful people. It was an incredible learning experience and one of my most well-spent vacations.

Thank you GEIT, for giving me the opportunity to be part of this revolution.

Special thanks to Sangeeta Naik, Vincent Toscano, Jessica D’Abreo, Mona Parras and Pradeep Gaonkar.

Press conference at Goa Chamber of Commerce & Industry at the end of the 10-day camp

India Internet of Things Week 2015 by UNICOM

India Internet of Things Week 2015 by UNICOM

Three weeks back, I received a message from my mentor, Mr. Pranav Pai Vernekar (Founder of Inventrom) saying that he would be going to a conference in Bangalore. The conference was being organized by UNICOM. The theme was: ‘Internet of Things: Link Your World’ and it was part of India Internet of Things Week 2015.

This was a corporate conference, but it was interesting and I wanted to attend the event. So I sent an email to them. The next day I got a reply from the CEO of UNICOM, Mr. Nitesh Naveen himself! He said that they would consider it and get back to me on the same. That evening, I received another email saying that they would permit me to attend the conference and would also (most kindly) waive the standard entry fee. ☺

I was jumping with joy and immediately packed my bags

My father’s friend, Gaurish Dharwadkar from Travel Shop, booked the tickets. This was to be the first time that I would travel alone. He ensured that I had a pleasant experience.

On 9th September 2015, I boarded an Indigo flight to Bangalore. 50 minutes later I was at Kempegowda International Airport, Bangalore.

Early the next morning, I took a taxi to the conference venue: Movenpick Hotel & Spa

I pushed the door of the hall, in anticipation of what awaited me on the other side. When I entered, Mr. Axel Angeli was giving a talk on preparing for the next industrial revolution with IoT. He focused on the fact that data on a cloud is much more secure than data on a single computer. For the simple reason that new methods of encryption can be devised and also, divided data is harder to hack and steal.

The next talk was by the head of MediaTek Labs (India), Mr. Ashish Bedekar on wearable IoT.

After that came the much awaited ‘IoT Tech 10’. This is a sub-event in which companies can showcase their work in the area of Machine-to-Machine (M2M) and Internet of Things.

The companies were:

  • Emnics – Ethernet I/O card
  • Atoll solutions – Bluetooth Low Energy sensing solutions
  • Teamchat – Messaging platform for Machine-to-Machine, Human-to-Machine, and Machine-to-Human communication.
  • Inventrom Netplug: device which can make almost anything IoT enabled
  • Leaf TechnologiesAIR: a device which controls the lighting, temperature, etc. of your home according to your preferences.
  • Avench – Sav i3: a battery operated system which uses Bluetooth Low Energy to wirelessly monitor a biogas plant and relay information to a smartphone.

(At the end of the event, Teamchat won the IOT Tech 10 award.)

For the next half hour, there was a networking break, followed by an hour long panel discussion on exploring the emerging technologies in IoT.

After the discussion there was a workshop held by MediaTek Labs on integrating wearable devices with IoT using their development board: LinkIt ONE

The first talk post lunch was by Bipin Pradeep Kumar (co-founder of Gaia Smart Cities) on how the Internet of Things will proliferate as a network of networks of ‘Things’.

This was followed by ‘IT to IOT’ by Pavan Kumar & Viswanadh Akella from SAP Labs India. They stressed on the power of new generation smart applications that will be based on SMAC (social, mobile, analytics and cloud) coupled with Big Data.

Abhimanyu Prabhavalkar from Oracle’s IoT Engineering sector talked about using IOT as a tool to transform business from edge to enterprise.

The last event of the day in the Technology Track was a hands-on workshop by Inventrom on the usage of Raspberry Pi in IOT. In the workshop, participants were taught basic Python coding for GPIO pins on the Raspberry Pi.

At the end of the day, I took a taxi back to the place where I was staying. The next day, at around 12:00 pm, I boarded my flight back to Goa. I have to say that this was the first time that I met so many interesting people in the IT and IOT sectors, all in one place.

It was indeed, a very fruitful experience and I thank everyone at UNICOM Learning for having allowed me to attend this event.

Internet Of Things with Raspberry Pi – 2

Internet Of Things with Raspberry Pi – 2

This is a follow-up to my previous tutorial Internet of Things with Raspberry Pi – 1. (If you’re not familiar with web servers, PHP coding and the basic concepts of IOT, you should probably go through part 1 first.)

In the previous tutorial, we set up an Apache 2 web server on the Raspberry Pi and created a web page for it, from which we could control an LED.

In this tutorial, we’ll be adding controls for playing videos and songs on the Raspberry Pi using the OMX media player.

DSCN4341

The setup

Step 1:

Connect the following to the Raspberry Pi as shown in the pictures:

  • Power supply
  • HDMI (if your screen/monitor doesn’t have an HDMI port, you can use a VGA to HDMI converter)
  • Ethernet (to internet)
  • USB Keyboard and mouse (unless you’re accessing the Pi over SSH or VNC)

FII90WGIBNHIEO9.MEDIUM

Step 2:

Run the following command to install OMXplayer on the Raspberry Pi:

sudo apt-get install omxplayer

You’ll be using this player to play media on your Pi.

Step 3:

Start by downloading two to three nice songs and shorten their file names to something small. (e.g. ‘Where the river flows by Scorpions’ can be shortened to just ‘WhereTheRiverFlows’) Long names also work, but they take too much time to type when coding. Now put all the songs into a folder called ‘songs’. Make this folder in ‘/home/pi’.

Step 4:

Similarly, create a folder in ‘/home/pi’ called ‘videos’ and add a video in it. Follow the same steps as earlier for naming it.

Step 5:

Run the following commands to open your current web page code:

sudo nano /var/www/index.php

Add the new parts as shown below or just copy this code to the index.php file:

<?php

    if (isset($_POST['on']))
    {
		exec("sudo killall python");
		exec("sudo python /var/www/mystuff/ledON.py");
    }
    else if (isset($_POST['off']))
    {
		exec("sudo killall python");
		exec("sudo python /var/www/mystuff/ledOFF.py");
    }
    else if (isset($_POST['blink']))
    {
                exec("sudo python /var/www/mystuff/ledBLINK.py");
    }

//New code starts here
    else if (isset($_POST['WhereTheRiverFlows']))//Your first song
    {
                exec("sudo omxplayer /home/pi/songs/'Where The River Flows.mp3'");
    }
    else if (isset($_POST['StarWars']))//Your second song
    {
                exec("sudo omxplayer /home/pi/songs/'Star Wars.mp3'");
    }
    else if (isset($_POST['BezubaanPhirSe'])//Your third song<br>
    {
                exec("sudo omxplayer /home/pi/songs/'Bezubaan Phir Se.mp3'");
    }
    else if (isset($_POST['bell']))//A funny sound clip
    {
                exec("sudo omxplayer /home/pi/songs/'bell.mp3'");
    }
    else if (isset($_POST['Presentation']))//Your video
    {
                exec("sudo omxplayer /home/pi/videos/Presentation.mp4");
    }
    else if (isset($_POST['stop all']))//This is to stop all media
    {
                exec("sudo killall omxplayer.bin");
    }//This command stops all media
?>
<html>
	<style type="text/css">
//Button colour is now yellow and size has been changed
		#form{font: bold 30px/30px Georgia, serif;}
		button{background: rgba(255, 255, 0, 0.99); width: 250px; height: 180px;border: none;border: 3px solid black;border-radius:20px;}
		#container{margin0px; auto;width:80%;min-width:40%;}
	</style>
	<body>
	<div id="container">
		<form id="form" method="post">
			<center>
			<button name="bell"><h1>Bell</h1></button>
<br><br>		<button name="on"><h1>Led ON</h1></button>
			<button name="off"><h1>Led OFF</h1></button>
			<button name="blink"><h1>Led BLINK</h1></button>
	//This part is contains the new buttons
<br><br>		<button name="StarWars"><h1>Star Wars</h1></button>//Your first song button
			<button name="BezubaanPhirSe"><h1>Bezubaan Phir Se</h1></button>//Your second song button
			<button name="WhereTheRiverFlows"><h2>Where The River Flows</h2></button>//Your third song button
<br><br>		<button name="Presentation"><h1>Presentation</h1></button>//Your video button
<br><br>                <button name="stop all"><h1>Stop all media</h1></button>//The button to stop all media
			</center>
		</form>
		</div>
	</body>
</html>

Step 6:

Connect to your local network from a smartphone or laptop and try playing some tunes! You’ll notice that the control panel now looks a lot more cheery with some colour and font size editing.

DSCN4342
Modifying the code to your personal requirements is relatively simple once you get the hang of it. So go ahead. Add some more songs and videos.
I also added a small code for a bell sound clip so that whenever someone is at my front door, they can connect to the open wifi network and ring the ‘IOT bell’ instead of the door bell!

Internet Of Things with Raspberry Pi – 1

Internet Of Things with Raspberry Pi – 1

When I was new to IOT (Internet Of Things), I saw that there were hardly any tutorials which were simple enough for a beginner to understand and try out. There was either to much technical jargon, or the hardware was too complex.

So now that I’ve played around with IOT a bit, I decided to make a 10 step tutorial on controlling an LED over a Local Area Network (LAN).

In this tutorial, we’ll be using an LED, a Raspberry Pi, a Wireless ADSL Router with internet connection and a device with a web browser. (Smartphone, Laptop, Computer, PSP, etc.)

On the software side, we’ll be using Apache2MySQL and PHP.

If you’re new to the Raspberry Pi, you might want to have a look at Getting started with Raspberry Pi before trying out this project.

(Note: This project only uses an internet connection for software installation. After the installation and coding is done, the internet connection is not required. For more info on making the project available on the internet, check port forwarding)

Components:

  • Raspberry Pi (I’ve used a Raspberry Pi 2 model B, but any model will suffice)
  • ADSL Wireless Router
  • Power adaptor for the router
  • Computer monitor / TV screen which has an HDMI/VGA port (If you’re using a VGA port then you will have to use a VGA-HDMI converter)
  • Ethernet/LAN cable
  • 2 Female-Female jumper wires
  • Small LED
  • USB Keyboard and Mouse
  • A computer/laptop connected to the same modem as the Raspberry Pi (This will just be for the final test so even a smartphone is ok)

Hardware Setup:

DSCN4191    DSCN4186

DSCN4188    DSCN4198

Step 1:

Start your Raspberry Pi and open the Graphical User Interface (GUI) with the command:

startx

Step 2:

Once the interface is active, open the terminal and type the following commands:

sudo apt-get install apache2 -y

An IOT webpage will require a web server. This command will install a web server called Apache2.

Step 3:

To test the web server, you will need to know your Raspberry Pi’s IP address. Enter the command:

hostname -I

A number will be displayed. Start your Pi’s web browser and enter this number in the search engine.

You should see something like this:

apache-it-works

Congratulations! Your Apache server is up and running!

Step 4:

This is a default webpage which is stored in the ‘/var/www’ directory. To make changes to it and customise it, you need to enter this command:

sudo nano /var/www/index.html

Whenever you’re modifying a file, don’t forget to add ‘sudo’ at the beginning. This indicates that you are modifying it as a superuser.

Press Ctrl + X and hit enter to exit the file.

Step 5:

You will also need a preprocessor called PHP. Install it with the following command:

sudo apt-get install php5 libapache2-mod-php5 -y

Step 6:

Now enter the following commands:

cd /var/www

sudo rm index.html

sudo nano index.php

The last command will open a blank file. You will need to enter some PHP content to test it. Type the following:

<?php echo “hello world”;

Open the web browser and refresh the same web page. It should display ‘hello world’ in the top right corner.

You could also try:

<?php echo date(‘Y-m-d H:i:s’);

This will display the current date and time.

Step 7:

Install MySQL with the following command:

sudo aptget install mysqlserver php5mysql y

When installing MySQL, you will be asked for a password. You will need to remember this password in case it is required in the future.

Step 8:

Enter the following commands:

cd /var/www

sudo rm index.php

sudo nano index.php

The last command will open a new index.php file. Enter the following text in it:

<?php

    if (isset($_POST[‘on’]))

    {

exec(“sudo killall python”);

exec(“sudo python /var/www/mystuff/ledON.py”);

    }

    else if (isset($_POST[‘off’]))

    {

exec(“sudo killall python”);

exec(“sudo python /var/www/mystuff/ledOFF.py”);

    }

    else if (isset($_POST[‘blink’]))

    {

                exec(“sudo python /var/www/mystuff/ledBLINK.py”);

    }

?>

<html>

<style type=”text/css”>

#form{font: bold 12px/30px Georgia, serif;}

button{width: 150px;height: 75px;border: none;border: 3px solid black;border-radius:20px;}

#container{margin:0px auto;width:80%;min-width:400px;}

</style>

<body>

<div id=”container”>

<form id=”form” method=”post”>

<center>

<button name=”on”>Led ON</button>

<button name=”off”>Led OFF</button>

<button name=”blink”>Led BLINK</button>

</center>

</form>

</div>

</body>

</html>

Exit the file by pressing CTRL + X. You will be asked if you want to save changes. Press Y and hit enter.

Step 9:

You will now need the Python files for controlling the LED.

There are three Python files. One to turn on the LED, one to turn it off, and one to make it blink.

Please note that the following Python codes are for Raspberry Pi models with 40 pins.

i.e. Pi model A+, Pi model B+ and Pi 2 model B

If you’re using a 26 pin Raspberry Pi (Model A or B), then you will have to change the GPIO pin number in all three codes to 13 instead of 40 and accordingly connect the LED.

Use the jumper wires to connect the negative lead of the LED to Pin 6 on the Raspberry Pi’s GPIOs and connect the positive lead to Pin 40. (Pin 13 in the case of a 26 pin GPIO Raspberry Pi.)

First, let’s create a file to turn on the LED. Enter these commands:

cd /var/www

sudo nano ledON.py

Type the following text in the blank file:

import time, RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)
GPIO.setup(40,GPIO.OUT)
GPIO.setwarnings(False)
GPIO.output(40, True)
time.sleep(1)

Exit the file by pressing CTRL + X. You will be asked if you want to save changes. Press Y and hit enter.

Now create a file to turn it off:

sudo nano ledOFF.py

Type the following text in the blank file:

import time, RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)
GPIO.setup(40,GPIO.OUT)
GPIO.setwarnings(False)
GPIO.output(40, False)
time.sleep(1)

Exit the file by pressing CTRL + X. You will be asked if you want to save changes. Press Y and hit enter.

Lastly, create a file to make it blink:

sudo nano ledBLINK.py

Type the following text in the blank file:

import time, RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)
GPIO.setup(40,GPIO.OUT)
GPIO.setwarnings(False)
while True:
GPIO.output(40, False)
time.sleep(1)
GPIO.output(40, True)
time.sleep(1)

Exit the file by pressing CTRL + X. You will be asked if you want to save changes. Press Y and hit enter.

 Step 10:

Now, you will need to change certain file permissions. Enter the command:

sudo nano /etc/sudoers

This will open a file which contains permissions for directories, files, etc.

Go to the last line of the file which says:

pi ALL=(ALL) NOPASSWD: ALL

Below it, type this:

www-data ALL=(ALL) NOPASSWD: ALL

Exit the file by pressing CTRL + X. You will be asked if you want to save changes. Press Y and hit enter.

Reboot the Raspberry Pi with the command:

sudo reboot

Test the setup!

Congratulations! Your first IOT project is now ready! You can try it out from any device which is connected to the same network as the Raspberry Pi.

If you’re having problems with this project, go over the whole tutorial once again. If it still doesn’t work, then feel free to contact me on sataklela@gmail.com

Once you know for sure that everything is functioning properly, try modifying the codes to play songs, run motors, etc.

You can even add a small relay circuit and control the lights in your house!

IOT is an amazing thing and once you understand it, there are almost no limits to what you can do.

In the video below, I tried to control the LED using my PSP (Play Station Portable):

DSCN4196

The final setup with minimal connections

For more, check out Internet Of Things with Raspberry Pi – 2.

Summer Internship 2015 – Inventrom

Summer Internship 2015 – Inventrom

Once again, this summer, I interned for a month at Inventrom Robotics, an electronic technology start-up based in Goa with primary focus on Robotics and Wireless devices.

IMG_20150529_182303464_HDR

I joined at a time when their IOT (Internet Of Things) product ‘Netplug‘ was in the R&D phase. Netplug is a single unit which can be connected to any physical device to control it over the internet.

My task was to integrate it with RGB LED lighting (multicoloured lights).

This involved writing Python scripts, on a Raspberry Pi, to automatically run through a cycle of 6 colours at various speeds. Depending on the area of usage, this could be used as mood lighting in bedrooms & lounges, or to reflect the energetic atmosphere of party zones, etc.

While I worked on the lighting system, my colleague Haston was simultaneously creating a backend program and a webpage for Netplug. Invariably, there would be conflicts between systems and processes. In such a case, we had to alert each other before rebooting the system or stopping backend programs.

Other quick jobs also included:

  • Packing kits for workshops
  • Assisting during workshops
  • Testing the ‘Chicken Smasher‘ app for bugs

believe it is essential for everyone to take up at least a part-time summer job to hone one’s skills on one’s subject of interest. This lets you spend your vacation time creatively, while helping you understand non-technical aspects of running a company like, time management, ensuring deadlines are met, keeping databases of contacts for future use, developing people skills, etc.

Working at Inventrom was truly a rich, educational experience which I will never forget.

Left

Left to Right: Pranav Pai Vernekar, Raunak Hede, Ryan D’Costa, Pranav Kundaikar, Haston Silva

BT Smart Alarm

BT Smart Alarm

Sometimes you’re plain old alarm clock just isn’t good enough. You need a drastic change in the external environment to shake you out of your deep slumber.

And this is just what the Bluetooth Smart Alarm does best!

The project consists of 3 modules and an Android application (made using MIT App Inventor 2).

20150302_214305     Screenshot_2015-05-01-12-44-19

How to use it:

Before going to bed, the user sets a wake-up time in the app. (The app will continue running in the background until removed from the list of background programs.)

Screenshot_2015-04-30-09-00-41

Screenshot_2015-05-01-14-26-33

Screenshot_2015-05-01-14-37-59

Screenshot_2015-05-01-14-38-11

Screenshot_2015-05-01-14-38-35

At this point, the fan in the room is on and the lights are off.

When the alarm rings (in this case, a song), the fan will go off and the room’s lights will be turned on.

Screenshot_2015-05-01-13-27-26

The user then has to switch off the alarm by clicking on a ‘Wakeup!’ button. This will also turn off the lights and the fan. Why the fan too? So that you feel hot and sweaty and don’t go back to sleep!

How it works:

I ] Components used in BT Smart Alarm Mod 1:

  • Relays rated at 250VAC, 5A with trigger 12VDC, 10A  – I used the JQC-3F(T73)DC12V
  • 2 pin PCB block screw terminals (2 nos.)
  • A small perfboard or veroboard

20150429_231924     20150429_231452     20150215_193428

II ] Components used in BT Smart Alarm Mod 2:

  • Arduino Nano v3.0
  • 2A Dual Motor driver module with PWM control (Any L298 based motor driver will do)
  • 2 Heat-sinks (small)
  • Barrel jack for 12v DC adaptor
  • Female header pins
  • Male to female jumper wires
  • 2 pin PCB block screw terminals (4 nos.)
  • HC-05 bluetooth module

20150429_231350     20150501_115719     20150501_115927

III ] Components used BT Smart ALarm Mod 3:

  • 12v DC adaptor which can provide upto 400mAh

IV ] Internal working:

Initially, the Arduino Nano turns off the lights and turns on the fan. When the user sets a wakeup time, the Android app stores the value and keeps checking it with another value containing the phone’s internal time. When the two values match, the app plays a song and sends a command to HC-05, which is connected to the Arduino. The Arduino then sends four individual signals to four separate relays. These relays control the lights and fan.

Video coming soon!

Quark 2015 – Birla Institute of Technology & Science (BITS) Goa, Vasco

Quark 2015 – Birla Institute of Technology & Science (BITS) Goa, Vasco

Quark 2015!

This is one of India’s largest tech fest, which took place recently at the BITS Pilani, Goa campus in Vasco.

The festival was from 6th to 8th of February and had some great minds from across the world attending it.

I was there too. Participating in Line Following, Robot Race and for the first time, Robokick!

20150114_165503  _DSC0771  IMG_0049

Line Following:

Objective: Design and build a fully autonomous robot which can traverse a black line on a white background.

Arena: Track had normal curves, right angles, sharp acute-angle turns, T-junctions, X-junctions, Y- junctions, Inverted Y- junctions and loops.

Line Follower performance: LFR v2.0 was smoooooth, thanks to the PWM control. (Pulse Width Modulation) It traversed all the angles well (90, 60 & 120 degree). Even the T- junctions were quite good apart from the fact that recovery took time. The only problem occurred at the inverted Y- junctions. Due to multiple case clashes (a common error faced by maze solving line followers), the bot took the first path that it sensed. i.e. the pathway back into the loop! Oh nooooo! And there it would continue traversing the loop until I picked it up and put it back on the correct path. (with a hefty penalty of course!)

Main Components:

  • Arduino UNO, rev 3 (ATMEGA 328)
  • L298 motor driver
  • 12v, 1A, Li-ion rechargeable battery
  • RKI-1032 digital line sensor (7 sensor array with TTL output)
  • 320 rpm BO motors

Click on the link to download the C++ code for LFR at Quark 2015.

Quark2015_BITS_Line following

Roborace:

Objective: Design and build a wired/wireless, remote controlled all terrain racer (Basically, a smaller version of an ATV, without you sitting inside it.)

Arena: Track was on a rough terrain which caused a lot of bouncing about. It was a world of obstacles. The track consisted of slopes up to 45 degrees, car tires with loosely stretched plastic to cover the hollow depression, dry grass, sand, a slow windmill, soda-can speed breakers & thermocol obstacles which had to be pushed into fixed areas. Another extremely difficult obstacle, was the double slope platform with a slit in the middle. This consisted of a 45 degree incline upwards, a flat platform with humps of about 1.5 feet and a 45 degree slope downwards. Now while you’re imagining all this, add a 3 inch slit in the middle of the 9 inch wide path. If you’re still having trouble visualising this perilous path, then please watch the video below.

Racer performance: ATR v1.0 performed exceedingly well here. Just a few glitches like hitting the windmill, rumbling off the track once or twice, and being unable to climb the 45 degree incline caused deduction of points. The racer also had weight problems while trying in vain to get out of the sunken plastic in the tire. I think it’s worth mentioning that ATR was one of the few wireless racers on the whole campus.

Main Components:

  • RKI-1014 Rx/Tx module (RF 4-way remote control)
  • DPDT switches
  • Lock n Lock tiffin
  • 12v, 1A, Li-ion rechargeable battery
  • 500 rpm Gear motors
  • Powder coated multi-purpose metal chassis

Quark2015_BITS_Roborace

Robokick:

Objective: Design and build a wired/wireless, remote controlled robot which can play one-on-one football with another robot. It should be able to be a good striker and, at the same time, be able to defend it’s own goal.

Arena: This event was held in a square arena of 3×3 meters. The arena had markings on it just like a real football field. There were two open shoeboxes used as goals. A smiley sponge ball was used in the game.

Robot performance: Frankly speaking, my registration for the Robokick event was a spot entry. Previously I had no intention of participating in Robokick, mostly because I had no clue whether my bot would meet the requirements. (They did mention a shooting mechanism on the website. Something my bot lacked completely.) During the Roborace, an announcement was made stating that participants of Roborace were also eligible for Robokick and that spot entries would be accepted. And so I entered the competition with ATR v1.0! After adding a couple of metal plates near the wheels, the very same robot which jumped off a ramp, was ready to play football!

Main Components:

  • RKI-1014 Rx/Tx module (RF 4-way remote control)
  • DPDT switches
  • Lock n Lock tiffin
  • 12v, 1A, Li-ion rechargeable battery
  • 500 rpm Gear motors
  • Powder coated multi-purpose metal chassis
  • Small metal rectangular plates from various MECHANIX sets (for striking/goalkeeping)

 

Surprisingly, I won the 3rd place at Robokick☺

IMG_20150208_220531223_HDR

LFR “Microcontroler-less!” Mini

LFR “Microcontroler-less!” Mini

Who said robots need a microcontroller to be smart? This robot certainly doesn’t believe that!

Presenting: LFR Mini! A line follower of the non-programmable kind!

LFR Mini

Since LFR Mini has no formal “brain”, it depends almost entirely on the digital line sensor to do the job. However, as you may know, a line sensor works on the principle of reflectance (i.e. dark colours absorb, light colours reflect), and therefore transmits signals based on this logic:

If the colour detected is black

then transmit 0 (negative signal)

If the colour detected is white

then transmit 1 (positive signal)

Hmm… thats good. But only for a white line follower. What if it has to follow a black line?

Fortunately, there is an IC available that can convert signals. e.g. 0 is converted to 1

This IC, popularly known as the NOT Gate, will simply input the negative signal (black) from the sensor and convert it into a positive signal for the motors. Likewise, a positive signal will be converted to a negative signal for the motors.

So far, so good. Just one last challenge to tackle. The 5v signal from the IC, is not enough for the 150 rpm BO motors. The voltage needs to be amplified. So lets throw in a couple of good old NPN transistors. They use 5v from the IC as a trigger and provide an amazing supply of 9v to the motors.

And, just to err on the side of caution, LFR Mini also has a couple of half-wave rectifier diodes to prevent the transistors from back EMF (reverse electromotive force which can cause shorting of parts in a circuit).

Here’s a video of LFR Mini following it’s first line:

The stuff that went into it:

I] The board:

  • 7805 IC, 5v Voltage Regulator (1)
  • 7404 IC, NOT Gate (1)
  • Male header pins (2, for battery)
  • Female header pins (4, Two for each motor)
  • Male to female wires (2, from battery snap to battery pins & 4, from IC input to sensor output)
  • NPN Transistors (2)
  • Half-wave rectifier diodes (2)

II] The rest of the robot:

A top view of the final robot:

LFR Mini-Top View

Credits: Pravin Kakode (krafters.goa@gmail.com) for laser cutting the acrylic chassis.