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, I think I've cracked it - that is if the battery and receiver share the same ground contact on the board.

Here is my revised and hopefully correct wiring diagram. Please tell me what you think (is it correct, pretty colours etc). Thanks!
Attachments
Baby O Wiring_b copy.jpg
Baby O Wiring_b copy.jpg (199.2 KiB) Viewed 7589 times
User avatar
peterwaller
Posts: 3213
Joined: Fri Feb 15, 2002 12:00 am
Location: Aylesbury Bucks
Contact:

Re: Cheap DC Motor Controller?

Post by peterwaller »

I think the wires to the battery and receiver you have marked as -5v should be 0v other wise you will be running you receiver from 10v.
User avatar
Shakey
Posts: 1119
Joined: Sat Mar 13, 2010 8:38 pm
Location: Reading

Re: Cheap DC Motor Controller?

Post by Shakey »

Yeah the -5V should all be ground.
Nuts And Bots - For all your components and ready built antweights!

Alex Shakespeare - Team Shakey / Nuts And Bots / Team Nuts:
AWS 44, 45, 49, 51 & 55 Winner - Far too many robots!
AntRoboteer
Posts: 441
Joined: Mon Mar 03, 2014 7:01 pm

Re: Cheap DC Motor Controller?

Post by AntRoboteer »

Thanks for that - I did mean 0V or ground as you would call it. So can you use the ground pin for both the receiver and battery 0V wires? I think it would be possible as all components need to have a common ground but I' not sure. Is there another ground pin/hole/socket/something else that I am missing here or is that diagram basically accurate apart from the -5V labels. Thanks for your help!
User avatar
peterwaller
Posts: 3213
Joined: Fri Feb 15, 2002 12:00 am
Location: Aylesbury Bucks
Contact:

Re: Cheap DC Motor Controller?

Post by peterwaller »

All 0v or grounds within the robot would be connected together.
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
Post Reply