Show Posts
Pages: 1 [2] 3
16  International / Nederlands / TowiTek RFID Reader on: February 01, 2013, 07:03:38 am
Hallo allemaal,

Na het gebruik van de parallax rfid reader ben ik over gestapt op de kleinere TowiTek RFID lezer. De onderstaande code:

Code:
long incomingByte;   
char Data[6];
int i;
unsigned long Tempo;

void setup()
{
  Serial.begin(9600);
}

void loop(){
 
   do {
     if (Serial.available()) {       
       Data[i] = Serial.read();
       i++;
       }     
     if(i<1)Tempo = millis();
     } while (i<5&&(millis()-Tempo) < 500);   
   Data[i] = 0;   
   incomingByte = atof(Data);   
   
   Serial.print(incomingByte); 
   
   for (i=0; i<5; i++) {
    Serial.print(Data[i]);   
    }
   i=0;
}

Werkte prima voor de parallax reader (die overigens op 2400 baud werkt).

Helaas is dit de output die ik krijg na het aanbieden van 4 tags:


Dus vreemde tekens ipv normale tag code.

Wie kan mij verder helpen?
17  International / Nederlands / Re: TextFinder and Ethercard on: January 19, 2013, 01:09:36 pm
Hoi Rikky,

Uiteindelijk moet het gewoon over Ethernet werken! Overigens was het geen probleem om verbinding te maken met mijn router en een IP adres toegewezen te krijgen over DHCP.

Ik snap wat je bedoelt, maar ik gebruik arduino niet als server maar als client. Door middel van de link kan ik informatie verzenden: iets.php?id=123 verstuurd id=123 naar de php pagina.

Maar wat ik wilde is gelukt!
18  Using Arduino / Networking, Protocols, and Devices / Re: How to process information from Ethercard on: January 19, 2013, 08:52:28 am
After some more googling I found a webscraping example for Ethercard and this works great.

Code:
          Serial.print("Code ");Serial.println(displayBuff);
           char fCode[] = "1111";
          Serial.print("Fcode ");Serial.println(fCode);
         
          if (displayBuff ==fCode)
          {
            Serial.print("Equal.");
          }

The result of this is
Code:
Code 1111
Fcode 1111

However the code does not return my print. I believed at first this was an issue because of the numerical string, but using ABCDE gives the same answer.
19  Using Arduino / Networking, Protocols, and Devices / Re: How to process information from Ethercard on: January 19, 2013, 07:14:29 am
The usage of Ethercard.h instead of Ethernet.h is what is causing the problems.

Client.read does not exist and I can't figure out how to put the buffer into a char instead of just getting printed.
20  International / Nederlands / Re: TextFinder and Ethercard on: January 19, 2013, 03:41:23 am
Ja, zo zou het ook kunnen maar ik dacht dat TextFinder makkelijk zou werken  smiley-mr-green

Het probleem is dat ik uit een voorbeeld heb dat die Ethercard informatie uitspuugt naar de seriele monitor maar dat ik geen enkel idee heb hoe ik iets met die informatie kan.

TextFinder kan iets uit een stream halen, maar hoe zorg ik dat die stream mijn pagina is? Als ik een Ethernet shield had dan was het niet zo lastig, maar 7 euro ipv 35 veranderd de zaak!
21  International / Nederlands / Re: TextFinder and Ethercard on: January 18, 2013, 05:06:06 pm
Hoi Jantje,

Hartelijk dank!

Nee, het gaat in dit geval niet om RFIDTAG maar om de pagina die ik terug krijg.

In de code gaat het om:
Code:
Serial.println((const char*) Ethernet::buffer + off);

Deze lijn spuugt de pagina uit die ik terug krijg en de content van die pagina bevat een "code/string/oid" die ik wil vergelijken met een aantal waarde en dan een actie uitvoeren. (Leg ik het zo duidelijk uit?)
22  Using Arduino / Networking, Protocols, and Devices / Re: How to process information from Ethercard on: January 18, 2013, 12:46:29 pm
Yeah I found some examples but since I am not using the Ethernet library but the Ethercard one.

It's not TextFinder finder (ether / Ethernet), so what is?
23  International / Nederlands / TextFinder and Ethercard on: January 18, 2013, 09:01:22 am
Hallo mede gebruikers,

Had deze vraag ook al in het Engels geplaatst maar misschien fijn om hier ook in het Nederlands over te praten.

Ik heb de volgende code:

Code:
#include <SoftwareSerial.h>
#include <EtherCard.h>
#include <TextFinder.h>

//Ethernet needs this
#define REQUEST_RATE 5000 // milliseconds
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };

char website[] PROGMEM = "jecom.nl";

byte Ethernet::buffer[400];
static long timer;

void Beep(){
 digitalWrite(7, HIGH);
 delay(300);
 digitalWrite(7, LOW);
 delay(300);
 digitalWrite(7, HIGH);
 delay(300);
 digitalWrite(7, LOW);
}



// called when the client request is complete
static void my_result_cb (byte status, word off, word len) {
  Serial.print("<<< reply ");
  Serial.print(millis() - timer);
  Serial.println(" ms");
  Serial.println((const char*) Ethernet::buffer + off);
  Beep();
}

//Parallax RFID Reader
#define RFIDEnablePin 2 //Pin that enables reading. Set as OUTPUT and LOW to read an RFID tag
#define RFIDSerialRate 2400 //Parallax RFID Reader Serial Port Speed

//Using SoftwareSerial Library to locate the serial pins off the default set
//This allows the Arduino to be updated via USB with no conflict
#define RxPin 5 //Pin to read data from Reader
#define TxPin 4 //Pin to write data to the Reader NOTE: The reader doesn't get written to, don't connect this line.
SoftwareSerial RFIDReader(RxPin,TxPin);

String RFIDTAG=""; //Holds the RFID Code read from a tag
String DisplayTAG = ""; //Holds the last displayed RFID Tag

void setup()
{
  // RFID reader SOUT pin connected to Serial RX pin at 2400bps
  RFIDReader.begin(RFIDSerialRate);

  // Set Enable pin as OUTPUT to connect it to the RFID /ENABLE pin
  pinMode(RFIDEnablePin,OUTPUT);
  pinMode(7, OUTPUT);

  // Activate the RFID reader
  // Setting the RFIDEnablePin HIGH will deactivate the reader
  // which could be usefull if you wanted to save battery life for
  // example.
  digitalWrite(RFIDEnablePin, LOW);

  Serial.begin(9600);           // set up Serial library at 9600 bps
 
   Serial.println("\n[getDHCPandDNS]");
 
 
  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
    Serial.println( "Failed to access Ethernet controller");

  if (!ether.dhcpSetup())
    Serial.println("DHCP failed");
 
  ether.printIp("My IP: ", ether.myip);
  // ether.printIp("Netmask: ", ether.mymask);
  ether.printIp("GW IP: ", ether.gwip);
  ether.printIp("DNS IP: ", ether.dnsip);

  if (!ether.dnsLookup(website))
    Serial.println("DNS failed");
  ether.printIp("Server: ", ether.hisip);
  Beep();
  timer = - REQUEST_RATE; // start timing out right away

}

void loop()
{
  ether.packetLoop(ether.packetReceive());
  if(RFIDReader.available() > 0) // If data available from reader
  {
    ReadSerial(RFIDTAG);  //Read the tag number from the reader. Should return a 10 digit serial number
  }

  //This only displays a tag once, unless another tag is scanned
  if(DisplayTAG!=RFIDTAG)
  {
    DisplayTAG=RFIDTAG;
    Serial.println(RFIDTAG);
    delay(1000);
     digitalWrite(7, HIGH);
 delay(300);
 digitalWrite(7, LOW);
    if (millis() > timer + REQUEST_RATE) {
    timer = millis();
    Serial.println("\n>>> REQ");
    char RFT[25];
    DisplayTAG.toCharArray(RFT,25);

    ether.browseUrl(PSTR("/frizzbar.php?tag="), RFT, website, my_result_cb);
    delay(1000);
   
   

   
   
  }
  }
}


// Magical stuff below

void ReadSerial(String &ReadTagString)
{
  int bytesread = 0;
  int  val = 0;
  char code[10];
  String TagCode="";

  if(RFIDReader.available() > 0) {          // If data available from reader
    if((val = RFIDReader.read()) == 10) {   // Check for header
      bytesread = 0;
      while(bytesread<10) {                 // Read 10 digit code
        if( RFIDReader.available() > 0) {
          val = RFIDReader.read();
          if((val == 10)||(val == 13)) {   // If header or stop bytes before the 10 digit reading
            break;                         // Stop reading
          }
          code[bytesread] = val;           // Add the digit           
          bytesread++;                     // Ready to read next digit 
        }
      }
      if(bytesread == 10) {                // If 10 digit read is complete

        for(int x=0;x<10;x++)              //Copy the Chars to a String
        {
          TagCode += code[x];
        }
        ReadTagString = TagCode;          //Update the caller
        while(RFIDReader.available() > 0) //Burn off any characters still in the buffer
        {
          RFIDReader.read();
        }

      }
      bytesread = 0;
      TagCode="";
    }
  }
}




Bij elkaar geschraapt.

Zoals jullie kunnen zien wacht hij op een RFID tag die hij dan in een URL zet en naar een pagina transporteert.
Ik krijg dan van die pagina een inhoud terug met de volgende waardes:
<code>hier nu nog kopie van de TAG</code>

Met TextFinder wil ik die code in een integer zetten of iets anders dat ik kan vergelijken of gebruiken. Alleen weet ik niet hoe ik dit precies kan doen en welke stream ik moet gebruiken om dit waar te maken.
24  Using Arduino / Networking, Protocols, and Devices / Re: How to process information from Ethercard on: January 18, 2013, 03:13:26 am
If the below is what is returned, then you can count the carrage returns in the stream and capture the string between what looks to be 8 and 9.

That seems logical indeed. However I am unsure how to do this. The example is quite clear, but since EtherCard is different from normal Ethernet I don't know how to implement it. Or in other words I don't know how to put the output in a stream that I can use with TextFind
25  Using Arduino / Networking, Protocols, and Devices / Re: How to process information from Ethercard on: January 18, 2013, 02:50:46 am
Quote
However, as I think of it I could just compare the complete buffer but it contains a date and time stamp.
It would be helpful to see the actual output, but, generally web site data is separated by carriage returns and line feeds into logical blocks. You could discard any data that does not contain data of interest. If you control the output, make it identify the interesting data in some easy to parse way.

<<< reply 5074 ms
Quote
HTTP/1.1 200 OK
Date: Fri, 18 Jan 2013 07:47:11 GMT
Server: Apache/2
Vary: Accept-Encoding,User-Agent
Content-Length: 4
Connection: close
Content-Type: text/html

1234

So the info is contained by ether.packetLoop but documentation on ethercard is limited so I don't know how to use it in combination with TextFinder
26  Using Arduino / Networking, Protocols, and Devices / Re: How to process information from Ethercard on: January 17, 2013, 05:21:03 pm
Hmm yep, sounds logical.

Yes, I am sorry if I was unclear. The content of this page is a numerical code so indeed it's "1234" (or whatever I make it spit out). However the buffer contains first the header and then the content of this page and I need only that numerical code.

However, as I think of it I could just compare the complete buffer but it contains a date and time stamp.
27  Using Arduino / Networking, Protocols, and Devices / Re: How to process information from Ethercard on: January 17, 2013, 12:42:46 pm
Code:
// Includes and defines

#include <EtherCard.h>

#define REQUEST_RATE 5000 // milliseconds

static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };

char website[] PROGMEM = "jecom.nl";

byte Ethernet::buffer[700];
static long timer;

// called when the client request is complete
static void my_result_cb (byte status, word off, word len) {
  Serial.print("<<< reply ");
  Serial.print(millis() - timer);
  Serial.println(" ms");
  Serial.println((const char*) Ethernet::buffer + off);
}

#include <SoftwareSerial.h>

int  val = 0;
char code[10];
char route[] = "020083741B";
int bytesread = 0;

#define rxPin 7
#define txPin 6



void setup () {
  Serial.begin(57600);
  Serial.println("\n[getDHCPandDNS]");
 
  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
    Serial.println( "Failed to access Ethernet controller");

  if (!ether.dhcpSetup())
    Serial.println("DHCP failed");
 
  ether.printIp("My IP: ", ether.myip);
  // ether.printIp("Netmask: ", ether.mymask);
  ether.printIp("GW IP: ", ether.gwip);
  ether.printIp("DNS IP: ", ether.dnsip);

  if (!ether.dnsLookup(website))
    Serial.println("DNS failed");
  ether.printIp("Server: ", ether.hisip);
 
  timer = - REQUEST_RATE; // start timing out right away
}

void loop()
{
  ether.packetLoop(ether.packetReceive());
 
  SoftwareSerial RFID = SoftwareSerial(rxPin,txPin);
  RFID.begin(2400);

  if((val = RFID.read()) == 10)
  {   // check for header
    bytesread = 0;
    while(bytesread<10)
    {  // read 10 digit code
      val = RFID.read();
      if((val == 10)||(val == 13))
      {  // if header or stop bytes before the 10 digit reading
        break;                       // stop reading
      }
      code[bytesread] = val;         // add the digit       
      bytesread++;                   // ready to read next digit 
    }

    if(bytesread == 10)
    {  // if 10 digit read is complete
      Serial.print("TAG code is: ");   // possibly a good TAG
      Serial.println(code);            // print the TAG code
     
      if (millis() > timer + REQUEST_RATE) {
    timer = millis();
    Serial.println("\n>>> REQ");
    ether.browseUrl(PSTR("/"), "frizzbar.php", website, my_result_cb);
  }
    }
    bytesread = 0;
    delay(5000);                       // wait for a second
  }
}

The contents of the page is only 1234 and I would like to put it into an variable which I can compare.
28  Using Arduino / Networking, Protocols, and Devices / How to process information from Ethercard on: January 17, 2013, 12:13:30 pm
Hi,

I setup the Ethernet card with the Ethercard library. It prints the page content including the header too my serial screen. However I need to capture a piece of the page and compare it to a code inside the arduino. I don't know how to process a part of the page result.

I've done the google and arduino search but maybe I'm looking the wrong way.

Someone here who can help me?
29  Using Arduino / Project Guidance / Re: Project Frizzbar; secure web send on: January 13, 2013, 01:56:22 pm
No, security isn't worth a lot of money to me. It is however worth the effort and challenge. So, its a soda machine run by and for friends so I am not that scared it will be abused.

I do like your suggestion. I guess its also possible to fill the EEPROM with random data (copy the data to my webserver securely) and use that to code and encode data I transmit.
30  Using Arduino / Project Guidance / Re: Project Frizzbar; secure web send on: January 13, 2013, 11:48:05 am
Move to a hardware platform that can support security features.

Let's assume for the discussion that this is not possible.

One of the ideas I had regarding this is the use of a SB70 LC (Serial to Ethernet adapter). This support SSL encryption and I believe it can be connected to an Arduino. But this costs another $59, so I am looking for a cheaper solution.

Another brain jump is that I only accept messages from the IP the server hosting the php file. That way not some malicious person could simply send info to the arduino, on the other hand Its possible to spoof an IP adres.
Pages: 1 [2] 3