Hello everyone,
First, I would like to give the list of equipments I have: one Arduino Uno R3 and 2 ARM-S model advanced radio modems of ATIM.
My aim is to send commands from a remote computer via the modems. I am now studying on a very basic application: controlling the angle of a servo motor. While the modems have RS232 interface, I am well aware that Arduino has TTL interface. For this reason I have constructed the circuit given in MAXIM website [1] on a breadboard using MAX232 and capacitors of 1 uF to provide the necessary conversion. I have connected RX and TX of Arduino to the inputs of the circuit (namely pins 11 and 12 of MAX232) and the outputs of the circuit (namely pins 13 and 14 of MAX232) to 2nd and 3rd pins of RS232 interface of one modem. I would like to remark that I didn't forget the ground connections. Hence I have established the connection between Arduino and one of the modems. Then, I have connected the other modem to my remote laptop using an RS232-USB converter. Initially voltage supply is provided to Arduino by connecting it to my desktop computer (not my laptop) through USB port. Under this condition every is smooth. When I send a value from serial monitor on my laptop, it is retrieved by Arduino without any problem. However problems start to appear when Arduino is fed by any external voltage supply other than my desktop computer. When I use an adaptor of 9 V the data sent by Arduino is corrupted and I was unable to send any data from my laptop. I thought this was because of inappropriate baud rate (in the beginning I was using 9600 baud). I change the baud rates of Arduino and the modems and conducted experiments. When I increased the baud rate, the number of corrupted data sent decreased. However I was still unable to send any data to Arduino. Later I started to think that the reason behind this failure is poor voltage supply. I used power supply, battery and iPhone adapter one by one and this time data is purely sent to Arduino. Yet again I failed to send data to Arduino from my laptop with any baud rate. It is quite weird that RX pin seems to be deactivated when Arduino is not connected to a USB port. As a final resort I have used Software Serial library to carry the data transmission to the pins 10 and 11. Unfortunately, there was no change. I believe that there is no sense in carrying and using Arduino with a computer not to face a problem. Here is the simple code piece I have written in case I have forgotten some point:
const int outPin = 9;
int sensorValue = 0;
String inString = "";
int AnalogValue = 0;
int AnalogValue_old = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
while (Serial.available() > 0) {
int inChar = Serial.read();
if (isDigit(inChar)) {
inString += (char)inChar;
}
if (inChar == '\n') {
if (inString.toInt() <= 255 && inString.toInt() >= 0) {
AnalogValue = inString.toInt();
AnalogValue_old = AnalogValue;
}
else {
AnalogValue = AnalogValue_old;
}
Serial.println(AnalogValue);
inString = "";
}
}
analogWrite(outPin, AnalogValue);
delay(1000);
}
Here I intend to convert the data sent from my laptop (a number between 0-255) into a voltage between 0-5 V on pin 9 and see the voltage on a multimeter. I am concluding this post with my questions. What is the connection between RX and power supply from USB port? Why cannot I send data to Arduino when I feed it with an external source? How can I overcome this problem? What am I missing? I would really appreciate if you could help me out. Thank you.
Best regards,
[1] http://datasheets.maximintegrated.com/en/ds/MAX220-MAX249.pdf

