Receiving data problem with an external voltage supply

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

Why cannot I send data to Arduino when I feed it with an external source?

I don't know why you can not do this, it is a perfectly normal thing to want to do and it does work. But you are finding that your setup does not work, therefore there is something wrong with your setup.

What you describe your set up to be sounds reasonable so that is not fundamentally the problem. So it looks like what you describe is not what you have.

In order to progress we would require a schematic of what you have, schematics are much easier to read than words and often it is easy to spot when something is missing on a schematic. Also we would require a clear well focused photograph showing the way you have wired this schematic so we can check the two agree.

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.

You will need an RC filter on that pin before a meter will read correctly.

It is very hard to make sense of your enormously long paragraph. Short paragraphs are much easier to read and assimilate.

I think I saw somewhere a reference to a 9v battery. The PP3 type of 9v battery is not suitable as it can't provide enough current. Try a pack of 6xAA cells.

Your code is short (which is good) but you have the receiving of the data and the control of the calculation of the value for analogWrite() all mixed up like muesli.

Have a look at the examples in serial input basics. Receive all the data before you try to make use of the data. That makes it much easier to debug problems.

...R

Hi. What is your 9V supply, can you post a picture of it and its specification plate/sticker.

Thanks Tom.. :)

I think I saw somewhere a reference to a 9v battery.

But he said:-

When I use an adaptor of 9 V

Which I took to mean a mains powered supply. But yes if it is a battery that could be a problem.

Grumpy_Mike: But he said:-

That is the problem with the OP's loooong paragraph ...

...R

Hi,

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:

phew......

Tom... :)

TomGeorge: phew......

Even after your sterling effort it is not going to win the Booker prize :(

...R

I am really sorry for my belated reply.

  • The pictures of the circuit I’ve made in different views are called Circuit 1 to 5.
  • I’ve constructed the circuit in Proteus for a better view in case of a possible visual confusion. The picture is called Arduino - MAX232 (Proteus).
  • The battery I’ve used as an alternative power supply is given in Battery.
  • Lastly the pin diagram of my modem is given in ARM-S.

I’ll be careful about long post issues in future. I just wanted to make sure to provide all steps I’ve taken so far.

Arduino - MAX232 (Proteus).PDF (33.7 KB)

But no schematic as requested in reply #1

Post the images in this Forum. Don't expect people to go to another website to view your pictures.

...R

Hi, If you use REPLY rather than QUICK REPLY and it has an attachment facility, so you can post your files as an attachment, but try code tags first.

Tom... :)

I edited my last post. Thank you for the heads up about the images.

Grumpy_Mike: But no schematic as requested in reply #1

What do you mean by schematic? I gave a reference to MAX232 website. Once again I am giving the reference. I constructed the same circuit on page 1 (maybe not the same, I put 2 LEDs and 2 resistors additionally. However the idea is exactly the same). http://datasheets.maximintegrated.com/en/ds/MAX220-MAX249.pdf If this is not what you wanted, please enlighten me because these are all I've got and I have nothing left to share.

fimbulwinter: I edited my last post. Thank you for the heads up about the images.

What do you mean by schematic? I gave a reference to MAX232 website. Once again I am giving the reference. I constructed the same circuit on page 1 (maybe not the same, I put 2 LEDs and 2 resistors additionally. However the idea is exactly the same). http://datasheets.maximintegrated.com/en/ds/MAX220-MAX249.pdf If this is not what you wanted, please enlighten me because these are all I've got and I have nothing left to share.

Those additional resistors and led, how are they connected? Thats why you should provide an exact schematic.

Actually I drew the whole circuit in Proteus and presented the output here. So you can see the LEDs and resistors in the relevant file.

Pin7/13 seems to be wrong in Proteus, but the wiring seems to be ok.

The supply cap needs to go close to the IC (pin 15, 16), not at the other end of a wire.

You can find many posts here of people having problems powering an Arduino with a 9volt PP3 battery. Leo..

Hi,
I’m not sure if you have the correct TX/RX connected to the MAX232 pins.
The attached image shows how connections should be.

Tom… :slight_smile:

max232_serial_microcontroller.gif

fimbulwinter: Actually I drew the whole circuit in Proteus and presented the output here. So you can see the LEDs and resistors in the relevant file.

And what is some one to do that not only doesn't have Proteus but has no idea what it is. I assume it is some sort of simulator, but a google of the word "Proteus" did not reveal anything that could be that on the first two pages.

If you want to engage the maximum number of people do not assume every one has the software you have and don't expect them to go off to other sites looking for your stuff.