Show Posts
Pages: 1 ... 22 23 [24]
346  Forum 2005-2010 (read only) / Exhibition / Re: Cell phone Control! on: October 04, 2010, 08:57:27 pm
Quote
do i need to put php script to apache and how i use it im php noob please help and by the way good job

Just change the php script to use your username and password, and upload it to any server that supports php. I used my own webserver, but you could use any free hosting service, bravenet.com supports php i believe. Just be sure to use the corresponding url to the php file in the python script. For some help on PHP, check out this website, its pretty helpful: http://www.w3schools.com/php/php_intro.asp

Good luck!
347  Forum 2005-2010 (read only) / Exhibition / Re: Cell phone Control! on: April 29, 2010, 09:27:17 pm
Well after replacing the username and password in the php file, because Twitter will not let you do the same status more than once, post a random 4 characters after the each status update (example: "Ledoff1234"), and then also in the php replace the "echo $xml->status[0]->text;" with:
Code:
$stat = $xml->status[0]->text;
echo substr($stat, 0, -5);
This gets rid of the last four characters before displaying, so twitter sees them as different messages each time you update.
Then, upload this to a webserver, and place its path in the python script where it says PATH TO WEB SCRIPT.
Now, in the python script replace the /dev/ttyUSB0 with the path to your arduino. On windows this would be something like COM1 or COM5, and mac and linux would be similar to the path above.
Then, download the arduino script and run the python, and update your twitter status from your cell phone!

Sorry its so complicated, i bet this could all be done in one language, but I had to make use of the bits and pieces of what languages I knew.

Good luck!
Bilbo
348  Forum 2005-2010 (read only) / Exhibition / Re: Cell phone Control! on: April 29, 2010, 08:54:03 pm
Hello Ansh,
Thank you!
The python script's purpose is to fetch the status (displayed on the php page) and send it to the arduino over serial.

Heres a little breakdown of the code:
Code:
from urllib import urlopen
import serial
import time
ser = serial.Serial('/dev/ttyUSB0', 9600)
That section imports the libraries necessary for the program, and opens a serial connection to the arduino.
Code:
while(1):
      lala = urlopen('PATH TO WEB SCRIPT').read()

      if lala == "Ledon":
            ser.write('1')
      elif lala == "Ledoff":
            ser.write('0')
      time.sleep(30)
That section loops indefinitely (thats the while clause). First, it gets the contents of the status php script. If it says Ledon, it sends the number 1 over serial to the arduino, which turns the LED on. If it gets Ledoff, it sends a 0 to the arduino over serial, which then turns the LED off. It then waits 30 seconds as to not overload my poor little php server, and runs again.

Thanks!
349  Forum 2005-2010 (read only) / Exhibition / Re: Cell phone Control! on: March 15, 2010, 02:41:21 pm
cr0sh: Already did that, thanks for the suggestion!

Any ideas as to what i should control with my new setup?
Thanks!
350  Forum 2005-2010 (read only) / Exhibition / Cell phone Control! on: March 15, 2010, 11:12:05 am
Alright now I know that there have been lots of threads on this, but I think this is a different approach. I wanted to be able to control my arduino from my cell phone, and without a cell shield or ethernet shield. Thus, i did it through twitter through my computer.

First, I setup mobile status updates in twitter, with a new account, and wrote this php script:
Code:
<?
function twitterCapture() {
        // Set your username and password here
        $user = 'USERNAME';
        $password = 'PASSWORD';

        $ch = curl_init("https://twitter.com/statuses/user_timeline.xml");
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch,CURLOPT_TIMEOUT, 30);
        curl_setopt($ch,CURLOPT_USERPWD,$user . ":" . $password);
        curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
        curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
        $result=curl_exec ($ch);
        $data = strstr($result, '<?');

        $xml = new SimpleXMLElement($data);

        return $xml;
}
       $xml = twitterCapture();  
      echo $xml->status[0]->text;
?>

Then, I wrote this python script:
Code:
from urllib import urlopen
import serial
import time

ser = serial.Serial('/dev/ttyUSB0', 9600)
while(1):
      lala = urlopen('PATH TO WEB SCRIPT').read()

      if lala == "Ledon":
            ser.write('1')
      elif lala == "Ledoff":
            ser.write('0')
      time.sleep(30)

Lastly, this arduino program.
Code:
int inByte;
void setup()
{
  // start serial port at 9600 bps:
  Serial.begin(9600);
}
void loop()
{
  if (Serial.available() > 0) {
    // get incoming byte:
    inByte = Serial.read();
  }
  if (inByte == '1') {
    digitalWrite(13, HIGH);
  }
  if (inByte == '0') {
    digitalWrite(13, LOW);  
}
}
Obviously, i will do more interesting things later, but for now, this is cool.
351  Forum 2005-2010 (read only) / Exhibition / Re: My Robot! on: July 13, 2010, 12:14:41 pm
The wood is superglued and the parts are electrical taped. As for your idea on the arduino and motor controller, this is intended to be a temporary solution. I have another atmega328p chip, and i was thinking of putting both chips together on a pcb protoboard. If i do this, how would you reccomend bringing the atmega pins up to the "second level" breadboard? About the batteries, I was thinking of the 4 AAs, but the lm7805 that i would use for my standalone atmega could take no less than  7volts, and the motors run ideally at 1.5v with a max of 3v. I am using the 3 AAs because the l293d has a vdrop of 2.6v putting me in the prime power range.

Thanks so much for your feedback!
352  Forum 2005-2010 (read only) / Exhibition / My Robot! on: July 13, 2010, 10:39:21 am
I have been interested in embedded electronics for a few years now, so I decided to build a robot. Right now, its fairly boring, but the great thing about it is there is tons of room for expansion. Let me know what you all think!
All the parts are from radio shack, mouser and sparkfun, except for the wood, from michaels, and the tamiya gearbox, motors and treads, from amazon.com.

Top view, arduino and electronics are on a breadboard stuck to a piece of wood over the gearbox. Plenty of room for expansion. The motors run of 3 AA batteries, and the arduino runs from a 9 volt. THe motor driver is an l293d.


The photo below shows the gearbox and treads, and my paperclip and wire obstacle detector.


Oh, and my personal favorite part, the blue LED power switch:


So? What do you think? Anything i did horribly wrong? What is the first sensor/arm/expansion i should add?

Thanks!

EDIT: I included my code below:
Code:
int portmotor[] = {6,7}; //Left motor drive pins.
int starboardmotor[] = {4,5}; //Right motor drive pins
int portenable = 10; //Left enable
int starboardenable = 11; //Right enable
void setup()
{
  pinMode(portmotor[0],OUTPUT);
  pinMode(portmotor[1],OUTPUT);
  pinMode(starboardmotor[0],OUTPUT);
  pinMode(starboardmotor[1],OUTPUT);
  pinMode(portenable, OUTPUT);
  pinMode(starboardenable, OUTPUT);
}

void loop()
{
forwards(255); //Go forwards at full speed. For all motor functions, the speed is a PWM number. The motors need at least a PWM of 200, thus the speed range is 200 to 255.
delay(1000);
if(analogRead(3) > 900) //Every 1000 seconds, poll the obstacle detector, if it is pushed, run the avoid routine.
{
  avoid();
}
}


void avoid()
{
 stopall();
 
 portbackwards(225);  
  delay(2000);
}
void portbackwards(int speed) //Left motor backwards
{
  analogWrite(portenable, speed);
  digitalWrite(portmotor[0],HIGH);
  digitalWrite(portmotor[1],LOW);
}

void portforwards(int speed) //Left motor forwards
{
  analogWrite(portenable, speed);
  digitalWrite(portmotor[0],LOW);
  digitalWrite(portmotor[1],HIGH);
}

void portstop() //Left motor stop.
{
  analogWrite(portenable, 0);
  digitalWrite(portmotor[0],LOW);
  digitalWrite(portmotor[1],LOW);
}

void starboardbackwards(int speed) //Right motor backwards
{
  
  analogWrite(starboardenable, speed);
  digitalWrite(starboardmotor[0],HIGH);
  digitalWrite(starboardmotor[1],LOW);
}

void starboardforwards(int speed) //Right motor forwards
{
  analogWrite(starboardenable, speed);
  digitalWrite(starboardmotor[0],LOW);
  digitalWrite(starboardmotor[1],HIGH);
}

void starboardstop() //Stop right motor.
{
  analogWrite(starboardenable, 0);
  digitalWrite(starboardmotor[0],LOW);
  digitalWrite(starboardmotor[1],LOW);
}

void forwards(int speed) //Turn on both motors at the same time for a straight course.
{
  int newspeed = speed - 10; //Compensate for the robot's weight imbalance.
  analogWrite(starboardenable, speed);
  analogWrite(portenable, newspeed);
  digitalWrite(starboardmotor[0],LOW);
  digitalWrite(portmotor[0],LOW);
  PORTD = PORTD | B10100000;
}

void stopall() //Stop both motors, using port manipulation.
{
  
  PORTD = PORTD & B00001111;
}
353  Forum 2005-2010 (read only) / Exhibition / Re: Very Cheap Wireless on: May 23, 2010, 11:05:32 am
Quote
FM begins in a range of 65 to 90 MHz (depending on where and when you live) on the dial - do you think a 16 MHz machine would be fast enough to generate such a signal?
Thats besides the point. Theoretically, if this was 100mhz Amplitude Modulated, the arduino could still control the logic pin on the 100mhz oscillator. The problem arises because FM is frequency modulation, which is not possible with an oscillator, because the frequency cant be changed.
354  Forum 2005-2010 (read only) / Exhibition / Re: Very Cheap Wireless on: May 22, 2010, 03:39:35 pm
Quote
I have a 100mhz oscillator with an on/off pin, so that if I pull it low it will broadcast. I have yet to try using the logic control pin, but my guess is that I will be able to send sound to an FM radio.
That would be much more complicated because FM is frequency modulated, not amplitude modulated. Im not sure if an Arduino is up to the task.
355  Forum 2005-2010 (read only) / Exhibition / Very Cheap Wireless on: May 19, 2010, 05:23:49 pm
Hello All!
I needed a way to transmit very simple signals (on or off) wirelessly over a small distance. Thus, i built an AM transmitter similar to this: http://www.instructables.com/files/deriv/FIX/F5B7/A9VEXCFDNXV/FIXF5B7A9VEXCFDNXV.MEDIUM.jpg   and hooked it up to the arduino. I then attatched an old am radio to my destination, and I can transmit logic highs and lows, and even some PWM. My next step, get serial working at a nice slow baud rate.

Hope this is interesting!
356  Forum 2005-2010 (read only) / Exhibition / Re: I'm completely new to Arduino and need help on: May 20, 2010, 07:13:30 pm
Ok i get it, sorry for the confusion. Thats a very cool, albeit difficult idea. If you have four seperate video feeds for each wall, you can use an arduino to switch between them when sending them to the projector. This can be done with a video switch like this: http://www.engadget.com/2007/03/13/how-to-make-a-solid-state-a-v-switcher except instead of pushbuttons, control it directly from the arduino. Then, as for the spinning, if your fan spins at a fairly constant speed, you can just use trial and error to figure out the timing. If you want to get fancy, you can use an accelerometer.
Good luck!
357  Forum 2005-2010 (read only) / Exhibition / Re: I'm completely new to Arduino and need help on: May 19, 2010, 05:17:05 pm
I'm with sciguy, couldnt you just mount the projector on the ceiling and aim it at the wall? What good does this whole complicated setup do? If i were you, start with something simple and practical...and move your way up to the useless stuff  smiley-wink
358  Forum 2005-2010 (read only) / Bar Sport / Great Schematics on: January 09, 2011, 05:11:00 pm
Thought it might be fun to share some interesting, clever, or crazy schematics...So I will start it off with a fun one: http://xkcd.com/730/

Please, join in!
359  Forum 2005-2010 (read only) / Bar Sport / Re: Anyone Seen The Maple? on: May 23, 2010, 07:30:56 pm
It seems to be just as fit for new users as the Arduino...given that its programming environment is the same, form factor is the same, and setup is similar. The major limit really seems to be their constraint to the arduino form factor...their upcoming "Maple Native" looks very interesting. I do look forward to the 32 bit arduino future...maybe with an atmel ARM?
360  Forum 2005-2010 (read only) / Bar Sport / Anyone Seen The Maple? on: May 23, 2010, 05:12:02 pm
Hi Everyone!
The Maple ARM board (http://leaflabs.com/devices/maple/) looks like it really packs some punch. I'm considering buying it, still trying to think of a specific application where it beats the arduino. But for the price, why not?!
Anyone tried it out yet?

Pages: 1 ... 22 23 [24]