How to add a new PCB to Makelangelo firmware
You’re looking to use your old printer control board to DIY a Makelangelo robot but the firmware does not already support your board. No two boards have quite the same features or pin settings. Ok! Here’s how to make it work for you and everyone after you.
Makelangelo-firmware on Github
The master copy of Makelangelo firware code on github. By using the git app you can push your changes to the master copy so that everyone’s improvements stay together. Plus you can add “contributed to well known open source” on your resume, right?
Download a git client if needed. On Windows 10 and OSX I use Github Desktop.
Use git client to clone a copy of https://github.com/MarginallyClever/Makelangelo-firmware/ and then change to the dev branch. master branch is for the code that matches the latest release of the app. dev is where all experimental stuff is happening.
Use git client to switch to the “dev” branch.
Add your Arduino changes
Download the Arduino IDE, if needed.
Open the local copy of Makelangelo-firmware in Arduino. In most systems you can double-click the “Makelangelo-firmware.ino” file.
use “new tab” to add a file and call it board_(your board model).h. Copy the contents of one of the other board files into your new file.
In the configure.h file you will find a list of microcontrollers supported. You will need to add your board here. Follow the pattern set by the existing boards.
Your new board would appear as
#define BOARD_YOURBOARD 7 right after
#define BOARD_SIX_MEGA 6. Further down in the file you’ll want to
#define MOTHERBOARD BOARD_YOURBOARD. This gives everyone a nice way to see the menu of available choices already supported and switch between boards with a single line of code.
Edit: There is now support for a local_config.h file where you can put all your customizations. No one will ever add local_config.h to the system so it will never step on your custom setup.
If you were to compile the code above as-is then it would build for RUMBA microcontroller. It’s as if the other files don’t even exist, so be sure to change this line immediately to your new board.
Please be sure to change the //comments at the top of the file with your name and contact. Also note that there is another BOARD_(your board) to change at the top of the file – this is how the other versions are ignored.
After that are many pin values that need to be tweaked. Since this varies from board to board it’s beyond the scope of this tutorial. There are forums right here where you can get help with your changes.
Make a Pull Request
Now that you’ve finished and tested your changes, it’s time to commit the changes. At this time it’s a great habit to add a description of what you’ve changed. The project maintainer may have to merge your changes into the master copy, so it’s also good form to keep your changes as small as possible. You can make many commits before you are ready to share your work.
When you are satisfied and all your changes have been committed then it is time to make a pull request, which tells the project maintainer your changes are ready to go. Please make sure that your pull request is to the ‘dev’ branch of Makelangelo-firmware.
As project maintainer I do not have a Make Pull Request button. I couldn’t even find a picture of the button online! Send me one, please.
I’m super excited to see your changes and I’m looking forward to whatever you make from here. Be sure to tag me on instragram when you post drawings online, and like/share/subscribe for more useful robot stuff.