Show Posts
Pages: 1 2 [3] 4 5 ... 646
31  Using Arduino / Motors, Mechanics, and Power / Re: Control from my PC, 5 motors independently on: September 10, 2014, 10:17:31 pm
Quote
input : 120 V

Relays might be an option.

http://www.ebay.com/sch/i.html?_from=R40&_sacat=0&_nkw=arduino+relay&rt=nc&LH_BIN=1
32  Using Arduino / Project Guidance / Re: Question regarding Serial Monitor on: September 09, 2014, 11:07:03 pm
Quote
I am trying to do this from a different programming software but i run intro a problem when trying to send some command through rs232.

The arduino input is TTL, so have you made an inverter to convert rs232 to TTL levels, or are you still using the arduino USB serial interface?
33  Using Arduino / Programming Questions / Re: Need help with some coding ( 2 servos 2 potentiometers) on: September 09, 2014, 10:59:10 pm
Some multi servo/pot test code.

Code:
//zoomkat multi pot/servo test 3-23-13
//includes dead band for testing and limit servo hunting
//view output using the serial monitor

#include <Servo.h>
Servo myservo1;  //declare servos
Servo myservo2;
Servo myservo3;
Servo myservo4;
Servo myservo5;

int potpin1 = 0;  //analog input pin A0
int potpin2 = 1;
int potpin3 = 2;
int potpin4 = 3;
int potpin5 = 4;

int newval1, oldval1;  //pot input values
int newval2, oldval2;
int newval3, oldval3;
int newval4, oldval4;
int newval5, oldval5;

void setup()
{
  Serial.begin(9600); 
  myservo1.attach(2); 
  myservo2.attach(3);
  myservo3.attach(4);
  myservo4.attach(5);
  myservo5.attach(6);
  Serial.println("testing multi pot servo"); 
}

void loop()
{
  newval1 = analogRead(potpin1);           
  newval1 = map(newval1, 0, 1023, 0, 179);
  if (newval1 < (oldval1-2) || newval1 > (oldval1+2)){ //dead band
    myservo1.write(newval1); //position the servo
    Serial.print("1- ");
    Serial.println(newval1); //print the new value for testing
    oldval1=newval1; //set the current old value
  }

  newval2 = analogRead(potpin2);
  newval2 = map(newval2, 0, 1023, 0, 179);
  if (newval2 < (oldval2-2) || newval2 > (oldval2+2)){ 
    myservo2.write(newval2);
    Serial.print("2- ");   
    Serial.println(newval2);
    oldval2=newval2;
  }

  newval3 = analogRead(potpin3);           
  newval3 = map(newval3, 0, 1023, 0, 179);
  if (newval1 < (oldval1-2) || newval3 > (oldval3+2)){ 
    myservo1.write(newval3);
    Serial.print("3- ");
    Serial.println(newval3);
    oldval3=newval3;
  }

  newval4 = analogRead(potpin4);           
  newval4 = map(newval4, 0, 1023, 0, 179);
  if (newval1 < (oldval1-2) || newval4 > (oldval4+2)){ 
    myservo1.write(newval4);
    Serial.print("4- ");
    Serial.println(newval4);
    oldval4=newval4;
  }

  newval5 = analogRead(potpin5);           
  newval5 = map(newval5, 0, 1023, 0, 179);
  if (newval1 < (oldval5-2) || newval5 > (oldval5+2)){ 
    myservo1.write(newval5);
    Serial.print("5- ");
    Serial.println(newval5);
    oldval5=newval5;
  }
  delay(50);  //to slow loop for testing
}


34  Using Arduino / General Electronics / Re: Multiple serial devices on single port (one at a time) on: September 09, 2014, 10:48:49 pm
Quote
I was thinking of having two devices share an RX and TX and only powering on one at a time, but I figured there should be a more elegant solution to switch the outputs using digital pins. Before working up something using transistors/AND gates, I figured there must be a standard way of doing this. Is there?

If you are having the master poll the slave units and then receive the reply from the slaves, you can connect the master tx pin to all the slave rx pins. the master can include a slave identifier in the slave request such that such that only the desired slave responds. You can put a diode on the slave tx pins so all the slave tx lines can be connected to the master rx pin.
35  Using Arduino / Networking, Protocols, and Devices / Re: Scan network using Ethernet Shield on: September 09, 2014, 10:36:10 pm
Past postings.

https://www.google.com/search?as_q=scan+network&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=http%3A%2F%2Fforum.arduino.cc%2Findex&as_occt=any&safe=images&tbs=&as_filetype=&as_rights=&gws_rd=ssl
36  Using Arduino / Programming Questions / Re: Webclientrepeating on: September 08, 2014, 09:25:11 pm
Basic client test code you can try to see if you get a reply from the server.

Code:
//zoomkat 9-22-12
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields
//remove SD card if inserted

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = "web.comporium.net"; // zoomkat's test web page server
EthernetClient client;

//////////////////////

void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }

  Serial.begin(9600);
  Serial.println("Better client test 9/22/12"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  } 
}

//////////////////////////

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.1"); //download text
    client.println("Host: web.comporium.net");
    client.println("Connection: close");  //close 1.1 persistent connection 
    client.println(); //end of get request
  }
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client

}

[/code

37  Using Arduino / Motors, Mechanics, and Power / Re: DFRobot DF15RSMG 360 degree rotation (20kg) Programming help on: September 07, 2014, 03:39:39 pm
Below is a basic setup for external power to a servo. Generally trying to power a servo from an arduino does not work.

38  Using Arduino / Project Guidance / Re: read several characters in arduino mega on: September 07, 2014, 11:07:35 am
A simple example of capturing characters sent from the serial monitor and operating the arduino LED.

Code:
// zoomkat 8-6-10 serial I/O string test
// type a string in serial monitor. then send or enter
// for IDE 0019 and later

int ledPin = 13;
String readString;

void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  Serial.println("serial on/off test 0021"); // so I can keep track
}

void loop() {

  while (Serial.available()) {
    delay(3); 
    char c = Serial.read();
    readString += c;
  }

  if (readString.length() >0) {
    Serial.println(readString);

    if (readString == "on")     
    {
      digitalWrite(ledPin, HIGH);
    }
    if (readString == "off")
    {
      digitalWrite(ledPin, LOW);
    }

    readString="";
  }
}

39  Using Arduino / Project Guidance / Re: Arduino as I/O device for RaspberryPi web server on: September 07, 2014, 10:57:36 am
Quote
I could write a separate web page / server for each location, accessible via unique IP addresses (what i do now), but what I really want is one very nice web page/server that is the GUI for my lighting controls.  One-stop-shop for all controls, and the ability to have "macros' that turn on sets of lights (e.g. all exterior lights) through that server.

Generally what is done for a setup like you want is serve the main control page from one server, and in that page have the control links for other servers embedded. Probably the majority of control web pages are made. Look at the below web page which is served from a main web server. if you look at the page source, you will see the control links embedded which connect to an apache web server and web cam application on an old computer I have. You could do the same for a bunch of arduino servers.

http://web.comporium.net/~shb/wc2000-PT-script.htm


40  Using Arduino / Programming Questions / Re: Serial Monitor doesn't show anything on: September 07, 2014, 10:38:56 am
Quote
When I press my pushbutton, d is pressed ,
my serial monitor however, stays blank.

Did I break my board or is something wrong with my arduino?

How do you have a keyboard wired to your arduino?
41  Using Arduino / Project Guidance / Re: Can you sniff RS2332 Data? on: September 06, 2014, 06:25:57 pm
Really all that is needed is an NPN transistor and two resistors to convert rs232 to arduino TTL.

http://www.scienceprog.com/alternatives-of-max232-in-low-budget-projects/
42  Topics / Robotics / Re: 360 degree rotating dome with limit switches on: September 06, 2014, 12:11:24 pm
Quote
My theory is that you run some code to spin the motor left until it hits switch 1, then the motor spins right until it hits the second limit switch then somehow works out where the centre point is between those two switches and spins the motor to the centre.

Why not put a third limit switch or position sensor at the middle position?
43  Using Arduino / Programming Questions / Re: Serial port communication (json encoding decoding) on: September 06, 2014, 11:19:21 am
Below is a simple data parsing setup you might consider.

Code:
//zoomkat 11-12-13 String capture and parsing 
//from serial port input (via serial monitor)
//and print result out serial port
//copy test strings and use ctrl/v to paste in
//serial monitor if desired
// * is used as the data string delimiter
// , is used to delimit individual data

String readString; //main captured String
String angle; //data String
String fuel;
String speed1;
String altidude;

int ind1; // , locations
int ind2;
int ind3;
int ind4;
 
void setup() {
  Serial.begin(9600);
  Serial.println("serial delimit test 11-12-13"); // so I can keep track of what is loaded
}

void loop() {

  //expect a string like 90,low,15.6,125*
  //or 130,hi,7.2,389*

  if (Serial.available())  {
    char c = Serial.read();  //gets one byte from serial buffer
    if (c == '*') {
      //do stuff
     
      Serial.println();
      Serial.print("captured String is : ");
      Serial.println(readString); //prints string to serial port out
     
      ind1 = readString.indexOf(',');  //finds location of first ,
      angle = readString.substring(0, ind1);   //captures first data String
      ind2 = readString.indexOf(',', ind1+1 );   //finds location of second ,
      fuel = readString.substring(ind1+1, ind2+1);   //captures second data String
      ind3 = readString.indexOf(',', ind2+1 );
      speed1 = readString.substring(ind2+1, ind3+1);
      ind4 = readString.indexOf(',', ind3+1 );
      altidude = readString.substring(ind3+1); //captures remain part of data after last ,

      Serial.print("angle = ");
      Serial.println(angle);
      Serial.print("fuel = ");
      Serial.println(fuel);
      Serial.print("speed = ");
      Serial.println(speed1);
      Serial.print("altidude = ");
      Serial.println(altidude);
      Serial.println();
      Serial.println();
     
      readString=""; //clears variable for new input
      angle="";
      fuel="";
      speed1="";
      altidude="";
    } 
    else {     
      readString += c; //makes the string readString
    }
  }
}
44  Using Arduino / Motors, Mechanics, and Power / Re: Using a large servo, but I can't get it to work. on: September 06, 2014, 12:48:42 am
Quote
Currently, the servo is connected to the 5V, Gnd, and Pin 9, directly to the Arduino.

You need an external power supply like below that will supply 6v (for best performance).


45  Using Arduino / Networking, Protocols, and Devices / Re: Hardware serial RX port on Uno problematic. on: September 05, 2014, 01:21:20 pm
Did you connect the device grounds together?
Pages: 1 2 [3] 4 5 ... 646