In this section I will describe step by step how to get the arduino project from GitHub on to your Arduino Nano. Using the arduino IDE.
- download and install Arduino IDE
- I recommend V2: Installation Guide
- clone the project from github
- I recommend using Github Desktop, which conveniently shows you the changes you made.
- open the File Millcontrol/Millcontrol.ino in the created Folder with Arduino IDE (should be default if installed correctly)
- Install Libraries
- Select Sketch->Include Library->Manage Libraries
- select and install U8glib
- Download encoder library + TimerOne library (see Dependencies) (recommended way: Download the ZIP's from Github)
- Select Sketch->Include Library->add .ZIP-Library
- select and install both downloaded zip files / libraries.
- connect the arduino
- choose your arduino and the coorect bootloader (For me it was Arduino nano with Processor ... Old bootloader)
- Depending on the Arduino and on the OS you may need to install CH341-Drivers. On Linux, I had to uninstall BRLTTY as well for successfull connection.
- depending on the relais (high or low trigger) you need to adjust the settings (see below Config changes for the relais)
- for the arduino nano you will need to change some configurations (see below Config changes for the arduino nano)
- depending on the display i2c or spi you need to adjust the settings (see below Config changes for the display)
- click on verify and then upload
- Verify should spit out some white text info about used memory and ram.
- after flash is complete you should see the first screen on the display of the arduino nano
The values for the PINs can be found here demoSetup.md
- MillControll.ino line 65: Rotator *UI::rotator = new RotatingEncoder(<CLK Pin>, <DT PIN>);
- MillControll.ino line 77: ENCODER_BUTTON <SW PIN>
- in UI.h line 32: MILL_BUTTON = <Taster Signal PIN>
- in UI.h line 36: MILL_BUTTON_2 = <Taster 2 Signal PIN> or comment out
- in UI.h line 109: Relais Pin = <Relais Signal PIN>
Depending on the used relay you may need to change following lines. My Relais triggers on High signal so I had to change:
- Run.cpp line 7: digitalWrite(UI::RELAY_PIN, HIGH); to digitalWrite(UI::RELAY_PIN, LOW);
- Run.cpp line 39: void Run::startMill() { digitalWrite(UI::RELAY_PIN, LOW); } to void Run::startMill() { digitalWrite(UI::RELAY_PIN, HIGH); }
- Run.cpp line 41: void Run::stopMill() { digitalWrite(UI::RELAY_PIN, HIGH); } to void Run::stopMill() { digitalWrite(UI::RELAY_PIN, LOW); }
The values for the PINs can be found here demoSetup.md
- depending on i2c or SPI you need to change some values (lines 141 and further). The default values should still work. If not we proably need to update the U8GLib
- if you use i2c, verify if the lines 115 - 123 (SPI - BUS) are comented out.
- display pins do not need to be set, because they are standard. You can take them from the schematic view or the demoSetup.md
- if you use i2c-display, based on this comment you may want to change line 132 to U8GLIB UI::u8g = *new U8GLIB_SSD1306_128X64_2X(U8G_I2C_OPT_FAST);
You may want to change some more settings in UI.h:
- if only 1x MILL_BUTTON: comment out line 36: //#define MILL_BUTTON_2 ...
- if Display is in horizontal orientation: comment out line 47: //#define PORTRAIT_DISPLAY
- if you want a single display page for every mode: uncomment line 52: #define FLAT_MODE
- if you want to erase EEPROM and flash with default values: uncomment line 59: #define RESET_MODE
- if you want to use the scale / HX711 Weight-cell: uncomment line 65: #define SCALE