Loading...
  Show Posts
Pages: 1 [2]
16  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.
17  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?
18  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.
19  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.
20  Using Arduino / Project Guidance / Project Frizzbar; secure web send on: January 13, 2013, 11:08:24 am
After solving my first problem with the coin acceptor a new mission comes up.

The plan is to use a RFID reader to identify a chip. The unique chip code should be send to a webserver which checks in a SQL database if the chip still has some credit (if so withdraws "1") and then returns a "Yes" ( - if a credit could be deducted) or a "No" ( - if the rfid chip wasn't recognized or has less then 1 credit).

This seems not the most difficult thing to do, however since it is used as a payment gateway using plain HTML isn't secure. I'm afraid that by reading network information on the local network the arduino is on someone could be able to reproduce an answer and send the "Yes" to the arduino without the script on the webserver even being touched.

Ofcourse SSL/TLS is not available for the arduino uno so what would you do to do this?
21  Using Arduino / Project Guidance / Re: NRI G.13 - Drinks machine on: January 13, 2013, 10:59:45 am
Unfortunately I don't have access to a scope but I have solved this issue outside the arduino so that I only have to use a relay to achieve what I want to do. Not a real neat way to do it, but it will suffice.

Thanks for all the advice and information given. Maybe in the future when I am more able with arduino's sdk I'll take another attempt at cracking the puzzle.
 
22  Using Arduino / Project Guidance / Re: NRI G.13 - Drinks machine on: January 11, 2013, 06:36:19 pm
As a side question, would it be possible to catch this on one pin (using pulsein) and then too just forward it to another pin with pulseout?
23  Using Arduino / Project Guidance / Re: NRI G.13 - Drinks machine on: January 11, 2013, 06:18:50 pm
My pulseIn program gave the following values:

around 10124 microseconds when euro has been inserted
around 9831 microsecond continuous so constant without euro.

So these are the values I have to use is 9.8 constant and then 10.12 when I insert a coin / push the button?
24  Using Arduino / Project Guidance / Re: NRI G.13 - Drinks machine on: January 11, 2013, 06:10:00 pm
So, normally I would have an interval of 9 milliseconds and on the push of a button it should need 10 milliseconds?
25  Using Arduino / Project Guidance / Re: NRI G.13 - Drinks machine on: January 11, 2013, 06:01:16 pm
What I've done to get the values:

I've used pulseIn to read the pulse the coin acceptor generates:

Code:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  pinMode(pin, INPUT);
}



void loop()
{
  duration = pulseIn(pin, HIGH);
   Serial.println(duration);
   delay(50);
}

It gives a long list of

9960
9899
9927
9932
9966
9892

And when I enter a euro (coin acceptor) it gives:

9928
10098
10124
9831

26  Using Arduino / Project Guidance / Re: NRI G.13 - Drinks machine on: January 11, 2013, 05:53:12 pm
I've read the output from the coin acceptor.

It's 100Hz normally and when you insert a coin it drops to 90Hz for a few milliseconds.

So I need to emulate this behaviour, from what I've read, PWM output should be the way to go.
27  Using Arduino / Project Guidance / Re: NRI G.13 - Drinks machine on: January 11, 2013, 05:43:39 pm
Yep, but haven't I done that by giving analogWrite 56?
28  Using Arduino / Project Guidance / Re: NRI G.13 - Drinks machine on: January 11, 2013, 05:39:55 pm
Yes and PWN is set between 0 and 255 right?

Zo 111Hz would be 56 value?
29  Using Arduino / Project Guidance / Re: NRI G.13 - Drinks machine on: January 11, 2013, 05:31:15 pm
Well even though it would be easier if someone did it, for me it would be better to learn it.

I've come up with this code:

Code:
void setup()

{

  pinMode(10, OUTPUT);   // PWM output right

}



void loop()

{

   analogWrite(10, 56);  // 56=111Hz ??


}
30  Using Arduino / Project Guidance / NRI G.13 - Drinks machine on: January 11, 2013, 05:04:21 pm
Hey Arduinousers,

We have an old can machine which uses a NRI G13.6000 (flat cable ribbon serial) as a coin acceptor. Now I need to trick the machines relays board to think that a payment has been made.

The NRI has several output channels, but the one I need (channel 8) sends out a pulse to the board. I need to emulate that Pulse with the push of a button.

This is the description of the output channel of the NRI:
Quote
NPN 100ms 10mA active low w/ 47K pull-up to +5V

Is there anyone who knows how to pull this off?

Moderator edit: Smiley removed
Pages: 1 [2]