Nano outputs garbage when using analog output

Have plugged in many nano boards all the same. The output seems to be fighting with baud rates. Both sketch and program both have 9600 but the output to a 10K pot is garbage on the serial monitor. It is just a small program to print variable output of the pot. I have tried to change computers, comm numbers, analog pins. I have traced the voltage to the pot (0 - 4.7v) and all good but when it enters he board nothing. I have tried an UNO and fine. All of my nano's do the same thing. I have changed baud rates. Anybody have any answers?

Please read How to get the best out of this forum and follow the advice to be found there. Once you have provided the proper information needed to address your situation it is possible that useful answers will be forthcoming.

2 Likes

Please post a clear and sharp picture of your setup.

In short we need to see your code, and your schematic - even if it IS a simple circuit

How to make a schematic you can post. - Using Arduino / Introductory Tutorials - Arduino Forum

Without that info my best guess is that you are mistaking analog output and analog input.

1 Like

My one: forgotten to solder the headers on the Nano.

2 Likes

Analog output of a Nano is PWM (pulse width modulation) at either 2 ms or 1 ms per HIGH+LOW signal depending on which PWM pin used.

It's got nothing to do with baud rate as it's not serial. It's only fast enough to drive motors. 9600 baud bits are 1024 micros wide serial data with is NOT PWM at all.

So sorry i am new to this as I have exhausted all knowledge I know.

No pre soldered and happens on all my nano boards but thanks

Don't be selective to what you answer. Questions were asked.

We asked for a clear picture, a schematic and code.

Without that there will not be much chance that you will get sensible help.

1 Like

OK I have a small program that only looks at a 10K pot. I am trying to get an output that is readable. The enclosed diagrams show both sketch and physical diagram. I have tried all my nano boards with the same result garbage in serial monitor. I plugged in my UNO and all is good. I have tried changing baud rates, components etc. I have checked voltage from pot and is good 0 to 4.7volts. For such a simple program I don't get it. Maybe I need a resistor somewhere. This only happens with my nanos which I have many and plan to use instead of UNO's. Anyone have suggestions?


I'm thinking that the Not connected. Select a board and a port to connect automatically. message might be a clue.

1 Like

No this shot is the result of board that I removed don't mean to be a smartass but

A screenshot of code with a board that's removed? I think I'm done here. Good luck and good-bye.

How to read PWM? Not with serial! A servo can indicate it, a led can be off to full brightness when fed PWM.

If you want serial output, read the pot with Analog INPUT then print the value on serial.

You could have prevented van_der_decken's reply if you would have posted the code in accordance with https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966#use-code-tags.

Do you have a link for the boards that you bought? Did you use those boards in the past with success. Or are they new and not working as expected?

I already asked for a picture of your setup; there does not seem to be anything wrong in the schematic. I would also like to see a close-up picture of the processor so the print on it is readable. And lastly can you post and example of the garbage that you get; use code tags for it as well.

At both sides (Nano and Serial monitor) or only one of them? If you haven't tried yet, only change the baudrate in the serial monitor.

Does a simple sketch that only prints e.g. Hello World work as expected?

Not sure why you still think that this is about PWM?

1 Like

Thread title: Nano Outputs Garbage when using Analog Output.

"Have plugged in many nano boards all the same. The output seems to be fighting with baud rates."

Arduino Nano Analog Output is PWM.

Hi, @b1udnt50
Welcome to the forum.

What is your native language?

Thread title: Nano Outputs Garbage when using Analog Output.

I think you mean.

Nano Serial Output, is garbage when using analog input.

Is that correct?

Can you post some images of your project?
So we can see your component layout.
This is very important at this stage.

Do you have a DMM? (Digital MultiMeter)

Thanks.. Tom.... :smiley: :+1: :coffee: :australia:

1 Like

Point taken, I can see the confusion.

2 Likes

I tried the experiment.


My code (I refuse to use archaic baud rates)

/*
*read voltage on A0 with nano; 10k pot between 5V & GND
*/
#define potPin A0

void setup() {
  Serial.begin(115200);
delay(2000);

}

void loop() {
  Serial.println(analogRead(A0));
  delay(1000);
  Serial.println(analogRead(potPin));
delay(1000);
while(1);  //stop execution
}

data on serial monitor is stable and valid.
depending on your nano you may need to use the "old bootloader"
image

so we are left with bad connections, or a faulty nano. Have you tried a different analog input?

1 Like