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

New good solution for C programmers?

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

New good solution for C programmers?

Post by siempre.aprendiendo » Thu Sep 27, 2007 10:39 pm

Post by siempre.aprendiendo
Thu Sep 27, 2007 10:39 pm

Some weeks ago I sent an email to Robotis asking them some questions about C programming and charging battery and IR comms for AX-S1...

I received this as part of the reply:

"We are working on a good solution for C programmers right now, and
I will send you an e-mail when we have a good solution."
...

Do you know something about this?
Some weeks ago I sent an email to Robotis asking them some questions about C programming and charging battery and IR comms for AX-S1...

I received this as part of the reply:

"We are working on a good solution for C programmers right now, and
I will send you an e-mail when we have a good solution."
...

Do you know something about this?
siempre.aprendiendo
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 559
Joined: Wed Aug 08, 2007 9:13 pm
Location: Barcelona

Post by limor » Fri Sep 28, 2007 9:41 am

Post by limor
Fri Sep 28, 2007 9:41 am

there are some function libraries that people wrote or improved on Robotis original example solutions for C programmers here on the forum.
see the aspiring Bioloid Knowledgebase
there are some function libraries that people wrote or improved on Robotis original example solutions for C programmers here on the forum.
see the aspiring Bioloid Knowledgebase
limor
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Post by siempre.aprendiendo » Fri Sep 28, 2007 5:13 pm

Post by siempre.aprendiendo
Fri Sep 28, 2007 5:13 pm

limor wrote:there are some function libraries that people wrote or improved on Robotis original example solutions for C programmers here on the forum.
see the aspiring Bioloid Knowledgebase


Very interesting! Thanks!
limor wrote:there are some function libraries that people wrote or improved on Robotis original example solutions for C programmers here on the forum.
see the aspiring Bioloid Knowledgebase


Very interesting! Thanks!
siempre.aprendiendo
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 559
Joined: Wed Aug 08, 2007 9:13 pm
Location: Barcelona

Post by Dewey » Sat Sep 29, 2007 4:14 pm

Post by Dewey
Sat Sep 29, 2007 4:14 pm

The Charging of the CM5 after power up via the U button is interesting.

Has anone got the circuit details for the CM5 charging circuit and how it is connected to the Atmel 128 enabling charging activation?

Mark Pepper's CM5 Schematic does not show this.

Dewey
The Charging of the CM5 after power up via the U button is interesting.

Has anone got the circuit details for the CM5 charging circuit and how it is connected to the Atmel 128 enabling charging activation?

Mark Pepper's CM5 Schematic does not show this.

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

Post by Kess » Tue Nov 20, 2007 8:37 pm

Post by Kess
Tue Nov 20, 2007 8:37 pm

If anyone is still interested I've traced the power supply and charging areas of the CM-5 (basically I think I've pretty much covered all the bits not shown by Mark Pepper's schematic). It's hand-drawn at the moment but I can scan and post it if it helps.

Kess
If anyone is still interested I've traced the power supply and charging areas of the CM-5 (basically I think I've pretty much covered all the bits not shown by Mark Pepper's schematic). It's hand-drawn at the moment but I can scan and post it if it helps.

Kess
Kess
Robot Builder
Robot Builder
Posts: 18
Joined: Sun Nov 18, 2007 7:56 pm
Location: The Cotswolds, UK

Post by siempre.aprendiendo » Tue Nov 20, 2007 9:38 pm

Post by siempre.aprendiendo
Tue Nov 20, 2007 9:38 pm

Kess wrote:If anyone is still interested I've traced the power supply and charging areas of the CM-5 (basically I think I've pretty much covered all the bits not shown by Mark Pepper's schematic). It's hand-drawn at the moment but I can scan and post it if it helps.

Kess


I'm interested! :)
Kess wrote:If anyone is still interested I've traced the power supply and charging areas of the CM-5 (basically I think I've pretty much covered all the bits not shown by Mark Pepper's schematic). It's hand-drawn at the moment but I can scan and post it if it helps.

Kess


I'm interested! :)
siempre.aprendiendo
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 559
Joined: Wed Aug 08, 2007 9:13 pm
Location: Barcelona

Post by Kess » Tue Nov 20, 2007 11:22 pm

Post by Kess
Tue Nov 20, 2007 11:22 pm

OK, my draft schematic can be found here - I hope my handwriting is clear! Treat it as provisional, there might be errors. Note my comments in red.

The schematic was based on a CM-5 PCB marked "Rev 4", I don't know if/how earlier PCBs differ.

Anyway, from this it looks as if from a programmer's viewpoint:

- Battery charging is activated by pulling the PB5 pin low.

- The ADC0 input monitors the +ve supply voltage.

- The ADC1 input monitors the -ve side of the battery during charging.

- The ADC2 input monitors temperature (this is an educated guess, assuming that component "T1" is a thermistor).

Any comments/corrections welcomed. If I can find a suitable schematic drawing package (any suggestions?) then I'll draw it up properly and perhaps, if he doesn't mind, combine it with the information from Mark Pepper's schematic to give a complete CM-5 circuit.

Kess
OK, my draft schematic can be found here - I hope my handwriting is clear! Treat it as provisional, there might be errors. Note my comments in red.

The schematic was based on a CM-5 PCB marked "Rev 4", I don't know if/how earlier PCBs differ.

Anyway, from this it looks as if from a programmer's viewpoint:

- Battery charging is activated by pulling the PB5 pin low.

- The ADC0 input monitors the +ve supply voltage.

- The ADC1 input monitors the -ve side of the battery during charging.

- The ADC2 input monitors temperature (this is an educated guess, assuming that component "T1" is a thermistor).

Any comments/corrections welcomed. If I can find a suitable schematic drawing package (any suggestions?) then I'll draw it up properly and perhaps, if he doesn't mind, combine it with the information from Mark Pepper's schematic to give a complete CM-5 circuit.

Kess
Kess
Robot Builder
Robot Builder
Posts: 18
Joined: Sun Nov 18, 2007 7:56 pm
Location: The Cotswolds, UK

Post by siempre.aprendiendo » Sat Nov 24, 2007 11:48 pm

Post by siempre.aprendiendo
Sat Nov 24, 2007 11:48 pm

Thanks, Kess!

Some free electronic schematic drawing software:
http://www.freebyte.com/electronics/#circuitdesigntools
Thanks, Kess!

Some free electronic schematic drawing software:
http://www.freebyte.com/electronics/#circuitdesigntools
siempre.aprendiendo
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 559
Joined: Wed Aug 08, 2007 9:13 pm
Location: Barcelona

Post by Dewey » Mon Nov 26, 2007 3:45 pm

Post by Dewey
Mon Nov 26, 2007 3:45 pm

Kess

Very useful many thanks.

Dewey
Kess

Very useful many thanks.

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

Post by Bullit » Mon Nov 26, 2007 9:13 pm

Post by Bullit
Mon Nov 26, 2007 9:13 pm

Kess, that's great! It should be easy to write a program to charge the battery using this information.
Kess, that's great! It should be easy to write a program to charge the battery using this information.
Bullit
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 291
Joined: Wed May 31, 2006 1:00 am
Location: Near robot

Post by Kess » Mon Nov 26, 2007 9:23 pm

Post by Kess
Mon Nov 26, 2007 9:23 pm

Glad to be of service! :D

As I mentioned, if anyone spots any errors then please let me know via this thread.

Kess
Glad to be of service! :D

As I mentioned, if anyone spots any errors then please let me know via this thread.

Kess
Kess
Robot Builder
Robot Builder
Posts: 18
Joined: Sun Nov 18, 2007 7:56 pm
Location: The Cotswolds, UK

Wicked

Post by acy.stapp » Tue Nov 27, 2007 7:13 pm

Post by acy.stapp
Tue Nov 27, 2007 7:13 pm

Time to start writing some charging code.
Time to start writing some charging code.
acy.stapp
Robot Builder
Robot Builder
Posts: 14
Joined: Sat Aug 25, 2007 5:25 pm

Re: Wicked

Post by Kess » Tue Nov 27, 2007 8:56 pm

Post by Kess
Tue Nov 27, 2007 8:56 pm

acy.stapp wrote:Time to start writing some charging code.

One other thing you guys may need to know is that the processor's AREF pin (pin 62), which provides the reference voltage for the ADC, is connected directly to the +5V rail.

I believe there is also an internal +2.56V reference that can be selected in software.

Good luck!
acy.stapp wrote:Time to start writing some charging code.

One other thing you guys may need to know is that the processor's AREF pin (pin 62), which provides the reference voltage for the ADC, is connected directly to the +5V rail.

I believe there is also an internal +2.56V reference that can be selected in software.

Good luck!
Kess
Robot Builder
Robot Builder
Posts: 18
Joined: Sun Nov 18, 2007 7:56 pm
Location: The Cotswolds, UK

Post by pieddemamouth » Sun Feb 10, 2008 6:22 pm

Post by pieddemamouth
Sun Feb 10, 2008 6:22 pm

hi all,

i've try to use the adc but it doesn't work.
Here is my code
Code: Select all
CM5_init();
    unsigned char i=1, low,high,condition=0;

    PORTE |= _BV(PE4);    //enable pull-up resistor 4
    /*DDRC = 0xFF;
    PORTC = 0xFF;*/

    //ADC configuration
    ADMUX = 0x10;
    ADCSRA = 0x80;


    //CM5_RS232_writeString("\rla charge du bioloid\n");

    //CM5_RS232_writeString("\rverif bouton\n");

    while(1)
    {
        i = PINE&0x10;
        if (i==0)
        {
            //CM5_RS232_writeString("\rAllumage led\n");
            //PORTC = 0xFE;
            ADCSRA |= 0x40;
            //CM5_RS232_writeString("\rattente de la conversion\n");
            do{
                condition = ADCSRA;
            }while(condition&0x10==0);
            ADCSRA=condition|0x10;
            low = ADCL;
            high = ADCH;
            CM5_RS232_writeHexChar(high);
            CM5_RS232_writeHexChar(low);
            CM5_RS232_writeString("\n\r");
        }
    }


And the CM5_init() function
Code: Select all
static void
CM5_init(void) {
  /* Init the ATMega128 ports */
  DDRA = DDRB = DDRC = DDRD = DDRE = DDRF = 0;
  PORTB = PORTC = PORTD = PORTE = PORTF = PORTG = 0x00;

  cbi(SFIOR, 2);
  DDRE |= (BIT_RS485_DIRECTION0 | BIT_RS485_DIRECTION1);
  DDRD |= (BIT_ZIGBEE_RESET | BIT_ENABLE_RXD_LINK_PC | BIT_ENABLE_RXD_LINK_ZIGBEE);
  PORTD &= ~_BV(BIT_LINK_PLUGIN);
  PORTD |= _BV(BIT_ZIGBEE_RESET);
  PORTD |= _BV(BIT_ENABLE_RXD_LINK_PC);
  PORTD |= _BV(BIT_ENABLE_RXD_LINK_ZIGBEE);

  /* Set the reception mode */
  RS485_RXD;

  /* Init the transmission stuffs */
  CM5_initSerial(SERIAL_PORT0, 1, RX_INTERRUPT);
  CM5_initSerial(SERIAL_PORT1, DEFAULT_BAUD_RATE, RX_INTERRUPT);

  /* Init buffers */
  gbRxBufferReadPointer = gbRxBufferWritePointer = 0;
  sei();
}


it seems that the content of "ADC Data Register" is always "1FF". To my mind, it's because I use the wrong Vref, but i don't know wich one I must use.

Thanks for your help
hi all,

i've try to use the adc but it doesn't work.
Here is my code
Code: Select all
CM5_init();
    unsigned char i=1, low,high,condition=0;

    PORTE |= _BV(PE4);    //enable pull-up resistor 4
    /*DDRC = 0xFF;
    PORTC = 0xFF;*/

    //ADC configuration
    ADMUX = 0x10;
    ADCSRA = 0x80;


    //CM5_RS232_writeString("\rla charge du bioloid\n");

    //CM5_RS232_writeString("\rverif bouton\n");

    while(1)
    {
        i = PINE&0x10;
        if (i==0)
        {
            //CM5_RS232_writeString("\rAllumage led\n");
            //PORTC = 0xFE;
            ADCSRA |= 0x40;
            //CM5_RS232_writeString("\rattente de la conversion\n");
            do{
                condition = ADCSRA;
            }while(condition&0x10==0);
            ADCSRA=condition|0x10;
            low = ADCL;
            high = ADCH;
            CM5_RS232_writeHexChar(high);
            CM5_RS232_writeHexChar(low);
            CM5_RS232_writeString("\n\r");
        }
    }


And the CM5_init() function
Code: Select all
static void
CM5_init(void) {
  /* Init the ATMega128 ports */
  DDRA = DDRB = DDRC = DDRD = DDRE = DDRF = 0;
  PORTB = PORTC = PORTD = PORTE = PORTF = PORTG = 0x00;

  cbi(SFIOR, 2);
  DDRE |= (BIT_RS485_DIRECTION0 | BIT_RS485_DIRECTION1);
  DDRD |= (BIT_ZIGBEE_RESET | BIT_ENABLE_RXD_LINK_PC | BIT_ENABLE_RXD_LINK_ZIGBEE);
  PORTD &= ~_BV(BIT_LINK_PLUGIN);
  PORTD |= _BV(BIT_ZIGBEE_RESET);
  PORTD |= _BV(BIT_ENABLE_RXD_LINK_PC);
  PORTD |= _BV(BIT_ENABLE_RXD_LINK_ZIGBEE);

  /* Set the reception mode */
  RS485_RXD;

  /* Init the transmission stuffs */
  CM5_initSerial(SERIAL_PORT0, 1, RX_INTERRUPT);
  CM5_initSerial(SERIAL_PORT1, DEFAULT_BAUD_RATE, RX_INTERRUPT);

  /* Init buffers */
  gbRxBufferReadPointer = gbRxBufferWritePointer = 0;
  sei();
}


it seems that the content of "ADC Data Register" is always "1FF". To my mind, it's because I use the wrong Vref, but i don't know wich one I must use.

Thanks for your help
pieddemamouth
Robot Builder
Robot Builder
Posts: 12
Joined: Sun Feb 10, 2008 6:17 pm

Post by Kess » Wed Feb 13, 2008 10:21 pm

Post by Kess
Wed Feb 13, 2008 10:21 pm

Hi pieddemamouth,

I wrote some ADC software a couple of months ago to verify that the ADCs worked as predicted by my CM-5 circuit diagram and observe how they changed during charging. I'll dig out the code and post it here shortly...

Kess
Hi pieddemamouth,

I wrote some ADC software a couple of months ago to verify that the ADCs worked as predicted by my CM-5 circuit diagram and observe how they changed during charging. I'll dig out the code and post it here shortly...

Kess
Kess
Robot Builder
Robot Builder
Posts: 18
Joined: Sun Nov 18, 2007 7:56 pm
Location: The Cotswolds, UK

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