Society of Robots - Robot Forum

Software => Software => Topic started by: AtomicWaste on October 15, 2009, 05:19:22 PM

Title: $50 robot programming problem. Bricked?
Post by: AtomicWaste on October 15, 2009, 05:19:22 PM
Hello, I'm new to the whole robotics thing but I plan to make it my career path. I just finished the circuit for the $50 robot and tested it with a CBL Multimeter. As far as I know, everything is fine. The problem comes when I attempt to upload a program to the chip. I keep getting error 24 with ponyprog and I can't find the problem. I must have checked everything a dozen times. I tried using AVRdude with the following command.

Code: [Select]
AVRdude  -p atmega8 -c ponyser -P com1 -v -F -U flash:w:"C:\hold_servo.hex":a -U flash:v:"C:hold_servo.hex":a
In response I got
Code: [Select]
...
Device Signature=0x000000
Yikes! Invalid device signature.
Expected signature for ATMEGA8 is 1E 93 07
...

Does this mean I somehow bricked my microcontroller? Is there ANY way to fix this outside of getting another chip? Please help. ANy suggestions are accepted
Title: Re: $50 robot programming problem. Bricked?
Post by: chelmi on October 16, 2009, 08:02:56 AM
Did you try to modify the fuses? From what I understand this is the only way to brick an ATmega.

Which programmer do you use? Could you post pictures of your circuit? Most of the time it's a wiring issue...
Title: Re: $50 robot programming problem. Bricked?
Post by: AtomicWaste on October 17, 2009, 04:22:34 PM
I didn't try to do anything but upload the program. I didn't even try to recompile it, I just used the photovore hex file that was on this site. I am using the cheaper programmer with ponyprog 2000. I can't post any photos but I've traced the circuit many times and followed it in comparison to the photos posted by others. I can see nothing wrong with the circuit itself. Is there any special way I should go about testing the circuit to see if it's a wiring issue?
Title: Re: $50 robot programming problem. Bricked?
Post by: Admin on October 18, 2009, 08:38:31 PM
If you didn't try to program fuses, the only other way you can still brick it is to try and program while the mcu is either off or at a really low voltage. (on rare occasions fuses can get corrupted during a bad programming)

Are you sure you are on com1? (check in system devices)

Are you using a USB to serial adapter? (it'll often cause cheap programmers to fail)
Title: Re: $50 robot programming problem. Bricked?
Post by: AtomicWaste on October 20, 2009, 07:18:33 PM
I'm not using a usb to serial adapter. There are two com ports on my computer labeled com1 and com2. I have tried both settings with both ports with 0 results. What exactly should I look for in system devices? The existance of com1? It's there and "working properly." There is also an lpt1 port. I imagine this isn't it but tried it anyhow. Failure.

I have the battery plugged in and all the voltages look fine. Actually no, scratch that last comment. I just checked again and the sensor bus is at 2.75 V with the chip in and 2.95 with the chip out. I don't get it. The voltage was fine before. The battery currently measures 6.8 V. All the connections still look fine though. Could this be the problem? Maybe I somehow fried my 5v regulator. I know it was fine before. I got a measurement of about 4.94v before.
Title: Re: $50 robot programming problem. Bricked?
Post by: Admin on October 20, 2009, 07:57:52 PM
Yea that voltage problem sounds like it. Check the regulator without any wiring except power and ground - if its still not working, then its the problem. As such, hit it with a hammer a few times as an example for all the other regulators that might decide to otherwise stop working.
Title: Re: $50 robot programming problem. Bricked?
Post by: AtomicWaste on October 20, 2009, 08:05:07 PM
Input: 6.77
output: 2.87

Darn.

In trying to make my quest to build this cheaper (unsuccessful), I ended up with free samples of three Voltage regulates from TI, would one of them work?
The bags are labeled:
IC VOLT REG POS 5V .5A DPAK
IC POS-VOLT REG 1.5A 5V D2PAK-5
IC POS-VOLT REG 5V D2PAK-5

 
Title: Re: $50 robot programming problem. Bricked?
Post by: Admin on October 20, 2009, 08:14:03 PM
Yeap those will work. Might be a little tricky soldering them, however:

(http://t2.gstatic.com/images?q=tbn:Vc2mUsJoDvQ-AM:http://www.kec-semicon.com/add_file/packaging/photo1/DPAK.jpg)


As for being cheap . . . remember that your *time* has value too. Wasting hours to save mere bucks isn't always worth it.

(http://media.digikey.com/photos/Vishay%20IR%20Photos/MFG_D2PAK5%20Package.jpg)
Title: Re: $50 robot programming problem. Bricked?
Post by: AtomicWaste on October 20, 2009, 08:17:30 PM
Thanks. I'll try them after a nights rest.

As for time. I'm a high school teenager that sleeps in a room he refers to as his "terminal". Time is the least of my worries.
Title: Re: $50 robot programming problem. Bricked?
Post by: AtomicWaste on October 22, 2009, 12:49:18 AM
well, I swapped in the last one, destroyed it like you said (helps with the anger), and checked the voltages. The servo bus reads 6.77. The sensor bus exactly 5 with a very occasional fluctuation to 5.02. Power Pins 7,20,21 read 5v as well the grounded pins 22 and 8. The programmer header also reads 5v. and yet...

I still can't program it.

I get the same errors in ponyprog 2000 and avrdude. What could possibly be wrong? How tight is the chip supposed to be in the DIP socket. I don't think I can push mine any deeper into the socket but it comes out easily. All the pins appear to be making connection though.

Is there any way I can make sure the atmega8 is powered up?

This site mentioned a similar problem.http://forums.obdev.at/viewtopic.php?f=8&t=2042 (http://forums.obdev.at/viewtopic.php?f=8&t=2042). I guess I have no choice but to pay another $5 for shipping to get another atmega8. Should I pick any thing else up while I'm at it? I have a low budget now (after spending $120 on this thing) but I'm not the type to just give up and throw it in a corner.

Thanks for bearing with me so far. Any other ideas?
Title: Re: $50 robot programming problem. Bricked?
Post by: Admin on October 22, 2009, 05:28:23 AM
Hmmm well there is still the chance that you bricked it during the low voltage problem. If you order another, also get an ATmega168 so you can do the upgrade. Mouser.com will probably have cheaper shipping.

If the ATmega seems kinda loose, bend out the pins a tiny bit so that it firmly fits.

Using a multimeter, measure the metal pins directly on the chip, then the traces on your board, and see if there is a good connection.
Title: Re: $50 robot programming problem. Bricked?
Post by: AtomicWaste on November 16, 2009, 02:31:10 AM
Sorry It has taken me such a long time, I was busy, had to wait for cash, and had to wait on parts.

Thank you for all your help, I replaced the atmega8 and was amazed to see that the thing worked.
 Like you said, I got an atmega 128 and a 328 for later, I have yet to test either.

I still have two problems though. The first, the LED. I have checked every schematic and picture I could find, I am sure I have the voltages right, and yet, no light. I touched battery wires directly to the LED (I know, bad idea, but, It didn't blow up) and it came on so I know it works. I also plugged  in a larger LED and saw a slight blink on that one upon turning on the robot, but only then. What size resister should I have used?

The second and more important problem involves the turning. Even when I place a flashlight over the one sensor and cover the other, all I get is a slight jerk, then the whole unit starts moving forward again. I am pretty confident my connections are all tight and  I've graphed the sensor data on a TI-83 plus so they must be working to some extent. Again, what size resister should I have used?
Title: Re: $50 robot programming problem. Bricked?
Post by: Admin on November 16, 2009, 06:14:48 AM
A 128, or a 168?

It almost sounds like you fried the LED. At least a 100 ohm resister will work. Use this to calculate a better value:
http://www.societyofrobots.com/electronics_led_tutorial.shtml (http://www.societyofrobots.com/electronics_led_tutorial.shtml)


So your robot moves forward, but doesn't turn? If you hold the robot off the ground, do the wheels turn when the robot turns? Did you center the servos properly?
Title: Re: $50 robot programming problem. Bricked?
Post by: hopslink on November 16, 2009, 06:56:14 AM
...The second and more important problem involves the turning. Even when I place a flashlight over the one sensor and cover the other, all I get is a slight jerk, then the whole unit starts moving forward again. I am pretty confident my connections are all tight and  I've graphed the sensor data on a TI-83 plus so they must be working to some extent. Again, what size resister should I have used?

Also see Admin's guide for calculating this resistor value >HERE< (http://www.societyofrobots.com/schematics_photoresistor.shtml)  :P
Title: Re: $50 robot programming problem. Bricked?
Post by: Webbot on November 16, 2009, 04:31:45 PM
The first, the LED. I have checked every schematic and picture I could find, I am sure I have the voltages right, and yet, no light. I touched battery wires directly to the LED (I know, bad idea, but, It didn't blow up) and it came on so I know it works. I also plugged  in a larger LED and saw a slight blink on that one upon turning on the robot, but only then. 

The LED is not a power indicator - its connected to an I/O pin and you must write the code to make it turn on the LED. To do this you have to set the pin to an output pin and then make it go low. (Yes - low) Since the LED is connected from the 5V supply via the resistor to the pin. So setting the pin low will cause current to flow through the LED.
Title: Re: $50 robot programming problem. Bricked?
Post by: AtomicWaste on November 17, 2009, 01:56:24 AM
Well, I solved the turning problem. It appears that the atmega8 bowed a little and the pins weren't connected as tight as I thought.  I little push and it worked fine.

Sorry typo, I got the 168.

As for the LED, I know it's not a power indicator, the program admin passed out does turn the LED on right?

The LED is not fried. I attached the end farthest from the controller directly to the source of the motor bus with a spare wire and it lit. I tried the same thing again except I passed it through the resister and it still lit. It only lights when I give it the 6.6v power though. I just don't think that the 5v being supplied to it from the atmega8 is enough to light it. I might decide to just turn it into a power indicator and forget about it.

Another odd thing, I took a second led and went down the outputs (connecting the chip to source)to see if it would light up, It did as expected on the two servo ports, but it also did on the two unused ports, yet for some reason, it did not light from the port the actual LED is plugged into. I can  think of only two possible reasons why. First, the program isn't turning it on, I didn't even recompile the included hex file so I don't think that is why; and second (more likely), the real LED is already using all the power,and 5v just is  not enough to light it.

I've considered attaching a transistor up to it and wiring it through the servo bus instead, that is after al,l the only way it appears to light. Would that work?
Title: Re: $50 robot programming problem. Bricked?
Post by: hopslink on November 17, 2009, 04:27:51 AM
Well, I solved the turning problem. It appears that the atmega8 bowed a little and the pins weren't connected as tight as I thought.  I little push and it worked fine.
Gald to hear it's sorted :) .
Quote
The LED is not fried. I attached the end farthest from the controller directly to the source of the motor bus with a spare wire and it lit. I tried the same thing again except I passed it through the resister and it still lit. It only lights when I give it the 6.6v power though. I just don't think that the 5v being supplied to it from the atmega8 is enough to light it. I might decide to just turn it into a power indicator and forget about it.
The fact it is not fried is more luck than judgement I'm afraid. You should use a current limiting resistor, without it you are shortening the life of your LED and risking your micro too. From what you describe here it sounds like the resistor you are using may be too large. What value are you using? Did you calculate it? See the Admin's link above.
Quote
Another odd thing, I took a second led and went down the outputs (connecting the chip to source)to see if it would light up, It did as expected on the two servo ports, but it also did on the two unused ports, yet for some reason, it did not light from the port the actual LED is plugged into. I can  think of only two possible reasons why. First, the program isn't turning it on, I didn't even recompile the included hex file so I don't think that is why; and second (more likely), the real LED is already using all the power,and 5v just is  not enough to light it.
The micro is only capable of supplying a certain amount of power from each pin, this is enough to drive 1 LED. Be careful about overloading ports as you could kill your micro. It is always better to use your meter to read voltages round a circuit. Also testing all the pins is fairly pointless unless you know specifically how each pin is programmed to behave.
Quote
I've considered attaching a transistor up to it and wiring it through the servo bus instead, that is after al,l the only way it appears to light. Would that work?
Yes it would, but it is not necessary. Any output pin on the micro should be capable of driving an LED directly if things are correctly configured. Again see Admin's link above to the LED page.