Show Posts
Pages: 1 ... 7 8 [9] 10 11 ... 13
121  Using Arduino / Project Guidance / Re: Home automation project on: February 14, 2013, 08:39:54 am
You only need 5 wires going to the MCU, most people never use the IRQ pin and then you have Vin and GND.  That leaves MOSI, MISO, SCK, CE, and CSN which you can connect to your MCU.  Good luck with your project.
122  Using Arduino / Project Guidance / Re: Home automation project on: February 13, 2013, 11:37:53 am
I like the JeeNodes but they use the RFM12B transcievers which are more expensive ~$5-$8.  You can get the nRF24L01 transcievers for ~$1-$2 off of ebay, and with the rf24 library they seem to work really well.  The big question is what frequency you want to use 915MHz or 2.4GHz.
123  Using Arduino / Project Guidance / Re: need suggestion and advice on: February 13, 2013, 10:12:55 am
It helps if you describe what you would like to happen different.  It is also easier if you describe what exactly you are trying to do.
124  Using Arduino / Project Guidance / Re: Valentine's Day project - Animatronic stuffed animal - Need ideas on: February 13, 2013, 09:30:35 am
What you need to do is use a little voodoo to transfer a human soul into the doll.  I hear it works really well, they made a movie about it. Child's Play I think was the name of it.
125  Using Arduino / Project Guidance / Re: Home automation project on: February 13, 2013, 08:28:26 am
This guy has done a lot of work with using the nRF24L01 modules.  Depending on what you want at each node you can build them for ~$10-$15.
http://maniacbug.wordpress.com/2012/03/30/rf24network/
126  Using Arduino / Project Guidance / Re: Home automation project on: February 12, 2013, 10:32:46 pm
You should be able to make your rf nodes for much cheaper than that.  What RF modules are you using?  Are you gonna use an arduino for every node?
127  Using Arduino / Project Guidance / Re: Home Heating Automation on: February 12, 2013, 10:27:35 pm
I made some small progress on this, but for me it was really exciting.  I hosted a Apache server on my laptop and created a simple php script

Quote
<?php
$fp = fsockopen("localhost", 5334, $errno, $errstr, 30);
if(!$fp){
    echo "$errstr ($errno)";
} else{
    fwrite($fp,$_POST["angle"]);
    fclose($fp);
}

?>

This sends data to the arduino running this sketch.

Code:
#include <Servo.h>

Servo myServo;

int incomingByte = 0;

int nPulseWidth = 1500 ; // 1500, defined in servo.h

String readString;


void setup()
{

  myServo.attach(2);
 
  // the library sets all servos to 1500 ms pulse width by default, this is center for a steering servo
  Serial.begin(9600);
  Serial.println("Completed setup"); 
}

void loop()
{
  while (Serial.available()) {
    char c = Serial.read();  //gets one byte from serial buffer
    readString += c; //makes the string readString
    delay(2);  //slow looping to allow buffer to fill with next character
  }
 
  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string
    incomingByte = readString.toInt();  //convert readString into a number
    nPulseWidth = (int) (incomingByte/90.0*1000 + 500);
    myServo.writeMicroseconds(nPulseWidth);
    Serial.print("Sending Servo: ");
    Serial.println(nPulseWidth,DEC);
    readString="";   
  } 
}

It was just exciting being able to control the servo from my tablet over our intranet.
128  Using Arduino / Project Guidance / Re: Home automation project on: February 12, 2013, 12:50:54 pm
All the libraries that you are including are jacking up your memory usage.  While hosting a web server on an arduino is possible, from what I have read you may be better off using something like a raspberry pi to host the web server and having the arduino connect to the hardware.  Just my 2 cents
129  Using Arduino / Project Guidance / Re: Controlling Arduino from an exernal (nice) webpage on: February 12, 2013, 09:48:02 am
I found some code in the feof manual page to handle feof blocking.
Code:
<?php
function safe_feof($fp, &$start NULL) {
 
$start microtime(true);

 return 
feof($fp);
}

/* Assuming $fp is previously opened by fsockopen() */

$start NULL;
$timeout ini_get('default_socket_timeout');

while(!
safe_feof($fp$start) && (microtime(true) - $start) < $timeout)
{
 
/* Handle */
}
?>
130  Using Arduino / Project Guidance / Re: Controlling Arduino from a exernal (nice) webpage on: February 11, 2013, 10:26:25 pm
I figured out a way to do this.  Its certainly not robust yet, mostly cause I'm not familiar with websites and php, but this is what I did.  Download serproxy onto your machine.  Modify the cfg file
Code:
# Config file for serproxy
# See serproxy's README file for documentation

# Transform newlines coming from the serial port into nils
# true (e.g. if using Flash) or false
newlines_to_nils=true

# Comm ports used
comm_ports=1,2,3,4

# Default settings
comm_baud=9600
comm_databits=8
comm_stopbits=1
comm_parity=none

# Idle time out in seconds
timeout=300

# Port 1 settings (ttyS0)
net_port1=5331

# Port 2 settings (ttyS1)
net_port2=5332

# Port 3 settings (ttyS2)
net_port3=5333

# Port 4 settings (ttyS3)
net_port4=5334

Then make your create your php file
Code:
<?php
$fp 
fsockopen("localhost"5334$errno$errstr30);
if(!
$fp){
    echo 
"$errstr ($errno)";
} else{
    
fwrite($fp,"Hello Arduino");
    
$endline=FALSE;
    
$string="";
    
$startline=FALSE;
    while(
$startline==FALSE){
        
$character=fgets($fp,2);
        if(
strstr($character,"%")){
            
$startline=TRUE;
        }
    }
    while(
$endline==FALSE){
        
$character=fgets($fp,2);
        if(
strstr($string"#")) {
            
$endline=TRUE;
        }else if(
$endline==FALSE){
            
$string.=$character;
        }      
        
    }
    echo 
$string;
    
fclose($fp);
}


?>


And a test sketch for arduino
Code:
int count = 0;
String readString;

void setup()
{
  Serial.begin(9600);
  Serial.println("Completed setup");  
}

void loop()
{
  readString="";
  if(Serial.available()){
    while(Serial.available()){
      Serial.read();
      char c = Serial.read();
      readString+=c;
      delay(10);
    }    
    count=count + 1;
    Serial.print("%Hello Website: ");
    Serial.print(count,DEC);
    Serial.println("#");    
  }
}

I really wanted to use the proper fgets procedure but was having troubles.  Mostly feof won't find the end of file with the serial port is still open.  Anybody with more experience with this stuff should be able to figure it out.  Hope this helps
Code:
while (!feof($fp)) {
    echo fgets($fp, 128);
}

EDIT: Slightly better test code
131  Using Arduino / Project Guidance / Re: Controlling Arduino from a exernal (nice) webpage on: February 11, 2013, 08:50:58 pm
Quote
Being on a "WINDOWS" platform... I am in the understanding that this type of approach/communication is only '1-way'... the Arduino can NOT data back and have the PHP script grab it..and update the 'page'...  I believe this to be a PHP 'thing'.. related to Windows..  I have read using LINUX..  Arduino >> PHP will work fine..
I can't imagine that PHP can't do serial communications both ways.  If not you should be able to use python.  I used java to do 2-way serial communications fairly easily.
132  Using Arduino / Project Guidance / Re: Controlling an animatronics bust on: February 11, 2013, 08:43:51 pm
Most algorithms involve increasing P until it oscillates.  Once you have that set P to half that.  Then increase I and D to get better speed or control.  Read that quick wiki page and you should get a good idea of what you want.
133  Using Arduino / Project Guidance / Re: Controlling an animatronics bust on: February 11, 2013, 08:21:30 pm
Have you tried this method for PID tuning?
http://en.wikipedia.org/wiki/Ziegler%E2%80%93Nichols_method
134  Using Arduino / Project Guidance / Re: Controlling an animatronics bust on: February 11, 2013, 02:45:19 pm
You may be able to send a higher PWM when you start and then immediately send a lower PWM frequency.  This could be done using state programming.  If just starting to move or reversing direction send a higher PWM, short delay, check PID, then send the lower required PWM.
135  Using Arduino / Project Guidance / Re: Controlling Arduino from a exernal (nice) webpage on: February 11, 2013, 12:28:03 pm
Here is an example of the second type.  You would need to have an apache web server or some such on your PC that is connected to the arduino.
http://schmidtcds.com/2011/01/arduino-home-automation-part-2/
Pages: 1 ... 7 8 [9] 10 11 ... 13