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
input : 120 V

Relays might be an option.
32  Using Arduino / Project Guidance / Re: Question regarding Serial Monitor on: September 09, 2014, 11:07:03 pm
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.

//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.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)){ 
    Serial.print("2- ");   

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

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

  newval5 = analogRead(potpin5);           
  newval5 = map(newval5, 0, 1023, 0, 179);
  if (newval1 < (oldval5-2) || newval5 > (oldval5+2)){ 
    Serial.print("5- ");
  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
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.
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.

//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[] = ""; // 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:

  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 =; //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
    client.println("GET /~shb/arduino.txt HTTP/1.1"); //download text
    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

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

  client.stop(); //stop client



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.

// 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() {
  pinMode(ledPin, OUTPUT);
  Serial.println("serial on/off test 0021"); // so I can keep track

void loop() {

  while (Serial.available()) {
    char c =;
    readString += c;

  if (readString.length() >0) {

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


39  Using Arduino / Project Guidance / Re: Arduino as I/O device for RaspberryPi web server on: September 07, 2014, 10:57:36 am
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.

40  Using Arduino / Programming Questions / Re: Serial Monitor doesn't show anything on: September 07, 2014, 10:38:56 am
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.
42  Topics / Robotics / Re: 360 degree rotating dome with limit switches on: September 06, 2014, 12:11:24 pm
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.

//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.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 =;  //gets one byte from serial buffer
    if (c == '*') {
      //do stuff
      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.print("fuel = ");
      Serial.print("speed = ");
      Serial.print("altidude = ");
      readString=""; //clears variable for new input
    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
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