1

I'm really new to Arduino and wanted to know if I can make Arduino a permanent controller? and could you help me with a cheaper alternative? I also wanted to know about "fuse", i read it somewhere that i can protect the code from someone else who wishes to use, using a FUSE.

Thanks a lot for helping me out:)

  • hi thanks chris, appreciate your help, so basically i'm coding for an arduino to use it in a product commercially but since i'm really new to this idk if the arduino stores the code for ever. secondly i wish to protect the code from being copied, to a great extent. – Harsh Vardhan Sinha Sep 23 at 9:19
  • The search keywords you are looking for are “AVR lock bits”. – Edgar Bonet Sep 23 at 10:02
3

idk if the arduino stores the code for ever

The code is saved in the flash memory, which is non-volatile. It does not lose its content during power cycles. Also, when looking at the time dimension, it holds the code over a very long time, though not for ever. The datasheet of the Atmega328p (the microcontroller in the Arduino Uno or Nano) states:

Reliability Qualification results show that the projected data retention failure rate is much less than 1 PPM over 20 years at 85°C or 100 years at 25°C.

So over 20 years at a temperature of 85°C you can get 0.0001% of data loss in the flash memory. At normal room temperature you can get that loss in 100 years. So significantly longer than the lifetime of most electronic products.

I also wanted to know about "fuse", i read it somewhere that i can protect the code from someone else who wishes to use, using a FUSE.

There are different ways and levels of protection. Though that is a more advanced topic, that you should tackle, when your product is finished otherwise. There are multiple resources on the web about this. The first place to look is always the datasheet of the used microcontroller. First part might be to not use the standard Arduino bootloader, but your own. And then you can set 2 fuses for getting different levels of protection (write protection, read protection), that will lock out 99% of the people. This question on Electrical SE might also be interresting for you. You can find many resources on the web by searching for something like "Arduino code protection" or "AVR code protection" (if you are using an AVR based microcontroller like with the Arduino Uno/Nano/Mega)


Apart from that I also would open the question to you, if your code is really that new and ingenious, that you need to protect it from being read that way? It might totally be, that this is the case for you. But from my perspective the probability is very low. I cannot say of my own codes, that they are worth the hassle of protection. And it also depends on what you really want to prevent that way.

For context: When you program the Arduino (or any microcontroller) with your C/C++ program, the text of the program is not saved on the Arduino. Instead the code is first converted to Assembler code and then compiled into binary machine code. On that level all the nice concepts of the higher level languages are not present, so they are done by multiple lower level functions (for example loops are jumps with conditions). An attacker might read the machine code back from the microcontroller. The biggest threat here is, that he would just copy it to a new microcontroller.

If he wants to get "code" from it, he would invoke a disassembler, which converts the machine code back to the assembler language. But at this point all symbols (names of variables, functions, ...) are lost, because they are not saved in the original machine code from the start. Reading and understanding such a code is very difficult, especially, if your code is rather big and complex. Most times it would be easier for an attacker to just reverse engineer your code based on the behavior of the original microcontroller.

So in the end, you cannot really prevent people from building counterfeit products. That's what a patent is for.

This does not mean, that you should not use the code protection. Just do a realistic security assessment and then decide, if it is worth the hassle.

| improve this answer | |
  • Right. Protecting your code with lock bits is not any way to prevent someone like me from copying your code. I don’t need to see your code to copy it. If you really think your idea is that unique then patent it. Otherwise lock bits are like locking the doors to prevent a thief who just comes in through the window instead. Long ago the way to make money on code was to keep it secret and prevent anyone from getting it without paying. That’s not a very good business model anymore. It guarantees that you won’t sell for long because those products are the first to get freeware versions. – Delta_G Sep 23 at 13:14
  • I'm just knew to this environment, so I guess I was overexcited but the way you guys have explained(chrisl and Delta_G) I really appreciate it. Thank you!!! – Harsh Vardhan Sinha Sep 23 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.