Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more. Accepting essential orders - here's how.
0

Arduino Programming proplem
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Arduino Programming proplem

by kpurzycki on Sat Feb 22, 2020 1:34 pm

hi

I have been playing with Arduino 2 wheel robots for several years The current bot I was building uses Adafruit Motor v2 board and a screw shield. Three days ago I got a strange 10 page error report which I have no idea what was about. I rebooted the computer and loaded Arduino (latest version) The program compiled and uploaded OK. But now the the robot only does one Motor command at a time. Last week when the bot was turned on it went forward until the nose went off the edge of the table The front sensors went low and the bot stopped, backed up, stopped, turned left or right and then went forward until it went over the table edge. This would go on forever.

I also have a LED on pin 13 to act as a visual that the Arduino is powered on. It use to only blink 3 times when the power was applied. Now it randomly goes ON and OFF??? while the bot is moving??? The Sketch does not turn pin 13 high or low. The bot will do strange things which it was not programed to do?? It almost seems like the Arduino is executing left over commands or changed command options. I cannot find out what's causing these anomalies? I am attaching the 10 page error message and the current Arduino Sketch.

Can you please take a look
I am using the latest version of Windows 10
How can I send you the 10 page error message??
Attachments
KENBOT_B_1-22-20.ino
(3.85 KiB) Downloaded 6 times

kpurzycki
 
Posts: 108
Joined: Mon Jan 13, 2014 11:46 am

Re: Arduino Programming proplem

by danhalbert on Sat Feb 22, 2020 11:15 pm

Arduino has a "Copy Error Messages" in the bar above the error log window. Is that the 10 page report you are talking about? Copy the text and paste it into a text editor like NOTEPAD, and save it as a .txt file, and then upload it here.

It sounds like you might have a hardware or wiring failure which is causing the strange behavior.

danhalbert
 
Posts: 1969
Joined: Tue Aug 08, 2017 12:37 pm

Re: Arduino Programming proplem

by kpurzycki on Sun Feb 23, 2020 10:42 am

Thank you for the response
Yes 10 pages ??>?? I saved the message and posted it as a TXT file
Did you receive the Arduino Sketch?

I randomly get the attached error message. The rest of the time the Arduino sketch verifies and uploads without any error messages

I checked all the connections and visually every thing seems to be wired correctly. I even recharged all the batteries thinking it may be a low voltage problem. I also checked all the libraries and updated all libraries. I am running the newest version of Arduino.

I am using USB COM8
The LED on pin 13 blinks 3 times every time the Motors activate. If you look at the sketch there is no reference to turning pin 13 high or low? The blinking LED reminds me of result of the blink example??

Ken
Attachments
Arduino Error Mess.txt
(19.59 KiB) Downloaded 3 times

kpurzycki
 
Posts: 108
Joined: Mon Jan 13, 2014 11:46 am

Re: Arduino Programming proplem

by adafruit_support_bill on Sun Feb 23, 2020 11:04 am

There is a bunch of stuff there - including a warning about multiple copies of the servo library. But that is not a show-stopper.

The real problem is that the IDE is not finding your board on COM8. Double check in you Device Manger to see what port your board is connected on. Sometimes Windows will assign it a different port number when you plug it in.

avrdude: ser_open(): can't open device "\\.\COM8": The system cannot find the file specified.

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

adafruit_support_bill
 
Posts: 76695
Joined: Sat Feb 07, 2009 10:11 am

Re: Arduino Programming proplem

by kpurzycki on Sun Feb 23, 2020 11:30 am

Com8 only shows up when on device manager when Arduino Uno is connected via a USB cable. Device manager says the Com8 is operating properly and the Drivers are all up to date and okay. see attached JPG file

How Can I change or add more Com Ports to use Arduino on? Does it matter if the com port is a com 1 port or com 2 port or com3 port or a high speed port com port???



ken
Attachments
Device manager.jpg
Device manager.jpg (37.89 KiB) Viewed 66 times

kpurzycki
 
Posts: 108
Joined: Mon Jan 13, 2014 11:46 am

Re: Arduino Programming proplem

by adafruit_support_bill on Sun Feb 23, 2020 12:18 pm

The Arduino will always connect as a "USB Serial Device". When you connect it, Windows will typically assign it a COM port number of COM3 or higher.

In theory, the Arduino UNO should work with any USB port on your computer - including the high-speed ones. But if you are having trouble on one USB port, try another.

adafruit_support_bill
 
Posts: 76695
Joined: Sat Feb 07, 2009 10:11 am

Re: Arduino Programming proplem

by kpurzycki on Sun Feb 23, 2020 1:07 pm

I tried the same sketch on a different computer. The Arduino used Com4 the Sketch verified and uploaded with no errors.
The bot reacts exactly the same which means something is compiling wrong. When the bot is placed in the middle of a table and powered up it should go forward until the sensors detect the edge of the table it should then stop and backup and turn left The sensors' should detect it not over the edge and go forward until it detects another edge.

What actually happens is that the bot goes forward for 5 or 6 inches stops the LED on pin 13 flash and the bot goes forward 5 or 6 inch's until it comes to the edge.. The bot should not stop and go every 5 or 6 inches it should go forward unerupted until the front sensors tell it to stop only then should it back up.

I checked all connections, com ports are okay and drivers updated Checked the sensors. The values of the FR and FL sensor are 14 units which meets the condition of (FRdistance >10 && FLdistance >10 ) the bot should go forward without stopping and with out the LED flashing.

Do you see any thing wrong with my programing any syntax error Library error

Are my observation correct that the sketch does not do what it suppose to do. These worked flawlessly last week.
I am not an Arduino expert I feel something is wrong with the Arduino. maybe the ram got contaminated ???? everything seems to work except the program after it is updated does things that there are no code for.

What your thoughts
Ken

kpurzycki
 
Posts: 108
Joined: Mon Jan 13, 2014 11:46 am

Re: Arduino Programming proplem

by adafruit_support_bill on Sun Feb 23, 2020 1:59 pm

the bot goes forward for 5 or 6 inches stops the LED on pin 13 flash

The flashing LED on pin 13 suggests that the Arduino is re-booting. That can be due to motor interference, or to a power problem. Does the problem persist with fresh batteries in the bot?

adafruit_support_bill
 
Posts: 76695
Joined: Sat Feb 07, 2009 10:11 am

Re: Arduino Programming proplem

by kpurzycki on Sun Feb 23, 2020 3:39 pm

The batteries were charged last night I use 5 AA rechargeable batteries total v output 5.6 volts. Its not the batteries

I think the something crashed and corrupted the memory or the Arduino software. Is there a way to clear the Arduino Memory (RAM) and reinstall Arduino Uno Software so that the Arduino will be like it was received new??

If I had a spare Arduino Uno R3 I would run the Sketch on it and see what happens. if it works properly then I would know the problem is do to the hardware or the Arduino Software.

Do you any other way to eliminate the Arduino Uno as the Source of the Problem.
ken

kpurzycki
 
Posts: 108
Joined: Mon Jan 13, 2014 11:46 am

Re: Arduino Programming proplem

by adafruit_support_bill on Sun Feb 23, 2020 4:19 pm

Before trying to swap out the Arduino, I'd try disconnecting the motors and manually move the robot up to the table edge and see if the LED still flashes. If it still flashes, that would rule out motor interference.

It is possible to re-flash the UNO bootloader. But I don't think that is the problem since the bootloader's job is done once the code has been uploaded and starts running. If the bootloader were corrupted, you would not be able to upload code.

https://learn.adafruit.com/arduino-tips ... bootloader

adafruit_support_bill
 
Posts: 76695
Joined: Sat Feb 07, 2009 10:11 am

Re: Arduino Programming proplem

by kpurzycki on Sun Feb 23, 2020 6:26 pm

Okay I disconnected the 4 motor leads from the Motor Shield. I moved the bot so that the front sensors LED went out which means the front is over the Edge. No Pin 13 action.

I will hold off of bootlegging it looks like it may out of my ability. Did I read correctly that I can buy the chip that is already loaded with the Arduino Uno Software. for $5 All I would have to do would be to remove the old chip and replace it with the new chip. Is that true??

would you recommend buying a new Aruino Uno or Adafruit Metro?

Do you know how to add a new Arduino USB port? I know the first time you use a new Uno it assigns which port to use. Which stays for ever and even assign the same port on different PC. Therfore there must be a way to do it

kpurzycki
 
Posts: 108
Joined: Mon Jan 13, 2014 11:46 am

Re: Arduino Programming proplem

by adafruit_support_bill on Sun Feb 23, 2020 8:12 pm

I moved the bot so that the front sensors LED went out which means the front is over the Edge. No Pin 13 action.

That seems to indicate that you might have a motor interference problem since when you disable the motors, you don't see the reset.

DC motors generate a lot of noise in operation. And huge reverse voltage spikes when stopped. These can feed back into the Arduino power supply and cause processor resets.
Since you are stopping the motors when you detect the edge, I suspect that the reset is caused by the sudden stop.

See the FAQ for a solution for this problem: https://learn.adafruit.com/adafruit-mot ... aq-2861890

adafruit_support_bill
 
Posts: 76695
Joined: Sat Feb 07, 2009 10:11 am

Re: Arduino Programming proplem

by kpurzycki on Mon Feb 24, 2020 12:29 pm

HI Thanks for your patience and your suggestions.
I been using these TT motors without ever having a problem! I have a previous robot which has similar boards, sensors. batteries and motors.
I decided to switch parts one at a time to try and determine what is causing the anomaly.
First I ran the old bot which has a Uno, Adafruit v2 motor Shield, Sensors and no Adafruit screw down shield. I t performed all the maneuvers that the new bot was suppose to do. Therefore I exchanged Unos and shields from both bots. I put the old Arduino Uno and old motor shield and the Screw down Shield all into the new bot. I did not exchange the drive motors or sensors. The new bot with the old bot parts performed as the old Bot. Conclusion I did not get the anomalies I was looking for therefore the problem was not coming from the Motors!!
Second Since the new bot work with all the old parts I replaced the Old Arduino V2 motor with the new Motor Shield. The new bot motor shield performed anomaly free. (therefore anomaly was not being caused by the new motor shield.

The only thing left is to replace the old Arduino Uno with the new Arduino Uno This would have confirmed the anomalies were coming from the new Uno. Unfortunately I do not have the old bot sketch that the old bot was using. Which means I cannot eliminate the anomalies being caused by the New Arduino Uno!!!!

Bottom line I have a new bot which is performing as programed which is anomaly free.

Did you ever read the 10 page error message I received!! Everything started with it I would really like know why Arduino supplies an error message which is useless for most users to understand.

Again Thank you for you assistance I am sorry I could not determine the cause of the Anomalies. It might happen to someone in the future. I was convinced that the Uno somehow got contaminated?? That I ordered a Adafruit Metro 328 hopeful it will arrive in a few days. If I do find out what it was I will Contact you.

Thanks Ken Purzycki

kpurzycki
 
Posts: 108
Joined: Mon Jan 13, 2014 11:46 am

Re: Arduino Programming proplem

by adafruit_support_bill on Mon Feb 24, 2020 1:03 pm

Good to hear you have a working robot now. The TT motors do generate a lot of noise. It is possible that the voltage regulation on your old UNO is damaged, so it is more affected by the motor noise.

adafruit_support_bill
 
Posts: 76695
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.