Web Server in a box?

I bought a Silicon Chip Web server in a box kit today, and put it together. It has a RS232 output, on a 3 pin header: RX, GND, TX

I connected GND to Arduino GND, TX to Arduino RX, and RX to Arduino TX.

The web GUI for it has the option to send strings, strings with newline, and decimal character code.

I have setup the Arduino to just echo back anything it recieves:

void setup() {
  Serial.begin(115200);
}
void loop() {
  if (Serial.available() > 0) {
  Serial.println(Serial.read());
  }
}

Baudrates on both sides seem fine.

Here is the problem:

Whatever I send, seems to get translated into a bunch of numbers. If I send 1 thru to 10 thru the decimal character code option, it gives me:

127
63
126
31
125
62
124
15
123
61

Sending it 1 - 10 thru string with newline:

103
121
61
179
222
15
102
121
61
89
222
15
101
121
61
178
222
15
100
121
61
172
235
0
99
121
61
103
86
235
0

abcd with string and newline:

79
121
61
167
222
15
78
121
61
83
222
15

If I send string without newline, I only get single values.

1 to 13:

103
51
102
25
101
50
100
12
99
103
6
103
103
103
51
103
102

a - z (lowercase) without newline:

79
39
78
19
77
38
76
9
75
37
74
18
73
36
72
4
71
35
70
17
69
34
68
8
67
33

The numbers seem consistent. Like, if I keep sending it the same value, it keeps giving me the same value, I just don't know what the values mean ...

Cheers, Dan :)

blablabla...

Use...

Serial.print

... instead of

Serial.println

... and the letters won't be one to a line. How things go when you get to the end of a line... you'll see. Might be a problem. Might not be.

=== You said...

I bought a Silicon Chip Web server in a box kit...

Where? What did it cost? (Please!)

Thanks :)

Still seem to have a weird problem, the letters don't match.

Sending "1" without newline gives me a "g" , and nothing else matches up either ..

:-? :-?

EDIT: Bought it from here (Well, local store): http://www.jaycar.com.au/productView.asp?ID=KC5489&keywords=Web+server&form=KEYWORD

Cheers, Dan

Try this instead.

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

void loop() {
  if (Serial.available() > 0) {
    delay(10);
    while(Serial.available() > 0){
      Serial.print(Serial.read(), BYTE); // We need Byte format.
    }
  Serial.println();
  }
}

I love to find a way to store it in a value so it can be check by the script

Still seem to have the same problem :(

1 to 10 without newline:

g
3
f

e
2
d

c
g

-Dan

mmm is you send a msg to the arduino over serial trough the IDE it works perfect...

Wierd.

btw does it handle PHP?

I'm not sure if it supports PHP sorry ..

Was just reading thru the instructions and it says: "The levels are not true RS232 levels, but simply 3.3V CMOS levels"

May this be the cause of my problems?

EDIT: Nope, it's definitely an encoding issue :(

Here is A - Z (Caps) without newline:

95
47
94
23
93
46
92
11
91
45
90
22
89
44
88
5
87
43
86
21
85
42
84
10
83
41

Hmm, it seems that RS232 is inverted so it can be fed directly into a transceiver .. that could be my problem .. I don't really want to have to buy an IC for it though :(

Cheers, Dan

Quick thought... maybe wrong...

If you XOR the bytes with $FF that might solve your problem. Or not... the serial port may not be able to read the data as intended as the "space" between bytes may be lost in the inversion.

Hardware signal inverter not a BIG deal if it comes to it. This I KNOW. Someone more knowledgeable than I may be able to supply a simple answer... maybe just a strategically deployed transistor....?

Heh screw it, I’ll just pick one of these up today: http://www.jaycar.com.au/productView.asp?ID=ZK8824&keywords=MAX232&form=KEYWORD

Cheers,
Dan

Ok, I got the MAX232 here.

Now, I'm kind of stuck on how to wire it up. The chip seems to have internal voltage doublers/inverters .. which I don't think I need since the 5V is required for the Arduino, but I don't get anything thru the serial port.

Could someone please help me in wiring this up?

Cheers, Dan :)