Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: How conect micro SD card with ArbotiX-M

  1. #1

    How conect micro SD card with ArbotiX-M

    Hello everyone!!


    I wanted to ask if anyone knows if it is possible to connect a micro SD card with the ArbotiX-M.


    My goal is to save more movements of some servos in order to move a robotic arm, since I have the SRAM memory of the arbotix completely full.


    Thank you!!


    Urko

  2. #2

    Re: How conect micro SD card with ArbotiX-M

    I've been researching and I think maybe this connection could be made through the ISP pins, but I do not know exactly ... is there someone who can help me?


    For example to connect the micro SD reader to the UNO arduino, the following scheme is used:
    http://www.naylampmechatronics.com/m...le-default.jpg

    But I still do not know how to connect it to the ArbotiX-M (I have a micro SD reader similar at one of the image)


    Thank you,

    Urko.

  3. #3

    Re: How conect micro SD card with ArbotiX-M

    I do think it is possible... Personally it might be easier using a different controller, like OpenCm9.04 for about $20 which has I think twice the program space and maybe 5 times the RAM... More Speed, more Uarts... And as you may have seen on this forum I do like Teensy boards by PJRC...

    But to answer your question. Yes you can probably hook up a MicroSD adapter, like the one from SparkFun:
    https://www.sparkfun.com/products/13743

    Which is a pretty basic setup, it has a voltage regulator built in to convert 5v to 3.3v, plus ttl level converters to change the Arbotix-m 5v signals into 3.3v signals...

    You should read through the hook up guide for this: https://learn.sparkfun.com/tutorials...r-hookup-guide

    And then translate the IO pins from what where SPI is on the Arduino to where it is on the Arbotix:

    If you looks that the pins_arduino.h as part of Arbotix installation, you will see some definitions like
    Code:
    const static uint8_t SS   = 4;
    const static uint8_t MOSI = 5;
    const static uint8_t MISO = 6;
    const static uint8_t SCK  = 7;
    Which show you the SPI pins on the Arbotix... Which if you look at the pin definitions for a simple Arduino you will see:
    Code:
    #define PIN_SPI_SS    (10)
    #define PIN_SPI_MOSI  (11)
    #define PIN_SPI_MISO  (12)
    #define PIN_SPI_SCK   (13)
    
    static const uint8_t SS   = PIN_SPI_SS;
    static const uint8_t MOSI = PIN_SPI_MOSI;
    static const uint8_t MISO = PIN_SPI_MISO;
    static const uint8_t SCK  = PIN_SPI_SCK;
    So that should hopefully give you some hints on how to translate the pins...

    Once you have it hooked up electrically you will then need a library like the SD library to talk. If you are still using the default Arbotix installation of Arduino 1.0.4, not sure if or how well these libraries work. So hopefully you are on a more recent Arduino IDE like 1.8.5!

  4. #4

    Re: How conect micro SD card with ArbotiX-M

    Thank you KurtEck!!

    Okey, during theese days i was trying to implement what you say but i didn´t get results... The ISP module of the arbotix is like this image:

    Click image for larger version. 

Name:	ISP_ARBOTIX.png 
Views:	38 
Size:	6.1 KB 
ID:	7181
    So, I understand that I should connect the MOSI, MISO, GND, VCC and SCK pins in a normal way to the micro SD card reader, and then do what you tell me:

    static const uint8_t SS = PIN_SPI_SS;for the SS pin, right?


    If not, tell me and I will try to correct it! thank you very much!!!!!

    Urko.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	ISP_ARBOTIX.png 
Views:	30 
Size:	8.1 KB 
ID:	7180  

  5. #5

    Re: How conect micro SD card with ArbotiX-M

    I think I discover the SS pin in the ArbotiX-M, in the PB4 port, so, i will try to do with this pin.
    I was looking in the datasheet of the ATmega644P.

    http://ww1.microchip.com/downloads/e..._Datasheet.pdf

    Urko.

  6. #6

    Re: How conect micro SD card with ArbotiX-M

    Note: with most libraries, I am not really sure how important it is to get the hardware CS pin... It has been a long time since I did it with an AVR board and I believe there were in some cases issues if the hardware CS pin was not enabled, but for the actual CS pin code, most libraries simply use a standard digital pin to control the chip select to the actual device (pinMode(pinX, OUTPUT), digitalWrite(...)

    And most libraries try to make sure that the hardware stuff is taken care of.

    If you look at the Arbotix-m Schematic: http://learn.trossenrobotics.com/ima...-schematic.pdf

    You will notice that the different SPI pins are also wired to some standard digital pins like D5-D7... SO you can hook up to those as well.

    Even if you don't use those pins to connect, you can NOT use those pins for anything else as they are logically the same and connected to each other.

  7. #7

    Re: How conect micro SD card with ArbotiX-M

    Hardware CS is only important in two cases:
    1) when being a SPI slave
    2) when doing fancy DMA-driven high-speed communication

    The Atmegas can't do 2) and you're not doing 1) in this case so it's not necessary in this case.

  8. #8

    Re: How conect micro SD card with ArbotiX-M

    Thanks for answering!! more or less I have managed to understand and find out which pins the MISO, MOSI, SCK and SS refers to:

    SCK/PCINT15 – Port B, Bit 7– SCK: Master Clock output, Slave Clock input pin for SPI0 channel. When the SPI0 is enabledas a slave, this pin is configured as an input regardless of the setting of DDB7. When theSPI0 is enabled as a master, the data direction of this pin is controlled by DDB7. When thepin is forced to be an input, the pull-up can still be controlled by the PORTB7 bit.– PCINT15: Pin Change Interrupt source 15. The PB7 pin can serve as an external interruptsource.

    MISO/PCINT14 – Port B, Bit 6– MISO: Master Data input, Slave Data output pin for SPI channel. When the SPI0 is enabledas a master, this pin is configured as an input regardless of the setting of DDB6. When theSPI is enabled as a slave, the data direction of this pin is controlled by DDB6. When the pin isforced to be an input, the pull-up can still be controlled by the PORTB6 bit.– PCINT14: Pin Change Interrupt source 14. The PB6 pin can serve as an external interruptsource.

    MOSI/PCINT13 – Port B, Bit 5– MOSI: SPI Master Data output, Slave Data input for SPI channel. When the SPI0 is enabledas a slave, this pin is configured as an input regardless of the setting of DDB5. When the SPIis enabled as a master, the data direction of this pin is controlled by DDB5. When the pin isforced to be an input, the pull-up can still be controlled by the PORTB5 bit.– PCINT13: Pin Change Interrupt source 13. The PB5 pin can serve as an external interruptsource.

    SS/OC0B/PCINT12 – Port B, Bit 4– SS: Slave Port Select input. When the SPI is enabled as a slave, this pin is configured as aninput regardless of the setting of DDB4. As a slave, the SPI0 is activated when this pin isdriven low. When the SPI is enabled as a master, the data direction of this pin is controlled byDDB4. When the pin is forced to be an input, the pull-up can still be controlled by thePORTB4 bit.– OC0B: Output Compare Match B output. The PB4 pin can serve as an external output for theTimer/Counter0 Output Compare. The pin has to be configured as an output (DDB4 set “1”) toserve this function. The OC0B pin is also the output pin for the PWM mode timer function.– PCINT12: Pin Change Interrupt source 12. The PB4 pin can serve as an external interruptsource


    And I understand that each pin can get to behave in different ways or forms, for example the Port B, Bit 6, can be the MISO or an interruption. What I do not know is how to configure it, that is, what code should be set to work as MISO, MOSI, SCK and SS instead of pins with interruption for example ... I mean, I can not put only pin (4) to refer to the pin of the SS no?

    Other question, i have to configurate the arduino.h library? because as yo have sayd to me KurtEck, in this library i know that the following code appear:

    Code:
    #define PIN_SPI_SS    (10)
    #define PIN_SPI_MOSI  (11)
    #define PIN_SPI_MISO  (12)
    #define PIN_SPI_SCK   (13)
    
    static const uint8_t SS   = PIN_SPI_SS;
    static const uint8_t MOSI = PIN_SPI_MOSI;
    static const uint8_t MISO = PIN_SPI_MISO;
    static const uint8_t SCK  = PIN_SPI_SCK;
    But i don't know if i have to configure this library and i don´t know neither if there exists a library of arbotix.h...do anyone know?

  9. #9
    Join Date
    Sep 2010
    Location
    ಠ_ಠ
    Posts
    2,240
    Images
    27
    Rep Power
    271

    Re: How conect micro SD card with ArbotiX-M

    The SPI library is part of hardware/avr/... (platform specific) libraries and the SD library is part of the global Arduino libraries. If you are using Arduino 1.8.x and the board manager with my pathetic attempt (add https://tician.github.io/arbotix/pac...tix_index.json to the board manager list in the preferences window), then you should only need to upgrade to v0.0.3 of the 'arbotix by tician' package, select the arbotix-m as your board, and run any of the SD library examples.

    The arbotix uses:
    Code:
    static const uint8_t SS   = 4;
    static const uint8_t MOSI = 5;
    static const uint8_t MISO = 6;
    static const uint8_t SCK  = 7;
    so you only need to hook up the correct pins to the SD card and let the SPI and SD libraries do the rest. The examples may or may not require the 'Chip Select' pin to be defined as pin 4 or any other pin you choose to use as the SS/CS pin.
    Please pardon the pedantry... and the profanity... and the convoluted speech pattern...
    "You have failed me, Brain!"
    bleh

  10. #10

    Re: How conect micro SD card with ArbotiX-M

    Sorry tician, but i don´t understand you very well, where did you say that i have to put this link and why? i don´t understand the text that the link open. Is like a configuration of the arbotix or?


    Mi code right now is like this, (is a simple program that reeds the folder named "Prueba"):

    Code:
    #include <SPI.h>
    #include <SD.h>
    File myFile;
    
    
    void setup()
    {
      Serial.begin(9600);
      Serial.print("initializing SD ...");
      if (!SD.begin(4)) {
        Serial.println("It failed to initialize");
        return;
      }
      Serial.println("successful initialization");
     
      myFile = SD.open("Prueba.txt");//WE OPEN THE FILE 
      if (myFile) {
        Serial.println("Prueba.txt:");
        while (myFile.available()) {
          Serial.write(myFile.read());
        }
        myFile.close(); //WE CLOSE THE FILE
      } else {
        Serial.println("Error opening the file");
      }
    }
    
    
    void loop()
    {
      
    }
    And I have conected the wires like this:
    MISO- digital 6
    MOSI- digital 5
    SCK- digital 7
    SS- digital 4
    VCC- ISP VCC
    GND-ISP GND

    I don´t know if i have to put more code to especificate that those pins are doing MOSI, MISO... work or what...

    The program runs, but in the serial monitor they is only appearing this:

    "initia⸮ initia⸮ initia⸮ " And i don´t know why...

    Also, the micro SD card reader does not even turn on the led...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Question(s) Error uploading arduino program to arbotix card
    By urko_18 in forum Arbotix, Microcontrollers, Arduino
    Replies: 2
    Last Post: 11-21-2017, 08:53 AM
  2. hobby pwm micro servo on Arbotix pro
    By dottuli in forum HR-OS1 Development and Discussion
    Replies: 2
    Last Post: 10-01-2015, 06:37 PM
  3. USB Business Card
    By jdolecki in forum Robotics General Discussion
    Replies: 1
    Last Post: 10-28-2010, 03:12 PM
  4. Question(s) micro servos for a micro hexapod
    By gallamine in forum Humanoids, Walkers & Crawlers
    Replies: 3
    Last Post: 01-23-2010, 12:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •