VJTI Rocks !! Or does it now ;)

Share

Some time ago I did this search for VJTI on Google and it came up with a very interesting result.

There’s this spoof website call “Uncyclopedia” and apparently someone in a very brilliant and inspired bout of sarcasm and creativity went ahead to dedicate a proper webpage in VJTI’s memory.

Here’s the link :

http://uncyclopedia.org/wiki/VJTI

I’d read this before college started, and everything registered once the things mentioned actually started happening…You can’t stop yourself from falling off laughing…

If you need some inspiration to go there, just check this :

I think you should go ahead and enjoy the humour yourself…Trust me, you’ll repent if you are missing it… 😀

Share

Writing code for your AVR Micro-controller

Share

Ok, now that you’ve made the programmer, I am sure you will be raring to go and program the microcontroller with it.

Before you begin to do anything, check this :

1. Check the continuity(using the multimeter) of various pins of the parallel port with the cable connected.
2. Make sure none of the pins are shorted.
3. Make sure the right pins of the parallel port go to the right pins of the micro-controller.

Now,
you will need the following to proceed :

1. WinAVR :
It is software that is used to program most of the AVR micro-controllers.
You can download the latest version here.

2. Micro-controller :
This is a crucial part. While choosing a micro-controller, you must take into consideration the memory,speed and compatibility of the mcu with software. The ATMEGA series of AVR micro-controllers is pretty useful for most beginners and intermediate projects.
The ATMEGA16 or ATMEGA32 were recommended to me as being handy.I bought an ATMEGA32L and later realised that I was stuck with a “problem child”.
The chips having L at the end are almost the same,except that they have speed limitations.
The problem in my case was that ATMEGA32L was not among the list of supported devices.
I eventually found a way to overcome this, but I’ll come to that later…

Now to begin :

Once you’ve connected the microcontroller to the port using the cable and installed WinAVR :

1. You need to write the code for the program that your micro-controller will run.
For this , open “Programmers’ Notepad” in the “WinAVR” folder.

2. Type the code in programmers’ notepad. For my first project I used Bibin John’s code for blinking LEDs on all ports. You can find that and other useful stuff here.

3. Now you have to make a “makefile” which contains all the information about your micro-controller and other hardware.

In the application that opens,

you must change the following parameters :

1. Main file name : Enter the name of c file that you have made, without the .c extension
2. MCU Type : Select the microcontroller you are using.
3. Programmer : BSD
4. Port : lpt1

You need not bother with anything else, unless you are experienced enough.

Ok, now you need to save the file : save it in the same folder as your source-code and don’t change its name.

Now, you’re done with the program and just need to load it to memory.

Again, open Programmers’ Notepad and click on Tools — > Make All

If there are no problems with the code, the making should be successful and a lot of files will appear in your program folder. I haven’t faced any such errors in my program, but will try and put them here as soon as I encounter them.

Ok, now you need to load the finished program to the mcu. Just turn on the external power supply to the programmer and click on Tools — > Make program.

If everything’s perfect, the compiler will take some 2 or 3 seconds to flash the program to chip and will get a “Process Exit Code: 0 ” as the output.

However, in quite a few cases you will get an error with different messages . Here are the ones I know about and their causes :

1. Connection problems :

/——————————————————————————————
avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
make.exe: *** [program] Error 1
——————————————————————————————/

Here, they mean exactly what they say. Check your connections. Also check that the external power is turned on.

2. Port access :

I don’t remember the exact error code for this one, but the problem here is that Windows XP often blocks access to ports that will prevent your PC from communicating with the micro-controller.To overcome this problem, run “install_giveio.bat” in your WinAVR directory.

3. Device Mismatch

This was the most problematic error for me, and I spent two days racking my brains over it.
This error is caused when you try to use a micro-controller other than the one that you have mentioned in the makefile.

However, in my case, I had no option because the ATMEGA32L I was using was not in the WinAVR list of supported devices. I tried downloading some 5 additional software which might be compatible with my mcu, but that was not to be. None worked. I was stuck with the chip and had no option but to somehow get it to work.
Then it hit me. I figured that since the ATMEGA32 and the ATMEGA32L were the same except for their processing speeds (and some other features I was not aware of 😉 ) , the program should work fine.
So, I decide to use the ‘-F’ switch that allows me to over-ride the device signature error.
Finding how to focibly flash it was a bit difficult, but I finally found it.
Here’s how to go about it :

1. Copy all the files in your source code folder to the ‘bin’ directory where WinAVR is installed.
2. Run DOS prompt and enter the bin directory again in DOS.
3. Now, when you try to click on “Make Program” in WinAVR and get the error, check the output window. In the very beginning there will be a line like this :

avrdude -p atmega32 -P lpt1 -c bsd -U flash:w:blink.hex

When you type this in DOS and press enter you will get the same signature error.
4. Now, to bypass the error, just add -F at the end of the command, like this :

avrdude -p atmega32 -P lpt1 -c bsd -U flash:w:blink.hex -F

Here, the computer will encounter the error, but will ignore it and continue flashing it. This should do the trick. You will get a success message at the end.

HOWEVER,THIS IS VERY RISKY. I DID IT ONLY BECAUSE I HAD NO OTHER OPTION,AND BECAUSE BOTH WERE ALMOST THE SAME.
TRYING THIS WITH WRONG CHIPS WHICH ARE NOT SIMILAR MIGHT CAUSE THEM TO BLOW.PLEASE BE SURE OF WHAT YOU ARE DOING BEFORE YOU DO THIS.

I have tried to make this as easy and comprehensive as possible, but suggestions are most welcome.

I will try putting in more errors and solutions if and when I encounter them.

Share

Making your own AVR Programmer

Share

Having worked on a parallel port bot before,I wanted to move on to something more complicated.
Making intelligent bots,that work on only sensors,somehow didn’t appeal to me and I wanted software to play some role on it…So I decided to work on a micro-controller project.

Well,for programming a micro-controller,I need a programmer : Hardware that will interface the chip with the computer. I bought an AVR ATMEGA32L chip, as it seemed enough for my foreseeable projects. I browsed the web for a programmer.Lots of links are available with tons of information on making as well buying one. Well, I asked a friend and he told me that it was possible to make one and that it would also be more convenient to just buy it,as it was pretty cheap.
However, being in the electronics field, I decided to make one myself, just to learn how things work(which I would never have bothered to do otherwise). Well, the experience has been great and have had statements ranging from puzzled to pure frustrated !!

After almost a week of 3 hours daily and almost an entire weekend,I finally managed to piece everything together…It necessarily doesn’t take this long, I just spent lots of time planning the layout..which eventually got messy anyways…

Its nothing more than assembling a circuit on a PCB,which requires basic soldering and planning skills.


Click the image for a larger view

Here’s the power circuit :


Click the image for a larger view

Here’s how to go about making the programmer :

1. Get a mount for your chip. That way,the chip can be plugged in or removed any time, improving portability…Beats soldering the chip directly…
2. Get safety resistors for all pins going to the parallel port..They limit the current and protect the parallel port from blowing up
3. Get a diode (I couldn’t because I have fixed polaritites..) to prevent everything from blowing up in case you connect the power cable wrong
4. Get LED’s before the regulator and after the regulator..It goes a long way in troubleshooting…Has saved me a lot of frustration
5. Get a switch for the power supply…This will save you the trouble of removing the power plug every now and then
6. Use a LED for the RESET port….This will tell you when a RESET has been applied.
7. The capacitors in parallel with the voltage regulator are optional..generally to be used if dealing with radio circuits to reduce noise and stabilise voltage…
8.The external clock is optional and used to increase the speed. It won’t be used until you make some settings in the software,so you might as well put it on your board and keep for future use..

The connection between the parallel port pins and the pins of the ATMEGA32L are as follows :

Pin 7 ——————> ~RESET (Reset Bar)

Pin 8 ——————> SCK

Pin 9 ——————> MOSI

Pin 10 —————–> MISO

Pin 19 —————–> GROUND

Here’s how my programmer looks


Click the image for a larger view

Here’s one with the power on :

.
Click the image for a larger view

When the reset switch is pressed :


Click the image for a larger view

Tips while soldering:

1. Use solder wisely. You don’t want to make unwanted connections just because you used too much solder..
2. The solder should not only be adequate, it should also hold the component in place.I had two such problems,where the switch and a resistor were soldered,but not held in place, due to which there were loose connections leading to power problems.This is extremely dangerous,as you wouldn’t want power going off while you are programming it…
3. Tap your circuit vigorously and also wave it in the air vigorously,while the LEDs are glowing. Also the PCBs are slightly flexible,so try bending them and see if the LEDs go off…This will help you detect loose connections.
4. I also had an issue with the LED that comes before the voltage regulator. Even though I supplied more than 12V from the eliminator, most of the voltage dropped across the resistor connected with the LED and so the regulator did not get the needed supply and the chip did not work. If this happens, you will get a “AVR Device not responding” error when you try to program it . If so,remove the LED and resistor. They are supposed to be indicators, but there’s no point in keeping them if they only spoil the fun.

/*——— This programmer can be used with ANY 40-pin AVR Chip, not only the———-*/
/*——— ATMEGA32L. ———-*/

Hope you found this easy to understand and fun..
If you have any questions or suggestions, please comment

Share

The elusive Port 25

Share

All those who are trying to send email using the email servers of their local service providers will know the frustration that accompanies this problem.

I have been trying to use my local ISP’s smtp server since a long time, but always failed to connect to it. In addition, my ISP had shut off all ports (a port is just a communication channel) except port 25 for email purposes. I was in a fix….However hard I tried, I just couldn’t it to work…

Destination net unreachable, unable to connect were the words of death…I spent a whole day behind it,and after a few minor corrections on the ISP’s part and one on mine, I could get it to work…

The problem in most cases should be elementary…Windows XP has blocked connections on port 25…To know if this is so, just try to connect to any adress of your local ISP…If you cant connect to any of them , or get no reply other than “Destination net unreachable”, then port 25 is most likely blocked…

Here’s how to fix it…
1. Go to Control Panel
2. Click on Windows Firewall
3. Select the “Exceptions” tab
4. Click on add port
5. Name the exception whatever you like
6. In the port number box, enter 25.

This should do the trick.

If not, then there is some other problem and you will have to go back and keep on reading all those complicated technical replies in Google search.

Share