Go Down

Topic: Starting my first UGV project - need some starting help (Read 16 times) previous topic - next topic

TiboJ

#30
May 19, 2012, 03:43 pm Last Edit: May 19, 2012, 04:51 pm by TiboJ Reason: 1
Okay, I've took the time to think about everything, and this is how it will work:

TX  > 2.4Ghz  > RX > cable > WP controller  > Serial cable > Arduino

I'm not going to use a servo controller, as I can control servo's with Arduino, via the Servo library.


Now I have a few more questions:

- I've read the following about the WP controller: The default pins for RC mode are D0 and D1. As these are also the serial communications pins used for programming. You must disconnect cables connected to these pins when uploading a new program or usinging the serial port for diagnostics.
So I can't upload sketches with a USB?
I've read it here: http://sites.google.com/site/daguproducts/home/tutorials/understanding-wild-thumper

- With the software serial, is it possible to use any digital pin on the Arduino for serial communication?
- The receiver will be connected to the WP controller RC pins. If the receiver is connected to the RC pins(D0 and D1) on the WP controller, will everything we talked about be possible(use channels for spotlights, etc...)?
I'm not going to connect the receiver to the Arduino, but first to the WP controller.
This is what I mean:


PaulS

Quote
- With the software serial, is it possible to use any digital pin on the Arduino for serial communication?

Any pins except the hardware serial pins.


TiboJ


TiboJ

I've add one more question in my post before the answer of PaulS

cr0sh


- I've read the following about the WP controller: The default pins for RC mode are D0 and D1. As these are also the serial communications pins used for programming. You must disconnect cables connected to these pins when uploading a new program or usinging the serial port for diagnostics.
So I can't upload sketches with a USB?
I've read it here: http://sites.google.com/site/daguproducts/home/tutorials/understanding-wild-thumper


That reads, and I quote:

Quote
Control and Communications:
The default settings in the sample code allow the controller to be controlled using a standard RC receiver. In this mode pulsewidths from the receiver are measured and converted to speed and direction for the two motors. The default pins for RC mode are D0 and D1. As these are also the serial communications pins used for programming. You must disconnect cables connected to these pins when uploading a new program or usinging the serial port for diagnostics. If you have spare I/O pins then you can redefine "RCleft" and "RCright" in the "IOpins.h" tab of the sample code. Other servos can be plugged directly into the RC receiver to create a fully radio controlled robot.


So - number one - if you want to hook that board up to your receiver as it is intended to be used (ie, pins 0 and 1 to the receiver), then in order to upload your own sketches to it via it's on-board USB port, you will have to disconnect the RC receiver from those pins -before- you do so. What this means is that you can't use the USB port -and- have the RC receiver connected at the same time. The main reasons for this is: If the receiver is on, you would likely get garbage sent to the bootloader when you tried to upload your sketch; furthermore (and more likely), you might damage your RC receiver when you uploaded a sketch because you would be driving the receiver's -outputs- with the HIGH/LOW signals from the serial converter, which would be a bad thing.

This is pretty standard fare whenever you code on the Arduino; if you need those extra two pins, you can use them, but you can't use the USB if you have something connected to them.

So - for the WildThumper board, what do you do if you want to use USB -and- use the RC receiver? Move the receiver pins to other pins! Note in the quote above, it reads:

Quote
If you have spare I/O pins then you can redefine "RCleft" and "RCright" in the "IOpins.h" tab of the sample code.


If you look in IOpins.h (I have it here open in front of me), you'll see that RCleft is defined as "0" (digital pin 0) and RCright is defined as "1" (digital pin 1); those are the two pins as currently defined. What you would need to do is instead use a couple of the "servo output" pins as "input" instead; you could either define outputs 0 and 1 for the inputs, or outputs 5 and 6, or some other combination (whatever you are comfortable with); just know that you can't use those headers on the WT board for servos any more, only for the R/C input (you could do you debugging this way, then switch it back later, too). So, for instance, IOPins.h could be modified like follows:

Code: [Select]
#define LmotorA             3  // Left  motor H bridge, input A
#define LmotorB            11  // Left  motor H bridge, input B
#define RmotorA             5  // Right motor H bridge, input A
#define RmotorB             6  // Right motor H bridge, input B

#define RCleft              2  // Taking over servo 0 for RC receiver input
#define RCright             4  // Taking over servo 1 for RC receiver input

//#define S0                  2  // Servo output 00 - NO LONGER AVAILABLE
//#define S1                  4  // Servo output 01 - NO LONGER AVAILABLE
#define S2                  7  // Servo output 02
#define S3                  8  // Servo output 03
#define S4                  9  // Servo output 04
#define S5                 10  // Servo output 05
#define S6                 12  // Servo output 06

#define A1                  1  // Analog input 01
#define A2                  2  // Analog input 02
#define A3                  3  // Analog input 03
#define A4                  4  // Analog input 04
#define A5                  5  // Analog input 05

#define Battery             0  // Analog input 00
#define RmotorC             6  // Analog input 06
#define LmotorC             7  // Analog input 07
#define Charger            13  // Low=ON High=OFF


...and that modification would now use servo pin 0 (digital pin 2) for RCleft and servo pin 1 (digital pin 4) for RCright, and you would connect your receiver to those pins instead. Does that make sense?
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Go Up