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

Bioloid I/O interface

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

Bioloid I/O interface

Post by pepperm » Wed Sep 06, 2006 8:46 pm

Post by pepperm
Wed Sep 06, 2006 8:46 pm

Hi

Just thought I would start a new thread for the design on an I/O interface for the Bioloid. This has been discussed here: http://robosavvy.com/modules.php?name=Forums&file=viewtopic&t=294&postdays=0&postorder=asc&start=30 but probably needs bringing out into it's own thread.

I have proposed the following circuit diagram and PCB. I'm now looking for code.

Image

Image

Mark
Hi

Just thought I would start a new thread for the design on an I/O interface for the Bioloid. This has been discussed here: http://robosavvy.com/modules.php?name=Forums&file=viewtopic&t=294&postdays=0&postorder=asc&start=30 but probably needs bringing out into it's own thread.

I have proposed the following circuit diagram and PCB. I'm now looking for code.

Image

Image

Mark
pepperm
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 190
Joined: Sat Jul 01, 2006 1:00 am

Post by jaho434 » Thu Sep 07, 2006 6:57 pm

Post by jaho434
Thu Sep 07, 2006 6:57 pm

Let's get this thread back on track, yeah? :lol:

limor wrote:pepperm : still reading up on the differences between the Atmega128 and Atmega8 registers and playing with the example.c code. it's a bit tricky without the actual device. Give me another day or so. :oops:


pepperm wrote:Limor

Do you have the means to program a Mega8 in circuit? If so I could easily knock up another PCB when I make mine and send you one. I have just received the smd 74HC126 (I think) so all you would need is a PDIP Mega 8 and a few bits and bobs that I may not have 2 of.

Mark


Mark/Limor: A mate of mine (The guy selling his KHR-1) is an AVR & Atmega8 guru. Was speaking to him today about your attempts to get this working. He seems to think that the code shouldn't be too hard. Limor, if you're having troubles...... you might be able to post what you've done, I'm sure he wouldn't mind having a crack at it. Would you, Nathan?!!? :lol: I'm sure he has some Atmega8's lying around......

Keep up the good work, guys! I should be ordering my Bioloid in the next few days!
Let's get this thread back on track, yeah? :lol:

limor wrote:pepperm : still reading up on the differences between the Atmega128 and Atmega8 registers and playing with the example.c code. it's a bit tricky without the actual device. Give me another day or so. :oops:


pepperm wrote:Limor

Do you have the means to program a Mega8 in circuit? If so I could easily knock up another PCB when I make mine and send you one. I have just received the smd 74HC126 (I think) so all you would need is a PDIP Mega 8 and a few bits and bobs that I may not have 2 of.

Mark


Mark/Limor: A mate of mine (The guy selling his KHR-1) is an AVR & Atmega8 guru. Was speaking to him today about your attempts to get this working. He seems to think that the code shouldn't be too hard. Limor, if you're having troubles...... you might be able to post what you've done, I'm sure he wouldn't mind having a crack at it. Would you, Nathan?!!? :lol: I'm sure he has some Atmega8's lying around......

Keep up the good work, guys! I should be ordering my Bioloid in the next few days!
jaho434
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 41
Joined: Mon Sep 04, 2006 1:00 am
Location: London, UK

Post by limor » Thu Sep 07, 2006 8:57 pm

Post by limor
Thu Sep 07, 2006 8:57 pm

I have the STK500 programer kit from Atmel. Atmega8 is in the list of supported devices so if I had the 28-DIP MCU i could program it.
How would I program it in circuit? connect the legs one by one to the appropriate holes on the STK? if there's a better way, maybe involving another programmer? if it doesn't cost too much let me know and i'll order it.
Can you recomend an EU online shop for ordering the Atmega8 in 28-DIP? (they dont seem to be RoHS compliant so i doubt digikey will ship them to Europe)
I have the STK500 programer kit from Atmel. Atmega8 is in the list of supported devices so if I had the 28-DIP MCU i could program it.
How would I program it in circuit? connect the legs one by one to the appropriate holes on the STK? if there's a better way, maybe involving another programmer? if it doesn't cost too much let me know and i'll order it.
Can you recomend an EU online shop for ordering the Atmega8 in 28-DIP? (they dont seem to be RoHS compliant so i doubt digikey will ship them to Europe)
limor
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Post by jaho434 » Thu Sep 07, 2006 9:13 pm

Post by jaho434
Thu Sep 07, 2006 9:13 pm

Limor,

I believe you would connect to the "SV1 Prog Connector" on Mark's schematic by using one of these or similar.

Correct me if I'm wrong, someone.
Limor,

I believe you would connect to the "SV1 Prog Connector" on Mark's schematic by using one of these or similar.

Correct me if I'm wrong, someone.
jaho434
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 41
Joined: Mon Sep 04, 2006 1:00 am
Location: London, UK

Post by pepperm » Thu Sep 07, 2006 9:26 pm

Post by pepperm
Thu Sep 07, 2006 9:26 pm

Limor

It uses the 6 pin DIL connector from the STK500 and you should be able to get samples from Atmel of the PDIP mega8.

Can you send me your address to my email or something and I will include one on the PCB when I make it....hopefully at the weekend.

I belive you have my Email address somewhere. It's the pipex one.

Mark
Limor

It uses the 6 pin DIL connector from the STK500 and you should be able to get samples from Atmel of the PDIP mega8.

Can you send me your address to my email or something and I will include one on the PCB when I make it....hopefully at the weekend.

I belive you have my Email address somewhere. It's the pipex one.

Mark
pepperm
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 190
Joined: Sat Jul 01, 2006 1:00 am

Post by limor » Fri Sep 08, 2006 1:08 am

Post by limor
Fri Sep 08, 2006 1:08 am

i've spent hours analyzing example.c and comparing register settings and conditions between the Atmega128 and Atmega8 and i think i have a foundation code that can initialize the ports and serial lines. It probably doesnt compile and it doesn't analyze received packet structure (responding accordingly).

I'll appreciate if anyone can take a look at the register settings.

atmega8sensor_8Sep06.c
i've spent hours analyzing example.c and comparing register settings and conditions between the Atmega128 and Atmega8 and i think i have a foundation code that can initialize the ports and serial lines. It probably doesnt compile and it doesn't analyze received packet structure (responding accordingly).

I'll appreciate if anyone can take a look at the register settings.

atmega8sensor_8Sep06.c
limor
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Post by nathankirchner » Fri Sep 08, 2006 3:17 am

Post by nathankirchner
Fri Sep 08, 2006 3:17 am

HI all... I have been peer-presured into lending some help to the "cause" by Jules, aka jaho434.

I have been using AVR's, in particular the Atmega88 for a bout 4 years now and have done several embedded robotics apps and embedded sensors with them. This is good for you guys cause the Atmega88 is the same as the Atmega8 but has a bit more on board memory...

My background, B.Eng Mechatronics and currently doing a PhD (Mechatronics) with the Centre for Autonomous Systems. www.cas.edu.au, went to Uni with Jules,

So anyway.. first things first...

pepperm, it is not obvious to me what you are trying to achieve with the gated inverters? why not just have seperate connectors for RX and TX? You can stop transmitting or stop reading in the AVR code, you don't need a gate stopping the I/O signal.

next. If you are using TX from a PC for instance then the RX line of the AVR should not be inverted... what/where are you expecting the serial to be coming from?

I am not 100% sure what you are trying to do...

as for code...

I have code that will let you read the ADC, read and write serial, configure outputs, toggle digi outputs and do PWM outputs.. I have code that will talk to the AVR from Cygwin or Linux via serial.

So... who wants to learn AVR?!?!? contact me and I will send you the stuff and give you my MSN details and then talk you through it.

ok, Jules you owe me one!

nk

p.s. I am chronically lazy and stupidly busy.... BUT I have extremely thick skin and am impossible to annoy... so if you want the help you are probably going to have to harass me for it! don't count on me coming here to look for posts.

p.p.s Sorry if I sound like a dick
HI all... I have been peer-presured into lending some help to the "cause" by Jules, aka jaho434.

I have been using AVR's, in particular the Atmega88 for a bout 4 years now and have done several embedded robotics apps and embedded sensors with them. This is good for you guys cause the Atmega88 is the same as the Atmega8 but has a bit more on board memory...

My background, B.Eng Mechatronics and currently doing a PhD (Mechatronics) with the Centre for Autonomous Systems. www.cas.edu.au, went to Uni with Jules,

So anyway.. first things first...

pepperm, it is not obvious to me what you are trying to achieve with the gated inverters? why not just have seperate connectors for RX and TX? You can stop transmitting or stop reading in the AVR code, you don't need a gate stopping the I/O signal.

next. If you are using TX from a PC for instance then the RX line of the AVR should not be inverted... what/where are you expecting the serial to be coming from?

I am not 100% sure what you are trying to do...

as for code...

I have code that will let you read the ADC, read and write serial, configure outputs, toggle digi outputs and do PWM outputs.. I have code that will talk to the AVR from Cygwin or Linux via serial.

So... who wants to learn AVR?!?!? contact me and I will send you the stuff and give you my MSN details and then talk you through it.

ok, Jules you owe me one!

nk

p.s. I am chronically lazy and stupidly busy.... BUT I have extremely thick skin and am impossible to annoy... so if you want the help you are probably going to have to harass me for it! don't count on me coming here to look for posts.

p.p.s Sorry if I sound like a dick
nathankirchner
Newbie
Newbie
User avatar
Posts: 4
Joined: Wed Sep 06, 2006 1:00 am
Location: Sydney, Austalia

Post by pepperm » Fri Sep 08, 2006 6:34 am

Post by pepperm
Fri Sep 08, 2006 6:34 am

Hi Nathan & Limor

About the reasoning for the gated I/O for the RS485 bus. The gates are NOT inverters. Everyone seems to make that mistake but there are no little circles at the points of the triangles.

They are gated 3 state buffers. You need a buffer to drive the potentially long one wire serial line with all those devises hanging off of it. They are gated because you need to be able to take both the Tx and Rx to tristate at times because box send and receive share the same single comms line.

This design is exactly the same design used in the Robotis CM-5, AX-12, AX-12+ and AX-S1 circuitry, and constitutes a standard RS485 line driver, making efficient use of a single small and cheap IC. On the CM-5 the remaining 2 gates in the 74HC126 are use to buffer and select between the RS232 and Zigbee serial lines. They are not used on our board but could be if we find a need.

Regarding code.

I think the key is the section of the code that communicates with the CM-5 down the RS485 interface. Unfortunately this is not like RS232 in that the comms need to go down a single wire (hence the gated outputs from the processor). Example.c shows the code needed to be a master of this one wire bus but what this device needs to be is a slave on the bus. It needs to sit there reading serial data, looking for a command that is destined for it, then replying with an answer which includes the states of the outputs etc. So the device needs to be able to be given an address. Currently the AX-12 servos sit at 1 to 19 and the AX-S1 sits at 100 I think. the addresses on the servos can be set programmatically but for starters we could just set ours to say 50 while we get the slave code right. Have a look at the AX-12 and AX-S1 PDFs here: http://www.robotis.com/ follow the following links....English - Data - Product Manual - AX-S1 Manual (English) and AX-12 Manual (English) and download the PDFs. These explain the serial protocol involved very well.

By the way I know the Mega8 silicon quite well and have written a lot of code in BASIC for it. My code is simple really though and I am not an expert with C. When I get the PCB made I will knock up some simple code to test the board that will probably do the obligatory led flash, maybe even just send serial data out of the serial port.

Mark
Hi Nathan & Limor

About the reasoning for the gated I/O for the RS485 bus. The gates are NOT inverters. Everyone seems to make that mistake but there are no little circles at the points of the triangles.

They are gated 3 state buffers. You need a buffer to drive the potentially long one wire serial line with all those devises hanging off of it. They are gated because you need to be able to take both the Tx and Rx to tristate at times because box send and receive share the same single comms line.

This design is exactly the same design used in the Robotis CM-5, AX-12, AX-12+ and AX-S1 circuitry, and constitutes a standard RS485 line driver, making efficient use of a single small and cheap IC. On the CM-5 the remaining 2 gates in the 74HC126 are use to buffer and select between the RS232 and Zigbee serial lines. They are not used on our board but could be if we find a need.

Regarding code.

I think the key is the section of the code that communicates with the CM-5 down the RS485 interface. Unfortunately this is not like RS232 in that the comms need to go down a single wire (hence the gated outputs from the processor). Example.c shows the code needed to be a master of this one wire bus but what this device needs to be is a slave on the bus. It needs to sit there reading serial data, looking for a command that is destined for it, then replying with an answer which includes the states of the outputs etc. So the device needs to be able to be given an address. Currently the AX-12 servos sit at 1 to 19 and the AX-S1 sits at 100 I think. the addresses on the servos can be set programmatically but for starters we could just set ours to say 50 while we get the slave code right. Have a look at the AX-12 and AX-S1 PDFs here: http://www.robotis.com/ follow the following links....English - Data - Product Manual - AX-S1 Manual (English) and AX-12 Manual (English) and download the PDFs. These explain the serial protocol involved very well.

By the way I know the Mega8 silicon quite well and have written a lot of code in BASIC for it. My code is simple really though and I am not an expert with C. When I get the PCB made I will knock up some simple code to test the board that will probably do the obligatory led flash, maybe even just send serial data out of the serial port.

Mark
pepperm
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 190
Joined: Sat Jul 01, 2006 1:00 am

Post by pepperm » Fri Sep 08, 2006 6:44 am

Post by pepperm
Fri Sep 08, 2006 6:44 am

Here are links to the manuals on this site.

http://robosavvy.com/Builders/pepperm/AX-12%20Manual%20115102294960.pdf
http://robosavvy.com/Builders/pepperm/AX-S1%20manual%2011510230637.pdf

Note that the RS485 line drive circuitry shown in the manuals is NOT the one Robotis use in their circuitry. It would be expensive and wastful to use a whole chip for the one invertor. so they drive the gate enables with separate processor pins.

Happy reading

Mark
Here are links to the manuals on this site.

http://robosavvy.com/Builders/pepperm/AX-12%20Manual%20115102294960.pdf
http://robosavvy.com/Builders/pepperm/AX-S1%20manual%2011510230637.pdf

Note that the RS485 line drive circuitry shown in the manuals is NOT the one Robotis use in their circuitry. It would be expensive and wastful to use a whole chip for the one invertor. so they drive the gate enables with separate processor pins.

Happy reading

Mark
pepperm
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 190
Joined: Sat Jul 01, 2006 1:00 am

Post by pepperm » Sat Sep 09, 2006 7:11 pm

Post by pepperm
Sat Sep 09, 2006 7:11 pm

I now have 2 test boards made and successfully running the following BASCOM program:

'---------------------------------------------------------------
' Bioloid I/O board V1 Test program
' Flashes LED on PortD 2
' Sends JMP Bioloid I/O V1.0 Test at 9600 BAUD down Data IO pin of
' RS485 port
' Copyright 2006 Mark Pepper
'---------------------------------------------------------------

' Configure Pord D pins
' Set PORTD to have pullups on Inputs
Portd = &B00111001

' Configure PortD 1,2,6,7 Outputs 0,3,4,5 Inputs
Config Portd = &B11000110

' Turn on LED
Set Portd.2

'Setup Comms hardware for transmit
' Disable Receive buffer
Reset Portd.6

' Enable Transmit buffer
Set Portd.7

' Main loop
Do

' Wait for LCD controller to initialise
Wait 2
Print "JMP Bioloid I/O V1.0 Test " ;
Toggle Portd.2

Loop

Over to you programmer guys.

Mark
I now have 2 test boards made and successfully running the following BASCOM program:

'---------------------------------------------------------------
' Bioloid I/O board V1 Test program
' Flashes LED on PortD 2
' Sends JMP Bioloid I/O V1.0 Test at 9600 BAUD down Data IO pin of
' RS485 port
' Copyright 2006 Mark Pepper
'---------------------------------------------------------------

' Configure Pord D pins
' Set PORTD to have pullups on Inputs
Portd = &B00111001

' Configure PortD 1,2,6,7 Outputs 0,3,4,5 Inputs
Config Portd = &B11000110

' Turn on LED
Set Portd.2

'Setup Comms hardware for transmit
' Disable Receive buffer
Reset Portd.6

' Enable Transmit buffer
Set Portd.7

' Main loop
Do

' Wait for LCD controller to initialise
Wait 2
Print "JMP Bioloid I/O V1.0 Test " ;
Toggle Portd.2

Loop

Over to you programmer guys.

Mark
pepperm
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 190
Joined: Sat Jul 01, 2006 1:00 am

Post by jaho434 » Tue Sep 12, 2006 10:03 am

Post by jaho434
Tue Sep 12, 2006 10:03 am

Mark,

Have you been able to compile or test Limor's code on your hardware yet?

Jules
Mark,

Have you been able to compile or test Limor's code on your hardware yet?

Jules
jaho434
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 41
Joined: Mon Sep 04, 2006 1:00 am
Location: London, UK

Post by pepperm » Tue Sep 12, 2006 10:23 am

Post by pepperm
Tue Sep 12, 2006 10:23 am

I haven't got any code from Limor. Have I missed it somewhere? If so could you point me to it please.

Mark
I haven't got any code from Limor. Have I missed it somewhere? If so could you point me to it please.

Mark
pepperm
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 190
Joined: Sat Jul 01, 2006 1:00 am

Post by jaho434 » Tue Sep 12, 2006 10:40 am

Post by jaho434
Tue Sep 12, 2006 10:40 am

limor wrote:i've spent hours analyzing example.c and comparing register settings and conditions between the Atmega128 and Atmega8 and i think i have a foundation code that can initialize the ports and serial lines. It probably doesnt compile and it doesn't analyze received packet structure (responding accordingly).

I'll appreciate if anyone can take a look at the register settings.

atmega8sensor_8Sep06.c


Not sure if it was directly intended for yourself, but seeing as though you have the hardware, I thought you might be giving it a go. It's by no means complete, but it looks like a good start.

No actual code to read requests from the CM5 or anything, just setting up ports and stuff. Should be a good base to start from.
limor wrote:i've spent hours analyzing example.c and comparing register settings and conditions between the Atmega128 and Atmega8 and i think i have a foundation code that can initialize the ports and serial lines. It probably doesnt compile and it doesn't analyze received packet structure (responding accordingly).

I'll appreciate if anyone can take a look at the register settings.

atmega8sensor_8Sep06.c


Not sure if it was directly intended for yourself, but seeing as though you have the hardware, I thought you might be giving it a go. It's by no means complete, but it looks like a good start.

No actual code to read requests from the CM5 or anything, just setting up ports and stuff. Should be a good base to start from.
jaho434
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 41
Joined: Mon Sep 04, 2006 1:00 am
Location: London, UK

Post by pepperm » Tue Sep 12, 2006 11:10 am

Post by pepperm
Tue Sep 12, 2006 11:10 am

Yep, I missed that link. I have sent a board to Limor so he should have one himself soon. I will take a look at the code.

Mark
Yep, I missed that link. I have sent a board to Limor so he should have one himself soon. I will take a look at the code.

Mark
pepperm
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 190
Joined: Sat Jul 01, 2006 1:00 am

Post by pepperm » Tue Sep 12, 2006 11:13 am

Post by pepperm
Tue Sep 12, 2006 11:13 am

By the way, it may be an idea to look at the Megabitty. This board contains a Mega 8 and 2 motor drive ICs as well as loads of connections and voltage regulators. It is very small too, and it has a boot loader.

Have a look here: http://www.bittybot.com/index.php?pageId=MEGAbitty

It would need the RS485 circuitry adding though, which is just 1 small IC.

Mark
By the way, it may be an idea to look at the Megabitty. This board contains a Mega 8 and 2 motor drive ICs as well as loads of connections and voltage regulators. It is very small too, and it has a boot loader.

Have a look here: http://www.bittybot.com/index.php?pageId=MEGAbitty

It would need the RS485 circuitry adding though, which is just 1 small IC.

Mark
pepperm
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 190
Joined: Sat Jul 01, 2006 1:00 am

Next
45 postsPage 1 of 31, 2, 3
45 postsPage 1 of 31, 2, 3