Wednesday, 8 October 2014

Developing windows phone 8.x apps - Jumpstart

Hello everyone out there. This post is how to develop windows phone 8.x apps be it for Windows phone 8.0 or 8.1 the overall process is more or less similar. The post is divided into parts and it will clearly explain about all the steps that are required. In case of any problem encountered at any steps, mail me by clicking here.

Let's talk about some pre-requisites before getting into the developing part. To talk about the pre-requisites, you don't need to have a hi-fi programming knowledge. All you need is Microsoft Visual Studio 2012 or later and some interest of learning something new with a good knowledge of logical reasoning. Microsoft visual studio can be downloaded from msdn network by Microsoft. Note that you need to have a developer account for publishing your developed apps. For that the best way is to go via dreamspark. A bing or a google search might help you all.
For errors or problems faced or encountered during the installation of Visual studio, always feel free to comment here or drop a mail here.

Once you have downloaded Microsoft Visual Studio, open it by clicking on it.
Figure 1: Start screen of Microsoft Visual Studio 2013
  Once opened, under start menu, click on New Project.

Figure 2: Start page of  Visual Studio. Enter the name of your app here.

Once you click on New Project, a new dialog box will open. After opening, Expand: Visual c#--Store apps-- Windows phone apps. Then browse down to Blank app(Windows phone silverlight). Give a name of your app. Well for starters I used a simple hello world application. Now click on ok. 

UI part (xaml code)
Now, after you have clicked on ok, the page will open and the tab MainPage.xaml will open. Here in this page we will design the UI for our app. Now as far as this post is concerned, we will make a simple hello world application. The app will consist of a single page and will be made by incorporating a textbox, a textblock and a button. Each of these controls are available under the toolbox tab of your Visual Studio.
Figure 3: MainPage.xaml In this page, you have to add the UI elements.
In Figure 3, notice that some code is already present. The code is in xaml and it's the base code for your UI. On the extreme left side, notice that a Toolbox tab exists. Click on it to add the UI components. The UI components will include
1: A textBlock
2: A textBox
3: A button
Each of the components will have their own properties under the properties tab located on the bottom right corner of the screen as shown in figure 3. Add those components and edit them accordingly. Also notice that two TextBlocks already exists. According to Windows Phone design guidelines, the upper textblock will consists of the name of your app (in upper case) and the lower one will consists of the name of the page (in lower case). Edit them accordingly from xaml code. After editing and adding the components, you will get the screen somewhat similar to the figure 4.
Figure 4: Layout after the adding of components.
Now let's change the default texts and write them here in accordance to our wish.

Figure 5: Final layout.
Well we are not yet doe with the UI, The button acts as an event. When an user will click on the button, the text in the textbox will be displayed in the textblock. In order to achieve that, we need to create an event handler. To create an event handler, double click on Go and you will automatically be navigated to MainPage.xaml.cs page. In this page you will write the c# code for your app. Another task that you have to do in MainPage.xaml page is to assign names to the components. You can assign names by seleting the component and browsing to the properties tab.


Once you double click on Go you will automatically be navigated to MainPage.xaml.cs

Figure 6: MainPage.xaml.cs
Now under the method void Button_Click(object sender, RoutedEventArgs e), we will add the following code to make our app work.

String msg = ip.Text;
op.Text = msg;

A simple two line code is all what you need to run this app. In the above code, we are storing the text available in the textBox in a temporary string type variable named msg. Then we are storing/Displaying that string in the TextBlock. My naming for the textbox is ip and for the the textblock is op.
ip and op are objects and text is the property. The text property of the object is accessed by '.' (dot) operator.

Now your app is ready for testing

Once you developed an app, you need to test it. When you will be installing visual studio, an emulator is also installed. The emulator is a virtual device that runs on hyperv environment. Now in case of my PC, it doesn't supports hyperv. So I have deployed my apps on a Nokia Lumia 520. For selecting your method of deployment, see figure 7's highlighted area. You can access the emulator from the drop down menu that appears after clicking on the arrow on it. To deploy your app, press F5 and then the app will run. As already mentioned, I don't have hyperv so the scrrenshot of the working app is shown in figure 8.
Figure 7: Deploying Windows phone apps
For deploying your app in the device, your phone must be developer unlocked. 

Figure 8.1: Status before clicking on Go
Figure 8.2: Status after clicking on Go

Now as you have seen that in figure 8.1, the textblock shows the previous message. In Figure 8.2, the textblock shows the message written in the textbox. 

Developing Windows phone apps is not a herculean task. You must have an idea and some skills to jumpstart your developing. Now for publishing your apps, you need to have a developer account in Windows store. If you are a student, then dreamspark will help you alot. This post was only for begineers. Channel9 and MSDN provides sufficient tutorials for developing Windows phone apps. 



Friday, 19 September 2014

Unmanned Ground Vehicle development and design


An unmanned ground vehicle is a vehicle or a robot that operates in contact with the ground without an on-board human presence. UGV have different applications including military operations to other dirty and dangerous activities. In this post I will be talking about the key components of a UGV and the option to make it open source.

Introduction to hardware components
Choice of hardware is a key factor to the development of UGV. Depending on the type of application of the UGV, the hardware is to be selected. The hardware will consist of 4 parts.
1: The Controlling unit
2: The Driver unit
3: The Engine unit
4: The Chassis unit.
5: The power unit

The controlling unit
The UGV needs a controller to control it's mobility. Depending on the UGV to be human controlled or autonomous, the choice has to be made accordingly. For a UGV to be human controlled, the controlling unit will need a wireless module. Wireless module may also be needed for an autonomous UGV for live data. What ever the case is, the choice is yours. Arduino is an open source SOC capable of carrying out multiple commands at a time. Starting from beginner level to advanced level, arduino always remains on the front lines. Let us consider an Arduino board named Arduino Leonardo. The Arduino Leonardo has 20 Digital input/output pins out of which 7 pins can be used as PWM pins. a 16 MHz crystal oscillator, a micro USB connection, a power jack, an ICSP header, and a reset button. You can use the board as your controlling unit, Simply you need to code your arduino along with the instructions. Details regarding the Arduino board are available in The arduino can be interfaced with the driver unit by using the pins.
Arduino Leonardo board. PC:

In case of Black e Track(UGV developed by team AARPT), the Arduino leonardo is used as a controlling unit. If your UGV is autonomous, then the sensors must be attached to digital I/O pins in input mode. The digital pins are bi-directional and can work as input as well as output. The arduino leonardo is controlled by a PC using serial port communication.
Note: The arduino leonardo uses serial() function when connections to the PC or other device is via USB. When shifted to rx and tx pins(pin 0 and pin 1) serial1() function has to be used. 
In the case of Black e Track, team AARPT have used wireless communication with PC. The PC sends serial data to the Arduino by serial port communication based on RF frequency of 2.4 GHz. Many hardware are available for wireless communication. List of websites where products can be bought are mentioned at the end of the post.  

The driver unit
The UGV is controlled by the combination of control unit and wireless module. Now there is another unit called the driver unit which is responsible for the driving of motors or servos. In case of Black e Track, team AARPT have used high torque DC metal geared motors. So in order to control the motors, we need a driver which will receive digital signals from the controlling unit. There are some factors that must be kept in mind while choosing the driver unit. e.g: Your UGV must be able to move through rough terrains so you need a driver unit capable of providing much power to the motor. The choice for the hardware is yours. In case of Black e Track, Motor driver of 18V and a max current rating of 20A is used.

The engine unit
The engine unit is the one that provides mobility to the UGV. Depending on the designer of the UGV, the engine unit can be either a 4 wheel drive system or a 2 wheel drive system. For rugged application, it is always advised to make the UGV a 4 wheel drive system. The steering of the 4WD is comparatively easier to implement. Generally differential drive steering mechanism is used to steer the UGV. The designer should keep in mind certain factors including length, breadth and height of the UGV for the choice of the drive system and the steering system. There are several other factors as well. Depending on the type of application the choice is yours for the motor. The motor in case of rugged application must be able to carry the UGV forward in rough and rugged terrain so it's always better to use high torque DC geared motors.

The chassis unit
The chassis or the base of the UGV is a key element of the UGV to operate smoothly. Depending on the drive system or the steering system, you must adapt your chassis to it. eg: In case of 4WD differential steering system, the breadth must be equal to or slightly greater than the length for the UGV to turn effortlessly. Wheel slip should be as low as possible. The design of the chassis unit is very essential for the UGV. Try to make the chassis as light and tough as possible.

The power unit
The power source will supply energy to your UGV. It's always preferred to use a Li-ion battery because of it's capacity in a small size. In Black e Track, the initial version used a DC power supply as we weren't able to manage a battery for some time and financial problems. The next version contains an inbuilt power source of  11.75V 4.5A.

Before getting your hands dirty with the mechanical part of the UGV it's essential you know how to control it. An UGV if controlled remotely, must be operated by a PC with some user interface. Many controlling software are available but it's always preferred you make one. In the above tutorial, I have talked about the use of Arduino board. I have communicated with the Arduino board by serial port communication through RF module of 2.4 GHz. It's pretty easy to code for your UGV's controlling software. I would prefer for the use of Microsoft Visual Studio.

List of websites from where parts can be bought.


Below here is the video of our Black e Track initial version.
PS: The wires are not for controlling. The wires were used for DC power of 12V 3A.