Cheap DC Motor Controller?

All things antweight

Moderators: BeligerAnt, petec, administrator

AntRoboteer
Posts: 441
Joined: Mon Mar 03, 2014 7:01 pm

Re: Cheap DC Motor Controller?

Post by AntRoboteer »

Right, the controller should be in the post and I was hoping to get it all wired up and working by Saturday. Seeing as I ordered it last week, I should stand a pretty good chance but right now, things seem to be conspiring against me.

I tried to access this link: http://garya.org.uk/software/embedded-c ... controller but found that the site was down as the bandwidth was exceeded. Very annoying. Furthermore, the Marto code I have heard about does not seem to work one bit which is also rather irritating. When I compile it, it just throws up a load of exceptions.

I am a bit stuck here. If somebody could point me to a working version of Gary's code (which I like best as when I opened it, it appeared to work but I then stupidly did not save it locally because I didn't expect the site to go down) that would be very much appreciated.

Also, if I did not use the battery balance plug to detect the voltage (I shall be using a 6v NiMH battery, would it still work or, if not, could I just remove that section of the code?

Thanks in advance to anybody who can help - time is short and I really need to get this working for Saturday!
User avatar
Rhys
Posts: 738
Joined: Tue Oct 29, 2002 12:00 am
Location: Caerphilly, South Wales

Re: Cheap DC Motor Controller?

Post by Rhys »

Marto's code is written in arduino, not C, so I imagine that's what's causing your issues. Look at the second and third links on this website for instructions.

http://www.robowars.org/wikka/PololuB328

Marto's code has always worked seamlessly for me. Alternatively, here's a different C code for the controller

http://www.pololu.com/docs/pdf/0J37/rc_3pi.pdf
Image
AntRoboteer
Posts: 441
Joined: Mon Mar 03, 2014 7:01 pm

Re: Cheap DC Motor Controller?

Post by AntRoboteer »

Thanks so much for that Rhys! The code appears to compile OK but seeing as the board itself hasn't yet arrived, I can't test it out. It's looking a bit risky for Saturday!

I'm just unclear on a few things about programming this board:

1) Do you have to have everything unplugged from the board to program it?

2) Must the board be powered by means other than the AVR programmer such as a battery?

3) I can see a pin marked with an arrow on the board. I presume it is there so I am able to plug in the 6 pin programming connector the right way round. However, on my programmer, there is no arrow, presumably because it has to use a 10 pin to 6 pin adapter. It has pins which are labeled as follows: GND, MOSI, VCC, MISO, SCK and RS1. I presume RS1 connects to ISP pin 1 which I have now seen on a diagram but I am still unsure.

4) I can also see that it is using pins 7 and 4 (if I am not mistaken) for the receiver input. Which pins are these? Are they definitely PD0 and PD7 as mentioned in a previous post?

5) Do I just change the 1 in this line: #define MIXING 1 to 0 if I don't want mixing?

Thank you all ever so much for your useful help! Sorry to post so many questions but I am a bit unsure of what I'm doing here! Hopefully should be able to get something ready for Saturday. That is if the board arrives and my exams are OK!

Thanks again!
User avatar
BeligerAnt
Posts: 1872
Joined: Wed May 15, 2002 12:00 am
Location: Brighton
Contact:

Re: Cheap DC Motor Controller?

Post by BeligerAnt »

I've emailed you my code, sorry about the Spambots using up all my bandwidth :evil:

To answer your questions:

1) No, you shouldn't need to disconnect anything unless it connects to the pins used for programming.

2) Yes, the programmer only senses the voltage it doesn't supply power to the board.

3) The pin marked with an arrow is pin 1. the pinout is shown here: http://www.atmel.com/webdoc/stk600/stk6 ... g_ext.html

4) The Baby Orangutan has the Atmega port pin names shown in the schematic and written on the silk screen: http://www.pololu.com/picture/view/0J663 and http://www.pololu.com/picture/view/0J659

5) Sounds reasonable but I'm not familiar with that code.
Gary, Team BeligerAnt
User avatar
Rhys
Posts: 738
Joined: Tue Oct 29, 2002 12:00 am
Location: Caerphilly, South Wales

Re: Cheap DC Motor Controller?

Post by Rhys »

My mistake, it is indeed PD4 and PD7.
Image
AntRoboteer
Posts: 441
Joined: Mon Mar 03, 2014 7:01 pm

Re: Cheap DC Motor Controller?

Post by AntRoboteer »

So, finally the board has arrived and all looks good. I just have some questions so I know exactly how I can approach this:#

1) I am going to be soldering on the header pins just so I can change signal pins and add other things if I need to without tricky soldering. To do this, I was going to use female breadboard leads; would this work?

2) To solder the pins on, would you recommend aligning the pins in a breadboard and then soldering them on to make sure they are straight or will they not align in a breadboard?

3) I am planning to solder them so they are facing upwards along with the programming pins. Would this cause any problems?

Thanks in advance to anybody who can answer any one of these questions!
User avatar
BeligerAnt
Posts: 1872
Joined: Wed May 15, 2002 12:00 am
Location: Brighton
Contact:

Re: Cheap DC Motor Controller?

Post by BeligerAnt »

1) If I understand you correctly, yes it will work well for testing but I wouldn't rely on it in a combat situation! The header pins supplied with the Baby O are standard 0.64mm square pins and will mate with "female breadboard leads".

2) If you do that, only tack one or two pins on each row then remove the pins from the breadboard before soldering the rest. Don't heat the pins for too long otherwise you will start to melt the breadboard! It's usually better to solder one pin, then reheat the solder while pushing the plastic insulator flat against the board (don't put your fingers on the pin you are soldering!). Once one pin is soldered straight, the rest can be soldered.

3) The only problem with soldering the pins so they protrude from the top of the board is that you cannot plug the Baby O into a breadboard or custom PCB (because the programming pins & components get in the way). There's no electrical reason not to do it, it's purely down to the mechanics of how you assemble the rest of the project.
Gary, Team BeligerAnt
Post Reply