Show Posts
Pages: 1 2 [3] 4
31  Using Arduino / Programming Questions / Re: RFID Tag Compare on: August 31, 2012, 12:15:09 pm
Maybe this tutorial can help you futher,
http://www.tigoe.net/pcomp/code/PHP/347/
I did build my code around this and works great.

I appreciate the link, but Tom approaches this a little differently since he is reading and writing to EEPROM.

However, I figured it out this morning by adding one extra loop to check my other Tag ID's. Now it works.

Here is the code for the loop:

Code:
for (int n=0; n<ARR_LEN; n++){
if(memcmp(master, target_tag[n], TAG_LEN) == 0 )  //Compares two bytes of TAG_LEN, if they are a match, the argument will be 0, thus 0 == 0
  {
            Serial.println("This Card is a Match!");             
  }
       }

Thanks.
32  Using Arduino / Programming Questions / Re: RFID Tag Compare on: August 30, 2012, 11:42:51 pm
Code:
if(memcmp(master, target_tag, TAG_LEN) == 0 )

Hmm, for some reason it was throwing an error before: cannot compare byte* & byte...it works now, but only for one of my RFID cards. The other one wont validate.

This is my array for all my tags that Ive got saved in the Arduino:

Code:
byte target_tag[ARR_LEN][TAG_LEN]={{0x4F, 0x00, 0x88, 0xB3, 0x4F},{*My Other Tag*}}
33  Using Arduino / Programming Questions / RFID Tag Compare on: August 30, 2012, 10:29:29 pm
Hello,

I have this dilemma with comparing two RFID Tag numbers using the ID-12 Reader and an Arduino Uno, one from a card, and the other in an array. I'd like to print to Serial: "Card is a Match", then do something. Im manipulating the example from this site:http://www.arduino.cc/playground/Code/ID12

The tag Im trying to compare to:
Code:
byte target_tag[TAG_LEN] = {0x4F, 0x00, 0x88, 0xB3, 0x4F};

I cant make up my mind which of these sets of code is the right one to use, as Ive seen them both work in other people's programs, but they wont work for me:

Code:

if (bytesread == 12) {                          // if 12 digit read is complete
        Serial.print("5-byte master: ");
        for (i=0; i<5; i++) {
          if (master[i] < 16) Serial.print("0");
          byte master1 = master[i];
          Serial.print(master[i], HEX);
          Serial.print(" ");
          //Serial.println();
        }
    if(memcmp(master, target_tag[i], TAG_LEN) == 0 )
    {
               Serial.print("This Card is a Match!");
    }
    }
        Serial.println();

        Serial.print("Checksum: ");
        Serial.print(master[5], HEX);
        Serial.println(master[5] == checksum ? " -- passed." : " -- error.");
        Serial.println();
     

Or this one:
Code:
if (bytesread == 12) {                          // if 12 digit read is complete
        Serial.print("5-byte master: ");
        for (i=0; i<5; i++) {
          if (master[i] < 16) Serial.print("0");
          byte master1 = master[i];
          Serial.print(master[i], HEX);
          Serial.print(" ");
          //Serial.println();
        }
   for(int i = 0; i < ARR_LEN; i++)
        {
          if (CheckTwoBytes(target_tag[i], master))
          {
            Serial.print("This Card is a Match!");
          }
      }
    }
        Serial.println();

        Serial.print("Checksum: ");
        Serial.print(master[5], HEX);
        Serial.println(master[5] == checksum ? " -- passed." : " -- error.");
        Serial.println();
}

boolean CheckTwoBytes ( byte a[], byte b[] )
{
if ( a[0] != NULL ) // Make sure there is something in the array first
match = true; // Assume they match at first

for ( int k = 0; k < 5; k++ ) // Loop 5 times
{
/*
Serial.print("[");
Serial.print(k);
Serial.print("] ReadCard [");
Serial.print(a[k], HEX);
Serial.print("] StoredCard [");
Serial.print(b[k], HEX);
Serial.print("] \n");
*/
if ( a[k] != b[k] ) // IF a != b then set match = false, one fails, all fail
match = false;
}
if ( match ) // Check to see if if match is still true
{
//Serial.print("Strings Match! \n");
return true; // Return true
}
else {
//Serial.print("Strings do not match \n");
return false; // Return false
}
}

Im trying to write the code myself, and learn how it works as Im writing it. I dont feel comfortable just copying and pasting other people's code just to get it to work.

I've searched around the web, and found a variety of help pages, examples and tutorials, but nothing as detailed in explanation as Im looking for.

Any help is greatly appreciated.
34  Community / Exhibition / Gallery / Re: Smart Home Manegment System on: May 28, 2011, 08:53:15 pm
Quote
3-axis gyro, compass, and 3-axis accelerometer
I'm interested in this as I'm in the process of designing an accelerometer board now.

NOTE: I may not have have access to the internet for the next 2-3 weeks, but if you post anything I'll get it eventually smiley

lol well these three boards are the Teensy 2.0 equivalent of the Arduino Shields on Sparkfun. Let me know if theres anything specific you're looking for and I'll see if I can accommodate you. Since they have no directly relation to my project, I dont think I'd get these boards made unless there was somebody specific who wanted them.  smiley-wink
35  Community / Exhibition / Gallery / Re: Smart Home Manegment System on: May 28, 2011, 12:08:55 pm
Sounds very interesting. But are you then planning on an Arduino in every room?
My quick thoughts are a separate arduino in each room with an ethernet shield. Ofcourse xbee is possible too but it would be fairly costly.

For my prototype I've decided to use a dedicated Arduino for each System & Zone it will be monitoring. My setup for now is an Arduino Uno, and a W5100 Ethernet Shield. Basically communications to and from the server will be over LAN, and I'll be using PoE to send power to the board. If the unit will be outside, I'll use a solar panel to recharge a battery. If the unit will be embedded in a wall as is the case for the lighting control, it will have a small transformer and a backup battery to run the board.

For the relays, I plan to trigger them with transistors. Its simple and clean.  smiley-wink

In the long run, Im working on designing my own microcontroller boards using either the ATMEGA32u4 or the ATMEGA128L. For those I've got a set of Crossbow sensor nodes (http://bullseye.xbow.com:81/Products/productdetails.aspx?sid=164) from a previous project, so I like the format and size that they have, so I'll create something a bit more custom for this application, but along the same size and power requirements. The board is only 1.25"x2.25". So you can see why I've chosen it.  smiley

As for wireless communications, I've decided with WiFi. I found a company that sells the WiFly module for only $20, so that will be perfect. My roundabout estimate for the cost of each module will be in the 60-100 dollar range for each one. Probably even cheaper once they are mass produced. Total cost will probably be a few thousand dollars for an entire system complete with extra features, but this would still be A LOT cheaper than say a system you professionally custom designing for your home. Those can easily cost as much as your home.

By the way I've also designed some shields to go with the Teensy 2.0 for various applications (i.e. 3-axis gyro, compass, and 3-axis accelerometer), if anyone is interested. Those aren't directly related to the project, but I figured Id throw them in the soup as well. smiley-razz
36  Community / Exhibition / Gallery / Re: ¬| Project Sentry Gun |⌐ on: May 28, 2011, 04:18:58 am
lol this is funny, cause a friend of mine is also working on the same project, except its more like the bots from Portal. Thanks for the share, I'll be sure to let him know. smiley-grin
37  Community / Exhibition / Gallery / Smart Home Manegment System on: May 28, 2011, 01:14:25 am
I got the idea to create a smart home system (I call it a 'Smart Home Management Service') that would be more beneficial to people than existing systems do today. I decided to expand more on my Undergraduate Senior design project work, and come up with more creative ways of doing things. There are three major elements that I am currently working on. The first is the Active Fire Detection System. The next is Smart Energy & Lighting. How it works is simple. For example, if a person enters a room, and its night outside, you want the lights to turn on automatically. Say its hot outside, but not oven-like, the fan would turn on as well (assuming thats what the user has set in the settings). If a person was to leave the room, the lights and the fan would turn off. Likewise, if its cold outside, the fan wouldnt turn on, but instead the heater would adjust so that the one room the person is in would get the heat of the heater in such a way as to warm the room but not apply direct heat on the person in the room (this concept of the heater is still in the works). Finally, the last component is active home security to detect a threat to your home before it becomes a problem.

So far there are really 3 primary systems to this service:

1) Fire Prevention/Detection
2) Energy Efficiency
3) Home Security

I bounce around between design of each system, but in the meantime I'm working on a shield for the Arduino Uno to step up the 5 volts from the regulator to 9, 12, and 24 volts for use with various relays in projects Im working on, and for any other projects used in the future. Im just trying to get a feel for if there is interest in a board like this, whether its pre-assembled, or as a kit. I could post a parts list if you only want to buy the board by itself.

I also have a relay board in the works with two 30A relays on it that can be powered via the converter shield or via an Arduino Uno depending on the power requirements of relay being used. These two boards will be used in the Energy Efficiency part of my system. Visit my blog for more information on it: tae09.blogspot.com

I currently have a Teensy Relay Shield (which uses SPDT solid state MOSFET relays) in the Fab shop, so once I get that one in the mail and tested, I'll solder it up and get it operational.

Suggestions, and ideas are welcome as well as if you're interested in buying a board.  smiley  

Thanks!
38  Community / Products and Services / Re: Norduino when Arduino meets Nordic! on: April 19, 2011, 04:28:34 am
woah these are pretty cool.
39  Community / Products and Services / Arduino Patches! on: April 19, 2011, 04:27:38 am
Thought someone might like to buy some of these:
Heres the link: http://multilogica-shop.com/patch-%C3%ADcone-do-Arduino

Enjoy!
40  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Sensor Data with PHP/HTML on: April 17, 2011, 10:09:52 pm
I think perhaps I've been trying to do things the hard way, and host a site and show data at the same time off an arduino. I'm gonna change it to only post data to some other server and that server will host a website to show off the data.

Do you happen to know how I can setup the other server so that the data stream can be logged into a database? Or is it application specific to all the software I'll be running?

I appreciate the help!
41  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Sensor Data with PHP/HTML on: April 17, 2011, 12:22:19 am
I guess you misunderstood my meaning. You can't add my code at end of your program. The string of code can't be sent in a sentence. I add more details in the code below. It demoes how to INSERT the sensor data into the html body.

I tried to insert it into the loop. What Im trying to do is insert it into the
Code:
PROGMEM prog_char content_page1[] = "<hr /><h3>Sensor 1</h3><p><font color=green><b>Gas Sensor 1 Data goes here: </b><input type=text name=sensor1 value=sensor1></font></p><br /><br /> <h3>Sensor 2</h3><p><font color=green><b>Gas Sensor 2 Data goes here: </b><input type=text name=sensor2 value=sensor2></font></p><br />";
section of code.

I'd like very much to keep the same formatting features, and the loading from memory part of things, and the easier multi-page setup. But I need to insert sensor data into that array also. Will the example code you give allow me to do it so that I dont have to use client.print(). Im trying to avoid that if possible.

Quote
The below has the arduino server code to return a fairly complex web page. You could make something simpler to reurn requested data to a data box in a web page. I haven't seen code to run both client and server in the same code, but it probably can be done. The server would need to run all the time in a loop, and the client would be embeded in the server loop and be run when a some condition is met.

http://www.scienceprog.com/getting-hands-on-arduino-ethernet-shield/

I looked at the link, but its not doing what I need. Im not trying to do a complex web page, Im trying to do a simple one that loads from the memory, and inserts live data into that code. Something like setting a variable to a php variable, or javascript variable... smiley-confuse Thanks!
42  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Sensor Data with PHP/HTML on: April 15, 2011, 06:15:42 pm
Are you trying to display the data in a web page supplied from the Arduino, or are you trying to upload the data to some other server?

Actually both. I'd like a web page to be available for whoever wants to check the Arduino on site, and also to get the data sent to a local server.

You can use the below code to insert the dynamic data.

Code:
// client is an instance of Client
int sensor1 = analogRead(analogChannel);
client.print( " <span id='sensor1'>");
client.print(sensor1);
client.print( "</span>\n");

I tested the code, and thats not what Im trying to do. If you look at the image, I want the data to display where it says sensor1.

43  Using Arduino / Networking, Protocols, and Devices / Ethernet Sensor Data with PHP/HTML on: April 15, 2011, 02:03:53 am
Hello there,

Im working on manipulating an example of code I found on the Arduino website. I specifically need to insert some sensor value read in the loop into the html/php code where the sensor data is going to be displayed. I tried using a textbox and setting the name of it to the name of the variable, hoping that the data would input into that box, but it didnt work. So, could someone show me how to display that sensor value into the html text or the textbox? I know what Im asking is probably trivial, but its just not coming to me.  smiley-cry I would appreciate the help!

Code:
// Page 1
PROGMEM prog_char http_uri1[] = "/";
PROGMEM prog_char content_title1[] = "<h2>Sensor Data</h2>";
PROGMEM prog_char content_page1[] = "<hr /><h3>Sensor 1</h3><p><font color=green><b>Gas Sensor 1 Data goes here: </b><input type=text name=sensor1 value=sensor1></font></p><br /><br /> <h3>Sensor 2</h3><p><font color=green><b>Gas Sensor 2 Data goes here: </b><input type=text name=sensor2 value=sensor2></font></p><br />";

Code:
void loop() {
   
    int analogChannel=0;
    int sensor1 = analogRead(analogChannel);
   
    // give the web browser time to receive the data
    delay(1);
    client.stop();
 
}

Thanks in advance! smiley
44  Using Arduino / Installation & Troubleshooting / Re: New UNO, Error when Uploading on: April 13, 2011, 02:13:43 am
Where did you get the Uno from?

Sparkfun


Edit: I think I fixed it but I have no idea how it worked...I just typed some random keys into the serial monitor, and the blinking stopped...then I reset the board, and tried to upload my sketch again (while holding the reset down), then release before it uploads...and it worked! I guess just sending something through the serial reset that serial sync issue.

Thanks for the help guys!
45  Using Arduino / Installation & Troubleshooting / New UNO, Error when Uploading on: April 12, 2011, 11:35:04 pm
Hello,

I tried to upload a sketch for the first time using my new Arduino UNO, and Im getting this strange error. Im using Windows VISTA, x64, and I have the latest Arduino v22 program. Oh and the D13 LED flashes when I plug it into the PC; the computer gives me the ding-dong sound that I've plugged it in. The first time I plugged it in, the drivers auto-installed. I've noticed that the RX & TX LED's flash a little bit and the D13 LED goes out while its attempting to program, but then goes back to the original blinking. Heres the error:

Code:
avrdude: stk500_getsync(): not in sync: resp=0xf9
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

The troubleshooting page didnt help, and looking through the old and new forums didnt help much either. I would appreciate any help. I dont have a clue whats wrong.

Thanks!
Pages: 1 2 [3] 4