Hi guys, I’m developing a little gadget based on Arduino Nano v3 and I’d like to prevent others to read, modify or overwrite my sketch...
I thought I could fill with a black resin my box but what about the code and the usb access?
On usb I need the serial monitor working so just disable (se or hw) the sketch reading writing would be fine
Your sketch in not on the Arduino -- only a translated, machine code version is uploaded, and it is very difficult to interpret.
However, you can set the code protection or "lock" bits, which in principle prevents people from reading even the machine code. That does not prevent anyone from erasing everything, and reprogramming your gizmo for something else.
Thanks, can you help me with that code protection and lock bit? How to set it?
Google "arduino set lock bits".
Once I had figured out how your program works, how long would it take me to write my own version? That would be quicker than downloading and disassembling what was on the processor.
Ok but... what about preventing “cloning” my gadget?
I’d like to be sure no one can just download my sketch and upload on another Arduino based gadget without undestrabd how it works.
For instance I’d implement my own communication protocol....
I recently ran across a "mystery chip" on a board, a PIC 12F629 processor with one output line and no input lines.
Since I had access to the programming pins, I attempted to read out the code, only to find out that the "lock bits" were on.
Then I used an oscilloscope to see what that output was doing: it emitted a 50 usec pulse every few milliseconds, just to keep the rest of the system alive.
The entire program probably consisted of 5 lines of code but the programmer wanted to make sure that no one else could download it!
If you need to protect the software, then make sure you include some "failsafe" code so that the gadget will lock up and not be functional outside of its normal environment. For example, have some of the code in eprom and overwrite it as part of the kill process.
If you need to protect the hardware from being discovered and duplicated, then you may want a means for physical self-destruction as a last resort (doomsday scenario). A few creative lines of code would probably do the trick.
As mentioned above, you can't prevent reverse engineering but you can at least make it somewhat difficult and time consuming.