Society of Robots - Robot Forum

Software => Software => Topic started by: ed1380 on March 27, 2007, 04:30:31 PM

Title: $50 robot programing
Post by: ed1380 on March 27, 2007, 04:30:31 PM
Is the source code for the $50 debugged and working?
I have a report due in a few weeks, about any topic I choose and think this would be a great way to take my first step into actually building a robot, and getting to show off at school 8)


Will a 9.6v ~2000ma/h battery be good? Got a couple of those laying around not being used.
Title: Re: $50 robot programing
Post by: Admin on March 28, 2007, 04:41:01 AM
Quote
Is the source code for the $50 debugged and working?
Yeap it works. But I recommend getting the ~$30 programmer cause I havent had time to figure out what went wrong with the cheaper one . . . the issues are all explained in the tutorial.

Quote
Will a 9.6v ~2000ma/h battery be good? Got a couple of those laying around not being used.
Yes and no. The servos are rated for a maximum of 6V (meaning they will fry if you go much higher). You could of course use a switching regulator to step the 9.6V down to 6V. The microcontroller circuitry will seperately use the 5V regulator so no need to worry about that.
http://www.dimensionengineering.com/DE-SWADJ.htm
Title: Re: $50 robot programing
Post by: ed1380 on March 28, 2007, 05:24:44 AM
Will I be able to use that programmer in the future when I go more advanced? Will it work with the more advance mcu's?

Can I get another 5v voltage regulator and use that for the servo's, cause I'm not too excited spending $15 on a voltage regulator?
If anything I'll use a 6v battery pack.
Title: Re: $50 robot programing
Post by: Admin on March 28, 2007, 05:48:48 AM
Search digikey for ATAVRISP2 and check the datasheet for what it supports. The more expensive one is better and supports more AVR's. Its the one I normally use, and I think most people use.

Quote
Can I get another 5v voltage regulator and use that for the servo's, cause I'm not too excited spending $15 on a voltage regulator?
Nope. A regular regulator is extremely inefficient and will fry with all the wasted heat.
Title: Re: $50 robot programing
Post by: dunk on March 28, 2007, 09:12:05 AM
Quote
Nope. A regular regulator is extremely inefficient and will fry with all the wasted heat.
unless you research "switching regulators" which are typically 90% efficient or better but at the expense of added complexity.
the LM2596 for example. http://www.national.com/pf/LM/LM2596.html (http://www.national.com/pf/LM/LM2596.html)

dunk.
Title: Re: $50 robot programing
Post by: ed1380 on March 28, 2007, 03:11:22 PM
I'm on a really tight budget. I scavanged some heatsinks off an old motherboard. will it work then?
What would you guys recomend for me to do since I'm on a tight budget? suck it up and get it, since I'm going to use it in the future, or use a 6.0v battery pack?
Title: Re: $50 robot programing
Post by: dunk on March 28, 2007, 06:04:03 PM
so you could use a regular linear regulator from a 9v battery for your servos but the "spare" 4 volts will be converted into heat.
bolting a heatsink on there will help but it really depends how long your servos will be running for.
when i first learned this my regulators were ok while the servos were stationary but they would over heat after less than a minute of movement.
trust us here, linear regulators aren't much good for big voltage drops or anything that draws more than a few hundred milli Amps.

switching regulators on the other hand have little controllers in them that switch the power on and off at high frequency, then smooth out the output with an inductor and capacitor to get the required voltage.
no nasty heat build up and very little wasted power.
using a LM2575, an inductor, a diode and 2 capacitors you can build a 1 Amp switching regulator for under $5.
http://www.national.com/pf/LM/LM2575.html (http://www.national.com/pf/LM/LM2575.html)
pick a capacitors, diode and inductor that will be able to withstand more than 1A. (i think from memory the datasheet tells you the minimum specs for these components.)

once you have one of these built you will be able to convert the power from most batteries to 5 Volts.

dunk.
Title: Re: $50 robot programing
Post by: ed1380 on March 28, 2007, 07:21:41 PM
so you could use a regular linear regulator from a 9v battery for your servos but the "spare" 4 volts will be converted into heat.
bolting a heatsink on there will help but it really depends how long your servos will be running for.
when i first learned this my regulators were ok while the servos were stationary but they would over heat after less than a minute of movement.
trust us here, linear regulators aren't much good for big voltage drops or anything that draws more than a few hundred milli Amps.

switching regulators on the other hand have little controllers in them that switch the power on and off at high frequency, then smooth out the output with an inductor and capacitor to get the required voltage.
no nasty heat build up and very little wasted power.
using a LM2575, an inductor, a diode and 2 capacitors you can build a 1 Amp switching regulator for under $5.
http://www.national.com/pf/LM/LM2575.html (http://www.national.com/pf/LM/LM2575.html)
pick a capacitors, diode and inductor that will be able to withstand more than 1A. (i think from memory the datasheet tells you the minimum specs for these components.)

once you have one of these built you will be able to convert the power from most batteries to 5 Volts.

dunk.
Thats awesome. Thanks.
If I were to set the photovore off in the class room what would it do? The room's brightly lit. If I turn off the lights will it follow the beam of a flashlight on the ground in front of it?
Title: Re: $50 robot programing
Post by: ed1380 on March 30, 2007, 05:11:21 AM
How hard would it be to add or change the source code to a robot with infared object avaoidance? or maybe both and a switch to choose which one would have priority.
Title: Re: $50 robot programing
Post by: ed1380 on March 30, 2007, 11:11:26 PM
bump? Anyone?
I've tried avrlib, and don't know how to find source codes. All it gives me is a link to a site.
I don't know what to order if I don't know if it''ll work or not.
Title: Re: $50 robot programing
Post by: ed1380 on April 01, 2007, 07:08:21 AM
Am I seriously going to have to wait until the night before the profect is due to get an answer?  :'(
Title: Re: $50 robot programing
Post by: dunk on April 01, 2007, 11:45:24 AM
Quote
How hard would it be to add or change the source code to a robot with infrared object avoidance?
that depends on whether you understand the source code.
if you can follow the C program then modifying it to use IR rangefinders should just take a little trial and error.

Quote
I've tried avrlib, and don't know how to find source codes. All it gives me is a link to a site.
avrlib is source code. download it and unpack it. there you will find lots of shiny source code.
i don't think it will help you much though. avrlib is mainly code for interfacing with some of the more complicated AVR hardware and peripherals.
if all you want to do is change sensor type you should be able to just modify Admins code a bit.

Quote
Am I seriously going to have to wait until the night before the profect is due to get an answer?
deal with it. people only post here because they enjoy doing so.
if you are not getting a reply, try providing more information or clarifying what you are asking.
maybe you are being too vague. or maybe no one knows the answer.
for example:

Quote
If I were to set the photovore off in the class room what would it do? The room's brightly lit.
don't know. i have never built one.

Quote
If I turn off the lights will it follow the beam of a flashlight on the ground in front of it?
probably.
(Admin can probably answer these last 2 when he gets back from his trip. 2 more weeks i think.)

dunk.
Title: Re: $50 robot programing
Post by: Admin on April 01, 2007, 03:37:30 PM
(the admin was invoked :P)

Quote
If I were to set the photovore off in the class room what would it do? The room's brightly lit.
it will run into chair legs, the menace of all hobby robots! (serious, chair legs are hard to avoid with optical sensors - even for experts)

Quote
If I turn off the lights will it follow the beam of a flashlight on the ground in front of it?
yes

Quote
Quote
Quote
Am I seriously going to have to wait until the night before the profect is due to get an answer?

deal with it. people only post here because they enjoy doing so.
if you are not getting a reply, try providing more information or clarifying what you are asking.
maybe you are being too vague. or maybe no one knows the answer.
for example:
the issue is that vague questions get vague answers, specific questions get specific answers :P
~15 minutes of google searching can usually help you ask more specific questions  8)
Title: Re: $50 robot programing
Post by: ed1380 on April 01, 2007, 04:46:15 PM
Thanks.
As long as it'll follow the beam of light it'll be safe from the chair legs.  :)
Title: Re: $50 robot programing
Post by: ed1380 on April 08, 2007, 10:37:35 AM
I was looking around on the web at the arduino, and for $30 it comes with everything the $50 robot's circuity has, and I wouldn't have needed to buy a $15 cable. >:(
Since both are atmega8's wouldn't they program and work the same?
Wouldn't it be better to spend a little more now on teh $50 robot, and have a good platform for later?
Title: Re: $50 robot programing
Post by: dunk on April 08, 2007, 04:51:09 PM
yup that should work (although i haven't ever looked at the arduino or it's datasheet) but now you have the cable you will be able to program as many atmega8 chips costing just a few $ each.
that's if you intend to build more robots.
and you'll need lots more robots if you are going to take over the world before i do...

dunk.
Title: Re: $50 robot programing
Post by: ed1380 on April 08, 2007, 05:02:34 PM
Thanks. but having something prebuild would be better quality then what I could solder up

Me and my friends are already planning on taking over the world and we won't need robots.  8)
Title: Re: $50 robot programing
Post by: NOOBinDistress on April 13, 2007, 06:53:55 PM
nonesense I ll take over the world before you all HAAAA HAAA HAHAHAHHAHAHAHHAHAHAHAHAHAHHA!!!!!!!!!!!!!!!!!!!!!!!! >:( >:( >:(
Title: Re: $50 robot programing
Post by: ed1380 on April 16, 2007, 10:45:52 AM
I think the chip is fried. anyway i could send it to someone who already has done the $50 robot, so they could give it a shot? admin? noobindistress?
Title: Re: $50 robot programing
Post by: ed1380 on April 20, 2007, 02:25:01 PM
I got this  (http://www.allegromicro.com/en/Products/Part%5FNumbers/980502/)
What is L1 in the lm2575 usage diagram? By the datasheet it looks like you wire it up like the lm2575
Title: Re: $50 robot programing
Post by: ed1380 on April 20, 2007, 02:28:55 PM
I also got  this (http://www.allegromicro.com/en/Corporate/Press/06_3995.asp)
Is it a good one? IT say max 2.4a. at what voltage is that?
datasheetarchive, and google doesn' help
Title: Re: $50 robot programing
Post by: dunk on April 21, 2007, 04:37:46 AM
Quote
What is L1 in the lm2575 usage diagram? By the datasheet it looks like you wire it up like the lm2575
L1 is an inductor.
the datasheet should tell you what value will need.

Quote
I also got  this
Is it a good one? IT say max 2.4a. at what voltage is that?
datasheetarchive, and google doesn' help
so the datasheet is linked off the Alegro motorcontroller page you linked to. (top right: "Datasheets:...")
not that you need it to answer your question.
"36 V output rating" is one of the first lines on the page you linked to....

as for being a good one, the biggest problem i see for you is soldering down the QFN package.
you are going to need to be able to make your own PCBs if you are going to use it.

dunk.
Title: Re: $50 robot programing
Post by: ed1380 on April 21, 2007, 06:39:21 AM
I'm not blind I know it's rated for 36v and 2.4a. the problem is that   v*a=w
so 2.4a at 5v is diferent from 2.4a at 36v.

cars are the inverted. they say it makes 300hp, but thats at the redline, so they also say how much hp it makes at Xrpm
might be bad example, but best I could come up with (just woke up)
Title: Re: $50 robot programing
Post by: dunk on April 21, 2007, 07:38:30 AM
actually, now i look at this again, i meant the datasheet's linked off this page:
http://www.allegromicro.com/en/Products/Part_Numbers/3995/index.asp (http://www.allegromicro.com/en/Products/Part_Numbers/3995/index.asp)
here in fact:
http://www.allegromicro.com/en/Products/Part_Numbers/3995/3995.pdf (http://www.allegromicro.com/en/Products/Part_Numbers/3995/3995.pdf)

so the A3995 will run at 2.4a at 36v.
i understand your confusion. it would make logical sense for an H-bridge to have a power rating (in Watts) rather than a voltage and amperage rating.
you would think if you ran it at a lower voltage you would be able to increase the current, right?
i don't know why they don't work like this but any H-bridges i have looked at the datasheets for are all labled in the same way. (ie. a max voltage and a max amperage separately.)

i presume the A3995 can run at max voltage and amperage indefinitely without overheating as long as you have the heatsink soldered on to a biggish piece of copper on the PCB.

dunk.
Title: Re: $50 robot programing
Post by: Admin on April 21, 2007, 09:04:49 AM
so the reason they must list the voltage rating seperate from the power rating is that electrons tend to jump further distances at higher voltages - causing internal shorts without exceeding the maximum power rating
Title: Re: $50 robot programing
Post by: ed1380 on April 21, 2007, 11:45:57 AM
thanks.
so that little thing will run 80 watts(under 36v of course)   :o

so 16amps at 5v would work.
Title: Re: $50 robot programing
Post by: ed1380 on April 21, 2007, 01:30:55 PM
Could you take one of these (http://www.allegromicro.com/en/Products/Part_Numbers/2981/index.asp), and use 4 channels for one output and 4 for another, and hook that up to the mcu and use that instead of a motor driver?

should be alot easier than hooking up the strobe and data and clock to a regular driver.
set high, low for one way.   low, high for reverse, and high, high/low, low for brakes. couldn't you also do PWM?
you should even be able to stack them, or use all 8 channels for one output and another chip with 8 for the other.

Now that I have looked more I should have gotten this one. http://www.allegromicro.com/en/Products/Part_Numbers/2559/index.asp
much more powerful
Title: Re: $50 robot programing
Post by: dunk on April 21, 2007, 02:26:42 PM
Quote
so that little thing will run 80 watts(under 36v of course)   Shocked

so 16amps at 5v would work.

no. it's still only rated for 2.4A no matter what voltage.

dunk.
Title: Re: $50 robot programing
Post by: ed1380 on April 21, 2007, 03:56:54 PM
cmon dunk. ain't you gonna take a stab at the second question?  ;D
Title: Re: $50 robot programing
Post by: dunk on April 21, 2007, 05:51:39 PM
nope.
you'd more or less answered it yourself.
you are talking about building an h-bridge from those.

there are simple h-bridge motor controllers out there if you want.
try searching for the L293D.

dunk.
Title: Re: $50 robot programing
Post by: ed1380 on April 21, 2007, 06:53:51 PM
I was doubtful and thats why I asked.
Kinda like an h-bridge, but with only 2 amps  <-couldn't find better word
Title: Re: $50 robot programing
Post by: ed1380 on April 22, 2007, 12:01:41 PM
anyone ever tried modifing servo's by taking the pot out completely, and puting resistor? stupid mcu won't program, so I might have to do that.
Title: Re: $50 robot programing
Post by: Bonzai Clif on May 01, 2007, 05:44:51 PM
I have been trying to have my Advanced Physics class make the $50 robot with various levels of success and frustration. 

Out main problem now is that the kids and I that have finished making the circuit and have got to loading the program stage.

We are using AVR studio with the USB programmer adapter.  It will connect fine and load the program but has failed always at the read verify stage. We have gone over and over the circuit and see no problems.

Is there anybody out there than can give us a new direction to solve this?  We are so close it hurts.......
Title: Re: $50 robot programing
Post by: JonHylands on May 01, 2007, 06:32:51 PM
For me, programming typically fails when I have a couple of the pins shorted together that aren't supposed to be, which is common when doing surface mount work. For what you're doing, its most likely a wire connected to the wrong place.

- Jon
Title: Re: $50 robot programing
Post by: Admin on May 01, 2007, 07:46:01 PM
hmmmm this is a tough one . . . ???

a few 'stupid' checks first:
make sure the board is getting proper power when programming, try a different battery, etc.
turn off the read verify and see if the robot works without it
make sure there arent any loose (sometimes connected) wires

Which programmer are you using, the AVR STK Serial Port Dongle Programmer or the more expensive AVR ISP 2?

Can you also supply a screen shot of the failure?
Title: Re: $50 robot programing
Post by: ed1380 on May 01, 2007, 08:47:01 PM
hmmmm this is a tough one . . . ???

a few 'stupid' checks first:
make sure the board is getting proper power when programming, try a different battery, etc.
turn off the read verify and see if the robot works without it
make sure there arent any loose (sometimes connected) wires

Which programmer are you using, the AVR STK Serial Port Dongle Programmer or the more expensive AVR ISP 2?

Can you also supply a screen shot of the failure?
are you talking about the cable? I though they were all teh same.



BTW when programing my mcu, did you use my cable?
Title: Re: $50 robot programing
Post by: Bonzai Clif on May 01, 2007, 09:45:01 PM
Our problem deviated from (Admin's pics) when I got the programmer port and it had a 6 pin configuration not the ten that is on the web site.  So we had to make that conversion.

We have the pin outs connected to the appropriate pins so from what you are saying, we need to change batteriers and recheck the wiring.

Here is one question that the students have.  When does the LED on the circuit board come on?  Is it suppose to happen when you plug in the power or is it when the chip is up and running?  I realize this might be a stupid question but those can be the most perplexing. Duh.

Thanks for any and all help.....
Title: Re: $50 robot programing
Post by: Admin on May 02, 2007, 04:56:17 AM
Quote
BTW when programing my mcu, did you use my cable?
I used the more expensive programmer. I havent had much free time lately so I havent been able to debug the problems I have had with my cheaper programmer . . .

Quote
Our problem deviated from (Admin's pics) when I got the programmer port and it had a 6 pin configuration not the ten that is on the web site.
Which programmer are you using? The more expensive one comes with both a 6 pin and 10 pin adapter.

Quote
When does the LED on the circuit board come on?
Well it is supposed to come on right when you turn it on, but I made a dumb mistake in the code. Ill show you how to fix it.

In the file Photovore_v1.c, look for this line:
LED_off();//turn LED on

If it isnt already obvious, change that to LED_on();//turn LED on
Then just compile it again.

I think I was debugging the code, changed it, and then didnt change it back . . . The servos should work either way.

Ill be coming out with some newer simpler code soon. Ill also soon come out with some test code so that you can verify that your board is working properly.
Title: Re: $50 robot programing
Post by: ed1380 on May 02, 2007, 05:23:41 AM
so the cable is called the programmer? I bet the software is called the compiler then?
so you programmed both of our bots with the expensive cable?
Title: Re: $50 robot programing
Post by: Admin on May 02, 2007, 06:49:58 AM
yup 8)
Title: Re: $50 robot programing
Post by: Bonzai Clif on May 02, 2007, 09:40:41 AM

Quote
Which programmer are you using? The more expensive one comes with both a 6 pin and 10 pin adapter.

We got the AVR ISP mkII.  It only came with a 6 pin connector

Quote
When does the LED on the circuit board come on?
Well it is supposed to come on right when you turn it on, but I made a dumb mistake in the code. Ill show you how to fix it.

In the file Photovore_v1.c, look for this line:
LED_off();//turn LED on

If it isnt already obvious, change that to LED_on();//turn LED on
Then just compile it again.

Fixed that but still have no light on.

 We still need to try programming with a different battery pack.  Thanks again