How to test arduino mega

Ok, I have never used arduino before, but after what happen today I think I have to learn how it works, and I hope someone can give my some advices.

Case,
I have a car and inside the trunk there is an arduino mega, which handles open/close the boot cover. Right now, the boot cover is stuck and wont open, and I cant open in any manual way(no handles etc to do this, the car is modified from the previous owner). The only way in is through a button connected to the arduino inside the trunk, which is not working.

I cant get the arduino out of the car, but I can connect to the arduino through USB, and I have connected through Arduino IDE. It seems to work.

Two questions

  1. Is it possible to make any diag of the board, or the software on the board without have the source code? Meaning, if I write any new code to the board, I dont have the ones thats on the board now.

  2. Can I test the program/board, through the IDE, so I can see if its the button that is broken, or something with the board?

Before I start digging, whats my options?

A arduino on it's own won't do much. As long you don't know what is hooked up to it or how it's hooked up to your car's electrical system there is not much to be done. Go to the garage and have them open up your trunk

john121212:

  1. Is it possible to make any diag of the board, or the software on the board without have the source code? Meaning, if I write any new code to the board, I dont have the ones thats on the board now.

You can download the compiled program from the board, but it's not possible to do so via the Arduino IDE. Instead, you'd need to run avrdude from the command line. You would also need to use avrdude from the command line to upload the downloaded program back to the board.

john121212:
2. Can I test the program/board, through the IDE, so I can see if its the button that is broken, or something with the board?

You could upload a test sketch that reads the pins prints to Serial Monitor when any of their states change. But you need to be aware that when you upload the test sketch it will erase the previous program. If you don't have the source code for that program then you need to be sure to download the compiled program so that it won't be lost.

I agree with Bringamosa. Get the trunk opened, so you can look at the mechanism, and see what is actually happening when you push the button. There are a lot of parts even in this seemingly simple automation. Difficult to debug even in a lab, let alone in situ.

pert:
You can download the compiled program from the board, but it's not possible to do so via the Arduino IDE. Instead, you'd need to run avrdude from the command line. You would also need to use avrdude from the command line to upload the downloaded program back to the board.

Ok. When downloaded, is it possible to do any debugging on the program, since its compiled?
I know the board is doing 7 sequences when open the trunk(hydraulics), I was hoping that I could try one sequence or function at the time, to see if its the board or hydraulics that is broken.

regards

john121212:
Ok. When downloaded, is it possible to do any debugging on the program, since its compiled?

In practical terms the answer is NO. Even a very experienced Arduino programmer would find it difficult to figure out how a program works from the compiled code with no assistance from the person who wrote the program.

To be honest I think the Arduino is the least likely place where the fault lies. More likely there is a broken connection or a failed component somewhere else.

As has been suggested, get the trunk opened first. Then consider repairing or replacing the Arduino based system.

If you choose to repair it I presume this episode will encourage you to have a manual override in the new system :slight_smile:

...R

Robin2:
In practical terms the answer is NO. Even a very experienced Arduino programmer would find it difficult to figure out how a program works from the compiled code with no assistance from the person who wrote the program.

To be honest I think the Arduino is the least likely place where the fault lies. More likely there is a broken connection or a failed component somewhere else.

As has been suggested, get the trunk opened first. Then consider repairing or replacing the Arduino based system.

If you choose to repair it I presume this episode will encourage you to have a manual override in the new system :slight_smile:

...R

Ok, hmm a bit stuck then. There is a manual override, the only problem is that the earlier owner has installed it wrong during the renovation(the car is from 1955), so it doesnt work.

Is it possible to force to run the program from USB cabel and the IDE, without the source code? Its just two buttons, one to open, and one to close, and if that button is broken i would like to test it from another way. What do you think?

Who can know. When I had a stuck trunk I got in by removing the back seat and manually flipping the latch. Might be worth a try.

john121212:
Is it possible to force to run the program from USB cabel and the IDE, without the source code? Its just two buttons, one to open, and one to close, and if that button is broken i would like to test it from another way. What do you think?

That makes no sense unless you know exactly how everything is connected and I'm guessing you don't have a wiring schematic. An Arduino on its own is not capable of opening a lock - there has to be some other component between the Arduino and the lock and my guess is that is where the failure lies.

Get into the trunk first.

...R

PS ... the reason the manual override does not work may be the same failed component that is preventing the automated system from working.

john121212:
Is it possible to force to run the program from USB cabel and the IDE, without the source code?

I don't understand what you mean by that.

Of course you can write your own program and upload it to the Mega. That program can simply ignore the buttons and run whatever "sequences" you like on any pins. However, if you don't know what output is required and if the necessary output is at all complex then it's going to be very difficult. Of course, the problem in the system is much more likely to be with the unlocking mechanism than with the buttons. If the unlocking mechanism is broken then it won't help no matter what program you run on the Mega.

So once again to be sure. This was working before, and is not working now?

If it was working before why do you think the "program" on the arduino is the problem and not anything else?

You can try connecting the thing to a laptop, open IDE, have the serial monitor open. Press a button and see if the monitor gives a response. But still I don't think the problem is the "program" on regarding.

Also, a manual overwrite wad installed but wrongly and was never working? Or, was it worrying before, just like the arduino, and not anymore?

It is possible that the Arduino was programmed with debug messages going out the USB connection. Hook up a laptop and see if the Arduino shows up as a virtual com port. If so, connect a serial terminal emulator to that com port and see if you receive any messages when you cycle power on the Arduino or activate whatever inputs you have access to. If you get some messages, that might tell you what is going on.

If you get NO messages, you are no worse off. :slight_smile:

johnwasser:
If you get NO messages, you are no worse off. :slight_smile:

Except in the sense that time has been wasted on IMHO the least likely cause of the problem.

Even if the problem is down the Arduino it will be necessary to get the trunk open to fix things.

As I see it, this concern about the Arduino is just distracting the OP from getting the real problem fixed by getting the trunk opened.

...R

It's been 4 days, apparently getting the trunk open is not a priority.

Or just neglected to report back.... :frowning: so sad when that happens

Bringamosa:
So once again to be sure. This was working before, and is not working now?

If it was working before why do you think the "program" on the arduino is the problem and not anything else?

You can try connecting the thing to a laptop, open IDE, have the serial monitor open. Press a button and see if the monitor gives a response. But still I don't think the problem is the "program" on regarding.

Also, a manual overwrite wad installed but wrongly and was never working? Or, was it worrying before, just like the arduino, and not anymore?

Yes, it worked until 3 weeks ago.
Acctually, Im not sure what the problem is, so my first thought was to check if the arduino is working. I want to see if there was an easy way to do it.
When I connect the laptop and open serial monitor, it says STARTED, and nothing more. Nothing happens when pushing the buttons. But since I havent checked that before, when it worked Im not sure what I should expect.

The manual way to open the trunk, which is to losen to screws under the car, have never worked.

Robin2:
That makes no sense unless you know exactly how everything is connected and I'm guessing you don't have a wiring schematic. An Arduino on its own is not capable of opening a lock - there has to be some other component between the Arduino and the lock and my guess is that is where the failure lies.

Get into the trunk first.

...R

PS ... the reason the manual override does not work may be the same failed component that is preventing the automated system from working.

There is hydraulics connected to the arduino, but no I dont know the schematic. And you are probably right, what I can read from everyone in here, is that maybe the first hydraulic is broken.

johnwasser:
It is possible that the Arduino was programmed with debug messages going out the USB connection. Hook up a laptop and see if the Arduino shows up as a virtual com port. If so, connect a serial terminal emulator to that com port and see if you receive any messages when you cycle power on the Arduino or activate whatever inputs you have access to. If you get some messages, that might tell you what is going on.

If you get NO messages, you are no worse off. :slight_smile:

I tried the serial monitor in the IDE, and it doesnt show anything, but STARTED. So I guess there´s no debug messages then.

Or it is possible that the fault is in the wiring and it just cant "hear" the buttons.

ChrisTenone:
It's been 4 days, apparently getting the trunk open is not a priority.

Sorry for that, no its highly prioritized for me.
Right now, from your recomendations, I´ve cut a hole in the metal under the car in to the trunk, where I can look in, and see the board and the connections. From what I can see, not from the best angle, the board have 3 lights, red, green and yellow.