Mega and Nano serial communication issues on power up

Im hoping for a little help with a project I have built.

Im not totally sure this is in the right category, but this seems the best place to start!

Background:
We have built a large Lego model for display at shows and part of that is lighting and interactivity.

The build is split into smaller transportable sections (modules) so each module gets its own controller. I am using classic Nano's for this task and am controlling them all from a master using a Mega2650. The Nano's seem sufficient as all we basically have are LEDs for lighting and certain effects (such as fireplaces, UV glow etc).

I then have 2 button packs (1 front and 1 back) with 4 buttons and 4 LEDs.

The master has a RTC board and a DFRobot mini mp3 player board.

Its all being powered from a large USB power bank, 5V, 4.2A, 30000mAh.

All the modules share Serial3 - they only receive data and dont reply. Each module is using Nick Gammons modified SoftwareSerial RX only library.

The button packs are using Serial1 and Serial2. These are also using SoftwareSerial but with both TX and RX.

The basic principle is the master looks for data on either Serial1 or Serial2 which corrosponds to a button press. It then tells the buttons to control the LED (flash on the one playing, turn off the rest), the DFRobot plays the corrosponding MP3 file, the model then dims all the lights in the build apart from the one thats been pressed. When the master receives the 'finishedplaying' message from the DFRobot, it resets all the modules back to a waiting command (light back up, buttons stop flashing etc) and then sits monitoring the button Serial again.

This all worked great most of the time with my prototype rats nest wired up version thrown in a box.

We have added some more to the Lego and I thought it might be time to make a decent version of the master, so its all been made neatly on veroboard. This is where my problems have really begun..

The problem!

Some times when I plug the USB powerpack in everything switches on great and away it goes.
Some times when I plug the USB powerpack in, it switches on then after a few seconds it stops responding.

An unplug and plug in may or may not solve this.

If it does great, if it doesnt then the only way that I can seemingly fix the problem is to take a section off the build at a time till it starts responding, then reflash the code onto the 'affected' arduino and then put it all back together and it works again.

Its almost as if somehow the serial RX line is getting stuck on the affected arduino and repogramming it releases it? What I cant figure out is whats causing the initial issue.

I also noticed that during the times when its not responding the DFRobot seems to break too.. I get SD card not found and timeout errors. Which to me is extremely odd as thats running on SoftwareSerial not hardware serial. Even odder is that this is on the master running the Mega2650 and I have never had to reflash it only the smaller modules in the build.

I've tried a few things already:
I added big capacitors to the extreme ends of the bus incase it was voltage drop etc.
I've tried different USB powerbanks - which it does seem more stable on a smaller bank I have, but it did still glitch.
I shortenned the interconnect leads as far as I can (but it was previously working with long leads).
I moved the USB speakers to a different powerbank (in case it was some weird interference).

I originally used I2C for the whole build and it was really awful and I kept getting major problems with it not responding, thats why I swapped to serial and I managed to use it successfully for a number of shows with only non electrical issues!

I have included the circuit schematics in the hope that someone has an idea on what to try next.




The only thing that I can see is that I am using the 5V output (which is coming directly from the USB powerbank) to power the rest of the build, and then it is being fed back into the 5V pins of the Nano's. As a final last resort tonight I am tempted to swap the power on all the Nanos to VIN and using a higher voltage, such as 12V, just means instead of a nice handheld powerbank I am going to have to lug around a bigger battery (as a lot of shows dont have mains hook up).

Please try to be clear and explain when this problem FIRST occurred. What has been changed since then? What was the change that started the trouble?

1 Like

This occurred when I first swapped my master controller onto a veroboard. Exactly the same circuit layout just instead of using soldered wires between everything it's soldered to the board.

I have now found after some tinkering that when the nano that causes the issue is having its problem the voltage is being pulled down on the supply line.. like it is shorting out the RX line to ground and pulling everything down with it.

Ok, so further interesting info..

I think my setup doesn't like the powerbanks. When running from a USB port everything seems to work correctly.

I have also found that the flashing my code back into the affected nano is not necessary, I had a crash earlier and I got fed up, unplugged it from the power and after a while I came back and i just tried reconnected it and everything is working again.

I'm wondering if somehow the voltage from the powerbanks are not staying stable etc and it's causing the softwareserial library to glitch which is pulling down the RX line and after a power down for a while it clears again.

You will need to monitor the voltage with a volt meter, if that does not show it you may need a scope. If you can put something in the 220uF range on the power input to each module, not sure it will help but it will not hurt.

Hey, thanks for your help with this.

I checked the voltage at the end of the bus. The 5v line was dropping to about 3v, so I then went back and checked it at the beginning of the bus and it too had dropped to 5v.

I genuinely wouldn't believe that the 30Ah battery pack would drop the voltage, especially when it's digital display was showing 90% charged, 0.8A output at 4.95V

I replaced it with an 18V Makita battery pack and a USB adapter and boom it's working exactly as it should do.

After reading more on the battery pack and checking the product sticker on the back it uses a 3.6V battery and steps it up, obviously not very well!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.