I built a simple led and buzzer box with lots of buttons for my toddler. The intention was to power it with a short cable and powerbank.
The prototype made with an Uno on a breadboard works fine.
However, the final version only works when the USB cable is plugged into my laptop. When I plug it into any of my power banks I can see the power LED is on on the nano board but none of the buttons respond. Does the micro USB of the nano require a different input voltage or something? Something the laptop will output but the power banks don't?
Note as mentioned, these banks work fine with the Uno, and don't have any low current or auto sleep cut offs that I've found so far.
sounds like a ground plane issue. Are are the buttons, nano and power bank connected to a common ground. Does the power bank go into the USB port or Vin? How about a simple schematic?
Sorry about the poor schematic, I'm not sure of the proper symbols for everything.
The switches use the internal pull up resistor called via the EZButton library.
All 6 switches have the ground soldered together, which goes to a line on the veroboard. Also connected to that ground line is the ground for the speaker and the ground for the LED. So that all ends up on a single pin.
I've soldered male headers to the wires and female to the veroboard as I figured that would allow for me to take the top off easier. I guess something could be loose but I don't understand why it works on the laptop but no other power sources?
Which basically tell the mcu to do ; (blank statement, or, nothing) when Serial is not opened. And since Serial is only opened when you connect to a computer, it won't do anything.
Also, remember to configure the button input pins to "INPUT_PULLUP".
Thanks both. I've tried commenting out all my Serial things (I didn't have any in while loops but did have some in IFs and FORs). Didn't make a difference.
This is a clone Nano. I've just looked at the specs on the traders website and noticed the recommended input voltage is 6-9v....whereas all my powerbanks output at 5v.
Atmel ATmega328
CH340G USB Chip
Onboard 5V 800ma Regulator IC
Onboard 3.3V 500ma Regulator
Operating Voltage (logic level) 5 V
Input Voltage (recommended) 6-9 V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 8>
DC Current per I/O Pin 40 mA
Flash Memory 32 KB (of which 2KB used by bootloader)
I hadn't found much before that suggested this was a common problem, but I've since found several threads which have shown other people have had the same issue.
Some suggest adding a delay at the very start of the code to allow the board to stabilise power. I've tried this and it made no difference.
Hitting the reset button on the nano board itself, seems to fix the issue, at least until I unplug power and then plug the power back in. As a workaround I've added a small pushbutton connected to Ground and the RST pin, so now at least once everything is hooked up I can press the button and it works correctly.
In terms of the hardware, I've pinppointed that it's something to do with the LED. I systematically reconnected everything, checking if the issue reoccured after each connection. The project was totally fine with all the switches, but as soon as I connected any of the RGB LED pins (the Ground was fine) the issue reoccured.
Schematic wise, I have the RGB pins connected to digital 5, 6 & 7. From there each wire goes to a female header on the vero board. Each row has a resistor, the other end of which is connected to an RGB pin. The Ground pin goes back to the GND pin on the Nano. I don't see why this would cause an issue, and this occurs even when I use an example sketch that doesn't utilise pins 5,6 or 7?
The resistors are 220,470 and 1k ohm to try and balance the different outputs of the 3 colours (green was super bright).
The power banks I've used have worked fine on the Uno, and are low current with no auto cutoff as far as I can tell. Also, the issue occurs when plugging rhe USB cable into a USB wall socket too.
And finally, why would connecting an LED up cause the issue? Surely if anything it would add to the current draw?
Yes, though my electrical knowledge is very very slim so when I use it it tends to end up being a case of poking different things to see if it beeps, or seeing if there's 0v or 5v.
If you have a particular idea in mind I can give it a go though!
And that is total nonsense. Said "trader" has no electronics competence whatsoever and is parroting sadly confusing information from the archaic Arduino website.
You are advised to avoid using "Vin" to power most Arduinox.
You need a good 5 V power supply, connected to the "5V" pin and of course, ground.
cdr_xavier is likely to be correct and the problem is somewhere in your secret code.
One might expect the same problem as the "power bank" if it is plugged into a mains "USB phone charger". Surely you have one of those?
cdr_xavier is likely to be correct and the problem is somewhere in your secret code.
The code isn't secret, I'd originally posted it, but there's a lot of it so I removed it to keep the thread cleaner once I'd discovered it was not code related, given the simple "Blink" example exhibits the same issue without any modifications.
One might expect the same problem as the "power bank" if it is plugged into a mains "USB phone charger". Surely you have one of those?
Yes. I have tried two different power banks, and a cob LED floodlight that also can output as a bank. I have also tried two different USB phone chargers, one of which is a high power/fast charge unit. I have also tried dirrectly plugging into a wall socket with built in USB port. Same issue on all of them.
I feel that either this issue is down to the board being a funky clone unit, or something specific with my LED wiring or the LED itself, given that everything functions correctly when the LED is not connected (I.E. My circuit is all wired but I try to run Blink... No LED connected and the internal LED runs... Hook up the LED and the power light comes on but the internal LED remains unlit.) . Given the simplicity of the LED wiring, I am edging towards the board, as I have had some issues with the code uploading, several AVRDUDE errors and references to flash memory not being accessible:
Sketch uses 5158 bytes (16%) of program storage space. Maximum is 30720 bytes.
Global variables use 540 bytes (26%) of dynamic memory, leaving 1508 bytes for local variables. Maximum is 2048 bytes.
An error occurred while uploading the sketch
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avr_read(): error reading address 0x0000
read operation not supported for memory "flash"
avrdude: failed to read all of flash memory, rc=-2
avrdude: stk500_recv(): programmer is not responding
I've used the Uno and these powerbanks for past projects without issue. That's including the prototype of this project which as far as I know is a replica of the final version, the only differences being related to using a breadboard and not a veroboard. It functioned fine using my main two banks.
I think next time around I'll not skimp on the board and get a genuine one. Will save a lot of headaches.
And in case the thought was that I'd unintentionally created a solder bridge, here's a closeup of the button soldering and the LED area. I've still got a lot to learn with soldering, but I don't think there are any shorts here!?