Showing posts with label Arduino Projrcts. Show all posts
Showing posts with label Arduino Projrcts. Show all posts

Tuesday, December 9, 2014

An introduction to robotics

It’s a pleasure to be here after a while. I’m having my summer vacation after a long, stressful but exciting semester and I’m hoping to spend my vacation studying robotics and microcontrollers with my knowledge I gained throughout the semester. So I thought to share some of my experiences about planning and building simple yet very exciting robotic projects I've done so far.

Building a robot by your self could be a challenge. It depends on how complex your robot project is. But it’s rewarding. You’ll get to know a lot about electronics and programming and it’s a great chance to use your knowledge to building something cool if you already have some academic background in electronics and programming. I’m expecting to write few blog articles about how I carried out my projects and in this article I’m hoping to present some basic ideas about robotics and design. Please use the links I’m providing throughout the article to expand your knowledge. 


First thing first

When we are  planning to build a robot we need to have an idea about what sort of robot  we need or the requirements .In my case I wanted to build an obstacle avoiding robot which is capable of detecting obstacles ,avoid them as much as possible and wander around in a given area. Next step would be searching for different examples in web and have an idea about how those types of robot functions, what sort of materials they have use to build the robot  and what is it capable of. There are lots of  very good websites in the web which were very helpful in my case. As well as these ,you need to be aware of your budget .If you are a student like me you won’t be able afford much to building a robot but it’s good to have at least few hundred dollars if you wish to buy some materials for your robot.




Modelling your robot

Every robot can be simplified into four simpler sections.
  • Sensors, Inputs and outputs
  • Control system
  • A Power Source for robot
  • mechanical parts

The combination of all these sections makes pretty much every robot we see. So when planning it’s much easier and efficient to break your model into these categories and find the most suitable parts for your application.

Power source

The main power source for  a robot will be batteries .Things like solar panel will be a good idea if your robot will spend much of it’s time out door but even in that case batteries will be there as a backup power source. So it’s good to do some research about types of batteries used in robotics before you start. The article in here is a good article about different types of batteries and what are the pros and cons of them.  Rechargeable batteries are a good option if you can afford them since they are a bit expensive and you might need a purchase a specially designed battery charger along with them but if you are hoping to continue your robotics consider it as a good investment. In general you may be able to find good deals in E Bay or Amazon  if you search them a bit. Currently I’m using 6 conventional AA size batteries (1.5V) and a 9V battery as the power source for my robot  and I’m ok with them since I’m not extensively using my design.

Sensors ,Inputs and outputs


Sensors are another important part of any robot since they are the only way your robot can get to know it’s surroundings. There can be many types but some simple common sensors would be IR sensors, ultra sound distance sensor , photo resistors and thermal sensitive transistors etc. By  utilizing these you can give the robot an idea about it’s surroundings and to respond to them accordingly. In here I used an ultrasound distance sensor (HC-SR04) to measure the distance and navigate the robot. Your outputs would be LEDs, Speakers or even LCD displays which are capable of inform something to you about the status of your robot.
Image retrieved by http://blog.oscarliang.net/how-to-use-ultra-sonic-sensor-arduino-hc-sr04/

A Control system


For most of us this would be the first thing comes in to mind when we talk about robots .Controls system acts like the brain of the robot. It takes the inputs from sensors ,process them according to the instructions given  by the program and decide what do according to the results and sends the control signals to the required hardware.There are lots of microcontrollers you can choose to program your robot .Arduino is one of the most popular platform for robotic applications and I’m using that an Arduino Uno board to control my robot .It’s considered as one of the best platforms for the beginners and it’s a pretty decent and sufficient board for most of the robots applications. It is capable of many functionalities that you can use to control a robot and there are lots of support for Arduino projects out there in web and it’s very helpful when you got a problem or trying out new things and you need some support. I highly recommend official Arduino web site as a reference.

Image retrieved by http://store.arduino.cc

All other mechanical and electrical components


This categorises all other moving and non moving parts like the chassis , electrical motors connectors wheels etc. I’m not going to this section in detail about these as my primary concern is electronic and software section of the robot and I don’t have much knowledge about the mechanical parts or how they work. So my solution to this was to buy an assembled chassis from web and all I have to do was design electronics (both hardware and software)to control the motors . I used a tank type chassis (RP5-CH02) as the base of my robot because it got all the motors and gear systems that otherwise I have to build. So it’s completely up to you to make a decision but if you can build a chassis ,then you will have more freedom to customize your design.  
 
Image retrieved by http://static.rapidonline.com


So in my next post I’m hoping to talk about some of the things you may need to know about  electronics and software fields to make a robot.    

Saturday, June 28, 2014

Building a simple  counter using Arduino uno



                                           Figure 1
Counter circuits are one of the most common uses of digital electronics in our daily life. A digital counter  is a system that is designed to perform counting from a given number to a specified value.(in general case 0 to any arbitrary number.)You don’t need an Ardunio board or any other microcontroller to build a counter  but using Ardunio ,we can simplify our task and we can do changes to our design very easily. In this article I’m hoping  to give a small introduction to sequential systems as well.
Counter s are categorized under a family called sequential systems. In electronics there are two kinds of systems .
Ø  Combinational systems
Ø  Sequential systems
The key difference between these two systems are sequential systems’ output depend on the previous output as well as the inputs and combinational systems’ output depend only on it’s inputs. Another key difference is that the sequential systems will typically have a clock. Clock is an essential part of sequential design and it’s the thing that defines the present and previous state.


                                                                  





Figure2


State Diagram 

State diagrams are used to describe a sequential system. It describes how the transition from one state to another state occur and the inputs (inputs of the system as well as the previous state) that triggers the transition.There are 2 kinds of FSM(finite state machines)
  •          Moore state machine -sequential systems which output depend only on states.
  •          Mealy state machine - Sequential systems which output depend on states as well as inputs of       the system.
         Counters are Moore machines since it's output(the corresponding number to each state) only depends on states,there are no inputs to the system.   

Figure 3-State diagram of a 0 to 9 counter

Coding

The following code was used to implement the counter .The reference code is just there for help in writing code since this code is long, coder can just copy and paste and change that piece of code as required to generate the output. I have used a conventional common cathode 7 segment display so there may be a possibility that other 7segments may have different pin configuration.
There are few tricks that I’ve used to simplify coding.
·         I used a for loop to declare the output pins.(you have 7 pins to declare.)
All of them are digital output pins of Arduino .
·         I declared a constant called del to store the delay value in ms . This is very helpful when we want to change the delay time.(That’s the time interval the counter going to stay in each state.)





  The best advantage of implementing circuits using arduino is these circuits can be improved or changed at any stage.if the circuit is built from scratch it is very difficult even to add a small change.but using Arduino you only have to change the code.So it's very convenient if you are intending to do experiments with your design.
You can download my version of this design(source code and Ardunio source code) by Here