Here is another great tutorial on how to install the sanguino files, brought to you by the evilmadscientist team, the creators of Alpha Clock 5, another sanguino-compatible device.
It also seems that sanguino.cc was "upcycled" into something more revenue-producing.
Updated April 7, 2013 - added details (sanguino section in boards.txt etc).
Although this post was written for Arduino 21, it applies almost identically to Arduino 1.0 and later.
I say "almost" because:
- file WProgram.h was replaced by Arduino.h
- the original sanguino files may not be maintained publicly anymore. Instead of copying them from sanguino.cc, as suggested originally, you can download my updated (for Arduino 1.0+) version from here.
Sooner or later, if you have Wise Clock 3 or 4, you may want to upgrade the software.
This process requires the following prerequisites:
- the Sanguino-related files need to be installed (since Wise Clock 3/4 is compatible with Sanguino);
- an FTDI cable/breakout is required to upload the sketch to the board.
To install the Sanguino files, you may follow the instructions found here. Basically, you need to do two things:
- Firstly, add the definition of the Sanguino board to the file arduino21/hardware/arduino/boards.txt;
This "Sanguino" section should look like this:
sanguino.name=Sanguino
sanguino.upload.protocol=stk500
sanguino.upload.maximum_size=63488
sanguino.upload.speed=38400
sanguino.bootloader.low_fuses=0xFF
sanguino.bootloader.high_fuses=0xDC
sanguino.bootloader.extended_fuses=0xFD
sanguino.bootloader.path=atmega644p
sanguino.bootloader.file=ATmegaBOOT_644P.hex
sanguino.bootloader.unlock_bits=0x3F
sanguino.bootloader.lock_bits=0x0F
sanguino.build.mcu=atmega644p
sanguino.build.f_cpu=16000000L
sanguino.build.core=sanguino
sanguino.verbose=false
Pay attention to the upload speed (38400), which is "burned" in the bootloader and essentially important for communication with the board (sketch upload, serial monitoring). Also pay attention to the second last value, which indicates the folder where core files are found. This parameter MUST not be "arduino", but "sanguino". Thanks to Dave, who found this potential issue. Even though compilation and uploading were successful, the sketch failed to run as expected. This was because the core files used at build time were not those for ATmega644/ATmega1284 (as used in sanguino).
If your processor is ATmega1284, the "Sanguino" section in boards.txt should look like this:
atmega1284.name=Sanguino W/ ATmega1284p 16mhz
atmega1284.upload.protocol=stk500v1
atmega1284.upload.maximum_size=129024
atmega1284.upload.speed=57600
atmega1284.bootloader.low_fuses=0xFF
atmega1284.bootloader.high_fuses=0x98
atmega1284.bootloader.extended_fuses=0xFD
atmega1284.bootloader.path=atmega
atmega1284.bootloader.file=atmega1284p_16MHz.hex
atmega1284.bootloader.unlock_bits=0x3F
atmega1284.bootloader.lock_bits=0x0F
atmega1284.build.mcu=atmega1284p
atmega1284.build.f_cpu=16000000L
atmega1284.build.core=sanguino
Note that for ATmega1284 the upload speed is 57600. Also note that the core folder (last parameter in the list above) is still "sanguino".
- Secondly, create the folder "sanguino" and copy the Sanguino files, as shown in the screenshot below.
After these two steps are completed, you should see "Sanguino" listed in the menu "Tools/Board" of Arduino IDE 21 (used as an example here).
To upload the sketch, you will need to connect the board to the PC/Mac with an FTDI cable/breakout. The USB end of this cable gets plugged into the PC/Mac, the FTDI end gets connected to the Wise Clock 3/4 board as shown in the photo below.
With both the software and hardware in place, the upgrade will consist in the following steps:
- download the latest software on the PC;
- launch Arduino IDE and load the sketch;
- compile, after chosing "Sanguino" as the target board;
- upload to the Wise Clock 3/4 board.
Unziping the WiseClock3/4 source code (found here) should result in a directory structure as shown in the screenshot below.
If you get compilation errors related to "tone.cpp" file, like the following,
...\ArduinoIDE\libraries\WiseClock3\Sound.cpp: In function 'void soundAlarm()':
...\ArduinoIDE\libraries\WiseClock3\Sound.cpp:60: error: 'tone' was not declared in this scope
...\ArduinoIDE\libraries\WiseClock3\Sound.cpp: In function 'void beep()':
...\ArduinoIDE\libraries\WiseClock3\Sound.cpp:75: error: 'tone' was not declared in this scope
make sure the file Tone.cpp is present in the sanguino folder, as shown in the next screenshot.
(April 7, 2013: The following info is obsolete now. File WProgram.h was replaced by Arduino.h.)
Also, make sure that WProgram.h (in the sanguino folder) contains the line
If you get compilation errors related to "tone.cpp" file, like the following,
...\ArduinoIDE\libraries\WiseClock3\Sound.cpp: In function 'void soundAlarm()':
...\ArduinoIDE\libraries\WiseClock3\Sound.cpp:60: error: 'tone' was not declared in this scope
...\ArduinoIDE\libraries\WiseClock3\Sound.cpp: In function 'void beep()':
...\ArduinoIDE\libraries\WiseClock3\Sound.cpp:75: error: 'tone' was not declared in this scope
make sure the file Tone.cpp is present in the sanguino folder, as shown in the next screenshot.
(April 7, 2013: The following info is obsolete now. File WProgram.h was replaced by Arduino.h.)
Also, make sure that WProgram.h (in the sanguino folder) contains the line
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);