Migrating/graduating from Arduino board to standalone microcontroller?

Sorry, I know there are other threads that have addressed this, I’ve just been having some difficulty making sense of them and sometimes it can just be more helpful to ask...

But I am planning a project and wanted to migrate/graduate off of an arduino board long term (and just use the standalone microcontroller) and had a few questions.

  • Would it make more sense/take less work to prototype on the board then migrate to a standalone controller, or program directly to a microcontroller from the start?

  • I’ve seen there are a few ways to program microcontrollers- if I were to program the microcontroller directly (from the start of my project), what would be the best way to program it (as far as hardware)?

  • And lastly, how do I get started with programming a microcontroller on the software side? When programming on a board, obviously you have the arduino libraries to reference, but how does a microcontroller differ (obviously doesn’t use the arduino libraries for one, but how else might it differ)?

CatDadJynx:

  • Would it make more sense/take less work to prototype on the board then migrate to a standalone controller, or program directly to a microcontroller from the start?

Either, I tend to prototype on the board and then program the standalone when I have my code sorted.

CatDadJynx:

  • I’ve seen there are a few ways to program microcontrollers- if I were to program the microcontroller directly (from the start of my project), what would be the best way to program it (as far as hardware)?

That depends on your setup. If you are using a board with a removeable 328 then it can be easier to program on board and then move the chip to the standalone. Another option is to use the board as the programmer - there's heaps of references to do that. Alternatively a standalone programmer - but I don't use that method.

CatDadJynx:

  • And lastly, how do I get started with programming a microcontroller on the software side? When programming on a board, obviously you have the arduino libraries to reference, but how does a microcontroller differ (obviously doesn’t use the arduino libraries for one, but how else might it differ)?

It doesn't differ. The libraries are included in the final code by the linker/compiler. You include chosen libraries in your code, then the linker/compiler simply adds the library code into the hex file that gets written to the microcontroller.

obviously doesn't use the arduino libraries for one

There are MANY non-Arduino "custom microcontroller" boards that still use the Arduino Libraries (and IDE.)
Notable example: 3d printers - "Sanguino" was one of the first Arduino derivative "products", developed because the Diecimilla (or whatever was current back then) didn't have quite enough pins or memory to drive all the motors and run all the code...

Oh alright, thanks!

CatDadJynx:

  • And lastly, how do I get started with programming a microcontroller on the software side? When programming on a board, obviously you have the arduino libraries to reference, but how does a microcontroller differ (obviously doesn’t use the arduino libraries for one, but how else might it differ)?

An Arduino board is just a microcontroller on a PCB with the necessary support components. There's no magic to it. If you use the same microcontroller in your project then you can the same Arduino libraries as you would if that microcontroller was on the Arduino board.

Ohh, awesome, thanks! I was under the impression the difference was in the board pinout vs the microcontroller pinout and that the libraries pertained more to using/using with the boards, thanks so much!

You do need to be aware that Arduino pin numbers are different from the physical chip pin numbers. The Arduino pin numbers are an arbitrary assignment of numbers to the IO pins on the microcontroller to make it easy for to reference them in our code. You can find Arduino pin mapping diagrams for whichever microcontroller you're using.

Just keep in mind that Arduino IO functions like pinMode, digitalWrite, etc. only work with Arduino pin numbers. You can't use physical chip pin numbers or port/bit notation with these functions.

You can, theoretically, create a board variant where the PIN numbers used for digitalwrite() and etc are EXACTLY the chip PIN numbers...

pert:
You do need to be aware that Arduino pin numbers are different from the physical chip pin numbers. The Arduino pin numbers are an arbitrary assignment of numbers to the IO pins on the microcontroller to make it easy for to reference them in our code. You can find Arduino pin mapping diagrams for whichever microcontroller you're using.

Just keep in mind that Arduino IO functions like pinMode, digitalWrite, etc. only work with Arduino pin numbers. You can't use physical chip pin numbers or port/bit notation with these functions.

Aha! See THIS was the answer I was looking for. I figured the pin numbers were different, just didn’t know how else that may affect things (which makes sense now things like digitalWrite also wouldn’t work). Thanks so much!

My home brew arduino micro compatible atmega32U4 based board (tqfp -44).

Do you mean arduino micro compatible as in you program like an arduino micro (because they use the same controller)?

I see that several of the advantages of your home brew board are peripheral custom parts (obviously), but what are some advantages to keeping with arduino firmware/libraries and not just programming your own?

Now that I think about it, my only reasoning for thinking I would move on to a custom bootloader/firmware was to save memory (which probably isnt even be necessary), although I would also think that using the arduino libraries/firmware would do the work of the pin mapping for you (on the software side).

CatDadJynx:
what are some advantages to keeping with arduino firmware/libraries and not just programming your own?

Not having to write you own. Some very smart people spent a lot of time writing all that code. I'd rather build on what they did instead of wasting my time reinventing the wheel.

Others may prefer to write their own everything from the ground up either because they think they can do a better job or because they want to have a full understanding of their program.

CatDadJynx:
my only reasoning for thinking I would move on to a custom bootloader

Which microcontroller are you targeting? What functionality do you need from the bootloader? If you're using one of the common AVR microcontrollers and only need a serial bootloader, you might as well just use Optiboot because it already fits in the minimum boot section so you wouldn't save any memory at all by making your own even if it was smaller than Optiboot. Another option is to skip the bootloader altogether and use a programmer to upload your firmware to the microcontroller.

CatDadJynx:
firmware was to save memory (which probably isnt even be necessary)

There's that old saying: "premature optimization is the root of all evil".

CatDadJynx:
I would also think that using the arduino libraries/firmware would do the work of the pin mapping for you (on the software side).

The main benefits of Arduino's pin mapping are:

  • It makes the code easier for beginners to understand.
  • It makes the code more portable between platforms.

The pin mapping does come at the expense of significant overhead in memory use and execution time. If the benefits of pin mapping are not helpful to your particular application and the overhead is of concern, you can skip pin mapping and do direct manipulation of the registers.

CatDadJynx:
Do you mean arduino micro compatible as in you program like an arduino micro (because they use the same controller)?

I see that several of the advantages of your home brew board are peripheral custom parts (obviously), but what are some advantages to keeping with arduino firmware/libraries and not just programming your own?

Now that I think about it, my only reasoning for thinking I would move on to a custom bootloader/firmware was to save memory (which probably isnt even be necessary), although I would also think that using the arduino libraries/firmware would do the work of the pin mapping for you (on the software side).

You can program it the same way as if it was an arduino micro board. You choose the arduino micro board from the board menu.

Not sure what you mean with yiur next question. I do use the same libraries the arduino uses as well as the same bootloader.
The main advantage of ghe above design is that you can squeeze the arduino, 6 relays with their driver, rs485 interface, RTC, power supply, nrf24 radio, eeprom and more in 10x10 cm double sided pcb with no wires flying inbetween modules.