help: Rx and Tx pins on arduino with G15 servo

Talk about Arduino board, sheilds. Sharing Arduino projects, program, problems, solutions, suggestions..... many more, all are welcome.

help: Rx and Tx pins on arduino with G15 servo

Postby muta » Fri Sep 26, 2014 9:38 pm

Hay guys
I have got 2 G15 servos and a GD02 driver to run them, i have made the default connections to the driver board to my arduino uno. but because Rx and TX on arduino are also used for programming and serial communication with the computer, i cant upload a code or serialprint anything since the G15 is also using them.

is it possible to change the G15 Rx & Tx pins from D0&D1 (on arduino) to other pins, so that any uploading of code or serial communication would be fine without any interference with G15. maybe by changing something in the G15 library!!
please help
muta
Freshie
 
Posts: 7
Joined: Fri Sep 26, 2014 9:14 pm

Re: help: Rx and Tx pins on arduino with G15 servo

Postby yonghui » Sat Sep 27, 2014 9:14 am

it is possible to change to other pins, but you will need to modify the library. but i think it will be easier for you to unplug or put a switch to disconnect the RX pin of arduino from G15 driver when you wan to program it.
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm

Re: help: Rx and Tx pins on arduino with G15 servo

Postby muta » Sat Sep 27, 2014 2:29 pm

but i cant use any serial communication with my computer, i want to monitor some readings from my robot.
i have looked into the library and its just including hardwareserial.h library, i tried to change it to software library and assign two other pins with the assigning command, but it failed!
please help me what part or parts in the library can i change to use other pins.
muta
Freshie
 
Posts: 7
Joined: Fri Sep 26, 2014 9:14 pm

Re: help: Rx and Tx pins on arduino with G15 servo

Postby yonghui » Mon Sep 29, 2014 10:35 am

u will need to open both the .ccp file and .h file of G15 library and do some modification for all the code related to serial pls refer to http://arduino.cc/en/Reference/softwareSerial

for example:
//declare the soft serial class object and assign the pin you wan to use
SoftwareSerial mySerial(10, 11); // RX, TX

Serial.begin (baud) ; change to mySerial.begin(4800);
Serial.setTimeout(SerialTimeOut); change to mySerial.setTimeout(SerialTimeOut);
Serial.write(TxBuff[i]); change to mySerial.write(TxBuff[i]);

byte readcount= Serial.readBytes(Status, packet_len); change to byte readcount= mySerial.readBytes(Status, packet_len);

change all related code of serial interface
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm

Re: help: Rx and Tx pins on arduino with G15 servo

Postby muta » Tue Sep 30, 2014 4:58 am

hai
thanks alot for your instructions. but after i have successfully changed the G15.cpp and G15.h to a softwareserial tx and rx and solved all the errors, i uploaded the code but it did not seem to work! i exactly followed the steps mentioned but the G15 just does not respond, seems like the new tx&rx can not communicate with it! i even tried turning the G15 led on, nothing!
muta
Freshie
 
Posts: 7
Joined: Fri Sep 26, 2014 9:14 pm

Re: help: Rx and Tx pins on arduino with G15 servo

Postby yonghui » Tue Sep 30, 2014 9:24 am

hi,
which version of G15 driver you are using?
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm

Re: help: Rx and Tx pins on arduino with G15 servo

Postby yonghui » Tue Sep 30, 2014 11:11 am

Hi,
Pls download and try the library attached. You can use both Hardware serial or software serial for the library

void G15DriverInit(long baudrate, byte rx, byte tx, char G15_CTRL)

if you define rx and tx and 0 and 1 respectively. automatically the library will use hardware serial
otherwise the library will create software serial class object and use software serial.

you can use software serial for G15 driver and use Hardware serial to do monitoring from computer using the library.


change the definition of TxMode and RxMode if needed in G15.h
#define TxMode LOW //Master Transmit to G15
#define RxMode HIGH //Master Receive from G15

you can download the library from Cytron website too
Attachments
G15SoftwareSerial.zip
(15.04 KiB) Downloaded 254 times
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm

Re: help: Rx and Tx pins on arduino with G15 servo

Postby muta » Tue Sep 30, 2014 4:20 pm

Hi
i have downloaded the attached library and loaded the positioning example provided in it to my arduino just as it came:

G15DriverInit(19200,2,3,8);

using the IDs for the G15 as follows:

G15 servo1(0x00);
G15 servo2(0x01);

I did not work. i also have tried to set rx = 0, and tx = 1 as mentioned in order to set it back to the hardware serial pins, but it also didnt work or even blink the leds in the servos. i believe all my connections are ok no problem as that when i use the original G15 library the servos run and work.

i have also tried to reset the servos ids to make sure, but still can't work when it comes to the softwareserial library that i downloaded.
muta
Freshie
 
Posts: 7
Joined: Fri Sep 26, 2014 9:14 pm

Re: help: Rx and Tx pins on arduino with G15 servo

Postby yonghui » Tue Sep 30, 2014 5:20 pm

Hi,
the library was tested to work for both software serial and hardware serial.
I hope you can show us a clear picture of your setup.
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm

Re: help: Rx and Tx pins on arduino with G15 servo

Postby muta » Wed Oct 01, 2014 3:36 am

Hi
i have uploaded a link to a video showing my setup and also showing that everything is running well when using the original G15 library, but when the softwareserial is uploaded it does not work.
my connections are just as in the examples from the library i got from you, as follows:

G15DriverInit(19200,2,3,8);
arduino rx(2) --------connected to GD02 tx
arduino tx(3)---------connected to GD02 rx
arduino pin(8)--------connected to GD02 CTRL

i cant figure out what the problem is as you have also confirmed that you have tested the library and it worked.
hope the video could help, here is the link
http://www.youtube.com/watch?v=Cs71WhuCgDs&feature=youtu.be
muta
Freshie
 
Posts: 7
Joined: Fri Sep 26, 2014 9:14 pm

Next

Return to Arduino Based

Who is online

Users browsing this forum: No registered users and 33 guests

cron