Electronics – Tuts, tips and much more …

If we hear, we forget; if we see, we remember; if we do, we understand – Confucius

Archive for October, 2007

The Commet visible with naked eye !!

Posted by Omkar on October 27, 2007

Comet holmes is visible with naked eye in night sky. Don’t miss this chance. This commet is very simple to identify. See the attached map and follow these steps :

1)First locate the star Mirfak. It is the only brightest star in srrounding region.
2)Now locate second faint star ‘delta persei’ , which is at 5 o’clocks position with respect to mirfak.
3)Now, join these two stars with imaginary line (pink line).
4)Now from delta persei, move perpendicularly in diagonal direction as shown and you will see the commet . It will look like faint fuzzy blob.

NOTE : Ignore mountain in the map. It is just placeholder and doesn’t carry any significance. This sky map applies to all mumbai and probably maharashtra region.]

> Location of the commet . [ This is map of night sky for 27th oct, 9pm. It will be same for upto week or so...position of commet will change sligtly over the period of time. Position of moon will completely change in a day or two....so don't look at moon for reference. ]

> Clue to identify commet.

More information is available on these links :

http://www.tulsaworld.com/news/article.aspx?articleID=071026_1_A5_spanc54823

Posted in Astronomy | 1 Comment »

AVR : Tutorial 1: Introduction to AVR

Posted by Omkar on October 21, 2007

AVR microcontrollers from ATMEL are very good choice for designing mid-range embedded systems.They are 8Bit RISC controllers. They come in many verities and most of them gives 16MIPS (Mega Instructions Per Seconds) throughput at 16MHz . Unlike most of the popular PIC microcontrollers, AVRs have powerful instruction set, most executing in 1 cycle. Recently ATMEL has introduces some new controllers with speed upto 20MHz and USB support. (actually we can overclock AVR, which is characterised to run at 16MHz, upto 24MHz !! I will tell you how to do it sometimes later).

Which AVR ?

Most common AVRs are ATmega8 and ATmega16. They are available at Lamington road for Rs60 and Rs100 respectively.We will use ATmega16 AVR throughout these tutorials.

Which compiler ?

AVRs can be programmed directly in assembly. We have to use standard assembler provided by ATMEL. However, if you choose writing programs into assembly, you won’t be able to write complex programs, it will drive you nuts and half of your development time will be wasted in recollecting what you have done last time, why this line I have written, which register I am using for this variable, Oh my god now how can I do 32bit integer multiplication/divisions, etc. problems. The solution is simple…use C cross-compilers !

C cross-compilers(or to be simple call it as compilers) provide you facility to write programs in C and then they convert it to equivalent assembly code, which is then assembled by standard assembler provided by ATMEL. All happens at the background and you get HEX file at the output. Hex file actually contains machine code, which uC (i.e. microcontroller) will execute.

We will be using CodeVisionAVR C compiler.This is extremely user friendly and the best C compiler available for AVRs. Though it is commercial, its evaluation version can compile C code which should not result into HEX file having size more than 2KB. Later on once you are well versed with cvavr (i.e. CodeVisionAVR) and overall C programming methodology for uCs, you can switch to free GCC compiler for AVR.

How to put HEX file into uC ?

To program(or burn !) our code into uC. We need to use programmer hardware and programmer software. We will use simple parallel port programmer hardware and PONYPROG200 programmer software. To know how to build simple AVR programmer hardware and how to use PONYPROG2000 see Ultra simple AVR programmer.

Posted in AVR microcontroller | 3 Comments »

Some of the photographs shot by me…long ago.

Posted by Omkar on October 16, 2007

The Candle.

Big Neem tree in our building compound .

In the morning light …

Rear side view from my house during rainy season.

Golden Sky

Guess whats this ??….its an ICE :)

Posted in Album | 2 Comments »

Mega16/32 kit

Posted by Omkar on October 16, 2007

After 3-4 years of experience with AVR microcontrollers and robotics, I have designed this developement board based around mega16/32 AVR. This board can be readily used for robotics, project developement, product developement, as drop-in board.

Board Features :

  • - supports : mega16/32 AVR uC. With easy to use ZIF socket.
  • - Pins headers are provided for all ports of uC….so that any signal can be tapped and board’s functionality can be extended
  • - slot for crystal, so it can be changed. default crystal 16MHz
  • - 6 Voltage dividers for 6 ADC inputs. Helps you to measure almost any voltage levels even in excess of 5V.
  • - 8 LEDs on PORTB for debugging purpose.
  • -MAX232 provided for serial interface with PC
  • - 3 Tact switches(buttons) for user input – Two L293D motor driver IC. Each one has 4 H bridges and capacity of 500mA per bridge. This can be used for driving 4 DC motors or 2 Stepper motor.
  • - One of the two L293D IC, is connected to PWM out pins (OC1A,OC1B). This can be used for motor control using PWM
  • - Separate voltage regulator is provided for L293D. This helps you to provide any customary voltage to load.
  • - One Speaker for audio generation.
  • - Some prototyping area to build your own circuit, or connect small ICs(like EEPROMs) to microcontroller
  • - Supports In System Programming (ISP) using cable provided. – NO SMD COMPONENTS. So that you can replace any component on the board with your desired ones. Board Accessories:
  • - In System Programming cable. Connects to printer port of PC.
  • - Serial cable, to connect to SERIAL port of PC.
  • - One 8 Pin, Two 4 Pin, One 3 Pin, ready made connectors with wires attached.

#Board Information Sheet

#Circuit Diagram

<!–[endif]–>

FREE CD:

Contains…

  • -Evaluation version of CodeVisionAVR C compiler.(Supports upto 2KB of hex code)
  • - PonyProg2000. For burning your hex files into controller.
  • - Couple of sample programs

<!–[endif]–>

PRICING :

To encourage embedded enthusiats and help them to implement their ideas easily, price of the kit is quite low and thus affordable. Developement Kit, with such features, from other companies have exorbitant prices. If you want more info please contact me on my e-mail or scrap on orkut.

There are also other options available to order kit selectively…

> without : ZIF socket/ one L293D/ both L293D or combination of these options. Kit will cost less accordingly.
> Only blank PCB (no kit)

If not in stock, it will take around 10-15days to fullfill order. Contact

Cost(with mega16) : Rs 950/- Only (shipping extra)
Cost(with mega32) : Rs 990/- Only (shipping extra)
Blank PCB : Rs 230/- Only (shipping extra)
NOTE :
- Only few kits are available as of now. More will be available after 17th feb.
- Cost CAN be reduced, by not ordering kit with either/all of following things
>No L293D ( -55 for each )
>No mega16 ( -90 )
>No ZIF socket ( -70)

 

SOME SNAPS :

This is how it looks :

# sample PCB, hence without green coating

# final PCB, with green coating and silk print

# This is the way it can be used for diffrent projects

s_mega16brdv3-blankpcb.jpg # The blank PCB. You can use this PCB in your final product/project and
solder only required components.

# The Complete Kit.

Posted in AVR microcontroller | 7 Comments »

Configuring AVR Fuse Bits for clock selection

Posted by Omkar on October 15, 2007

VIMP NOTE:

fuse bit = 0 => fuse bit is PROGRAMMED
fuse bit = 1 => fuse bit is UN-PROGRAMMED

Fuse bits configuration is required when one has to change default factory setting of clock (internal/external) to desired setting. This is most important thing and setting fuse bits incorrectly may render microcontroller useless. Let us see which diffrent fuse bits are available for diffrent AVRs and their uses. PLEASE NOTE that discussion on this page is limited only for configuring fuse bits for clock source selection. We will use PonyProg2000 for configuring fuse bits.

There are diffrent clock sources available for AVR. They are : internal RC oscillator, external crystal/ceramic resonator, external clock. Mostly we need either internal RC oscillator or external crsytal hence we will only concentrate on that. Once you understand the process u can configure for other options with the help of datasheet.

Internal RC oscillator :

Many AVRs (like ATmega8, ATmega16, ATmega32) have internal RC oscillator. It is calibrated for 1,2,4 or 8 MHz. It has +-3% accuracy. Frequency of oscillator gets affected by VCC and temperature. If you are not performing any time critical operations in your system, then this is best option to go with. Follwing table shows how to set CKSEL fuses for diffrent frequencies. This table can be found in corresponding AVRs datasheet. CKOPT fuse should always be unprogrammed while using this option.

CKOPT
CKSEL3…0
Freq
1
0001*
1.0MHz
1
0010
2.0MHz
1
0011
4.0MHz
1
0100
8.0MHz

*If your AVR has internal RC oscillator then, device is shipped with this option.

Crystal oscillator :

Crystal oscillator should be used when u need accurate frequency of operation. CKSEL3,2,1 fuses should be configured as follows for crystal oscillator. If you want to use crystal of frequency more than 8MHz then CKOPT should be programmed. NOTE : setting of CKOPT depends on speed grade of your AVR. However please note that CKSEL0 fuse along with SUT0,1 is used for startup time selection in this mode. Refer datasheet for more info.

For AVR with 8PI or 8PU (i.e. max frequency of operation is 8MHz)

CKOPT
CKSEL3..1
Freq (MHz)
Decoupling Capacitor
1
101*
0.4 – 0.9
-
1
110
0.9-3.0
33pf
1
111
3.0-8.0
33pf
0
101,110,111
1.0
33pf

For AVR with 16PI or 16PU (i.e. max frequency of operation is 16MHz)

CKOPT
CKSEL3..1
Freq (MHz)
Decoupling Capacitor
1
101*
0.4 – 0.9
-
1
110
0.9-3.0
33pf
1
111
3.0-8.0
33pf
0
101,110,111
1.0 – 16.0
upto 8MHz : 33pf
more than 8MHz : 27pf

*This setting is only for ceramic resonators

You can get more information about crystal oscilator from datasheet.

I have put ready-made snap shots of fuse bit settings for diffrent AVRs :

  • ATmega8 – internal 1MHz RC , fast rising power

  • ATmega8 – external crystal 3.0 – 8.0 MHz, fast rising power

  • ATmega16/32 – external xtal upto 16MHz, full oscillator swing, slow rising power (65ms), JTAG disabled

Posted in AVR microcontroller | 8 Comments »

Make your own, ultra simple, universal AVR programmer !!

Posted by Omkar on October 15, 2007

Two types of AVR programmers can be built :

1)Parallel port
2)Serial port


PARALLEL PORT :
————————–

Following circuit diagram shows ultra simple AVR microcontroller (SOURCE: unkown). It requires very few components and its very simple to build on general purpose matrix PCB. You can use PonyProg2000 software to program your AVR using this programmer.

CIRCUIT DIAGRAM :


LIST OF COMPONENTS :

1)Resistors 220Ohms ,1/4W 4
2)Capacitors 27pF,disc 2
1µF , electrolytic 2
3)Crystal 4Mhz OR 8Mhz 1
4)Voltage regulator 7805 1
5)Connector D25 Male 1
6)Grid PCB 3″ x 3″
7)Connecting wires - -

approximate cost : 55 Rs

• As programmer circuit is very simple, u can use substitutes if particular component is not available at your place.
• You will not get 3”x 3” GPCB ready made, you have to cut standard sized PCB. 3” x 3” is just rough estimate

SNAPS :

Following photograph shows programmer I have made for 40Pin and 20Pin AVR µCs. MISO, MOSI, SCK, RESET, X1, X2 , VCC and GND pins of both 40pin and 20pin sockets are connected together.


CONFIGURING AND USING PONYPROG2000 :

  1. Open PonyProg2000
  2. Select menu : Setup>Interface Setup
  3. Select “parallel”, from drop down box select “Avr isp i/o”, select “LPT1″. Click OK.

  4. Now select menu Setup>Calibration. A dialog box will appear , click YES.
  5. Now PonyProg2000 is configured and ready to use.
  6. To burn your .Hex file into micro, select File>Open Program(FLASH) file.
  7. Select appropriate microcontroller from the list of devices at top-right. e.g >
  8. Connect your programmer ckt to PC, then place your micro into programmer ckt and turn on its power supply.
  9. Now click on the encircled icon :
  10. When device is programmed you will get “Program succesful” message.

SERIAL PORT :
———————-

Serial port programmer(reference: At-Prog) is shown here. Main advantage of using serial port is you can have cable length upto 2m. You can use PonyProg2000 software to program your AVR using this programmer. Serial port generates +- 12V on its pins, thus diodes and zener diode is used to clamp +12V to +5.0V(4.7V due to zener + 0.3V due to bat85) and -12V to -0.3V (due to lower Bat85). You can substitute Bat85 with 1n4148, however it is not recommended because, this diode will clamp +12V and -12V to +5.4V and -0.7V which are not desirable, as per datasheet of microcontroller. Its not that micro will burn if you use 1N4148 diodes, but why to take risk !!.

CIRCUIT DIAGRAM :

LIST OF COMPONENTS :

1)Resistors 1K,1/4W 4
2)Capacitors 27pF,disc 2
1µF , electrolytic 2
3)Crystal 4Mhz OR 8Mhz 1
4)Voltage regulator 7805 1
5)Connector D9 Female 1
6)Diode Bat85 8
7)Zener Diode 4.7V 1
8)Grid PCB 3″ x 3″
9)Connecting wires - -

approximate cost : 90 Rs

CONFIGURING AND USING PONYPROG2000 :

  1. All steps are same as described in parallel port programmer section, However during third step do the following settings :

    select “serial”, from list select “SI prog I/O”, select “COM1″( usually serial port is at COM1, if your computer have more than one serial ports multiple options will be active. Select appropriate, if you know, else do trial&error), check “Invert Reset”. Click on OK.


COMMENTS :

• Circuit diagrams shown above are generic and suitable for any AVR µC which supports ISP (almost all AVR, you can refer to www.atmel.com)
• Connect pins (e.g. MISO,MOSI, etc…) of AVR to appropriate points shown in circuit diagram.
• You can built programmer for more than one AVR devices by using different IC sockets for each device and doing appropriate connections of all above signal lines ( MISO,MOSI,SCK,RESET,X1,X2) and Vcc,Gnd of each AVR.
• Prefer using ZIF socket with IC base(refer: How to use ZIF socket in circuit without re-drilling holes on PCBs). Though It is bit costly, it proves extremely helpful.

Posted in AVR microcontroller | 132 Comments »

Make Your Own Power Supply !!

Posted by Omkar on October 15, 2007

Power supply is foremost important thing for any electronic hobbyist. Making one variable voltage power supply at home is extremely simple. You need just few components and one pretty nice transformer which can wholeheartedly supply enough current for your needs while staying cool !!.

LIST OF COMPONENTS :

1)Transformer 0-18 Volt, 1 Amp
[ alternative: 9-0-9, 1Amp]
1
2)LM317 – variable voltage regulator 1.5A (TO-220 package) 1
3)Diodes 1N5408
1N4007
4
2
3)Capacitors 2200µF(or more),50V(or more)
470µF,50V(or more)
10µF,50V(or more)
1
2
1
4)Resistor 220E, 1/4 W 1
5)Pot D25 Male 1
6)Grid PCB 3″ x 3″(approx)
7)Connecting wires - -

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CIRCUIT DIAGRAM :


NOTES :

  • Do not use transformer with output more than 0-18 V (or 9-0-9), because their no load voltage goes upto 22-28V depending upon manufacturer. If you use higher o/p voltage transformer (say 0-24) its no load voltage may reach to 35-40V, which will damage LM317, once LM317 gets damaged, it will short i/p to o/p and full voltage will get connected to your circuit under test, thereby ruining the circuit.
  • C1 should be as large as possible to get very good power supply ripple rejection.
  • C2 and R2 should be soldered as close as possible to LM317· Heat sink is recommended for LM317.
  • Try to obtain transformers current rating which is at least 1.5 times your maximum requirement. If u drive transformer considerably long time at its maximum rating it will become quite hot.
  • Use plastic tape to properly cover AC mains and transformer connection. Slight carelessness here would lead to a nasty shock.

Posted in Electronics | 2 Comments »

 
Follow

Get every new post delivered to your Inbox.

Join 46 other followers