Show Posts
Pages: 1 ... 323 324 [325] 326 327 ... 650
4861  Using Arduino / Motors, Mechanics, and Power / Re: How to move 18 Servos siumltaneously on: November 16, 2012, 10:46:26 pm
Quote
> 4. Would servo controller like this be effective in doing what I need to do? http://www.pololu.com/catalog/product/1356

No because it uses a USB input and the Arduino can control servos by itself without a "controller".

Per the above page the pololu servo controller is controllable using a TTL serial connection (below). If the servos need speed control and such, a standalone servo controller is cost effective and can save a lot of programming work. An SSC-32 servo controller might be another cost effective controller for many servos. 

Quote
•Three control methods: USB, TTL (5V) serial, and internal scripting.
4862  Using Arduino / Project Guidance / Re: Linear actuator setup on: November 16, 2012, 07:12:37 pm
You could attempt to DIY your linear actuators using inexpensive threaded rods and nuts/couplings from your local home improvement store. If much force is involved, then thrust bearings would probably be required. A ~$10 6v Black and Decker cordless screwdriver from walmart might be a start for the motor part. Below is a small DIY actuator that might provide some ideas.


4863  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial Communication using Arduino and Jbasic on: November 16, 2012, 06:37:42 pm
Below is some justbasic code I used to make an application for using a joystick to pan/tilt a two servo cam setup in ~2005. The servo controller was not an arduino, but the code basics should be useable with an arduino

Code:
open "joystick demo" for graphics as #joy
OPEN "com3:9600,N,8,1,CD0,CS0,DS0,OP0" FOR OUTPUT AS #2
#joy "down" 'put the pen down
#joy "trapclose [quit]"
timer 10, [readStick] 'every ten ms read the stick
wait

[readStick]
    scan
    readjoystick 1 'either 1 or 2
    #joy "place 50 50"
    #joy "\Reading X = "; Joy1x
    #joy "\Reading Y = "; Joy1y
    #joy "\Reading Z = "; Joy1z 'throttle slide
    #joy "\Reading X = "; (Joy1x - 1200)/195
    #joy "\Reading Y = "; (Joy1y - 1200)/195
    x = (Joy1x - 1200)/195
    y = (Joy1y - 1200)/195
    x1 = int(x)
    y1 = int(y)
    #joy "\Reading X1 = "; x1;"  "
    #joy "\Reading Y1 = "; y1;"  "
    #joy "\Reading jb1 = "; Joy1button1;"  "
    #joy "\Reading jb2 = "; Joy1button2;"  "

    if Joy1button1 = 1 then
        PRINT #2, CHR$(00); CHR$(128); CHR$(x1);
        PRINT #2, CHR$(01); CHR$(128); CHR$(y1);
    end if

     if Joy1button2 = 2 then
        PRINT #2, CHR$(00); CHR$(128); CHR$(x1);
        PRINT #2, CHR$(01); CHR$(128); CHR$(y1);
    end if

    wait

[quit]
    CLOSE #2
    close #joy
    end
4864  Using Arduino / Interfacing w/ Software on the Computer / Re: labview and arduino over internet on: November 16, 2012, 10:15:42 am
At the below prices, one would think labview would supply some type of user technical support.

http://www.ni.com/labview/buy/
4865  Topics / Robotics / Re: Servo motor speed adjust on: November 15, 2012, 11:31:05 pm
previous servo speed discussions that might be of interest.

http://arduino.cc/forum/index.php?topic=61586.0
http://arduino.cc/forum/index.php?topic=108073.0
4866  Using Arduino / Programming Questions / Re: web server and udpntp client at the same time on: November 15, 2012, 11:54:04 am
Client-server-UDP-time test code from various sources. Open the serial monitor and send an e, and the time should be returned.

Code:
//zoomkat 12-08-11, combined client and server
//simple button GET with iframe code
//for use with IDE 1.0
//open serial monitor and send an g to test client and
//see what the arduino client/server receives
//web page buttons make pin 4 high/low
//use the \ slash to escape the " in the html
//address will look like http://192.168.1.102:84 when submited
//for use with W5100 based ethernet shields


//NTP server implementation added by RobertJP

#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
IPAddress ip(192,168,1,102); // ip in lan
IPAddress gateway(192,168,1,1); // internet access via router
IPAddress subnet(255,255,255,0); //subnet mask
IPAddress myserver(208,104,2,86); // zoomkat web page
EthernetServer server(84); //server port
EthernetClient client;
String readString;

//////////////////////NTP declarations
IPAddress timeServer(77,245,91,218); // time.nist.gov NTP server
const int NTP_PACKET_SIZE= 48; // NTP time stamp is in the first 48 bytes of the message
byte packetBuffer[ NTP_PACKET_SIZE]; //buffer to hold incoming and outgoing packets
EthernetUDP Udp; // A UDP instance to let us send and receive packets over UDP
unsigned int localPort = 8888; //Port to listen for UDP packets

void setup(){
  pinMode(5, OUTPUT); //pin selected to control
  Ethernet.begin(mac,ip,gateway,gateway,subnet);
  server.begin();
  Serial.begin(9600);
  Serial.println("server/client 1.0 test 12/08/11"); // keep track of what is loaded
  Serial.println("Send an g in serial monitor to test client"); // what to do to test client
  Udp.begin(localPort);
  Serial.println("UDP started");
}

void loop(){
  // check for serial input
  if (Serial.available() > 0)
  {
    byte inChar;
    inChar = Serial.read();
    if(inChar == 'g')
    {
      sendGET(); // call sendGET function
    }
  } 

  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string
          readString += c;
          //Serial.print(c);
        }

        //if HTTP request has ended
        if (c == '\n') {

          ///////////////
          Serial.println(readString); //print to serial monitor for debuging

            //now output HTML data header
          if(readString.indexOf('?') >=0) { //don't send new page
            client.println("HTTP/1.1 204 Robert");
            client.println();
            client.println(); 
          }
          else {
            client.println("HTTP/1.1 200 OK"); //send new page
            client.println("Content-Type: text/html");
            client.println();

            client.println("<HTML>");
            client.println("<HEAD>");
            client.println("<TITLE>Arduino GET test page</TITLE>");
            client.println("</HEAD>");
            client.println("<BODY>");

            client.println("<H1>Zoomkat's simple Arduino 1.0 button</H1>");

            client.println("<a href=\"/?on\" target=\"inlineframe\">ON</a>");
            client.println("<a href=\"/?off\" target=\"inlineframe\">OFF</a>");

            //client.println("<IFRAME name=inlineframe src=\"res://D:/WINDOWS/dnserror.htm\" width=1 height=1\">");
            client.println("<IFRAME name=inlineframe style=\"display:none\" >");         
            client.println("</IFRAME>");

            client.println("</BODY>");
            client.println("</HTML>");
          }

          delay(1);
          //stopping client
          client.stop();

          ///////////////////// control arduino pin
          if(readString.indexOf("on") >0)//checks for on
          {
            digitalWrite(5, HIGH);    // set pin 4 high
            Serial.println("Led On");
          }
          if(readString.indexOf("off") >0)//checks for off
          {
            digitalWrite(5, LOW);    // set pin 4 low
            Serial.println("Led Off");
          }
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}

void sendGET()
{
  Serial.println("Send GET");
  sendNTPpacket(timeServer); // send an NTP packet to a time server
   // wait to see if a reply is available
  delay(1000); 
  if ( Udp.parsePacket() ) {
    Serial.println("Got it!");
    // We've received a packet, read the data from it
    Udp.read(packetBuffer,NTP_PACKET_SIZE);  // read the packet into the buffer

    //the timestamp starts at byte 40 of the received packet and is four bytes,
    // or two words, long. First, esxtract the two words:

    unsigned long highWord = word(packetBuffer[40], packetBuffer[41]);
    unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]); 
    // combine the four bytes (two words) into a long integer
    // this is NTP time (seconds since Jan 1 1900):
    unsigned long secsSince1900 = highWord << 16 | lowWord; 
    Serial.print("Seconds since Jan 1 1900 = " );
    Serial.println(secsSince1900);               

    // now convert NTP time into everyday time:
    Serial.print("Unix time = ");
    // Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
    const unsigned long seventyYears = 2208988800UL;     
    // subtract seventy years:
    unsigned long epoch = secsSince1900 - seventyYears; 
    // print Unix time:
    Serial.println(epoch);                               


    // print the hour, minute and second:
    Serial.print("The UTC time is ");       // UTC is the time at Greenwich Meridian (GMT)
    Serial.print(1+(epoch  % 86400L) / 3600); // print the hour (86400 equals secs per day)
    Serial.print(':'); 
    if ( ((epoch % 3600) / 60) < 10 ) {
      // In the first 10 minutes of each hour, we'll want a leading '0'
      Serial.print('0');
    }
    Serial.print((epoch  % 3600) / 60); // print the minute (3600 equals secs per minute)
    Serial.print(':');
    if ( (epoch % 60) < 10 ) {
      // In the first 10 seconds of each minute, we'll want a leading '0'
      Serial.print('0');
    }
    Serial.println(epoch %60); // print the second
  }
  Serial.println("Done!");
}

// send an NTP request to the time server at the given address
unsigned long sendNTPpacket(IPAddress& address)
{
  // set all bytes in the buffer to 0
  memset(packetBuffer, 0, NTP_PACKET_SIZE);
  // Initialize values needed to form NTP request
  // (see URL above for details on the packets)
  packetBuffer[0] = 0b11100011;   // LI, Version, Mode
  packetBuffer[1] = 0;     // Stratum, or type of clock
  packetBuffer[2] = 6;     // Polling Interval
  packetBuffer[3] = 0xEC;  // Peer Clock Precision
  // 8 bytes of zero for Root Delay & Root Dispersion
  packetBuffer[12]  = 49;
  packetBuffer[13]  = 0x4E;
  packetBuffer[14]  = 49;
  packetBuffer[15]  = 52;

  // all NTP fields have been given values, now
  // you can send a packet requesting a timestamp:         
  Udp.beginPacket(address, 123); //NTP requests are to port 123
  Udp.write(packetBuffer,NTP_PACKET_SIZE);
  Udp.endPacket();
}

4867  Using Arduino / Programming Questions / Re: Saving Serial.read() as a string, and splitting the string on: November 14, 2012, 10:50:14 pm
#8 on the below page has info on some string functions with example code of each. If you want to parse the name out of the string "Hi. My name's Billy Bob", and the "Hi. My name's " will always be the same, then the name will always start at the 15th character in the string and continue to the end. Also, the name will always start one character beyond the "s" in the string. lots of different ways to do things. If you have control over how strings are sent to the arduino, then just send the name without the Hi stuff.

http://arduino.cc/en/Tutorial/HomePage
4868  Topics / Robotics / Re: Servo motor speed adjust on: November 14, 2012, 10:31:16 pm
Try the "sweep" servo code example to see how it makes the servo move slower than usual.
4869  Using Arduino / Motors, Mechanics, and Power / Re: Continuous rotation Servo on: November 14, 2012, 04:51:12 pm
Quote
That is the situation. Keep in mind that there are true servos available that have 360 degree travel range/stops and even a few with 720 degree travel range/stops, often used in model sail boat winch operators. However those are not modified types for 'continuous' rotation service servos, which as I said before are no longer real servos.

The below hitec servo seems to be an exception the the general rules.

http://www.robotshop.com/ca/hitec-hs785hb-servo-motor-2.html
4870  Using Arduino / Programming Questions / Re: Arduino-Arduino LAN communication - client not connecting to server on: November 14, 2012, 04:36:45 pm
Quote
Each device that connects to a network has to have a globally unique MAC address. If only one arduino is present in the network it makes no difference what the MAC address is, as long as this address does not belong to another device, which is super highly unlikely.

So if I make a direct connection between two arduinos with ethernet shields and use the tcp/ip protocol, communication between the two won't work if both have the same MAC sddress? Where in this direct connection setup would the MAC address of the two arduino ethernet shields checked? I've ordered a mega with an ethernet shield to do some arduino to arduino testing, but just curious about the actual useage of the MAC address.
4871  Using Arduino / Programming Questions / Re: Arduino-Arduino LAN communication - client not connecting to server on: November 14, 2012, 02:15:57 pm
I think an area of interest might be to identify just what the particular function of the MAC address is relating to the arduino and under what conditions it is important or required. it appears that in some network situations it is critical, and in others it isn't.
4872  Using Arduino / Programming Questions / Re: How to take 2 sets of coordinates and altitude and calculate angle for Servos on: November 14, 2012, 01:44:05 pm
Quote
Often the pulse sequencing to be supplied to servos is refered to as PPM
No, PPM is the multiplexed stream between TX and Rx in an R/C system, so in a single frame, an individual channel's pulses are identified by their position relative to the sync pulse, which is simply a longer 'low' than the 'low' between channel pulses.
The individual channel pulses are indeed PWM, because their width defines the servo setting.

If you want info on R/C systems, go to an R/C website.

My bad!  smiley-cool The PPM is an RC tx/rx thing. I think the takeaway from my part of the discussion is that 1). never use PPM when talking servos, and, 2). the PWM used for servo control is a particular subset of general PWM control.


R/C website:
Servos are controlled with a 5vdc positive-going variable pulse width that repeats every 20mS. The pulse length determines the servo output shaft position but the 20mS frame rate is not position critical. The frame rate does need to repeat at least every 20mS or it will lose power or even stutter. The servo was designed for pulse widths that vary from 1.0mS to 2.0mS, where 1.5mS is centered. In the normal range the servo will move +/- 45 degrees from the centered (neutral) position.
4873  Topics / Robotics / Re: Arduino UNO + Tamiya twin gearbox + 298 H bridge. Please help. on: November 14, 2012, 12:54:49 pm
Quote
Well - you can try to find another h-bridge. Or - you can replace the motors when they die:

Well, I'd go cheap and put sufficiently large reverse paired diodes on the motor leads to drop the voltage to the motors by ~.7v per diode pair. Not efficient, but could resolve the over voltage to the motor issues with just a stop by radio shack. 
4874  Using Arduino / Motors, Mechanics, and Power / Re: MOTOR FOR HEAVY LOAD on: November 14, 2012, 12:30:20 pm
If the dish mount is properly designed and balanced, a large motor may not be necessary. A $10 cordless screwdriver motor might do the rotatrion job. For up/down operaton, linear acruators like below are normally used.

https://www.google.com/search?q=satellite+dish+actuator&num=100&hl=en&lr=&tbo=u&as_qdr=all&tbm=isch&source=univ&sa=X&ei=AdOjUNrFB4qx0AGtkYCICw&ved=0CGEQsAQ&biw=1196&bih=641

4875  Using Arduino / Programming Questions / Re: Simple servo + button + led Question on: November 14, 2012, 12:02:06 pm
Probably the easiest way to setup a button pin, set the pin high and then check for it being low when the switch is closed.

Code:
//zoomkat LED button toggle test 11-08-2012

int button = 5; //button pin, connect to ground to move servo
int press = 0;
boolean toggle = true;

void setup()
{
  pinMode(13, OUTPUT); //LED on pin 13
  pinMode(button, INPUT); //arduino monitor pin state
  digitalWrite(5, HIGH); //enable pullups to make pin 5 high
}

void loop()
{
  press = digitalRead(button);
  if (press == LOW)
  {
    if(toggle)
    {
      digitalWrite(13, HIGH);   // set the LED on
      toggle = !toggle;
    }
    else
    {
      digitalWrite(13, LOW);    // set the LED off
      toggle = !toggle;
    }
  }
  delay(500);  //delay for debounce
}

Pages: 1 ... 323 324 [325] 326 327 ... 650