Show Posts
Pages: 1 2 3 [4] 5 6 ... 9
46  Using Arduino / Networking, Protocols, and Devices / Re: A story of three xbees; two emitters and one hub on: November 09, 2012, 12:14:28 pm
Let me read over that. They are series 1
47  Using Arduino / Networking, Protocols, and Devices / Re: A story of three xbees; two emitters and one hub on: November 09, 2012, 10:57:03 am
Receiver Code :

Code:
#include <LiquidCrystal.h>

const int ledPin = 13;
//const int signalStrengthPin = 9;

//byte incomingByte, val_read;
int val_read;

int emitter2;

 
//int RSSIpin = 9;
//unsigned long rssiDur;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()
{
  Serial.begin(38400);
 lcd.begin(16,2);
lcd.noAutoscroll();
     
  pinMode(ledPin, OUTPUT);
 // pinMode(signalStrengthPin, INPUT);
}

void loop()
{


 //rssiDur = pulseIn(RSSIpin, LOW, 200);
  // print signal strength
  //Serial.println(rssiDur);
 
  if (Serial.available()>0)
  {
   // if ((int(val_read) == 'B'))
   
val_read = Serial.read();

Serial.println(int(val_read));
delay(100);


//delay(100);
//Serial.print(int(inches));
lcd.setCursor(0,0);
lcd.print("Bike1 = ");
lcd.print(int(val_read), DEC);
 
  emitterTwo();
}
}
void emitterTwo(){

   if ((int(val_read) == 1))
    {
      emitter2 = Serial.read();
      Serial.println(int(emitter2));
      delay(100);
      lcd.setCursor(0,1);
lcd.print("Bike2 = ");
lcd.print(int(emitter2), DEC);
  }
}


...and Emitter Code for only of the modules (basically same exact code) :


Code:
//Transmitter modules. These are the bike units intended to show signal strength indication in correlation to a central networked hub.
//x bees have been configured with personal ID's to avoid interference with other networks (encryption).
//optimal xbee use is outdoors, no wall interference/metal(close contact). range is 300ft at optimal conditions.
//





const int rssi_pin = 9; //RSSI Pin of the XBee Module
 int rssiDur; //variable to read pin
byte inches_val;

//LED pins//////////////////////////
const int led3 = 3;
const int led4 = 4;
const int led5 = 5;
const int led6 = 6;
const int led7= 7;
const int led8= 8;
const int led10= 10;
const int led11= 11;
const int led12= 12;
const int led13= 13;
/////////////////////////////////////

///Averager Variables///////////////////////////////

//this is intended to place first 10 read incoming RSSI values in an array and average. smoother readings

const int numReadings = 10;

int readings[numReadings];      // the readings from the RSSI
int index = 0;                  // the index of the current reading
int total = 0;                  // the running total
int average = 0;                // the average


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



void setup(){
 
   for (int thisReading = 0; thisReading < numReadings; thisReading++)
    readings[thisReading] = 0;

pinMode (led3, OUTPUT);
pinMode (led4, OUTPUT);
pinMode (led5, OUTPUT);
pinMode (led6, OUTPUT);
pinMode (led7, OUTPUT);
pinMode (led8, OUTPUT);
pinMode (led10, OUTPUT);
pinMode (led11, OUTPUT);
pinMode (led12, OUTPUT);
pinMode (led13, OUTPUT);
 
   //Serial1.begin(38400);
  Serial.begin(38400); //Xbee communicating at this baud
}




void loop(){


 rssiDur = pulseIn(rssi_pin, LOW, 200); //this is set to 200ms with ATRP @ 2
inches_val = rssiDur; // XBee times out 10-12 inches apart, so added 11
inches_val = rssiDur + 24; // XBee times out 10-12 inches apart, so added 11
min(inches_val, 1);
//min(inches_val, 18);
total= total - readings[index];         
  // read from the sensor: 
  readings[index] = inches_val;
  // add the reading to the total:
  total= total + readings[index];       
  // advance to the next position in the array: 
  index = index + 1;                   

  // if we're at the end of the array...
  if (index >= numReadings)             
    // ...wrap around to the beginning:
    index = 0;                           

  // calculate the average:
  average = total / numReadings;         
 
 //Serial.print("Signal Strength distance inches = ");
//Serial.println(average );
  Serial.write(1);
    //Serial.write("emitter two");
  Serial.write(average);   
  delay(100);        // delay in between rea

// value 10 = 1 meter
if (average > 24 && average < 124){ //1-5 meters
 // Serial.write(1);
   digitalWrite(led3, HIGH);
       digitalWrite(led4, HIGH);
        digitalWrite(led5, HIGH);
        digitalWrite(led6, HIGH);
        digitalWrite(led7, HIGH);
        digitalWrite(led8, HIGH);
        digitalWrite(led10, HIGH);
        digitalWrite(led11, HIGH);
        digitalWrite(led12, HIGH);
        digitalWrite(led13, HIGH);
       
}
  if (average > 124 && average < 224){ //5-10 meters
  //Serial.write(2);
   digitalWrite(led3, HIGH);
       digitalWrite(led4, HIGH);
        digitalWrite(led5, HIGH);
        digitalWrite(led6, HIGH);
        digitalWrite(led7, HIGH);
         digitalWrite(led8, HIGH);
        digitalWrite(led10, HIGH);
        digitalWrite(led11, HIGH);
        digitalWrite(led12, LOW);
        digitalWrite(led13, LOW);
       
  }
  if (average > 224 && average < 324){ //10- 15 meters
  //Serial.write(3); //this is 10 meters. write to reciever
   digitalWrite(led3, HIGH);
       digitalWrite(led4, HIGH);
        digitalWrite(led5, HIGH);
        digitalWrite(led6, HIGH);
        digitalWrite(led7, HIGH);
         digitalWrite(led8, HIGH);
         digitalWrite(led10, LOW);
        digitalWrite(led11, LOW);
        digitalWrite(led12, LOW);
        digitalWrite(led13, LOW);
       
  }
  if (average > 324 && average < 424){ //15-20 meters
  //Serial.write(4);
    digitalWrite(led3, HIGH);
       digitalWrite(led4, HIGH);
        digitalWrite(led5, HIGH);
        digitalWrite(led6, HIGH);
        digitalWrite(led7, LOW);
           digitalWrite(led8, LOW);
        digitalWrite(led10, LOW);
        digitalWrite(led11, LOW);
        digitalWrite(led12, LOW);
        digitalWrite(led13, LOW);
       
  }
  if (average > 424 ){ //20-30 meters
 // Serial.write(5);
   digitalWrite(led3, HIGH);
       digitalWrite(led4, HIGH);
        digitalWrite(led5, LOW);
        digitalWrite(led6, LOW);
        digitalWrite(led7, LOW);
         digitalWrite(led8, LOW);
        digitalWrite(led10, LOW);
        digitalWrite(led11, LOW);
        digitalWrite(led12, LOW);
        digitalWrite(led13, LOW);
     
    }
   
    //isolated instances below
   
  if (average == 24 ){ //if their is no signal
  Serial.write(9);
   digitalWrite(led3, LOW);
       digitalWrite(led4, LOW);
        digitalWrite(led5, LOW);
        digitalWrite(led6, LOW);
        digitalWrite(led7, LOW);
         digitalWrite(led8, LOW);
        digitalWrite(led10, LOW);
        digitalWrite(led11, LOW);
        digitalWrite(led12, LOW);
        digitalWrite(led13, LOW);
}



both emitter values show up, but overlapping each other. and not mixed together, I mean with this code It shows one value, clears, then shows another value from other emitter, but all in same line.

And Im sure API mode would be useful, but I am not too comfortable right now to take on a new beast. If it is a must, and their isn't a good suggestion for what I am doing now, I need a push in the right direction for API mode aside from configuring AT command and installing an arduino library.

48  Using Arduino / Networking, Protocols, and Devices / Re: A story of three xbees; two emitters and one hub on: November 09, 2012, 12:43:57 am
I want to dumb this down to be 100% sure I answer that correctly.

So I two dividing print lines in the receiver that show two different Serial.read() variables I created. When printed, I first place one xbee transmitter  20 feet away, then I have another within arms reach the incoming lines both sync to the same number until I shift around one of the transmitters, then that new incoming value shows up, and affects everything else. 
49  Using Arduino / Networking, Protocols, and Devices / Re: A story of three xbees; two emitters and one hub on: November 09, 2012, 12:20:55 am
Quote
is the receiver seeing something like "AB129399"?

It fluctuates between the values. So in other words, when printing in the receiver, i.e. im just listening to any old thing coming into the serial port, i get a  flash of one value from one emitter then another value from the other. Make sense? I guess yes they are overlapping each other
50  Using Arduino / Networking, Protocols, and Devices / Re: A story of three xbees; two emitters and one hub on: November 08, 2012, 11:46:30 pm
Quote
Have the transmitting XBees include a unique identifier with the data. Could just be a single character.

I've tried your suggestion before, but might not be executing it right. for one of the transmitters, I am serially writing the incoming sensor value and and 'A' to establish an identifier like so:
Code:
  Serial.write('A');
Serial.write(average);
delay(100);
am I completely off? what were you suggesting?

oh, and let me clarify, im sending sensor data from each transmitting xbee to a single receiving xbee. I am getting the sensor readings, except everything is all being mushed together when I am reading from the receiving end.
51  Using Arduino / Networking, Protocols, and Devices / A story of three xbees; two emitters and one hub on: November 08, 2012, 10:46:59 pm
So I have two transmitting xbees sending data to a central arduino/xbee and that part is dandy. (btw, im working in transparent mode).

Now since these are all talking on the same serial port, I am getting both values mushed together when I want to be able to distinguish between each value from each emitting xbee.

tips? suggestions? whats possible?
52  Using Arduino / Programming Questions / Re: X Bee Series 1 RSSI signal pin values on: November 08, 2012, 10:42:01 pm
Nevermind, I solved it. Since im reading from the RSSI pin, I adjusted an AT command to set the pwm duty cycle to 99.
53  Using Arduino / Programming Questions / Re: X Bee Series 1 RSSI signal pin values on: November 07, 2012, 04:26:38 pm
Missed you PaulS!

yes, as stated in any forum, a measurement of signal strength is not the most accurate means to measure distance. ANYWAYS, in an ideal/interference free area, a measurement of the signal strength has been working for me until my issue (refer to the entire outlined explanation above)
54  Using Arduino / Programming Questions / X Bee Series 1 RSSI signal pin values on: November 07, 2012, 03:03:33 pm
Greetings! So I am currently sending the values from an X Bees RSSI pin to another X Bee and reading the incoming values, then printing on an LCD.

problem: The incoming values are only showing a range of 0-43ish. I want to see values extending to the 300ft range. I'm not sure what I am doing wrong. Here is my AT commands for each xbee, along with my sender and receiver code:

Receiver                            emitter(everything same as receiver except ones listed)
ATID4256
ATP01
ATIR0
ATCE0                              ATCE1
ATBD5
ATM02
ATRP10

Code:
// Emitter Code for xbee RSSI pin





const int rssi_pin = 9; //RSSI Pin of the XBee Module
 int rssiDur; //variable to read pin
byte inches_val;

//LED pins//////////////////////////
const int led3 = 3;
const int led4 = 4;
const int led5 = 5;
const int led6 = 6;
const int led7= 7;
const int led8= 8;
const int led10= 10;
const int led11= 11;
const int led12= 12;
const int led13= 13;
/////////////////////////////////////

///Averager Variables///////////////////////////////

//this is intended to place first 10 read incoming RSSI values in an array and average. smoother readings

const int numReadings = 10;

int readings[numReadings];      // the readings from the RSSI
int index = 0;                  // the index of the current reading
int total = 0;                  // the running total
int average = 0;                // the average


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



void setup(){
 
   for (int thisReading = 0; thisReading < numReadings; thisReading++)
    readings[thisReading] = 0;

pinMode (led3, OUTPUT);
pinMode (led4, OUTPUT);
pinMode (led5, OUTPUT);
pinMode (led6, OUTPUT);
pinMode (led7, OUTPUT);
pinMode (led8, OUTPUT);
pinMode (led10, OUTPUT);
pinMode (led11, OUTPUT);
pinMode (led12, OUTPUT);
pinMode (led13, OUTPUT);
 
 
  Serial.begin(38400); //Xbee communicating at this baud
}

void loop(){


 rssiDur = pulseIn(rssi_pin, LOW, 200); //this is set to 200ms with ATRP @ 2
inches_val = rssiDur ;
total= total - readings[index];         
  // read from the sensor: 
  readings[index] = inches_val;
  // add the reading to the total:
  total= total + readings[index];       
  // advance to the next position in the array: 
  index = index + 1;                   

  // if we're at the end of the array...
  if (index >= numReadings)             
    // ...wrap around to the beginning:
    index = 0;                           

  // calculate the average:
  average = total / numReadings;         
 

  Serial.write(average);   
  delay(100);        // delay in between rea


// value 10 = 1 meter
if (average > 18 && average < 196){ //1-5 meters
 // Serial.write(1);
   digitalWrite(led3, HIGH);
       digitalWrite(led4, HIGH);
        digitalWrite(led5, HIGH);
        digitalWrite(led6, HIGH);
        digitalWrite(led7, HIGH);
        digitalWrite(led8, HIGH);
        digitalWrite(led10, HIGH);
        digitalWrite(led11, HIGH);
        digitalWrite(led12, HIGH);
        digitalWrite(led13, HIGH);
       
}
  if (average > 196 && average < 393){ //5-10 meters
  //Serial.write(2);
   digitalWrite(led3, HIGH);
       digitalWrite(led4, HIGH);
        digitalWrite(led5, HIGH);
        digitalWrite(led6, HIGH);
        digitalWrite(led7, HIGH);
         digitalWrite(led8, HIGH);
        digitalWrite(led10, HIGH);
        digitalWrite(led11, HIGH);
        digitalWrite(led12, LOW);
        digitalWrite(led13, LOW);
       
  }
  if (average > 393 && average < 590){ //10- 15 meters
  //Serial.write(3);
   digitalWrite(led3, HIGH);
       digitalWrite(led4, HIGH);
        digitalWrite(led5, HIGH);
        digitalWrite(led6, HIGH);
        digitalWrite(led7, HIGH);
         digitalWrite(led8, HIGH);
         digitalWrite(led10, LOW);
        digitalWrite(led11, LOW);
        digitalWrite(led12, LOW);
        digitalWrite(led13, LOW);
       
  }
  if (average > 590 && average < 787){ //15-20 meters
  //Serial.write(4);
    digitalWrite(led3, HIGH);
       digitalWrite(led4, HIGH);
        digitalWrite(led5, HIGH);
        digitalWrite(led6, HIGH);
        digitalWrite(led7, LOW);
           digitalWrite(led8, LOW);
        digitalWrite(led10, LOW);
        digitalWrite(led11, LOW);
        digitalWrite(led12, LOW);
        digitalWrite(led13, LOW);
       
  }
  if (average > 787 ){ //20-30 meters
 // Serial.write(5);
   digitalWrite(led3, HIGH);
       digitalWrite(led4, HIGH);
        digitalWrite(led5, LOW);
        digitalWrite(led6, LOW);
        digitalWrite(led7, LOW);
         digitalWrite(led8, LOW);
        digitalWrite(led10, LOW);
        digitalWrite(led11, LOW);
        digitalWrite(led12, LOW);
        digitalWrite(led13, LOW);
     
    }
   
 
}


...and the receiver

Code:
#include <LiquidCrystal.h>

const int ledPin = 13;
//const int signalStrengthPin = 9;

byte incomingByte, val_read;



 
//int RSSIpin = 9;
//unsigned long rssiDur;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()
{
  Serial.begin(38400);
 lcd.begin(16,2);
lcd.noAutoscroll();
  pinMode(ledPin, OUTPUT);
 // pinMode(signalStrengthPin, INPUT);
}

void loop()
{


 //rssiDur = pulseIn(RSSIpin, LOW, 200);
  // print signal strength
  //Serial.println(rssiDur);
 
  if (Serial.available()>0)
  {
   // incomingByte = Serial.read();
 
    //Serial.print(" Byte: ");
    //Serial.println(incomingByte);
        //delay(100);
       
       
  //while ((int(incomingByte) == 1)) {
   
val_read = Serial.read();
//Serial.print("Svalues =");
//int inches = val_read / mathbyte;
Serial.println(int(val_read));

delay(100);
//Serial.print(int(inches));
lcd.setCursor(0,0);
lcd.print("Bike1=");
lcd.print(int(val_read), DEC);

}
 


  }
55  Using Arduino / Programming Questions / Re: Telnet SMTP gmail with copperhead Wifi Shield on: August 15, 2012, 02:31:02 pm
First off, thanks for the extremely helpful explanation.

Second, I am trying to send an SMS directly from the arduino. I figured I'd achieve this with wifi, since each service provider has unique email addresses to send texts to a phone number (i.e. 3122224444@txt.att.net)

So, that is where I am at. I am unaware of where to begin, based on the sample sketches that have been supplied with this wifi shield.
56  Using Arduino / Programming Questions / Re: Telnet SMTP gmail with copperhead Wifi Shield on: August 14, 2012, 04:40:32 pm
look, i dont know what questions to ask, where to begin so forgetting everything i posted except knowing what hardware im using,

i just want to send an sms through email.
57  Using Arduino / Programming Questions / Re: Telnet SMTP gmail with copperhead Wifi Shield on: August 14, 2012, 03:09:46 pm
it doesnt run. the syntax for the ethernet library does not work with the classes for the Wifi shield library. the sketch alone for just ethernet does not even compile. i have the library installed, but no luck.



Quote
You seem to have a sketch that connects to an SMTP server and tries to send an email using SMTP.

thats essentially what I want to. don't i need to specify login information? maybe an example sketch could get me going? I dont know what the issue is 
58  Using Arduino / Programming Questions / Re: Telnet SMTP gmail with copperhead Wifi Shield on: August 14, 2012, 01:03:05 pm
As mentioned above, I am able to connect the wifi shield to the network. that is where I am at. I am not sure how to use the class, what alternatives are available to me. insightful resources, sample code, etc are appreciated.
59  Using Arduino / Programming Questions / Telnet SMTP gmail with copperhead Wifi Shield on: August 14, 2012, 12:23:23 pm
alrighty, so I am trying to send an SMS via telnet to gmail, but i really have no idea what I am doing.

I am using this shield: http://www.cutedigi.com/wireless/wifi/linksprite-cuhead-wifi-shield-for-arduino.html

all of the sketches work fine. i've managed to connect the shield to the network.

Now onto executing telnet to gmail : I conceptually understand these guides on this process to connect illustrated here: http://www.tech-and-dev.com/2010/10/sending-email-using-gmail-smtp-server.html

and here is my attempt to fuse together somebodys ethernet shield example and the classes with the copperhead wifi shield. I have no clue what I am missing, what I need to consider, if anyone has working examples, what functions can be attached to this shields classes, etc. HELP.

Code:
/*
SEND AN EMAIL WITH ARDUINO
9/23/11
This code was created by modifying the connect example from arduino.cc
and with the help of the YABB forums and their very helpful members.
This code sends an email to any email address and then disconnects.
*/

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




#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {192,168,1,2}; // IP address of WiShield
unsigned char gateway_ip[] = {192,168,1,1}; // router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0}; // subnet mask for the local network
const prog_char ssid[] PROGMEM = {"ASYNCLABS"}; // max 32 bytes

unsigned char security_type = 0; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2

// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"12345678"}; // max 64 characters

// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, // Key 0
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 1
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 2
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Key 3
};

// setup the wireless mode
// infrastructure - connect to AP
// adhoc - connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;

unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters ----------------------------------------



//byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // Arduino's artificial mac address
//byte ip[] = { 192, 168, 1, 1 }; // my ip
byte server[] = { 64,233,183,109 }; // my smtp.xxx.net server ip f gmail

Client client(server, 465);

void setup()
{
  Ethernet.begin(local_ip, gateway_ip );
 Serial.begin(57600);

 Serial.println("connecting...");
 
 if (client.connect()) {
                        Serial.println("connected");
   
                        client.println("HELO itismeletschat"); /* say hello (statement after helo is needed but irrelevant)*/

                        client.println("MAIL From: me@my-isp.net"); /* identify sender, this should be the same as the smtp server you are using */

                        client.println("RCPT To: you@your-isp.net"); /* identify recipient */

                        client.println("DATA");

                        client.println("To: you@your-isp.net"); /* identify recipient */
                        client.println("Subject: You Have Arduino Mail!!"); /* insert subject */

                        client.println("Please let me know it worked!!!"); /* insert body */
                        client.println("."); /* end email */
                 
                        client.println("QUIT"); /* terminate connection */
                       
                        client.println();
   
 } else {
   Serial.println("connection failed");
 }
}

void loop()
{
   delay(10000);
   if (!client.connected()) {
   Serial.println();
   Serial.println("disconnecting.");
   client.stop();
   for(;;)
     ;
 }
}
60  Community / Gigs and Collaborations / Re: Chicago area Arduino developer needed, Paid! on: August 09, 2012, 11:08:37 pm
I know this is dated, but I would be able to help with this projects development. shoot me a message, danbertner@gmail.com
Pages: 1 2 3 [4] 5 6 ... 9