Wednesday, 8 July 2015


Rakshak-1: An attempt to create an open source system for data gathering in situations hazardous for directly accessing by humans. 

I thought of creating an open source system for  data gathering in a hazardous situation not fit for directly accessing by a human 

 Below is a video  demonstration of all its features






Applications
Suppose there is a major fire outbreak and after the fire outbreak the building is not safe to be entered becoz the  iron bars melt and walls become weak so  it has to be checked by the experts so that they can certify it to be safe. Now getting inside the building is not safe for the experts too, why not send a robot that could be controlled from outside,go in and send the video and images so that the team has the idea of the kind of damage and cracks and can further make a decision. Moreover the rover can also sense fumes and other toxic gas levels.As the weight of the rover will be lesser than the human weight it will further reduce the chances of collapsing the building.

Can also be tweaked to gather data from radioactive ,industrail gas leakage situation or for any other situation where there are no sensors already installed.There is a thought process behind creating any new thing a journey and a story of how you face hurdles and how you tackle them. In this post i will share about how i created the rakshak-1 system

 A simplistic Block diagram and illustration



HARDWARE INTEGRATION

The board numbered 1 is the first board on which i tested  various motors . The IC used is L298 by STmicroelectronics. The board is a paper epoxy board designed on eagle and completely fabricated at home using the laser printer and hot iron method.



Once i found it good i went for a more compact design that is numbered as 2 this is a glass epoxy board ,i ran two of my robots using this board.

I wanted to make a shield(A shield is an arduino compatible pin configuration) so that the hardware can be neatly stacked on the arduino uno .I came across a motor driver on an online shop and i found the design to be very compact. After running the motors of  Rakshak-1 on it i understood that it is a overuse of resources and space to  go with big power diodes IN5408  for blocking the spikes produced by motors rather a IN4007 would suffice and would make the design compact.
To make the system up and running i needed to have a hardware which can provide different voltages and can give enough power to drive the motors and power the sensors, micro-controller  and other peripherals. Initially the GUI software is tested with the hardware arrangement numbered as 3. The shield was handwired and  i have  used a 11.1 v 1500mAh lithium ion battery to power the system. If you would look closely there are 4 resistors of quarter watt attached in parallel to drop the voltage from 11.1 to 9v This 9v is fed to the motors and 5v regulator provides power to arduino ,IC operations and LM35. Since i couldnot find a single resistor of high wattage adding 4 in parallel solved the wattage problem  but still using resistors to drop voltage when current drawn is high  is an inefficient method. Hence i decided to use a buck configuration in the next design of shield.
A coil is an integral part of a buck circuitry,but soon i realised that finding a coil  of particular value is a uphill task ,i searched on element14 and a few other places but  an exact coil was very hard to find ,moreover the price of coil was almost of the same price as that of a  buck convertor module that include an IC ,some capacitors LED. So i initially though i will buy a module will desolder the coil and use it on the board i will design but there was another thing that was going to put me in a tight spot and that was the board house. The board house that i had easy access to still follows manual processes so i couldn't route the wires too close,too thin, moreover  i have to use the locally available through hole components because the SMD components are harder to find locally and the vender wouldn't make something available to you until you order in bulk. So finally the most practical solution was to buy the buck converter module and use it as a component. So i designed the pads where i can fix the module. The only SMD component that i used are the LM1117 regulators which were not only small in size but can also provide current upto 800mA.
After all this came the design number 4 , i had to add a component externally and it worked but i missed a few design consideration as i designed it in a hurry. In the next design no 5 i fixed those things and finally got something good .





In the picture aboveThe shield inbetween  is an xbee shiel that holds the Xbee and connects it to the arduino board



SOFTWARE
The software on the onboard micro-controller turns on and turns off the geared DC motors ,headlights and set the position of servo motors depending upon the data received by the GUI. It also samples the temperature sensor and gas sensor data using its 10 bit successive approximation type ADC. It also measures the number of revolutions of motor by using a hardware setup which includes a hall effect sensor by allegro and a magnetic ring, the ring has 8 poles north and south places alternatively the ring is mounted on the output shaft of the motor when one of the two pole passes the output of the sensor turns high and when other one passes the output becomes low. These state changes are counted by the micro controller over a period of time using the interrupts and then are sent to the GUI to use this data to find out the RPM and distance by taking into account the Circumference of wheel. I have tried to keep the manipulation on the GUI side as the microcontroller is a low end  8 bit microcontroller working at just 16Mhz.
The GUI software is written using open source processing development environment. This GUI software can run on  MAC, Windows or Linux.


                         


The current position of various elements on the GUI have come up after a number of iterations and after looking at the ease of user experience i found this placement to be most suitable.One challenge in creating the software was to manage the sending of commands and receiving of data. Xbee series 2 modules are used for transmitting and receiving the data and xbee are half duplex .Receiving the data and  transmitting the commands in real time would require a full duplex  system. So an approach is used where just for the short time while command is sent the channel is occupied ,rest of the time the time the channel is free to receive the incoming data. The microcontroller is set to send the sensor data once every second . This way while we have slight delay of 1  sec while receiving the data the rover can be controlled instantaneously,so it is not that you will have to stop the rover to receive the sensor value ,the usercan keep on moving it and make it go wherever he wants  and he will keep on receiving the data too. It is kind of parallel approach,may be in  future versions things can be improved even more.


3D PRINTING
3D printing is a great technology for makers In order to make place for my electronics i needed a housing and  below is a video where i have described my thought process.





Free hand sketch and pictures of 3D printed parts
















MY INSPIRATIONS
This  system is inspired by the robots by bostan dynamics ,particularly  the videos of their robots named Rhex and sandflea inspires me to own one such system . Some other robots that i find inspiring to me are shrimp rover by Auckland massey university .I have also been inspired by the great talks and community centric,innovative and futuristic ideas of many people that deliver a talk at TED. I have also been benefited  by reading people like  Rob faludi, and  Jeremy. and coursera

Futher Upgrades

  • Using a more powerful on board computing platform like arduino zero.
  • Precise motor control for better performance in different terrains.
  • A good  range Wireless camera and GPS
  • Replacing laptop with SOC like pi2
  • More hardware integration.
3D parts Parts can be found at My parts Stay tuned for more detailed info like the schematics,source codes. Finally i leave you with a fun video with this rover







Creative Commons License
Rakshak-1 by Deepankar Maithani is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Permissions beyond the scope of this license may be available at teckweck6@gmail.com.

Saturday, 4 July 2015

Tuesday, 23 June 2015

Access Raspberry pi GUI and command line from your windows machine using SSH and VNC

At times you might face a situation when you cannot connect your Raspberry pi to a monitor ,like in a situation when you actually don't have a monitor or when you have your pi working in a project like say a weather monitor and it is not possible to physically access. There is a possible solution to this using SSH  and VNC(Virtual network computing) and you only need to satisfy one condition for this and that is you should have your pi connected to the network using LAN or wifi. Here in this post i will show you how to do this.

Step1: know the IP address of your pi, 

for getting the IP address there are several methods you can follow any of them
Method-1
If you know the admin password of your wifi router open your browser and enter the adddress of your router it is generally if you enter 192.168.l.l in your browser on a computer connected to your router you will be prompted or admin password and username once you enter it you can get the IP addres of your connected devices
Method-2
If you donot have admin details of your routerConnect your android phone to your home network .install an app like wifi inspector from the google store and run it it will give you the ip address and mac address of al the connected device. This is the simplest method.

Method-3
This method require good understanding of commands and network.
In the command prompt
you can use ping raspberrypi  and it will give you the IP address it may or may not work for you.
you can also use netstat -r in the command prompt this will give you IP address of all your network routes and one of the ip address in the list will be of your pi but for this you need to be sure that the pi has successfully connected to the network.Or else you can use a software like nmap.



Step2: Download putty. It is a small softwae that lets you establish an SSH connection.Run putty and type this IP address of your pi in the host name under the sessions. and click open


Then login using login ID and password. Default is pi and raspberry respectively.



Step3: install VNC server using the command sudo apt-get install tightvncserver



Step4: type tightvncserver to start the server .It will prompt you for password enter the password. this password that you will set will be required to be fed into the VNC client.It would also ask you if you would like to set another readonly password press N to dismiss


Step5: Setup a socket by using the command vncserver :1 -geometry 800X600 -depth 24
(The part after the 1 is optional)
Step6: Install a VNC client like the real VNC view https://www.realvnc.com/download/viewer/


Step7: open putty enter the host IP(the ip of raspberrypi) in the host field under sessions. Then go to tunnels under the SSH tab.add source to be 5901 and destination to be hostIP:5901. then click add.Finally  click open.



Step 8: log in into the pi using putty
step9: Open real VNC  view. Under the VNC server name add localhost:5901. click connect. then click continue on the next popup. 




After this you will be prompted for password. Enter password that you have setup while setting up the vnc server and you will get the screen of your Pi.





Sunday, 21 June 2015

Are you buying  a new phone? You should read this

Mobile Radiations

what do you look at a phone when you buy?Compare phones for Great spec and low price,but one thing that we all forget is to compare the SAR ratings (Specific absorption rate).  It gives the measure of energy absorbed by the human body when exposed to a radio frequency electromagnetic field. In U.S. it is set at 1.6W/kg over 1 gram of tissue while in the EU it is  2.0W/kg over 10g of tissue.
The galaxy series phone by samsung are known to be the best as they have the lowest SAR ratings (galaxy S4 has SAR value of 0.30W/kg) . The iphones are the mid rangers in this category..90 percent of the time the phone works on low frequency signals but as the signal strength reduces specially in the areas like lifts and where the signal level drops if you are on a call you may be exposing yourself to the high radiation levels. However it is also true that there are no sold evidences of this having a bad effect on our health some reports say it is bad some says it is not. but it is good to be on a safer side.

There is also an android app that alerts you when your mobile is emitting a high frequency signals so that you take appropriate precautions.Give it a try.
Here is a video.

Hope this information proves to be helpful to you.

Monday, 15 June 2015


Experience with the new PI-2 

In this post i will share about my initial experience about PI-2,the latest model of Pi-family. Pi is really evolving and getting better with the time. Here are my experiences and observations.
1.BOOT TIME
The first difference you will find when you will make the Pi2 boot is there are 4 raspberries on the top of screen instead of 1 raspberry on B+ representing the quardcore nature of the processor. The time taken by Pi 2 to boot is significantly lesser than the B+.

2. NOOBS
If you have an older version of NOOBS you need to update it to run it on Pi2 since the ARM architecture is different on the two boards.The new version of NOOBS is compatible with the B+ model and the Pi2. However the new Noobs have very few operating systems to select from. Future releases will definitely and should definitely have more options.
However i had a queer observation i ran the new noobs on B+ and on Pi2 using the same SD card. When i run it on Pi2 and boot into the desktop i get the following message on screen.
GDBus.Error.org.feedesktop.Policykit1.Error.Failed: Cannot determine user of subject. Apart from this the operating system works fine.

3. RESOLUTION
since there is no bios on the Pi there is pain in getting the resolution right.The GPU reads the config.txt file everytime it boots up. I connected my Pi on a LG LED TV.And when i swap the Pi2 and B+ keeping the same SD card resolutions get disturbed. Had to fix it time and again if you also have such problem it can be fixed by firing Sudo nano/boot/config.txt. in the LX terminal . Paste the config.txt in your SD card if it is not there ,the file can be found on the raspberry pi official website. You will need to change a few values.
4. GAMES AND APPLICATIONS
I ran minecraft and the game play is much smoother on the Pi 2. Also the game loads faster. Similarly mathematica loads much earlier on Pi2. I also found the webpages load much better on PI

5. VIDEOS
Ran the sample video by using omxplayer /opt/vc/scr/hello_pi/hello_video/test.h264. The video runs great on both. Also ran a movie "book_of _life". To put the movie on pi i first put the file on the pendrive connected it to pi ,from the pendrive i copied it to the desktop.Changed the directory using cd/home/pi/Desktop. Then used omxplayer -o local book_of _life.mp3 to play it and have the audio through the 3.5 mm jack.I couldn't see any difference in the video playback on both the pi.

I have also done a video about the Pi ecosystem and comparison of the two Pi boards i used. I have made the video with the view that anybody who is not familiar with the Pi is able to have a understanding of what it is and for those who are already familiar with it i have info about the new things we are likely to see in the Pi ecosystem. Hope you will enjoy the video.





WHAT I DON'T LIKE ABOUT PI :


1. while booting the pi. The pi asks for username and password. After you enter the user name as Pi and then when you will try to enter the password you will see nothing appearing on the screen when you will press the keys on you keyboard.But actually if you have faith in yourself and you type raspberry and then if you will press enter you will find that you have successfully logged in. There should be stars****** on key press.


2. Pi doesn't have a power on /off button. Usually most of us connect our pi's adapter to a multisocket board but it is annoying to turn it off from there. It would be great if there is a button on pi to do this. Till it gets there on the board there is another solution for the people like me ,there comes a used cable that has a on/off button which can be used to as an alternate.


ABOUT THE PERIPHERALS I USED:

  • I used a wireless keyboard and mouse for the first time,earlier i use to go with a wired one. For those who want to buy one ,Logitech MK220 works flawless on the pi,no hassel just plug and play. Moreover this is the cheapest one available right now.
  • For wireless connectivity i used EDUP Mini Wireless N 11n Wi-Fi Nano USB Adapter. This is also just plug and play.
  • One last thing, do use a good quality power adapter otherwise it might deter the quality of your experience,the B+ and pi2 has good brown out detection and the power LED blinks if there is not enough power available.

Saturday, 6 June 2015

Processing:

What is there in the Processing software? 

Processing is a language and a development environment which came into existance in 2001.It is created by Ben fry and  Casey Reas at MIT media labs It is open and free to download development environment that can run on windows,linux and Mac.It is used by artists,designers,researchers and hobbists to create amazing visual arts and softwares.  
It has something for everyone no matter which domain of programming you fall into,if you are a android developer you can develop apps on it,if you work with core java you will find that in this too,similarly if you work in python there is also a python mode which has been added recently.Similarly if you want to work with OpenCV or want to create web servers or want to play with audio files or create GUI and interect with hardware like arduino or kinect,it has it all. whats brillient about this language is it has its own syntax and style but also gives you ability to make use of methods of some other specific domains like javascript,java,scala,actionscript, python,android, etc
Many people don't know but  Arduino IDE has come out from processing. Thats why there is a striking similarity between the two IDE.



This is one of the most versatile software environment that i have seen so far. It also gives you the ability to export your source code as an application that can run on  Linux,Windows and Mac. This is a great feature for creating applications for an end user.

Downloading and installing  Processing:
Processing is free to download. You can download it for your operating system from the following link download processing

After you download the zip file you will need to extract it. After you extact it you will find a folder that that will have the following content


You need not wait for any installation process to occur just double click on the processing icon and you are ready to write your first program.
When you will run it for the firsttime. It will create a procesing folder in your Libraries/Documents on a windows machine. 

Your source codes are called sketches in processing and all your source codes will be saved in a folder within  this folder . The name of the subfolder will be same as that of your source code.
Now you are all set  to write your first code.

Example: Replicating a graphics in processing

I have a picture that i will replicate with a processing code. The picture is as below and is taken from  http://www.clker.com/clipart-25665.html






// This code is written by Deepankar Maithani
//IMPORTANT
//The top left corner of the processing window is considered as (0,0) coordinate all the coordinate values are set with respect to that.

void setup()
{
size(600,600); // size of processing window  
background(255);// set color of background to white
noFill();// upcoming figures will only have boundries
strokeWeight(10); // width of boundries
  
  ellipse(150,300,150,150);//back tyre
  ellipse(150,300,30,30);// back smaller inner circle
  ellipse(390,300,150,150);//Front tyre
  ellipse(390,300,20,20);//front smaller inner circle
  ellipse(260,320,50,50);// paddle axle
  
  arc(150, 300, 180, 180, 4.1015, 5.8468, OPEN);// back mudguard
  arc(390, 300, 185, 185, 4.1887, 5.8468, OPEN);// front mudguard
  line(235,262,340,220);// connecting line back to front mudguard
strokeWeight(10.0);width graphics
strokeJoin(ROUND);// the characteristic  of join 
beginShape();
vertex(150, 285);// chain upper part. 
vertex(260,295);// 
endShape();

line(260,345,150,315);//chain lower part. done without  the vertex
strokeWeight(10);
  beginShape();
vertex(390, 290);// draws handle bar
vertex(320,150);
vertex(300,165);
vertex(280,160);
endShape();
line(250,250,220,200);
beginShape();// draws rider's seat
vertex(195,200);
vertex(240,200);
vertex(190,180);
vertex(195,198);
endShape();

}

void draw()
{
  
  // empty cause it is just a static graphics
  
}
NOTE: use ellipse command to draw the back tyre if you want exactly the same picture i like it this way

OUTPUT

Example 2 Displaying Sensor Value from arduino in Processing Window


Arduino Code: Upload this code to Arduino board
//This code written by Deepankar Maithani
const int  pot=A0;// Connect the middle pin of pot to this pin
int reading;// variable for storing the pot values
void setup() 
{
//initialize serial communications at a 9600 baud rate
Serial.begin(9600);
}
void loop()
{
reading=analogRead(pot);// reading the analog value
Serial.println(reading);// printing it on serial this line sends the data to processing
delay(1000);// stop for 1s
}

Processing Code:
// This software is written by Deepankar Maithani

import processing.serial.*; // this library handles the serial talk 

Serial myPort;  // Create object from Serial class
String data="" ; // empty string to gather the pot values
PFont  myFont;  // object from the font class
void setup()// this runs just once
{
size(500,500); // size of processing window
background(0);// setting background color to black
myPort = new Serial(this, "COM12", 9600);// giving parameters to object of serial class,put the com to which your arduino is connected and the baud rate
myPort.bufferUntil('\n');// gathers data till new line character
myFont=loadFont("Arial-Black-48.vlw");// font type see the data folder of your sketch
textFont(myFont,70);// font size


}
void draw()
{
  background(0);//refreshing background everytime the draw runs
  textAlign(CENTER);// alighn text to the centre of coordinates
  fill(255);// fill white color to text
  text(data,350,155);// display the data at 350,155 coordinate
  textSize(40);// size of text
  fill(#4B5DCE);// fillinf blue color on the text 
  text("Pot. Reading",155,150);
   noFill();the upcoming rect will not have anything inside
   stroke(#4B5DCE);// color of boader of rectangle
   rect(5,100,400,80); rectangle
  
}
void serialEvent(Serial myPort)// whenever serial event happens it runs
{
  
  data=myPort.readStringUntil('\n'); gathering data from pot in a variable
}

Demo of above softwares in action



For more info about the methods and API you can visit processing website orProcessing forum




Creative Commons Licence
Arduino to Processing by Deepankar Maithani is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Sunday, 24 May 2015

Product Ergonomics

Ergonomics is a discipline that deals with the understanding of interactions among humans and other elements of  a system,this discipline plays an important role in enriching the  end user experience  of a product.  For the success of any product it is very important that the user finds your product easy to use,aesthetically pleasing and safe. when we see anything around us our brain makes a decision about how safe it is how appealing it is depending upon our earlier experiences and number of other factors.
Ergonomics is divided into three categories 1. Physical Ergonomics 2. Cognitive Ergonomics & 3 Organisational Ergonomics.I will focus on the earlier two categories in this post.
Physical Ergonomics deals with the Human body's response to the physical and physiological loads while the cognitive ergonomics makes sure that any system comply with the human cognitive strengths like we can't see too small texts  and should avoid our cognitive weakness whereever it will hinder the good interaction between the system and humans. For example on a mobile phone the size of the keys of dialler should be large enough for comfortable pressing of keys,the colour of font should be such that it is easy to read. sometimes our weakness is used as a benefit like the phenomenon of persistence of vision is used to create a moving picture.
Here i will share about this important aspect of product design process . There are many physical design features that are there on a product, reason for the existence of some of them are very easy to interpret logically while others need a more investigative  and through understanding. Below are some of the examples from our day to day life products to understand the importance.

1. Bucket design
Below is a picture of two buckets that i took long back in my house. The water caring capacity of both of them is same. But the designers of the one on the left have made some extra curves and that has added extra value  to the product by increasing the ease of use of the product. If you would try to lift a bucket full of water  and pour water in another container these curves will assist you to have a better grip and reduce the chances of spilling the water.

2. Laptop Keys
The picture below is of  a laptop keyboard. If you look at the key 'F' and 'J' closely you will find that there is a dash/hyphen embossed on these keys.This is found on every keypad. The reason for this is that when you get pro at typing you don't look at the keys while typing rather you look at the screen this row of keys  is the home row,these protruding/embossed  hyphon helps in giving you an idea about the position of your fingers on the keyboard with actually moving your eys off the screen by just the fel of touch.

3. Colour of  Bag's Interior
The bag shown below is a SLR camera backback. If you see it closely you will find that the fabric used to make the interior of the  bag at the right is a bright orange colour and this colour is used because most of the camera accessories are black in colour so if you drop say a memory card in the bag it would be very easy to find it in the contrasting orange background.. While  the bag on the left is black from inside so if you accidental drop your SDcard it would be hard to find it and a more vigilant  search would be required.

4. Antimicrobial properties of copper

Copper is known to have antimicrobial properties and thus restricts the growth of microbes on its surface ,keeping this property in mind and keeping in mind that copper is a fairly expensive metal it is used at specific locations on products used in hospitals to help stop infections spread. Infact this property of copper is put to use Indian houses  from years. You would easily find people keeping  drinking water  in copper utensils. You can read more here


4 Engine Fins
The engine of a motor bike specially the air-cooled engines have fins on it. Adding these fins would increase the amount of material required in manufacturing the engine but still they are added so that the surface area of engine can be increased and hence better heat dissipation is achieved resulting in better performance of engine



5. Train Wheels
The wheels of trains are a part of cone (technically called frustum) rather than being a cut out part of cylinder because this helps in reducing the hunting oscillations (sidewise oscillation) which would make the train ride uncomfortable.




So these examples perfectly explains that the  physical features of body of a product,the curves,the bends and the material plays a great role in the better interaction of product and humans. 


Creative Commons Licence
Product ergonomics by Deepankar Maithani is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Wednesday, 20 May 2015

Constant current LED driver


LEDs have become ubiquitous these days you can find them in different roles like being used as indicators, home and office lightning solutions, in music synced lightening systems at clubs, signboards  etc. Today i will share about a constant current driving circuitry to make some LEDs glow with DC power sources.

Why do we need a driver circuit?

The first thing that might come to your mind is why do we need a driver circuit when you can just simply connect a coin cell battery to make an LED glow and  for higher voltage sources you can easily drop the voltage to desired value by using a resistor.
The use of a dedicated circuit is necessary because using the above mentioned method won’t provide a consistent and robust solution. The current through the LED is sensitive to even small changes in voltage across the LED and the temperature of LED so using the above mentioned way may provide different LED performance in different environmental conditions. The inefficiency using a resistor to drop the voltage would even be magnified while driving a high wattage LED.

Constant current LED circuit built around IRFZ44

The circuit below shows a reliable way of lighting an LED. This circuit allows us to decide a particular value of current that will flow through the LED by adjusting the value of R2 resistor.Depending upon how much current is allowed to pass through the LED the intensity of LED is adjusted.



How does the Circuit works and deciding the values of  current setting resistance?

when the value of current flowing through the LED to the R2 becomes high enough to provide a drop of 0.7 V across the base emitter junction of the transistor the diode gets turned on and the extra current goes to ground through the diode. This feedback mechanism leads to a constant current flowing through the LED.

Deciding the value of  R2
Value of current through the LED = 0.5/R2
value of power dissipated across =0.25/R2
R1 hould be a high value quater watt resistance say 100k.

Benefits of using this circuit
  • consistent LED performance over large range of supply voltage
  • low dropout ie the output voltage can be just 0.6 volt higher than the input voltage
  • cheap circuit
Important Points

  • Because the transistor T1 is thermal sensitive the current set point is also thermal sensitive so choosing a transistor with low thermal senstivity will give more accurate results like 2N5088BU
  • Care should be taken that the power dissipated by Q1 is within the range specified in data sheet power = voltage across Q1 x current through the LED
  • For maximum efficiency the LED should be configured such that the voltage is near the supply voltage.









Monday, 18 May 2015

The Journey of Electronic Products from idea to customer's hand


It require interdisciplinary expertise to bring an idea from concept to life. There is a need to bring people with background as diverse intellectual background like manufacturing,design,core electronics, management   together and work together. To survive in today's competitive market you have to give a feature rich product to your customer and that too at lowest possible price. In today's era of globalisation the markets are now open for everyone and while this leads to opportunity to serve more customers it also poses the difficulty of surviving the competitive market. One of the strategy that the companies adopt is to accomplish different parts like say the software from firms in India and for manufacturing needs get the job done in china and this way the price of the final product comes down.
Below is a block diagram representation of Product design cycle:


The process starts with an IDEA that may be a completely new product idea or an improvement or enhancement to the existing idea. After this a comprehensive research is carried out to determine the feasibility of the idea and decisions like which existing technology is to be used out of the pool of technologies is made. Sometimes a product is practically feasibly by one technology and is not with another or out of the two technology one provides same performance but cheaper final product so every care should be taken during this phase because this is going to be the basis of product performance.
Once the research phase is over and you come out with a circuit that you are going to use to implement the feature  the prototyping is done,you take into account the erogonomics of the products and refine the look and feel of the product and then multiple design reviews are done to make sure everything is working as it should be,once the performance of product is satisfactory here, the next step is to analyse the manufacturing capabilities and things like what processes needs to be outsources what can be one in-house are decided,then documentation is created these includes the documents supplied to the user as user guides and the directions and information to be provided to the customer support people. 
Agency compliance ensure that the company followed all the rules and regulation like the environmental regulations and safety measures are taken. Agency compliance is another major step and sometimes it pose to be a hurdle and cause of delay of product release  one very recent example that i came across is the delay in the release of  official touch screen for raspberry pi due to the compliance.  There are FCC agency compliance for America and CE for the European countries and you need to have a compliance certificate to sell your product in these countries. 

After all this you bring the product to market, and right marketing of the product is very important these days. If you look around yourself you will easily find many examples of some innovative and out of the box marketing strategies that the companies are adopting.  There is great craze among people for some products like a new iphone launch and samsung's galaxyS4 . People stand in queue for whole night to get hold of the first phone. Samsung   introduced the concept of virtual queue when it launched the S4 where the customers were turned into marketers. Rather than physically standing in queue to get the phone an on-line queue was made and the more you tweet and comment about the product the more you will move ahead in the queue. 

Finally after the product is sold you need to give good customer service so that you make sure the customer is happy with your product. 






Creative Commons Licence
The Journey of Electronic Products from idea to customer's hand by Deepankar Maithani is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Saturday, 9 May 2015

Arduino Tips & Tricks

Interfacing Gas Sensors with Arduino

Gas sensors commonly available in the market are the MQ series gas sensors. Different sensors in this series have different target gases for detection.But they all have more or less same structure and parts.Every gas sensor has a  heating coil and a surface with coating of some compound which is sensitive to the presence of a target gas.
Below is the picture depicting the structure of  MQ-2 which is a combustible gas sensor.


 These sensors require a 5V supply to power the heating coil .Since there is no electronic circuit inside them they can also be powered up using the AC.  These sensors can draw current upto 130 to 150 mA so these shouldnot be powerd using the Arduino. In case of the MQ-2 the sensitive material used in detection is Tinoxide. Mq2 is sensitive to LPG propane and Hydrogen.Below is a table with different gas sensors and their target gas.


CONNECTIONS WITH ARDUINO

As always now we will interface the sensor with the arduino Uno. The picture below shows the pins and how to connect it.
The polarity is not important in this sensor connect any one of the H pin to ground and the other one to the VCC. 
The MQ-2 sensor is not breadboard friendly,also it is difficult to solder wire directly on pins,I have designed a board on eagle to ease this out. I have also incorporated a LM35 temperature sensor.If you want to read out it interfacing you can read my previous post here



You can find the design files and gerbers on my github repository here Board,Gerbers. As always free to use and remix

SOURCE CODE:
float temp;
int gas;
int tempPin = A0;
int gasPin=A1;

void setup()
{
  Serial.begin(9600);
  
}

void loop()
{
  temp = analogRead(tempPin);
  gas=analogRead(gasPin);
  temp = temp * 0.48828;
  Serial.print("Temperature=")
  Serial.print(temp);
  Serial.print(',');
  Serial.print("Gas Sensor output")// 
  Serial.print(gas);// Stable readings comeout after 2 3 minutes
  delay(1000);
}

CALIBRATION:

The real challenge in dealing with the Gas sensors is the calibration,if you just want to use the gas sensor to know between high concentration of gas and low concentration  and then do something based on this ,for this much whatever we have seen so far is sufficient enough. But when you precisely want to know that what ppm of gas is there it is very important to correctly calibrate the sensor. For MQ2 it is recommended to expose the sensor to know value of target gas say 1000ppm and then observe the output and then with this data an algorithm is made to calculate the exact concentration of gas. But the problem is how to create an environment with known value of a gas. This would require a Lab with all the necessary equipments.
There are other factors that may also impact the sensor reading like humidity and temperature. Also there is a concept of burn in time which says that the sensor should be made to run for  of 18 to 24 hours after which it starts giving reliable readings. 

Quick Tip: In case you make the ADC to work with external reference or internal reference of 1.1 you might need to reduce the value of load resistance.Thats why i have kept a potentiometer in my hardware design so that it can be tweaked as needed.




Wednesday, 6 May 2015

Arduino Tips & Tricks

Understanding Sensing & Interfacing Temperature Sensor with Arduino.

Sensors are very important part of electronic systems. A sensor is a transducer whose purpose is to sense /detect some  some characteristics of its surroundings and provide a suitable corresponding output in the form of  electrical signal.
Example: Blood Sugar Detection Machine
There is a commonly available blood glucose measurement machine which is used by the patients. For measuring the blood sugar first you  prick the skin and put it on the strip that comes with the machine,there is a protein on  the strip which when  comes in contact with the blood sugar produces electrons and hence a voltage is created which is then read by the machine,the machine is pre calibrated to give a corresponding reading. 
Different sensors may have different ways of sensing a same characteristic. In a general  in any sensing device we make use of change in inductance,capacitance or resistance to get the desired output,however the technology used in the sensor affects some important features of a sensor like response time,accuracy,repeatability,lifetime. Power consumption is another important factor that needs to be taken care of while selecting a sensor,because lesser power consumption will give more up time.
ADC
When we talk about the sensors the next thing without which we cannot live are the ADC. These convert the analog voltage into digital voltage. There are many types of ADC available  like Counter type ADC,Parallel comparator type ADC(this is the fastest ),Successive approximation type ADC, Dual slope integrated type ADC. Each one of above have its pros and cons. The atmega328P on the arduino have a 10bit sussesive approximation type ADC. I am not going to go into the details of how it works,you can go here  if you want to read more.

CALIBRATION
This is the next buzz word you will here while dealing with the sensors,right calibration of sensor is very important for accurate measurement,different sensors  may require different ways for calibration,some sensors also come precalibrated.
 As a hobbiest it might not be super critical thing and we can do away with it at times  but on more important areas and in serious implementations like in bio medical instrumentation (like the example above)it is very important to have right calibration. 

HANDS ON 
Interfacing LM35
LM35 has a measurement range of -55*c to 150 *c. It is commonly available sensor that you can find for a price range between 35 to 45 INR. Below is a picture with its pin description.


STEP 1:
Connect the sensor to arduino as below.


STEP 2:
writing the software:
we have to read the analog value at the pin A5 of the arduino and the multiply it with a magic number
int val;
int tempPin = A5;
float reading,temperature
void setup()
{
  Serial.begin(9600);
}
void loop()
{
  val = analogRead(tempPin);
  reading= (val*4.88)
  temperature= reading/10;
  Serial.print("TEMPRATURE = ");
  Serial.print(temperature);
  delay(1000);

}
The magic is in these two lines below but where did these lines come from? Lets understand
  reading= (val*4.88)
  temperature= reading/10;
The ADC on the arduino gets a 5v as reference if you dont change it 
First thing we have done here is we have calculated the step size
Stepsize= Vref/2^n     n=no of bits  here we have a 10bit ADC on arduino.
stepsize= 5/1024 =0.0048828 = 4.88mV

from data sheet of LM35 we know for every 1 degree C rise there is increase of 10mv in the output.

temperature= (analogRead(A0)*4.88mV.)/10mv

If you want to increase the accuracy you can  decrease the Vref. Hope you enjoyed the post and gained something out of it.

HARDWARE SECURITY


For any electronic system to be secure it not only need to  have secure software but also need to be secure at the  Hardware level and Hardware security is an emerging issue.lets understand the difference between a secure and insecure system with the help of an example
Lets say we have to implement a 3 input encoder that assigns a 2-bit code to each of the three different input combinations. Here X,Y,Z are the inputs to the system and a and b are the outputs

If we look at the table we have used only 3 combinations of  X Y Z but there are 2^3 = 8 combinations possible with these inputs. But here the rest of the inputs are don't care .
If you will solve this system using K-map you will find following logical expression

a=x'yz' +xy'z'=(x(XOR)y)z'
b=x'y'z+xy'z'=(x(XOR)y'

But if you will analyse the  table closely there is another possible expression which is as following

a=z'  b=y'

Now lets compare these two versions ,on the first sight you might feel that the second implementation i.e a=z' and b=y' is a better implementation . Since it will require lesser number of gates which in turn means lesser propagation delay and hence faster system,lesser hardware so cheaper system,lesser space consumption. So it will be a fantastic reduction Isn't it?

But if you would really broaden your perspective and if you will look from the perspective of security this lower implementation is more vulnerable and it is more easy for a potnential intruder to find a back door.

Lets look at the problem
Here we have defined 3 input combinations. for 1,0,0 as input the output is 1,1. But there is another input combination 0,0,0 which we have not defined the system for,but can give the same output . So this is a potential backdoor.
Secondly if we give 011 or 111 is input the system gives 00 as output and  if this output is fed into another part of the system which doesn't expect this input there may arise undesirable things. Such type of attack is called a fault injection attack.

So with this small example we can understand that there is a trade off between the performance and security. Most of the time while making the system secure we have to add some extra overhead.

On the software side there is  more awareness about the vulnerabilities and techniques to fix them.With the software you may run software to test for virus and trojan horse.But on the hardware layer the first thing which is the detection of a vulnerability is very difficult once the final hardware is in your hand. . A complete trust can be only obtained if you have control over the whole development life cycle and again having control over the complete design cycle is very difficult job.
Vulnerabilities may arise in the hardware from the microchip supply chain.Someone can place a back door during the fabrication. Often the fabrication is done off shore in the areas where it can happen cheaply but it makes it difficult to control the design process. The IP and CAD design tools that are used to implement the hardware must be from a trusted source Improper implementation of logic like we saw in the above example is another cause of vulnurability.







Thursday, 23 April 2015

HARDWARE SECURITY


For any electronic system to be secure it not only need to  have secure software but also need to be secure at the  Hardware level and Hardware security is an emerging issue.lets understand the difference between a secure and insecure system with the help of an example
Lets say we have to implement a 3 input encoder that assigns a 2-bit code to each of the three different input combinations. Here X,Y,Z are the inputs to the system and a and b are the outputs

If we look at the table we have used only 3 combinations of  X Y Z but there are 2^3 = 8 combinations possible with these inputs. But here the rest of the inputs are don't care .
If you will solve this system using K-map you will find following logical expression

a=x'yz' +xy'z'=(x(XOR)y)z'
b=x'y'z+xy'z'=(x(XOR)y'

But if you will analyse the  table closely there is another possible expression which is as following

a=z'  b=y'

Now lets compare these two versions ,on the first sight you might feel that the second implementation i.e a=z' and b=y' is a better implementation . Since it will require lesser number of gates which in turn means lesser propagation delay and hence faster system,lesser hardware so cheaper system,lesser space consumption. So it will be a fantastic reduction Isn't it?

But if you would really broaden your perspective and if you will look from the perspective of security this lower implementation is more vulnerable and it is more easy for a potnential intruder to find a back door.

Lets look at the problem
Here we have defined 3 input combinations. for 1,0,0 as input the output is 1,1. But there is another input combination 0,0,0 which we have not defined the system for,but can give the same output . So this is a potential backdoor.
Secondly if we give 011 or 111 is input the system gives 00 as output and  if this output is fed into another part of the system which doesn't expect this input there may arise undesirable things. Such type of attack is called a fault injection attack.

So with this small example we can understand that there is a trade off between the performance and security. Most of the time while making the system secure we have to add some extra overhead.

On the software side there is  more awareness about the vulnerabilities and techniques to fix them.With the software you may run software to test for virus and trojan horse.But on the hardware layer the first thing which is the detection of a vulnerability is very difficult once the final hardware is in your hand. . A complete trust can be only obtained if you have control over the whole development life cycle and again having control over the complete design cycle is very difficult job.
Vulnerabilities may arise in the hardware from the microchip supply chain.Someone can place a back door during the fabrication. Often the fabrication is done off shore in the areas where it can happen cheaply but it makes it difficult to control the design process. The IP and CAD design tools that are used to implement the hardware must be from a trusted source Improper implementation of logic like we saw in the above example is another cause of vulnurability.