Saturday, September 10, 2011

Mechatronmics Trainer


Mechatronics Trainer


Mechatronics Trainer
Mechatronics board is a complete robotics development platform for students. Designed inspired by lady ada’s motor shield , Mechatronics Trainer gives just an extra bit for your robotic projects.
To view complete source of this article kindly subscribe here.
Figure 1 Mechatronics Trainer

Features of the board:
1) It is capable of interfacing with PS2 Mouse/Keyboard.
2) Two H-Bridge motor drivers capable of driving 2 X Stepper motors or 4 X DC motors.
3) IR object detection for Left,Right and Forward direction mainly for robotic cars.
4) LDR Light sensor.
5) Temperature Sensor.
6) 3 X Digital Switches
7) Buzzer for audio application.
8) Expansion header for direct connection to ESAT-ISP development board (Buy Here)
9) PS2 Interface

 Do it yourself – Robotics Kit
There are only two things providing motion to an object
A controller: An object having its own sensory system which translates changes in its state like speed, direction or position to digital or analog data.
A translation system: It provides a mechanism capability to move in accordance with its controller.
While most of the Industrial automation projects use joysticks many have started using UI softwares running on touch screen panels, providing a sense of human-machine interaction which exhilarates our experience in controlling the machine.
But neither joysticks nor touch screen panels can fit into a 50$ budget of a student for creating a customizable controller for his car or a robot.
Adding a sense of motion and speed control in your Robotic Car requires some extra capabilities in your controller controlling the car.
For Speed & Direction Control - It should have two – three environment variables varying proportionally according to change in their state. As explained above the readings are given in form of digital or analog data so the output data should have high resolution which enables us to determine in which direction a car should move more accurately.
A similar motion is performed while you are scrolling and moving your mouse pointer just now.
Yeah !! We can use a PS2 mouse to control and direct a robotic car accurately. To be able to use environment variables of a PS2 mouse I have used PS2 mouse library.
Here is a Project “Controlling motion of a stepper motor using PS2 mouse”

As you move scroll button of your mouse Up/Down the MouseInfo structure declared in stepper.h header file provides present information of the state of scroll position.
If scrolled up the function returns -1.
If scrolled down the function returns 1.
If not used function returns 0.
The output of the scroll function is given to a stepper motor function which uses states (-1,0,1) to controller direction of stepper motor and moves single step in that direction.
(-1) – Anticlockwise diection
(1)  - Clockwise direction
This concept can be used in variety of application like.
Industrial Automation
Computerized Numeric Control – CNC operations
·         3 Stepper motors + 1 uart
·         3 Stepper motors + ps2 mouse
·         3 Stepper motors + ps2 Keyboard
Security Camera motion control
·         3 Axis CCTV control with Keyboard
·         3 Axis CCTV control with Mouse

Robotic & College Projects

·         Using PS2 Mouse\Keyboard as joystick in Robotic Car direction & Speed Control.
·         Live Human detection and
Home Automation
·         Automatic Curtain Control
·         Room Mood Lighting
                Addition features
o   Day/Night Detection
o   Object/Human Presence Detection

/************************Code Begin***********************************/
#include
#include

/*
 * an arduino sketch to interface with a ps/2 mouse.
 * Also uses serial protocol to talk back to the host
 * and report what it finds.
 */
/*
 * Pin 2 is the mouse data pin, pin 3 is the clock pin
 * Feel free to use whatever pins are convenient.
 */

PS2Mouse mouse(3, 2);
#define STEPS 150
Stepper stepper(STEPS, 8, 9, 10, 11);

int scroll_pos;

void setup()
{
//  Serial.begin(9600);
  pinMode(13, OUTPUT);
//PINS 12 and 13 are representation of pins PORTB.5 and POTB.4 on Arduino UNO or a compatible board in Arduino software
  pinMode(12, OUTPUT);
  stepper.setSpeed(30); 
  mouse.init();
}

/*
 * get a reading from the mouse and report it back to the
 * host via the serial line.
 */
void loop()
{
  MouseInfo mouseInfo;
  mouse.getData(&mouseInfo);//Get reading from mouse structure
   digitalWrite(13, mouseInfo.leftClick); //Use digital data to control status of an Led
  digitalWrite(12, mouseInfo.rightClick); //Use digital data to control status of an Led
  stepper.step(mouseInfo.scroll);
}
/***************************Code End************************************/
References:
Make sure you have following libraries in your libraries folder in Ardunio

Obstacle Detection using Mechatronics Trainer


/************ You may skip information in this para as its only for passerby’s ************/
Before even thinking about making a robot first thing that comes to your mind is..
If I am going to construct a robot , How much time is it going to take ??
Well if you ask me ,which you might or might not ask ,But I am telling this with due respect given to time you are devoting in reading this stuff that , when I was in my graduation I had all the time to devote to do what I wanted to do. Its the only thing that matters in the end of day\week\month\year or life.
Coming back to robotics, or hobbies that you always wanted to pursue take my advice always start development with a tested source of hardware with some software examples. I am not telling you this to promote what I have developed, just in case you find the information given in this blog useful. I just want to share with my fellow students who are in league of becoming an MBA with an engineering degree that learning embedded and doing projects on robotics is not a rocket science course. Anybody having a basic understanding of C\C++ and computer architecture can do wonders in this field.
/****************************************************************************/

(Published in Embedded For You Magazine Issue: July – August 2011)

Saturday, August 20, 2011

Mechatronics Trainer

Mechatronics Trainer by Embedded For You
Mechatronics Trainer, a photo by Embedded For You on Flickr.

DIY Robotic Kit for for developing robotic or Mechatronics projects.

Features:
1) It is capable of interfacing with PS2 Mouse/Keyboard.
2) Two H-Bridge motor drivers capable of driving 2 X Stepper motors or 4 X DC motors.
3) IR object detection for Left,Right and Forward direction mainly for robotic cars.
4) LDR Light sensor.
5) Temperature Sensor.
6) 3 X Switches
7) Buzzer for audio application.
8) Expansion header for direct connection to ESAT-ISP development board (Arduino Compatible).
9) PS2 Interface

Tuesday, May 17, 2011

Traffic Light Controller using ATmega8


Embedded For You Magazine
Issue: March – April 2011
Traffic Light Controller
Traffic light controller is a traffic light simulator having a working GUI builds using national Instruments Labview. GUI software allows user to set the sequence order of each junction out of four and the on duration of each junction easily.

Traffic Light controller has four junctions. Each having its corresponding seven segment display to show the stop timer. As stop time expires, Green light of the corresponding junction goes green.

Algorithm for calculating the order in which the Red lights have to glow is decided by the priority of the corresponding junction. See the attached source code of the traffic light algorithm implemented in Turbo C++.

Traffic Light Controller is a shield board to be connected with ESAT-ISP Development Tool (Manual & Specifications).



Traffic Light Controller - Do It Your Self!!



Writing the Microcontroller Code your self

1.    Controlling the Seven Segments

BCD to 7-segment driver HEF4543 is used to display digits on seven segments. Control table of HEF4543 is given below.

There are Eight Seven Segments on Traffic Light controller board.

To display a number on a seven segment, it is first selected by pulling S1,S2,,S8 to 5 Volts(1).Numeric number to be displayed is selected by output of HEF4543 IC. See Table 1. for further details.

Code definitions:

//See Table 4 for Seven segment enable pins

A2/D3 A0/D2 A1/D1 A3/D0 Output
L 
L 
L 
L 
L 
L 
L 
L 
H 
H 9
Table 1 HEF4543 Details
#define S1 PORTD.2 //seven Segment 1

#define S2 PORTD.3//seven Segment 2

#define S3 PORTD.4//seven Segment 3

#define S4 PORTD.5//seven Segment 4

#define S5 PORTD.6//seven Segment 5

#define S6 PORTD.7//seven Segment 6

#define S7 PORTB.0//seven Segment 7

#define S8 PORTB.1//seven Segment 8

#define SEG_PORT PORTA

// See Table 1. A3/A2/A1/A0 are MCU pins and D3/D2/D1/D0 are HEF4543 pins.

unsigned char table[10]= {0x00,0x08,0x02,0x0A,0x01,0x09,0x03,0x0B,0x04,0x0C};

//to display a number on a given seven segment.

//To Enable Segment 1, corresponding enable pin is pulled up.

S1=1;

//Display a number on the Seven Segment 1 for Eg: to display 6

SEG_PORT= table[6];

Controlling Street Lights - Red/Orange/Green led lights

LS153 1-of-4 data selectors/multiplexers is used to select between Red - Orange/Green led lights for a traffic junction.

Red light of every traffic junction is tied to EN(1G or 2G) of corresponding LS153( See Table 2).Therefore when an EN pin of LS153 is disabled, corresponding Red light will glow, indicating a Red light .As long as EN pin is inactive orange and green light s will be disabled.

When EN pin is enabled Red light of the corresponding junction is automatically disabled.

Further Control pins A and B are used to indicate Yellow or Green signal according to your algorithm (see Table 3).

Pins A and B are common to all Junctions.

ENxResult 
1 Red ON  
0 Red OFF 
Table 2 Enable/Disable LS153
Code definitions:

#define EN1 PORTB.4

#define EN2 PORTB.5

B3/A B2/B Result 
0 NA 
1 NA 
0 Orange 
1 Green
Table 3 Indicate Orange/Green light while LS153 is Active
#define EN3 PORTC.5

#define EN4 PORTC.4

#define A PORTB.3

#define B PORTB.2

//To Indicate Red Light on junction 1 and Green light on Junction 2

Seven Segment Details 
Segment 1 
PORTD.2/ Arduino PIN1
Segment 2 
PORTD.3/ Arduino PIN2
Segment 3 
PORTD.4/ Arduino PIN3
Segment 4 
PORTD.5/ Arduino PIN4
Segment 5 
PORTD.6/ Arduino PIN5
Segment 6 
PORTD.7/ Arduino PIN6
Segment 7 
PORTB.0/ Arduino PIN7
Segment 8 
PORTB.1/ Arduino PIN8
Table 4 Seven Segment Enable Pins
EN1=1;//RED ON, Junction Inactive

EN2=0; //RED OFF, Junction Active

A=1; //Select Green

B=1; //Select Green













 

Wednesday, February 16, 2011

Coders Heaven: Physical Computing using ESAT – ISP (Arduino Compatible)

Physical Computing using ESAT – ISP (Arduino Compatible)

Physical Computing using ESAT – ISP (Arduino Compatible)

Physical Computing using ESAT-ISP

This Initiative by Embedded For You magazine is to promote design and development on Embedded System in India.

ESAT-ISP Project Description and its PCB will be provided in Embedded For You Magazine January-February 2011 Issue.


ESAT-ISP is a Three in one multi-purpose development board, meant for use in industry as well as in learning Embedded Systems using Arduino platform.

ESAT-ISP Features

  • Program over 94 AVR8 bit RISC architecture devices.
  • Completely Compatible with Arduino Platform.
  • Works under multiple platforms. Linux, Mac OS X and Windows are tested.
  • No special controllers or smd components are needed.
  • Programming speed is up to 5kBytes/sec.
  • SCK option to support targets with low clock speed (<>
  • Easily configurable GUI software available online.
  • Software Examples and Installation Manual Provided in CD.
To Register Your Self click here

Saturday, November 8, 2008

M Stuck! Help me!!

This time it's a question, not a "how to" guide.

How can we execute programs written in HLLs like c++/java in some chip or device apart from our personal computers?? Please elaborate on how to upload program; what all devices n cables do I need for this purpose.

Could I expect some help by genius visitors of this blog?

Note:I need to apply this concept to some image processing application.

Friday, October 24, 2008

Read .CSV file by Visual Basic

To run this code do following steps :
1) VS2005 or later should be installed.
2)Create Windows Application
3) Add a List box , Text box and a Button to you Form.
4) Go to the Code file
5)Replace the code with the following code
5)Debug
6)In Text Box write the location of the file (.csv)
7)hit the button
8) Enjoy
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim _str_arr As String
Dim _path As String
Dim _comma As String
Dim _temp As String
Dim _Read As System.IO.StreamReader
Dim i As Integer
Dim r As Integer
_path = TextBox1.Text
_Read = File.OpenText(_path)
_str_arr = _Read.ReadToEnd()
_Read.Close()
i = 0
While i < _str_arr.Length
_comma = ","
r = _str_arr.IndexOf(_comma)
_temp = _str_arr.Substring(i, r - i)
_str_arr = _str_arr.Remove(i, r - i + 1)
ListBox1.Items.Add(_temp)
End While
End Sub
end class



Contributor : sid_kuku@yahoo.com

Wednesday, October 22, 2008

Unipolor Stepper Motor Control ( Easiest Way )

I have invented a new way of running a stepper motors.
First il give u a brief on stepper motors.
As it name implies, a stepper motor does not rotate in a continuous fashion like a conventional d.c. motor but moves in discrete "Steps" or "Increments", with the angle of each rotational movement or step (3.6, 7.5 degrees for example) dependant upon the number of stator poles and rotor teeth each stepper motor has. For example, assume a stepper motor completes one full revolution in 100 steps. Then the step angle for the motor is given as 360 degrees/100 steps = 3.6 degrees per step. This is commonly known as the motors "Step Angle".



Unipolar Stepper motor has 4 windings.Represented as sw1 to sw4 in the diagram.










ON represents 1.

OFF represents 0.

/*
* ----------------------------------------------------------------------------
* "THE LASSI-WARE LICENSE"
* divyansh@ymail.com wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a lassiin return Divyansh Gupta :)

* ----------------------------------------------------------------------------

In the Alogorithm below i assume that you know about ports in up's or uc's.

If sw1 to sw4 is connected to P1.0 to P1.3 respectively then following code will

work for sure.

*/


char status={0x0A,0x09,0x05,0x06};//These values represent binary status of winding 1,2,3 and 4 in steps 1 to 4 as given in the diagram.


int main()

{

int i=0;

P1=OUTPUT;//assign P1 port as output port


for(i=0;i<4;i++)

{

P1=status[i];

delay(50);//delay for some time as it takes some time for the motor winding to get enegised.

}

}


A Motor having 1.7 degree Step angle