2

I am developing an educational product that I would like to mass produce. I am not sure of the quantity yet, but I imagine we will make a few hundred PCBs at least to begin

I spoke with an electrical engineering about how to take an Arduino prototype to mass production, and he warned me that the code written in the Arduino IDE cannot be fused onto the processor. (He used the term "fuse", although I don't see this elsewhere in the forum. is this the right term?)

He said that I would probably have to take each product, and load the Arduino code on manually, plugging in each one to a computer and upload like one would when prototyping. Also, he said the other option would be to recode my Arduino sketch from scratch using an AVR code.

Can someone shed some light on this for me? How can I take Arduino prototyping code and use it in mass production?

  • For easier programming, you might use a programmer with pogo-pins, and draw some connection pads on the PCB. Also, some programmers can program from stored memory, so you're not re-uploading it from PC everytime, but from the memory of the programmer. – Paul Jan 20 '16 at 10:40
1

I spoke with an electrical engineering about how to take an Arduino prototype to mass production, and he warned me that the code written in the Arduino IDE cannot be fused onto the processor.

That's nonsense. The output from the IDE compiler is a .hex file which is then sent via avrdude to program the board. If the output cannot be "fused" onto the processor how does he imagine we ever get anything done?

Possibly he is referring to changing the fuses to make it impossible to read the code back from the chip. This can be easily accomplished.


He said that I would probably have to take each product, and load the Arduino code on manually, plugging in each one to a computer and upload like one would when prototyping.

You have obviously spoken to someone with no experience in Arduinos, possibly one of those engineers with an active dislike of it.

I have written code to run on an Arduino to upload sketches to another board.

You can read about it at Atmega chip stand-alone programmer to upload .hex files. The idea is you take your .hex file, put it onto an SD card and then program your target board in a few seconds.

User "Crossroads" from the Arduino forum has taken that idea and made a stand-alone board, looking like this:

Hex programmer

You put up to 255 hex files onto the SD card. You dial-up which one you want with the rotary dial. You plug in the ICSP cable into your target board, and hit the "program" button. The whole thing takes a few seconds.

It is designed to be used "in the field". All you have to do is plug in a power-pack to supply power to it.

If you needed to protect the target boards with a fuse setting after uploading, you would modify the code in the programmer slightly to do that for you.

It would be helpful to have an ICSP header on your target boards, both for programming before deployment, and in case you find a bug and have to change it.

Failing that you might put the chips into a suitable board first (eg. with a ZIF socket), program them off-board, and then solder them on. There are lots of options for you.


Also, he said the other option would be to recode my Arduino sketch from scratch using an AVR code.

I don't see why that would be necessary, in any way.

  • Thanks for the response. That is just what I was looking for. – Alex K Jan 21 '16 at 2:05
1

Arduino code and AVR code is essentially the same, at least once compiled it is. The only real difference is the existence of the bootloader, and that is not essential.

For quantities of a hundred or so it is probably most cost effective to manually program them via an ISP connector to the board. For larger quantities Atmel provide a mass programming service to pre-program the chips, but that costs money so the more you have done at once the cheaper it is per chip. I am not sure on Atmel's procedure off hand but others I have used just take either a .elf or .hex file which the Arduino IDE is perfectly capable of producing.

Either way you should design in an ISP connector on your board so the firmware can be upgraded in the future if needed.

  • Great to know that Atmel provides this service. Thanks for the tip – Alex K Jan 21 '16 at 2:06
  • Actually, the difference between Arduino code vs. plain AVR code is the use of the Arduino libraries - the bootloader is, as you say, entirely optional. The best "connector" to use may be a single row of unpopulated plated through holes, as a mass production setup can hit those with pogo pins, while in the lab you can hold in a set of pin headers at an angle, or solder in a set if you are going to be reprogramming it a lot - but it's best to consult the factory on the specifics. – Chris Stratton Jan 21 '16 at 4:02
  • That is the difference in source code. I am on about when compiled. There is no difference when compiled. And the libraries are just AVR code. There is nothing special about them. – Majenko Jan 21 '16 at 10:10
1

Arduino code is AVR code. There's no real difference. The only thing is that Arduino's tend to use bootloaders, which might cause a problem. But in your case I'd advice to not use a bootloader anyways.

Since you plan to build a lot of them, you probably want to use bare ATMega chips, and not arduino boards. Bare chips don't have a bootloader to begin with.

You'd program the boards using ISP.

-3

For mass production, you really don't want to use your arduino code done with their IDE. There is several reasons for that, first would be optimization, then the portability (you may want to chose another MCU that fits closer your needs), and also robustness. The c++ like that arduino is using to ease the coding process is really not the best thing to use while programming MCU.

So to respond, definitely rewrite the whole thing in actual C and using AVR compiler.

  • 3
    That's complete nonsense. Arduino code is more portable that pure AVR code. This is because a lot of hardware stuff is abstracted away by the arduino functions. Arduino code will run and ATTiny8x (digispark), ATMega328 (UNO), ATMega1280 (Mega), SAMD21/Contex M0(zero), SAM3X8E (DUE), mk20dx256vlh7 (Contex M4)(Teensy 3.2), etc. Arduino code will run on all these different MCUs. Creating specific code, would mean you have to rewrite parts, or even everything, when you switch to a different chip. I also don't see how using the Arduino IDE will make code less robust or optimized. – Gerben Jan 20 '16 at 10:44
  • The IDE uses avr-g++ which is a fast, optimizing compiler. Not only that, it is free, as it is based on the GNU compiler collection g++ compiler. (It is the g++ compiler with additions to generate AVR object code). – Nick Gammon Jan 20 '16 at 20:02

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.