Arduino NG project questions

Greetings,

I'm not sure if anyone's familiar with the Arduino NG rev C anymore, it's the only Arduino I have left in my kit and I'm finally putting it to use.

It's been a while since I've done an Arduino project, and I'm running into some problems that I'm thinking might be specific to this old board... But maybe it's just me missing something (as usual), so please excuse me if this is the case, and these are silly questions...

It's a simple digital pin high/low sketch on a timer. It works only after I upload the sketch to the board, and not when I power on the board afterward (hopefully that's clear). For the sketch to run, I need to upload to the sketch to the board every time.

  1. Can anyone tell me if there are there lines of code that I can put in my sketch that will make the board run the program when it's just plugged into power?

  2. I'm trying to run a relay from the digital pins, but have noticed that the voltage drops from 5v to 2.8 (or something) when the relay is attached. Is the relay demanding too much current from the board and the voltage is dropping? This happens on both USB and 9v external power sources.

--

The sketch is simple

Thanks in advance for any help, and thanks for reading.

At1: if you leave the sketch as it is and disconnect the relay, the builtin LED should blink (if not, replace 13 with LED_BUILTIN).

At 2: Yes, you cannot drive a relay from Arduino pins or from the 5V pin. You need a separate power source!

Thanks!

So the board is faulty if it's not running the uploaded code when powered up?

What does that mean - exactly?

So this sketch makes pin 13 output 5v for one second at a time. This will happen after I compile then upload the sketch to the Arduino.

If I then unplug power from the board, then power it up again, it does nothing.

My understanding is that arduinos are designed to run the sketch when they're powered up, but maybe im wrong, and I need to do an additional step for this to happen.

"Unplug power"? Does that mean the USB cable?
If you Upload a sketch it does not go away.
It cannot run and then not run.

So the upload is 'successful' and it will run immediately after its been uploaded to the board. But when the USB cable is unplugged, then if I replug the USB cable it does not run. Same if I am using external power.

I'm thinking maybe I'm using the wrong 'programmer'? See the error code in the screenshot...

...or there's a trick to do this with the old boards, like you have to trigger the function with a trigger or something?

You need to investigate "code tags".
We don't do with screenshots of error codes or the program (anything in the IDE that way).

ArduinoNG, an unfortunate appellation that.

Post Edit --
You need to choose the right Port too --

Happy to oblige the code tags (hmm.. Not sure if I'm doing this correctly. Forgive me this time, it's late here

int ledPin = 13;              // LED connected to digital pin 13

void setup() {
  pinMode(ledPin, OUTPUT);    // sets the digital pin as output
}

void loop() {
  digitalWrite(ledPin, HIGH); // sets the LED on
  delay(1000);
  //delay(10800000);                // 3 hours
  digitalWrite(ledPin, LOW);  // sets the LED off
  delay(1000);
  //delay(75600000);                // 21 hours
}

Thanks for the tip on the port. I think this is correct but I'll try again.

What do you mean about the NG being unfortunate? It was a bad board?

You found the code tags.
Do the same for the error message.
They don't do a trial upload, something that doesn't take. If it uploads it's there till something else get uploaded.

Unfortunate Name, perhaps less-than-propitious?
(NG == No Good)

Your screenshot in post #1 suggests the upload was not successful.
Is that still the case?
For troubleshooting it is very important to know where things go wrong.
Step 1. Compile
Step 2. Upload
Step 3. Run
If you hit the upload button in the IDE, these steps will be performed automatically. The text in orange tells you what thing were successful and what things caused trouble. We need to know where things go wrong...
I.e. upload not successful:
Try another cable...
Or better: try another board. If that works, you know the cable and port settings are ok so the problem must be in your board.
So let us know where the process is stuck!

From your screen output I conclude that the program was not successfully uoloaded...
...your settings may be wrong, your cable may be wrong and or your board is faulty.
Best way to test your cable and settings is to upload to another board.

Once that is done you could perform some simple tests: is the 5V pin at 5 V???

It should show up in DeviceManager as a COM port.

That would also be a good sign... at least it would rule out that the cable is charge only ...

Hah! Was this the idea behind the name? Or you're joking about this?

Thanks for the suggestions. I'll try troubleshoot the problem again today, after some sleep and report any success.

Ok, so not sure exactly what I did to get the progress I have, it'll be one of the things that I'll list later on...

Goal--

  1. To get the sketch to run from the 9v power source and not usb power.

a. I have tested after getting no errors in the upload proceedure, that the sketch runs on the board with usb power from a power bank (not computer) so that might rule out... something... (useless info maybe)
b. The board will power up from the 9v power source, but wont 'do it's thing' unless a usb power source is connected at the same time, then I can remove the usb power source and it'll continue to run.

I'm starting to think witchcraft is the most likely solution. But perhaps more deducable hypotheticals would be more helpful... Ideas?

Edit Things I did.
Moved to from OSX to windows. Set the programmer to AVR ISP. Held my tongue 'just so' inbetween my left and right ring fingers.

Thank you for your kind reply. I can confirm 5V from the 5V pin whilst on ext power

And have found better success uploading the sketch without errors on windows.

Project note: If nobody can tell me how to fix the problem (I'm guessing its really simple, and I'm just being a fool (once again)), I'm going to solder-bridge from 5v pin to the power points on the USB port. Gogo hacky solutions (my usual standby for getting such projects done).

people should hire me for professional projects :wink: