Sunday, 5 February 2017

Detials about ATmega 2560 R3


Detials about ATmega 2560 R3
Arduino is an open-source physical computing platform based on a simple i/o board and a development environment that implements the Processing/Wiring language. Arduino can be used to develop stand-alone interactive objects or can be connected to software on your computer (e.g. Flash, Processing, MaxMSP). The open-source IDE can be downloaded for free (currently for Mac OS X, Windows, and Linux).

The Arduino Mega is a microcontroller board based on the ATmega2560. It has 54 digital input/output pins (of which 14 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started. The Mega is compatible with most shields designed for the Arduino Duemilanove or Diecimila.

The Mega 2560 R3 also adds SDA and SCL pins next to the AREF. In addition, there are two new pins placed near the RESET pin. One is the IOREF that allow the shields to adapt to the voltage provided from the board. The other is a not connected and is reserved for future purposes. The Mega 2560 R3 works with all existing shields but can adapt to new shields which use these additional pins.

Not sure which Arduino or Arduino-compatible board is right for you? Check out our Arduino Buying Guide!

Features:

ATmega2560 microcontroller
Input voltage - 7-12V
54 Digital I/O Pins (14 PWM outputs)
16 Analog Inputs
256k Flash Memory
16Mhz Clock Speed

Difference between Microprocessor and Microcontroller


The term microprocessor and microcontroller have always been confused with each other. Both of them have been designed for real time application. They share many common features and at the same time they have significant differences. Both the IC’s i.e., the microprocessor and microcontroller cannot be distinguished by looking at them.  They are available in different version starting from 6 pin to as high as 80 to 100 pins or even higher depending on the features.


Difference between microprocessor and microcontroller
Microprocessor is an IC which has only the CPU inside them i.e. only the processing powers such as Intel’s Pentium 1,2,3,4, core 2 duo, i3, i5 etc. These microprocessors don’t have RAM, ROM, and other peripheral on the chip. A system designer has to add them externally to make them functional. Application of microprocessor includes Desktop PC’s, Laptops, notepads etc.
But this is not the case with Microcontrollers. Microcontroller has a CPU, in addition with a fixed amount of RAM, ROM and other peripherals all embedded on a single chip. At times it is also termed as a mini computer or a computer on a single chip. Today different manufacturers produce microcontrollers with a wide range of features available in different versions. Some manufacturers are ATMEL, Microchip, TI, Freescale, Philips, Motorola etc.
Microcontrollers are designed to perform specific tasks. Specific means applications where the relationship of input and output is defined. Depending on the input, some processing needs to be done and output is delivered. For example, keyboards, mouse, washing machine, digicam, pendrive, remote, microwave, cars, bikes, telephone, mobiles, watches, etc. Since the applications are very specific, they need small resources like RAM, ROM, I/O ports etc and hence can be embedded on a single chip. This in turn reduces the size and the cost.

Microprocessor find applications where tasks are unspecific like developing software, games, websites, photo editing, creating documents etc. In such cases the relationship between input and output is not defined. They need high amount of resources like RAM, ROM, I/O ports etc.
The clock speed of the Microprocessor is quite high as compared to the microcontroller. Whereas the microcontrollers operate from a few MHz to 30 to 50 MHz, today’s microprocessor operate above 1GHz as they perform complex tasks. Read more about what is microcontroller.
Comparing microcontroller and microprocessor in terms of cost is not justified. Undoubtedly a microcontroller is far cheaper than a microprocessor. However microcontroller cannot be used in place of microprocessor and using a microprocessor is not advised in place of a microcontroller as it makes the application quite costly. Microprocessor cannot be used stand alone. They need other peripherals like RAM, ROM, buffer, I/O ports etc and hence a system designed around a microprocessor is quite costly.

Friday, 3 February 2017

Project Ideas

Project Ideas

List your project ideas. This can be helpful for both the novice and the experienced.

Navigation


Easy


Intermediate


Advanced

How about a wireless RC car in a friend's living room in say Germany, operated by a girl in New York (or San Francisco). Should be simple: girl uses keyboard to transmit instructions through German friend's computer. German Friend has a wireless transceiver that communicates to the RC car. How does she know what instructions to send? Easy way is Skype. Creative way are sensors, even cameras on RC car that communicates back to her in NYC!

Robot obeys to commands and gestures

Robot obeys to commands and gestures

Date:
February 24, 2012
Source:
Karlsruhe Institute of Technology
Sum....:
A robot helping in the household no longer is a dream of the future. ARMAR, the humanoid robot, can understand commands and execute them independently. For instance, it gets the milk out of the fridge. Thanks to cameras and sensors, it orients itself in the room, recognizes objects, and grasps them with the necessary sensitivity. Additionally, it reacts to gestures and learns by watching a human colleague how to empty a dishwasher or clean the counter. Thus, it adapts naturally to our environment.
FULL STORY
At the CeBIT in Hanover, Karlsruhe Institute of Technology and the FZI Research Center for Information Technology will present innovations for our everyday life in the future. At the joint stand G33 in hall 26, a humanoid kitchen robot will move around. The FZI House of Living Labs will present the interactive HoLLiE service robot and solutions for intelligent energy management.
ARMAR Robot Learns by Watching
A robot helping in the household no longer is a dream of the future. ARMAR, the humanoid robot, can understand commands and execute them independently. For instance, it gets the milk out of the fridge. Thanks to cameras and sensors, it orients itself in the room, recognizes objects, and grasps them with the necessary sensitivity. Additionally, it reacts to gestures and learns by watching a human colleague how to empty a dishwasher or clean the counter.
Thus, it adapts naturally to our environment. At the CeBIT, ARMAR will show how it moves between a refrigerator, counter, and dishwasher.
A video on ARMAR can be found at: http://www.youtube.com/watch?v=5x1G0nkSd9w

First steps with micro controllers (ATMega8)

First steps with micro controllers (ATMega8)

1) to learn how to connect the Micro controller in a simple circuit and how to power it
2) to see how to create a simple programmer (a device to connect the micro controller to a PC for uploading software)
3) to present a simple software program in C that controls a series of LEDS
4) to show everything in action
Note: its my first time when I'm working with micro controllers. The info presented here might be inexact, but not incorrect, since I will stick to my findings and to the easy path for a beginner.
All that is presented below was the result of one day of reading, soldering, testing - a good score I would say.

Short Intro and Motivation


Since I'm a C++ developer for Embedded Devices, small processing units were always a strong point of interest for me. Furthermore, building a robot for my bachelor degree, a few years ago, required getting over serious hardware limitations related to power consumption and weight. So I'm still looking for a way to perfect my robot, and to extend its functionality, and the microcontrollers look like a very interesting approach, to say the least.
For a start, I had two micro controllers at hand: the popular ATMega8-16PU and the not-so-popular PIC24FJ64GA002. The first one I've bought on Ebay from a very good seller in Thailand:

For this article I will be targeting the ATMega8, since it gave me excellent results, thanks to available documentation. Can't say the same about the PIC.
So let's start:

Our first ATMega8 circuit

The ATMega8 is an excellent micro controller:

28 PINS (23 for Input/Output !!!)
8-Kbyte self-programming Flash Program Memory
1-Kbyte SRAM
512 Byte EEPROM
6 or 8 Channel 10-bit A/D-converter
Up to 16 MIPS throughput at 16 Mhz
2.7 - 5.5 Volt operation
Its data sheet is available here
I suggest you download the ATMega8 image to the left and print it, since you will need it often to consult the PIN layout when doing your circuit.
The Input/Output pins are important when it comes to how many devices you want to connect/control/use. To control a simple LED you will need to use 1 PIN (for output). To control a temperature sensor, you will need another PIN (for input).
To do a simple circuit and power the micro controller, first thing you need to know is that you need a stable 5V power source. The best way to achieve this is to use a regulator like the 7905/7805. This component has constant output regardless of the input current - in regards to some given boundaries, of course.
Here is the circuit. I suggest you use sockets for the ATMega8, to easily change the chip on your board.

By implementing the schematics above, you'll have the microchip powered. But you'll need to program it in order to have a useful result.

Developing the Atmega software

Let's try something simple - like controlling a LED on/off.
For this, we need to attach the led to any of the ATMega8's available I/O pins.
I'll use Pin 28 named PC5. This pin is part of the PORTC set of 7 pins PC0 - PC6. Notice there are other sets of pins like PORTB (PB0-PB7) and PORTD (PD0-PD7).

So the wiring is like this:
Next you'll need a C compiler for the ATMega8 and a software programmer that will upload the compiled code to the micro controller.
For the compiler I've used AVR Studio from ATmel. Download the 3 files below and install them in the given order (the avr studio itself and 2 additional service packs):
1 AVR Studio, version 4.13, build 528 (73.8mb)
2 AVR Studio 4.13 SP1 (build 557) (37mb)
3 AVR Studio 4.13 SP2 (build 571) (45mb)
For the uploader I've used AVRDude that comes with the WinAVR package:
WinAVR
As soon as you've installed everything, start AVR Studio. You'll get a page like this:

Click on "New Project", and select AVR GCC, then add a project name "TestLED" and select a location to store the new project's files:


Click Next, and in this new page you can select "AVR Simulator" and to the right under Device, select ATMega8 as show below:


Simply press Finish, and you can start writing code:

First things we need to know:
  1. #include <avr/io.h>
Will include this library in our project so we can access basic Input/Output functions and macros.
  1. int main()
is the entry point of our program, here is where the program execution starts.
So, first thing to do is to set the PORTC as output. For this we'll use a special register named DDRC:
  1. DDRC = 0x20;
why 0x20? Let's have a look in binary:
PC6PC5PC4PC3PC2PC1PC0
0100000
Basically we set a value of 1 to the position associated with our target pin.
To set all pins to output, the value would have been:
  1. DDRC = 0x7F (in binary: 1111111)
To control other ports (B or D) you can use DDRB or DDRD in a similar way. At this point you should consult the micro controller's datasheet available here.
Next thing to do is to turn the led on and off by code. We want this in an infinite loop, so here's the approach:
  1. DDRC = 0x20; //PC5 set to output
  2. while (1) //forever
  3. {
  4. PORTC = 0x20; //set PC5 on . again computed in binary
  5. delay_cycles(1000); //a short delay to keep led on
  6. PORTC = 0; //all C Pins off
  7. delay_cycles(1000); //a short delay to keep led off
  8. }
An even better approach that doesn't interfere with other PORTC pin's settings would be:
  1. DDRC |= 0x20;
  2. while(1)
  3. {
  4. PORTC |= 0x20; //set 1 on first position, or simpler: PORTC = 0x20;
  5. waitd();
  6. PORTC &= 0x5F; //remove position 5 value, or simpler: PORTC = 0x0;
  7. waitd();
  8. }
After the code is ready, press Build in the menu. It will produce a .hex file, in this case testled.hex

A parallel programmer for the ATMega 8

A programmer is a hardware interface that connects the micro controller to a PC.
On the PC you create a software program, that you can then upload to the ATMega8 using the programmer. It's quite simple.
To make things easier, I'll describe how you can create a parallel programmer, but this will work for you only if your computer has a parallel port since that's where you need to connect it. If it doesn't, you can purchase an USB2Parallel adapter or build an USB Programmer directly (you can use this)
Use any of the three variants below. My first programmer was a BSD parallel programmer.
BSD Parallel programmer
The first one is called bsd, probably because it was originally available at AVRPROG program for FreeBSD.
For this parallel programmer you'll need a LPT 25pin connector and 4x470 Ohm resistors. This is the way you need to make the connections for the BSD type parallel programmer:
To download the previously generated .HEX file to the atmega8, we will use our Parallel BSD programmer. Go to WinAVR folder, and enter the BIN subfolder. Copy testled.hex here and make sure your parallel programmer is connected.
Type in this command:
  1. avrdude -p atmega8 -c bsd -U flash:w:testled.hex:i
stk200 Parallel programmer
This was my second build. It behaves like the STK200 AVR Starter Kit, and it is also compatible with the PonyProg software. The design is simple:

To write the hex you can use:
  1. avrdude -p atmega8 -c stk200 -U flash:w:testled.hex:i
DAPA Parallel programmer
I newer built this, as not long after the stk200 I moved to usb programmers. Dapa, which means Direct AVR Parallel Access cable, can be seen below:

The command to write the hex is:
  1. avrdude -p atmega8 -c dapa -U flash:w:testled.hex:i

The results:

After the avrdude command, if everything goes right, you will see a progress bar indicating the code upload to the micro controller:

As soon as the software is uploaded, the code will be automatically executed.
Sometimes you might need to disconnect your parallel programmer after the code has been uploaded!
Here's my ATMega8 micro controller and several leds connected to multiple I/O pins: