I am using an Arduino Uno for a collision/obstacle detection module on a small automated guided vehicule.
The uno is powered through two 12V batteries connected in series (24v), we later use a power converted to get 5v for the Arduinos. the Uno uses a shield we made. Its single hardware RX/TX link is being used to communicate with a the slamtec A1M1 lidar module.
For this project, the Uno is just a slave device for a main Arduino Mega board. Since the Arduino Uno serial port is already used by the A1M1, then i opted for using two “classic” pins to make the mega <-> uno communication. With those 2 pins, I have only 4 statuses reported back: evering ok + presence of an obstacle in warning zone + in critical zone + A1M1 communicaiton error. It is therefore pretty hard to know what going on the Uno since we have no Serial communication and cannot really debug with USB due to te A1M1 <-> Uno communication.
I have been using this system since early July on 3 of those small vehicles. And for one of the them specifically, we noticed two strange behaviors:
- the Uno <-> A1M1 communication error rate much higher than the two other vehicles (from 0~2 errors per day versus 500+ errors per day. all errors randomly spread during the ~10h in the day when the vehicle is powered on).
- No Uno <-> A1M1 communication at all.
I fixed all issues #2 just by reflashing the Uno (I do that with the Arduino IDE). To be more precise, I unplug the A1M1 (so that the Uno reflash operation does not interfere with the A1M1), do the reflash using USB cable re-writing the same .ino file, then remove the USB clable and replug the A1M1.
I was really struggling with #1 until a few days ago, after changing ribbon cables one by one, after changing the A1M1, when I finally swapped the Uno entirely for a new one => errors were gone.
Yes i did check that GND are indeed connected. the A1M1 does accept 5V (but it needs additionnal power for its motors compared to what the Uno 5V pin can deliver, which is just fine.
Is there a way the Uno can “forget” its code because of the Serial communication that goes on pins 0 & 1 ? For instance because somehow the communication could trigger a “flash rewrite / flash erase” event?
(or reflash can only happen with USB port exclusively?)
I should mention that I always try to buy “genuine” arduino boards from “serious” shops (radio-spares and mouser in EU). I always keep myself away from arduino copies/clones.
It’s just fine if i had bad luck with one specific Arduino Uno board (it’s a Rev3 i believe, I can post serial number if required). My concern is that the observe behavior repeats itself over time due to a flaw in the design that I would have missed.
I do want to have two arduinos because i want to keep monitoring the A1M1 and a few switches on a bumper regardless of what the main code does (otherwise I would read the A1M1 from an available hardware serial port on the Mega)
=> under what condition can an Arduino Uno Rev3 “forget” its own code due to data going on pin 0 &1 ?
=> can a noisy 5V power produce an unexpected behavior on Arduino Uno that could explain the observations? (i will check with an oscilloscope soon)
=> Is there anything that can explain the observed behavior?
=> What would you suggest?