Show Posts
Pages: 1 ... 13 14 [15] 16 17 ... 38
211  Community / Bar Sport / Re: Surrealistic Rubik's Cube robot [Auto-solver] on: September 26, 2013, 09:37:25 pm
This is pretty much what I am pursuing for (after 0:10).
212  Community / Bar Sport / Re: Surrealistic Rubik's Cube robot on: September 26, 2013, 06:13:47 pm
Anyway, here my back of the napkin sketch of the 6 servos. Regards!

Nice sketch - but I think servos are going to limit you due to the shaft offset from the body.

Hello cr0sh,
Thanks for your comments. Regarding the shaft offset, I just have come up with a solution (see picture below) but you are right about the size; this new arrangement increased the size of the cube up to 8.02 x 8.02 inches, but remember, this is a prototype. I will be checking your links. Thanks!

213  Community / Bar Sport / Re: Surrealistic Rubik's Cube robot on: September 26, 2013, 09:21:48 am
robtillaart, I really like your idea of holding diagonally the cube but I'm still thinking in the robot as a stand-alone cube that besides its ability to solve itself, also a human can grab it and scramble it anytime (or even can be used to give the impression that you are solving it!).

Jantje, you idea of using steppers is very good and it will get rid of the gyros but not sure yet.

Boffin1, the RGB LEDs could be an add-in to watch the robot in action in the dark but I see the wiring quite a challenge.

Anyway, here my back of the napkin sketch of the 6 servos. Regards!
214  Community / Bar Sport / Surrealistic Rubik's Cube robot [Auto-solver] on: September 25, 2013, 09:51:53 am
Reading the title of an upcoming article in the August 2013 Circuit Cellar Magazine (Build a Rubik’s Cube-Solving Robot, by Nelson Epp), it reminded me an idea that has been whirling in my mind for some time: A Rubik's cube robot that solves itself. Imagine for a moment a disordered 3x3x3 Rubik's cube that you just place on a surface and after a couple of seconds starts to bounce and flip, rotating its six faces and few seconds later stops with all of them now one-colored. What should be required to build this imagined 'surrealistic' Rubik's cube? I haven't read yet Mr. Epp's article but let's make an exercise imagining what parts should be required. Here my quick-start list:

1- Arduino micro
6- Full rotation servos
6- 3-axis-Gyroscopes (or Accelerometers)
1- Battery
1- Rubik cube.
Plus the Rubik's algorithms (the robot should knows in advance the unscrambled color positions).
What else?

Notice that my idea do raise other questions like what size or how fast will the robot solves itself?
(Current record: 5.27 secs CubeStormer II). Regards!
215  Products / Arduino Due / Re: Building a CAN API for Arduino DUE on: September 24, 2013, 09:12:51 pm
Hello M2319,
The updated version is here:
https://github.com/collin80/due_can

Regards!
216  Using Arduino / General Electronics / Re: TS922AIN vs TS922IN on: September 24, 2013, 09:07:23 pm
Hi,

Can someone clue me in what's the difference between TS922IN and TS922AIN?  Can I easily substitute TS922IN with TS922AIN in existing project?
From datasheet it seems like only difference is "Input Offset Voltage" which is 900uV max for TS922A.
Reason I'm asking is that TS922IN has been retired smiley-sad

Hello bratan,
You are right about 922A IOV but I don't see TS922AIN active at STElectronics. Only AID, AIDT, AIPT, AIYDT and AIYPT (none of them is DIP-8).
Regarding TS922IN STE still producing it but supporting only ongoing production, AVNET keeps 1278 in stock and Future Electronics keeps 1550. Farnell and RS Components (both in Europe) with a bit over 1000 in stock each. Good luck.
217  Products / Arduino Due / Re: Arduino DUE + Ethernet Shield/Sd WebServer not working on: September 24, 2013, 11:08:15 am
Yes. Georgi. I just tried to run the corrected code with IDE 1.5.4 and even though ping test runs OK and serial monitor shows normal, my laptop can't read the index.htm in SD.

Hello Cristian, are you aware of this? Thank you and regards!
218  Products / Arduino Due / Re: Arduino DUE + Ethernet Shield/Sd WebServer not working on: September 24, 2013, 10:26:30 am
I just tried the corrected code with a fresh IDE 1.5.3 using a crossover cable between Due and my laptop (W7 x64) and it is running OK. I am using Arduino shield model Ethernet R3. Here a snapshot.



Are you trying the corrected code? Regards!
219  Products / Arduino Due / Re: Arduino DUE + Ethernet Shield/Sd WebServer not working on: September 24, 2013, 06:36:59 am
Dear Georgi,
I am sorry you still stuck with this. As I mentioned, I ran your code (corrected) in my Due and Ethernet shield using IDE1.5.2 and 1.5.3 and ran OK with both. I am going to make time today to re-install IDE1.5.3 and corroborate if the code still working. Time to time, during my tests, I use to change lines in the Arduino code. Regards!
220  Products / Arduino Due / Re: Arduino DUE + Ethernet Shield/Sd WebServer not working on: September 23, 2013, 08:24:07 pm
Hello ggorine,

Your code runs smoothly by moving the following two lines to the bottom of the setup():

Quote
Ethernet.begin(mac, ip);  // initialize Ethernet device
server.begin();           // start to listen for clients

You don't need the enable/disable functions I gave you. The explanation that I give myself is that the latest IDE updates fixed it.

Here your corrected code:

Code:
#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>

// MAC address from Ethernet shield sticker under board
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(10, 0, 0, 20); // IP address, may need to change depending on network
EthernetServer server(80);  // create a server at port 80

File webFile;

void setup()
{
    Serial.begin(9600);       // for debugging
   
    // initialize SD card
    Serial.println("Initializing SD card...");
    if (!SD.begin(4)) {
        Serial.println("ERROR - SD card initialization failed!");
        return;    // init failed
    }
    Serial.println("SUCCESS - SD card initialized.");
    // check for index.htm file
    if (!SD.exists("index.htm")) {
        Serial.println("ERROR - Can't find index.htm file!");
        return;  // can't find index file
    }
    Serial.println("SUCCESS - Found index.htm file.");
    Ethernet.begin(mac, ip);  // initialize Ethernet device
    server.begin();           // start to listen for clients
}

void loop()
{
    EthernetClient client = server.available();  // try to get client

    if (client) {  // got client?
        boolean currentLineIsBlank = true;
        while (client.connected()) {
            if (client.available()) {   // client data available to read
                char c = client.read(); // read 1 byte (character) from client
                // last line of client request is blank and ends with \n
                // respond to client only after last line received
                if (c == '\n' && currentLineIsBlank) {
                    // send a standard http response header
                    client.println("HTTP/1.1 200 OK");
                    client.println("Content-Type: text/html");
                    client.println("Connection: close");
                    client.println();
                    // send web page
                    webFile = SD.open("index.htm");        // open web page file
                    if (webFile) {
                        while(webFile.available()) {
                            client.write(webFile.read()); // send web page to client
                        }
                        webFile.close();
                    }
                    break;
                }
                // every line of text received from the client ends with \r\n
                if (c == '\n') {
                    // last character on line of received text
                    // starting new line with next character read
                    currentLineIsBlank = true;
                }
                else if (c != '\r') {
                    // a text character was received from client
                    currentLineIsBlank = false;
                }
            } // end if (client.available())
        } // end while (client.connected())
        delay(1);      // give the web browser time to receive the data
        client.stop(); // close the connection
    } // end if (client)
}

Regards!
221  Products / Arduino Due / Re: Arduino DUE + Ethernet Shield/Sd WebServer not working on: September 22, 2013, 05:09:50 pm
Hello ggorine,

I don't see where you are matching Eth and SD pins to enable/disable them. Eth and SD modes can't work at the same time. You have to add something like this and call it from your setup:

void ethEnable()
{
  pinMode(4, OUTPUT);
  digitalWrite(4, HIGH);
  pinMode(10, OUTPUT);
  digitalWrite(10, LOW);
}

void sdEnable()
{
  pinMode(4, OUTPUT);
  digitalWrite(4, LOW);
  pinMode(10, OUTPUT);
  digitalWrite(10, HIGH);
}

Here my example that works OK with Due and the Arduino SD shield. You can use it as a reference.

Code:
#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>

// set up variables using the SD utility library functions:
Sd2Card card;
SdVolume volume;
SdFile root;
SdFile file;

// Matching SD in Arduino Ethernet shield: pin 4
const int chipSelect = 4;  
// Text to be read from SD card
String text1;

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
static byte arduinoMAC[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
static IPAddress ArduinoIPAddress(192,168,1,230);
EthernetServer telnetServer = EthernetServer(80);

// Matching pin to enable SD card and disable Ethernet
void ethEnable()
{
  pinMode(4, OUTPUT);
  digitalWrite(4, HIGH);
  pinMode(10, OUTPUT);
  digitalWrite(10, LOW);
}

// Matching pin to enable Ethernet and disable SD card
void sdEnable()
{
  pinMode(4, OUTPUT);
  digitalWrite(4, LOW);
  pinMode(10, OUTPUT);
  digitalWrite(10, HIGH);
}

// Initialization and reading of SD card
void sdCARD_INIT()
{
    Serial.print("\nInitializing SD card...");
    if (!card.init(SPI_HALF_SPEED, chipSelect)) {
    Serial.println("initialization failed. Things to check:");
    Serial.println("* is a card is inserted?");
    Serial.println("* Is your wiring correct?");
    Serial.println("* did you change the chipSelect pin to match your shield or module?");
    return;
  } else {
   Serial.println("Wiring is correct and a card is present.");
  }

  // print the type of card
  Serial.print("\nCard type: ");
  switch(card.type()) {
    case SD_CARD_TYPE_SD1:
      Serial.println("SD1");
      break;
    case SD_CARD_TYPE_SD2:
      Serial.println("SD2");
      break;
    case SD_CARD_TYPE_SDHC:
      Serial.println("SDHC");
      break;
    default:
      Serial.println("Unknown");
  }

  // Opening the 'volume'/'partition' - it should be FAT16 or FAT32
  if (!volume.init(card)) {
    Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
    return;
  }

  // print the type and size of the first FAT-type volume
  uint32_t volumesize;
  Serial.print("\nVolume type is FAT");
  Serial.println(volume.fatType(), DEC);
  Serial.println();
  
  volumesize = volume.blocksPerCluster();    // clusters are collections of blocks
  volumesize *= volume.clusterCount();       // we'll have a lot of clusters
  volumesize *= 512;                            // SD card blocks are always 512 bytes
  Serial.print("Volume size (bytes): ");
  Serial.println(volumesize);
  Serial.print("Volume size (Kbytes): ");
  volumesize /= 1024;
  Serial.println(volumesize);
  Serial.print("Volume size (Mbytes): ");
  volumesize /= 1024;
  Serial.println(volumesize);
  
  Serial.println("\nFiles found on the card (name, date and size in bytes): ");
  root.openRoot(volume);
  
  // list all files in the card with date and size
  root.ls(LS_R | LS_DATE | LS_SIZE);

  // reading a file
  if (file.open(root, "PRINT00.TXT", O_READ)) {
    Serial.println("Opened PRINT00.TXT");
  }
  else{
    Serial.println("error reading PRINT00.TXT");
    //error("file.open");
  }
Serial.println();
  
  // printing text inside the file
  int16_t c;
  while ((c = file.read()) > 0)
  {text1 = text1 + char(c);}
  Serial.println();
  Serial.println(text1);
  }

void sdCARD_IP_CONFIG()
{
//Changing the IP address for test

      ArduinoIPAddress[0] = 192;
      ArduinoIPAddress[1] = 168;
      ArduinoIPAddress[2] = 1;
      ArduinoIPAddress[3] = 101;
      
      delay(150);
      
      Serial.println(ArduinoIPAddress);
      Serial.println("\nNew IP address...Done");
}

void setup()
{
  // Open serial communications:
  Serial.begin(9600);
  // Enable SD card to read text in a file
  sdEnable();
  sdCARD_INIT();
  sdCARD_IP_CONFIG();
    
  // start the Ethernet connection and the server:
  Serial.println("starting the Ethernet connection and the server");
  ethEnable();
  Ethernet.begin(arduinoMAC, ArduinoIPAddress);
  telnetServer.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
}

void loop() {
  // listen for incoming clients
  EthernetClient client = telnetServer.available();
  if (client) {
    Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
          // add a meta refresh tag, so the browser pulls again every 5 seconds:
          client.println("<meta http-equiv=\"refresh\" content=\"5\">");
          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            int sensorReading = analogRead(analogChannel);
            // The following line was originally the printing of the text "analog channel"
            // Now will be the text inside the file in SD card "canal analogico"
            client.print(text1);
            client.print(analogChannel);
            client.print(" is ");
            client.print(sensorReading);
            client.println("<br />");      
          }
          client.println("</html>");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
    Serial.println("client disconnected");
  }
}
222  Products / Arduino Due / Re: How to reset Due´s pending Interrupts on: September 21, 2013, 08:42:22 am
Hello aSchindler,
I noticed you're clearing PIOC and enabling PIOA. What's your button's PIO? Regards!
223  Using Arduino / Programming Questions / Re: Counting pulses from an encoder without needing to use interruptions on: September 19, 2013, 08:36:28 pm
Looks fine although it will count on both rising and falling edges.

Hello Mike,
Yes. You are right. Silly of me. Here the corrected code that counts rising edges.

Code:
const int pulsePin = 2;
int counter=0;
int now = 0;
int last = 0;
void setup() {
  Serial.begin(115200);
}

void loop(){
  now = digitalRead(pulsePin);
    if (now == 1 && last == 0) {    
    counter++;
    last = now;      
  }
  else{
    last = now;
      }
  Serial.println(counter);
}
Given that my encoder (100pulses/rev) has a clean pulse train, it is OK but I believe that my code is not much useful with a mechanical switch that generates "switch bounce".  
224  Using Arduino / Programming Questions / Counting pulses from an encoder without needing to use interruptions on: September 19, 2013, 04:56:40 pm
Hello. I need to count the pulses from one channel of a rotary encoder in my Arduino Fio but without needing to use interruptions. So far, I came up with the following sketch and I was wondering if this could be the best approach. Any other ideas or comments? Thank you.

Code:
const int pulsePin = 2;
int counter=0;
int now = 0;
int last = 0;
void setup() {
  Serial.begin(115200);
}

void loop(){
  now = digitalRead(pulsePin);
    if (now != last) {    
    counter++;
    last = now;      
  }
  else{
    last = now;
    }
  Serial.println(counter);
}
225  Products / Arduino Due / Re: SAM3: How many clock cycles per instruction? on: September 19, 2013, 08:38:35 am
Hello transistorfips,
Here a brief summary of the Cortex-M3 processor in which is base the SAM3X8E, taken from Joseph Yiu book "The Definitive Guide to the ARM CORTEX-M3":

Quote
Many instructions, including multiplying, are single cycle. Separate data and instruction buses (Harvard architecture) allow simultaneous data and instruction accesses to be performed. Also, up to two instructions can be fetched in one cycle (they share the same memory space). Thanks to the Thumb-2 instruction set feature, there is no need to switch between 32 and 16 instructions that can be used together in one operation state (no state switching overhead). In other words, saving both execution time and instruction space give the Cortex-M3 processor higher performance efficiency.

If you are familiar with the Arduino legacy AVR family (Due, Mega,etc..) you will notice very soon Due's louder roar. Regards!
Pages: 1 ... 13 14 [15] 16 17 ... 38