Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

Tx and RX between PC and CM5 running a BCP using Zig100

Bioloid robot kit from Korean company Robotis; CM5 controller block, AX12 servos..
21 postsPage 1 of 21, 2
21 postsPage 1 of 21, 2

Tx and RX between PC and CM5 running a BCP using Zig100

Post by Dewey » Tue May 22, 2007 5:08 pm

Post by Dewey
Tue May 22, 2007 5:08 pm

Hope this isn't teaching everyone how to suck eggs but:

I have been investigating using two way communication between the CM5 and a PC while a Behavior Control Program is running on the CM5. I am using a CM5 with a Zig100 installed and a PC connected to a Zig2Serial/Zig100 combination.

It turns out this is simple. The CM5 is programmed as per the UserGuide to send and receive integers using the Zig100. The only thing that is needed is a PC program to send and transmit integers in the requires format and the CM5 thinks its talking to another CM5. Its down to you to 'code' the integers to convey the meanings/commands you want.

Here is the CM5/Zig100 format, as hex bytes:

FF 55 01 FE 08 F7

where:

FF 55 is the header.

The data in this example is integer 2049 = 01 + 256decimal * 08

FE is checksum for 01 -> 255decimal - 01 = FE
(i.e. Complement of byte)

F7 is checksum for 08 -> 255decimal - 08 = F7
(i.e. Complement of byte)

Another example: FF 55 04 FB 02 FD

Integer is decimal 516 = 04 + 256decimal * 02

Easy to write a PC program in your favourite language to write/decode this format.


The Zig2Serial board is slightly different from the diagram in the Robotis Manual. They have connected the serial port pin9 (Ring Indicator but rarely used these days) to the Vcc supply which should be +5volts. This is great if if you are using their USB2Dynamixel Board (expensive) to implement your serial port as it feeds through the USB +5Volts to pin9 of the serial D plug.
If you are using any old cheap USB2Serial cable it is unlikely to have +5volts on pin9 and the Zig2Seial interface will not powerup. I found that I could, with care, open up my USB2Serial lead at the D end cut the track to pin9 and jumper a wire from the USB +5volts to pin9. Use a meter to locate the USB +5volts wire using the D plug pin5 as a 0volt reference.

A standard PC serial port will not work as +5Volts is not present on pin9!

You can go down the route of providing an external power suppy to the Zig2Serial board (connector and a small jumper needed), but beware its easy to blow it up, exceed 5.5volts and puff!

Dewey
Hope this isn't teaching everyone how to suck eggs but:

I have been investigating using two way communication between the CM5 and a PC while a Behavior Control Program is running on the CM5. I am using a CM5 with a Zig100 installed and a PC connected to a Zig2Serial/Zig100 combination.

It turns out this is simple. The CM5 is programmed as per the UserGuide to send and receive integers using the Zig100. The only thing that is needed is a PC program to send and transmit integers in the requires format and the CM5 thinks its talking to another CM5. Its down to you to 'code' the integers to convey the meanings/commands you want.

Here is the CM5/Zig100 format, as hex bytes:

FF 55 01 FE 08 F7

where:

FF 55 is the header.

The data in this example is integer 2049 = 01 + 256decimal * 08

FE is checksum for 01 -> 255decimal - 01 = FE
(i.e. Complement of byte)

F7 is checksum for 08 -> 255decimal - 08 = F7
(i.e. Complement of byte)

Another example: FF 55 04 FB 02 FD

Integer is decimal 516 = 04 + 256decimal * 02

Easy to write a PC program in your favourite language to write/decode this format.


The Zig2Serial board is slightly different from the diagram in the Robotis Manual. They have connected the serial port pin9 (Ring Indicator but rarely used these days) to the Vcc supply which should be +5volts. This is great if if you are using their USB2Dynamixel Board (expensive) to implement your serial port as it feeds through the USB +5Volts to pin9 of the serial D plug.
If you are using any old cheap USB2Serial cable it is unlikely to have +5volts on pin9 and the Zig2Seial interface will not powerup. I found that I could, with care, open up my USB2Serial lead at the D end cut the track to pin9 and jumper a wire from the USB +5volts to pin9. Use a meter to locate the USB +5volts wire using the D plug pin5 as a 0volt reference.

A standard PC serial port will not work as +5Volts is not present on pin9!

You can go down the route of providing an external power suppy to the Zig2Serial board (connector and a small jumper needed), but beware its easy to blow it up, exceed 5.5volts and puff!

Dewey
Dewey
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 78
Joined: Sat May 12, 2007 1:17 pm
Location: Worcester UK

Post by roycepipkins » Wed Jun 13, 2007 4:44 am

Post by roycepipkins
Wed Jun 13, 2007 4:44 am

Thanks buddy! It took me about an hour to finally figure that the CM-5 must be expecting some sort of protocol. With RoboGames right around the corner I did not have the time to reverse to protocol. I don't even have a PC interface built, I'm transmitting from an ATmega168.

This info is going to allow me to get my hacked Nintendo controller online in time.

Thanks again!
Royce
Thanks buddy! It took me about an hour to finally figure that the CM-5 must be expecting some sort of protocol. With RoboGames right around the corner I did not have the time to reverse to protocol. I don't even have a PC interface built, I'm transmitting from an ATmega168.

This info is going to allow me to get my hacked Nintendo controller online in time.

Thanks again!
Royce
roycepipkins
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 25
Joined: Tue Jun 20, 2006 1:00 am

Post by Pev » Wed Jun 13, 2007 7:56 am

Post by Pev
Wed Jun 13, 2007 7:56 am

Hi Dewey,

Interesting stuff. I am assuming you just addess the Pc-Zig as a COM port? Well I am hoping anyway as that would probably mean BioBlue PC (my pc control app) would work with Zig.

Be interested to know.

Pev
Hi Dewey,

Interesting stuff. I am assuming you just addess the Pc-Zig as a COM port? Well I am hoping anyway as that would probably mean BioBlue PC (my pc control app) would work with Zig.

Be interested to know.

Pev
Carl
-------------------------
www.alt-view.co.uk
Pev
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 547
Joined: Sun Feb 26, 2006 1:00 am
Location: UK

Post by Dewey » Wed Jun 13, 2007 6:43 pm

Post by Dewey
Wed Jun 13, 2007 6:43 pm

roycepipkins

Glad its of use.


Pev

Yes as long as the language you are programming the PC in enables you to talk/listen to a serial port its easy.

If you have a USB to Serial interface/cable, which I was using purely because +5volts is available to power the Zig2Serial, then Windows will map it as the next free com port after any built in ones.

Dewey
roycepipkins

Glad its of use.


Pev

Yes as long as the language you are programming the PC in enables you to talk/listen to a serial port its easy.

If you have a USB to Serial interface/cable, which I was using purely because +5volts is available to power the Zig2Serial, then Windows will map it as the next free com port after any built in ones.

Dewey
Dewey
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 78
Joined: Sat May 12, 2007 1:17 pm
Location: Worcester UK

zigbee 100 and PC

Post by ryann2k1 » Mon Jun 25, 2007 4:14 am

Post by ryann2k1
Mon Jun 25, 2007 4:14 am

Hi Dewey,
I just received my new bioloid, so probably I am still not familiar with all the settings. I am trying to control my robot via wireless (at my PC side, connected to zig100 with zig2 serial and at my robot side, connected to cm-5 embedded zigbee100). In your experiment, especially at your PC side, how do you send the cm-5/zig100 format?how do you make sure that the wireless connection has been established?looking forward to your respond.
Thank you.

cheers

ryann2k1
Hi Dewey,
I just received my new bioloid, so probably I am still not familiar with all the settings. I am trying to control my robot via wireless (at my PC side, connected to zig100 with zig2 serial and at my robot side, connected to cm-5 embedded zigbee100). In your experiment, especially at your PC side, how do you send the cm-5/zig100 format?how do you make sure that the wireless connection has been established?looking forward to your respond.
Thank you.

cheers

ryann2k1
ryann2k1
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 154
Joined: Thu Nov 16, 2006 1:00 am

Post by Dewey » Mon Jun 25, 2007 10:02 am

Post by Dewey
Mon Jun 25, 2007 10:02 am

Hi ryann2k1

Sorry if the following is over the top but I am not sure what aspect you want advise/clarification on.

The thing to remember is that the CM5 has software embedded to allow two CM5s to talk wirelessly. To use the facility as designed by Robotis you must buy a pair of Zig100s and solder them into the CM5s. Follow the example in the User Guide page 101 onwards and it all works. The software transmits over the Zig100 at 57142 baud using the protocol I listed. What you have to do is connect one of your two Zig100s to the PC via the Zig2Serial and a USB to Serial cable, addressing the added complication of ensuring the Zig2Serial has a power source.

The PC now must send and receive using the USB Serial connection at 57142 baud in the format the CM5 uses. As far as the CM5 is concerned it is talking to amother CM5, or so it 'thinks'. You can now send and receive integers numbers to/from the CM5 running a Behavior Control Problem similar to User Guide page 104.

We must ensure the format these integers are sent in by the PC are encoded as the CM5 expects, and when the CM5 sends they are decoded by the PC. The crunch is you CANNOT use the Robot Terminal program at the PC to do this as it is just a text send/receive Dumb Terminal. You must write a program for the PC. You can use any programming language you have e.g. Visual Basic, C++, Delphi. I use Delphi, my program looks for number input from the keyboard say 2049 and encodes it and transmits it as hexadecimal [FF 55 01 FE 08 F7] down the USB Serial cable. It then looks for input from the USB Serial Cable and Decodes it and displays it as a decimal number, in pseudo code:

Start PC Program
Set USB Serial Cable to 57142 baud
Repeat
If input from PC Keyboard Then
Begin
Read it
Code it to CM5 format
Transmit dowm USB Serial Cable
End
If input from USB Serial Cable Then
Begin
Read it
Decode CM5 format
Display on PC Screen
End
Until The Cows Come Home (i.e. for ever)
End PC Program

Once you have this working, you have cracked it, you can make the program as fancy as you like but basically its only adding sugar to the basics.

The Crunch is you must have access to a Program Development Environment running on your PC and be able to implement a program along the lines of above. You cannot do it using just the software supplied by Robotis!

Hope this is helpful.

Dewey
Hi ryann2k1

Sorry if the following is over the top but I am not sure what aspect you want advise/clarification on.

The thing to remember is that the CM5 has software embedded to allow two CM5s to talk wirelessly. To use the facility as designed by Robotis you must buy a pair of Zig100s and solder them into the CM5s. Follow the example in the User Guide page 101 onwards and it all works. The software transmits over the Zig100 at 57142 baud using the protocol I listed. What you have to do is connect one of your two Zig100s to the PC via the Zig2Serial and a USB to Serial cable, addressing the added complication of ensuring the Zig2Serial has a power source.

The PC now must send and receive using the USB Serial connection at 57142 baud in the format the CM5 uses. As far as the CM5 is concerned it is talking to amother CM5, or so it 'thinks'. You can now send and receive integers numbers to/from the CM5 running a Behavior Control Problem similar to User Guide page 104.

We must ensure the format these integers are sent in by the PC are encoded as the CM5 expects, and when the CM5 sends they are decoded by the PC. The crunch is you CANNOT use the Robot Terminal program at the PC to do this as it is just a text send/receive Dumb Terminal. You must write a program for the PC. You can use any programming language you have e.g. Visual Basic, C++, Delphi. I use Delphi, my program looks for number input from the keyboard say 2049 and encodes it and transmits it as hexadecimal [FF 55 01 FE 08 F7] down the USB Serial cable. It then looks for input from the USB Serial Cable and Decodes it and displays it as a decimal number, in pseudo code:

Start PC Program
Set USB Serial Cable to 57142 baud
Repeat
If input from PC Keyboard Then
Begin
Read it
Code it to CM5 format
Transmit dowm USB Serial Cable
End
If input from USB Serial Cable Then
Begin
Read it
Decode CM5 format
Display on PC Screen
End
Until The Cows Come Home (i.e. for ever)
End PC Program

Once you have this working, you have cracked it, you can make the program as fancy as you like but basically its only adding sugar to the basics.

The Crunch is you must have access to a Program Development Environment running on your PC and be able to implement a program along the lines of above. You cannot do it using just the software supplied by Robotis!

Hope this is helpful.

Dewey
Dewey
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 78
Joined: Sat May 12, 2007 1:17 pm
Location: Worcester UK

Post by ryann2k1 » Tue Jun 26, 2007 5:07 am

Post by ryann2k1
Tue Jun 26, 2007 5:07 am

hi Dewey,
Thank you for your answer. at this stage i just to make sure whether my pc (with zigbee100/zig2serial) can establish a wireless com with my cm-5(zib100). Finally with the help of a terminal emulator I could solve the problem :D . now it is time to do more programming for my project.
so what kind of project are you working with your bioloid?

thanks again....

cheers

ryann2k1
hi Dewey,
Thank you for your answer. at this stage i just to make sure whether my pc (with zigbee100/zig2serial) can establish a wireless com with my cm-5(zib100). Finally with the help of a terminal emulator I could solve the problem :D . now it is time to do more programming for my project.
so what kind of project are you working with your bioloid?

thanks again....

cheers

ryann2k1
ryann2k1
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 154
Joined: Thu Nov 16, 2006 1:00 am

Post by roycepipkins » Tue Jun 26, 2007 5:18 am

Post by roycepipkins
Tue Jun 26, 2007 5:18 am

Pin 3 of the Zig-100 will short itself to ground internally if you've made a connection. It will cycle between open circuit and short-to-ground if it cannot make a connection/ is still trying to make a connection.

If you hook an LED's short lead to pin3, hook the LED's long lead to one lead of a 220 Ohm resistor and finally hook the other lead of the 220 Ohm resistor to your 3.3V power supply, then you will have a light that blinks when there is no connection and is on steady when there is a good connection to the remote Zig-100 module.

If you cut the LED leads down to size and can't remember which one was the short one, then look carefully for a flat portion on the circular base of the LED. That was the short lead before you cut it.
Pin 3 of the Zig-100 will short itself to ground internally if you've made a connection. It will cycle between open circuit and short-to-ground if it cannot make a connection/ is still trying to make a connection.

If you hook an LED's short lead to pin3, hook the LED's long lead to one lead of a 220 Ohm resistor and finally hook the other lead of the 220 Ohm resistor to your 3.3V power supply, then you will have a light that blinks when there is no connection and is on steady when there is a good connection to the remote Zig-100 module.

If you cut the LED leads down to size and can't remember which one was the short one, then look carefully for a flat portion on the circular base of the LED. That was the short lead before you cut it.
roycepipkins
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 25
Joined: Tue Jun 20, 2006 1:00 am

Post by ryann2k1 » Tue Jun 26, 2007 5:43 am

Post by ryann2k1
Tue Jun 26, 2007 5:43 am

Hi roycepipkins,
there is a status led on the zig2serial board,is that similar if I use ur configuration or they are different?
Thanks again for sharing....

cheers,

ryann2k1
Hi roycepipkins,
there is a status led on the zig2serial board,is that similar if I use ur configuration or they are different?
Thanks again for sharing....

cheers,

ryann2k1
ryann2k1
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 154
Joined: Thu Nov 16, 2006 1:00 am

Post by roycepipkins » Tue Jun 26, 2007 5:54 am

Post by roycepipkins
Tue Jun 26, 2007 5:54 am

I don't have a zig2serial board, but I'd suspect that the LED on that board is indeed setup to be wired to pin 3 when you plug in the zig-100 module.
I don't have a zig2serial board, but I'd suspect that the LED on that board is indeed setup to be wired to pin 3 when you plug in the zig-100 module.
roycepipkins
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 25
Joined: Tue Jun 20, 2006 1:00 am

Post by ryann2k1 » Tue Jun 26, 2007 6:04 am

Post by ryann2k1
Tue Jun 26, 2007 6:04 am

Yep, I agree with you roycepipkins,
I am referring to this site
http://www.crustcrawler.com/electronics ... 00(English).pdf
page 10. Btw, are you using C++ im programming your robot? how do you manage to control your robot motions? are there any speed latency?
thank you for sharing.

cheers,

ryann2k1
Yep, I agree with you roycepipkins,
I am referring to this site
http://www.crustcrawler.com/electronics ... 00(English).pdf
page 10. Btw, are you using C++ im programming your robot? how do you manage to control your robot motions? are there any speed latency?
thank you for sharing.

cheers,

ryann2k1
ryann2k1
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 154
Joined: Thu Nov 16, 2006 1:00 am

Post by roycepipkins » Tue Jun 26, 2007 7:50 am

Post by roycepipkins
Tue Jun 26, 2007 7:50 am

I made an error in my earlier post, in case anyone ever needs it. The resistor should be connected to ground and the LED leads should be reversed from my first description. Pin 3 goes from open circuit to short-to-Vcc. I was looking at the wrong LED schematic when I made my post.

Anyway, I've just made the leap to C. I haven't gotten very far yet an I'm about to go on vacation for two weeks.

StuartL should be posting his async dynamixel library soon. I look forward to that as I think it'll be a good bit nicer than the fairly raw thing they give you in the examples.

Here is a post that describes the structure of the motion data in the MCUs flash.
http://forums.tribotix.info/forum1/76.html
Getting such motion data to play back in C just as it would in the motion editor should be a short to medium leap from that information. (Maybe StuartL will make us a nice library for that too. :D )
I made an error in my earlier post, in case anyone ever needs it. The resistor should be connected to ground and the LED leads should be reversed from my first description. Pin 3 goes from open circuit to short-to-Vcc. I was looking at the wrong LED schematic when I made my post.

Anyway, I've just made the leap to C. I haven't gotten very far yet an I'm about to go on vacation for two weeks.

StuartL should be posting his async dynamixel library soon. I look forward to that as I think it'll be a good bit nicer than the fairly raw thing they give you in the examples.

Here is a post that describes the structure of the motion data in the MCUs flash.
http://forums.tribotix.info/forum1/76.html
Getting such motion data to play back in C just as it would in the motion editor should be a short to medium leap from that information. (Maybe StuartL will make us a nice library for that too. :D )
roycepipkins
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 25
Joined: Tue Jun 20, 2006 1:00 am

Post by Dewey » Tue Jun 26, 2007 8:10 am

Post by Dewey
Tue Jun 26, 2007 8:10 am

The Zig2Serial board has 3 LEDs. Two are used to show the Tx and Rx of the Serial line connected to the PC (which in my case is via a Serial to USB converter). The third LED is the staus of the Zig100.

The circuit diagram suggested in the Zig100 Robotis Manual to interface the Zig100 is in effect the circuit of the Robotis Zig2Serial Board. I presume they published this circuit because at the time the Zig2Seial Board was not available as a stock item from them. Beware however there are some differences, in particular the 'feed' of +5 volt power via pin9 as mentioned in my original post.

Dewey
The Zig2Serial board has 3 LEDs. Two are used to show the Tx and Rx of the Serial line connected to the PC (which in my case is via a Serial to USB converter). The third LED is the staus of the Zig100.

The circuit diagram suggested in the Zig100 Robotis Manual to interface the Zig100 is in effect the circuit of the Robotis Zig2Serial Board. I presume they published this circuit because at the time the Zig2Seial Board was not available as a stock item from them. Beware however there are some differences, in particular the 'feed' of +5 volt power via pin9 as mentioned in my original post.

Dewey
Dewey
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 78
Joined: Sat May 12, 2007 1:17 pm
Location: Worcester UK

Post by ryann2k1 » Tue Jun 26, 2007 10:28 am

Post by ryann2k1
Tue Jun 26, 2007 10:28 am

Thanks again.Dewey, Since i just bought it a week ago, so there are still some setting that I missed.
enjoy your vacation roycepipkins, looking forward to hearing your C project.
Thank you...

cheers

ryann2k1
Thanks again.Dewey, Since i just bought it a week ago, so there are still some setting that I missed.
enjoy your vacation roycepipkins, looking forward to hearing your C project.
Thank you...

cheers

ryann2k1
ryann2k1
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 154
Joined: Thu Nov 16, 2006 1:00 am

Zig2serial issue

Post by Zwolsee » Fri Oct 24, 2008 2:31 am

Post by Zwolsee
Fri Oct 24, 2008 2:31 am

Hey guys I am new to this forum and the bioloid but ive just bought a zigbee set with a zig2serial and am experiencing a few problems. I currently have my robot reading values from my com port in my robot C program using the RxD8(). This works fine via a serial link but now I want to switch to wireless transmission. Ive noticed that my zig2serial board doesn't power up and I can't connect to it in the robot terminal. From what ive read this is because I need an external 5V power supply right? If so what pins does this power need to be connected to?
Also once I have established a wireless link could anyone offer some example code or some explanation for the steps needed to achieve sending values from my PC to the robot via a zigbee link. That is, any variables I need to enable, or protocol needed?

Thanks guys any help would be much appreciated.
Hey guys I am new to this forum and the bioloid but ive just bought a zigbee set with a zig2serial and am experiencing a few problems. I currently have my robot reading values from my com port in my robot C program using the RxD8(). This works fine via a serial link but now I want to switch to wireless transmission. Ive noticed that my zig2serial board doesn't power up and I can't connect to it in the robot terminal. From what ive read this is because I need an external 5V power supply right? If so what pins does this power need to be connected to?
Also once I have established a wireless link could anyone offer some example code or some explanation for the steps needed to achieve sending values from my PC to the robot via a zigbee link. That is, any variables I need to enable, or protocol needed?

Thanks guys any help would be much appreciated.
Zwolsee
Robot Builder
Robot Builder
Posts: 11
Joined: Wed Sep 17, 2008 3:11 am

Next
21 postsPage 1 of 21, 2
21 postsPage 1 of 21, 2