Nano Sketch Uploads Via USBasp/USB but wont run when powered by 12V -> 9V

I know that the firmware for the USBasp programmer needs an upgrade but the code uploads to the Nano without issue, if im looking at the logs correctly, but when I hook it up to 9V (VIN) the Power light is on and steady but nothing triggers when I press a button.

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: reading input file "C:\Users\Innov\AppData\Local\Temp\arduino_build_451035/EAL_MK4_Code.ino.hex"
avrdude: writing flash (1808 bytes):

Writing | ################################################## | 100% 1.30s

avrdude: 1808 bytes of flash written
avrdude: verifying flash memory against C:\Users\Innov\AppData\Local\Temp\arduino_build_451035/EAL_MK4_Code.ino.hex:
avrdude: load data flash data from input file C:\Users\Innov\AppData\Local\Temp\arduino_build_451035/EAL_MK4_Code.ino.hex:
avrdude: input file C:\Users\Innov\AppData\Local\Temp\arduino_build_451035/EAL_MK4_Code.ino.hex contains 1808 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.95s

avrdude: verifying ...
avrdude: 1808 bytes of flash verified

avrdude done.  Thank you.


Note in advance: nothing is urgent.

May we assume that your sketch runs correctly when powered over USB?

What is the 9V source? A PP3 battery? Those are quite useless in general as they can't deliver the needed current, especially if you have anything more connected than a simple button.

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project :wink: See About the Installation & Troubleshooting category.

It does yes

The source is a 12V running through a 9V 1A regulator

and this has worked when i used the Mini B port to program (Which has been de-soldered due to the nature of the project) and then powered by battery

Well then, you are doing it entirely wrong. :roll_eyes:

The Nano specifically operates on 5 V. You need a (switchmode) 5 V regulator, to power it by the "Vcc" pin. That is the only proper way to power it for any serious project. :face_with_raised_eyebrow:

But I have the prototype Running off the exact same regulator and it works perfectly

What is there to prototype on a Nano only? Or is there more which you did not mention; especially, is there anything that is powered from the Nano's 5V pin? Remember that the 5V pin can hardly provide any power.

And that prototype uses the (physically) same components (same Nano, same whatever)?
What are the differences between the prototype and the setup that you're now talking about (e.g. breadboard or stripboard vs PCB)?

You will need to provide as much detail as possible; schematics will help (as well as PCB layouts if applicable).

It might be getting outside my area of knowledge but others might need that information.

I see what you mean, unfortinately i dont have access to the schematics and resources like that currently but the Prototype has the exactly the same parts as the new model with a few small mods, So both running Nanos and the same 9V regulator hooked up the the VIN pin not the 5V pin.

Update: Blink Works when Uploaded via ISP but still nothing when uploading my actual Code

Hi, @Ashlord24
Why are you using ISP on a Nano, can't you use the USB cable to program like most users?

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

Which might be very relevant.

For me, it sounds like a power problem. But nobody will know till we have a full description of and information about your project.

Sorry for the late update, I had lost internet but the information is below

const int BUTTON_PIN = 4; // Arduino pin connected to button's pin
const int RELAY_PIN  = 5; // Arduino pin connected to relay's pin
const int RELAY_PIN2  = 3; // Arduino pin connected to relay's pin

void setup() {
  Serial.begin(9600);                // initialize serial
pinMode(BUTTON_PIN, INPUT); // set arduino pin to input pull-up mode
pinMode(RELAY_PIN, OUTPUT);        // set arduino pin to output mode
pinMode(RELAY_PIN2, OUTPUT);        // set arduino pin to output mode
}

void loop() {
  
  if (BUTTON_PIN, LOW) {
    digitalWrite(RELAY_PIN, HIGH); // turn on
                      }
    else {
    digitalWrite(RELAY_PIN, LOW);  // turn off
         }
/********************************************************/         
  if (BUTTON_PIN, HIGH) {
    digitalWrite(RELAY_PIN2, HIGH); // turn on
                      }
    else {
    digitalWrite(RELAY_PIN2, LOW);  // turn off
         }
  }

Unfortunately i don't have any schematics to post yet but An Arduino nano is being powered by a 9V 1A regulator (From 12V) on the VIN and GND Pins, a remote Switch is hooked up to pin 4, powered by the 12V before the regulator, two 5V relays are on 3 and 5. Other than that it is a simple dual relay control that switches between them

I hope this helps cause I've got a new board with the USB and the same thing happens

Hey @TomGeorge

Originally I plan to remove the USb port and use the ISCP cause of the way its mounted int he case, but worse case scenario I'm gonna have to use USB but nothing seems to work.

If an Upload is made using ICSP, the I/O Board's bootloader is overwritten.
(From that point it cannot be Uploaded to via USB till the bootloader is Uploaded to it again.)

Yeah, I have re burned teh bootloader several times and still the same issue. blink both ways works perfectly but this code just doesn't want to run for some reason

Is it a Nano or a Nano_Every or Nano_something else?
With this 9V at VIN -- does the on-board power LED light?

Its a normal Nano V3 as seen on the board (https://www.jaycar.com.au/duinotech-nano-board-arduino-compatible/p/XC4414)
It does yes, lights up as bright as when its plugged into USB

Then everything should be a go.
Unless you're holding Reset low.
Upload a "blinks pin13 LED" sketch. Does that go ok?

Yeah Blink on PIN13 works perfectly
stupid question, what do you mean by reset low?

So it's established that the Blinkpin13 sketch works with the Nano running from your VIN ?

Yep