This Tutorial will show you how to upload the latest Spot Welder Software to your Arduino Nano and also how to update the Bootloader of the Arduino Nano.
The new Software is compatible with all V3 and later Arduino Spot Welders.
To upload the Arduino Code of the Spot Welder V3 to the Arduino Nano you need to do some preparation.
- download the Arduino IDE from https://www.arduino.cc/en/Main/Software
- download the Arduino Code from Github
Once you have installed the Arduino IDE you need to add three libraries. The “Adafruit_GFX” , “Adafruit_SSD1306” and “SoftwareReset” library.
Install them through the library manager in the Arduino IDE (click: Sketch -> Include Library -> Manage Libraries)
Then go to the SSD1306 library folder (on windows typically like this: C:\Users\Marc\Documents\Arduino\libraries\Adafruit_SSD1306-master ) and open the “SSD1306.h” with a text editor.
In the SSD1306.h you need to define line 51 (#define SSD1306_I2C_ADDRESS 0x3C) and line 69 (#define SSD1306_128_64) . In the latest version of the library its line 55 and 73.
The code should look like this after you changed it:
#define SSD1306_I2C_ADDRESS 0x3C // 011110+SA0+RW - 0x3C or 0x3D // Address for 128x32 is 0x3C // Adress for 128x64 is 0x3D (default) or 0x3C (if SA0 is grounded)#define SSD1306_128_64 // #define SSD1306_128_32 // #define SSD1306_96_16
After you have done this dont forget to click save.
Now you can go back to the Arduino IDE and open the Arduino Code from the Github project you downloaded. The file is the Arduino_Spot_Welder_V3.ino . Make sure all unziped files of the Spot Welder code are in the same folder and the folder is named Arduino_Spot_Welder_V3 .
Connect the Arduino Nano to your computer with an USB cable and it should automatically install the drivers for the Arduino Nano. If it does not connect take a look at this site https://arduino-info.wikispaces.com/Nano-USB-Drivers
If the Arduino is connected correctly a new Com Port should show up in your Arduino IDE under Tools -> Port
Select the new Com Port . Also selct as Board: “Arduino Nano” and Processor: “ATmega328”
To update the software on an existing V3.2 Spot Welder you need to set the processor to “ATmega328P OptiBoot” instead of “ATmega328P” . (See Step 1 and Step 4 of the “Updating the Arduino Nano Bootloader” Chapter)
Finally click on “sketch -> upload” to write the programm into the Arduino Nano. When it is finished the Display on the Spot Welder should show a low battery warning because the default low battery warning is set to 11V.
Updating the Arduino Nano Bootloader
That was the easy part of the Software update. If you have done the previous steps your new Software is working with all its functions but you can not use the reboot function of the system menu. The standard Arduino Nano Bootloader has a bug so it will execute the reboot in an endless loop until you manually unplug and power up the Arduino / Spot Welder again. To solve this the OptiBoot Bootloader is needed.
- Six jumper wires (male to female)
- Arduino UNO
Please only do this mod by exactly following the instructions. If you do something wrong the Arduino Nano will no longer be programmable by the Arduino IDE and become useless until a new Bootloader is flashed sucessfully.
First you need to add the following lines to the end of the boards.txt file.
## Arduino Nano OptiBoot w/ ATmega328
A typical location for the boards.txt is C:\Program Files (x86)\Arduino\hardware\arduino\avr . A good editor to do this is Notepad++ .
After you have done this there should be the ATmega328P OptiBoot selectable as the Arduino Nanos processor in your Arduino IDE.
Next you need to prepare the Arduino Uno as an ArduinoISP device to flash the Bootloader to the Arduino Nano. In theory it should also work to update the Bootloader of the Arduino Nano with another Arduino Nano. But in my case it did not work for some reason. With the Arduino UNO it works fine.
Upload the ArduinoISP Sketch to your Arduino UNO. This sketch is found in “File ->Examples ->ArduinoISP ->ArduinoISP”
Connect you Arduino UNO to your computer, select the Arduino/Genuino Uno as the Board and the Com Port your Arduino Uno is connected to. Then hit “Sketch -> Upload” .
Now the Arduino Uno can act as a programmer. Unplug it from the computer and connect the Arduino Nano 6 pin header to the Arduino Uno. Remove the Arduino Nano from the Spot Welder for this step.
- Nano Pin Header Pin 1 -> Uno Pin D12
- Nano Pin Header Pin 2 -> Uno Pin 5V
- Nano Pin Header Pin 3 -> Uno Pin D13
- Nano Pin Header Pin 4 -> Uno Pin D11
- Nano Pin Header Pin 5 -> Uno Pin D10
- Nano Pin Header Pin 6 -> Uno Pin GND
Once everything is connected plug the Arduino Uno back into the computer. But this time select Arduino Nano as the Board, ATmega328P OptiBoot as processor and the Com Port the Arduino Uno is connected to. Further down in the menu select “Arduino as ISP” as the programmer and then click Burn Bootloader
The Arduino IDE may complain some failures but if it shows ” Done burning bootloader” the upload was sucessfull.
Disconnect all the jumper wires from the Arduino Nano, connect it to your computer with a USB cable and upload the Arduino_Spot_Welder_v3 code again as described in the first chapter of this instruction. But this time set the processor to “ATmega328P OptiBoot” instead of “ATmega328P”.
Now you are able to use the Spot Welders reboot function of the system menu without the Arduino going to an endless reboot loop.