We have prepared a new version of BSP featuring following changes and upgrades:
:exclamation: NEW! :exclamation: Please see our tutorial how to burn the MINI bootloader with Arduino UNO .
If you will face some compilation errors after the update, please check your c:\Users\UserName\AppData\Local\Arduino15\packages\CONTROLLINO_Boards\hardware\avr\ folder and remove all previous obsolete versions (e.g. 2.0.0, 2.0.1, 3.0.0, 3.0.1, etc.).
This GitHub repository contains all you need to start with CONTROLLINO devices programming in Arduino IDE.
Please note that CONTROLLINO exists in 4 different variants.
Please, make sure that you have included the CONTROLLINO library in your sketch.
So, you can see #include <Controllino.h>
at the top of your sketch.
Of course, you can use Arduino native aliases for the pin numbers like A0, or 2, but CONTROLLINO library provides you its own set of aliases. It is always combination of CONTROLLINO_ and the text description of the screw terminal you can see on the device.
For example, for MINI we have defined following aliases:
CONTROLLINO_D0
CONTROLLINO_D1
CONTROLLINO_D2
CONTROLLINO_D3
CONTROLLINO_D4
CONTROLLINO_D5
CONTROLLINO_D6
CONTROLLINO_D7
CONTROLLINO_A0
CONTROLLINO_A1
CONTROLLINO_A2
CONTROLLINO_A3
CONTROLLINO_A4
CONTROLLINO_A5
CONTROLLINO_IN0
CONTROLLINO_IN1
Please, make sure that you have included also the SPI library in your sketch.
So, you can see #include <SPI.h>
at the top of your sketch.
It should be added automatically with the #include <Controllino.h>
.
Do not forget to properly setup the mechanical switch at your MINI!
char Controllino_RTC_init()
char Controllino_SetTimeDate(unsigned char aDay, unsigned char aWeekDay,unsigned char aMonth, unsigned char aYear, unsigned char aHour, unsigned char aMinute, unsigned char aSecond);
char Controllino_ReadTimeDate(unsigned char *aDay, unsigned char *aWeekDay, unsigned char *aMonth, unsigned char *aYear, unsigned char *aHour, unsigned char *aMinute, unsigned char *aSecond)
char Controllino_GetDay( void )
char Controllino_GetWeekDay( void )
char Controllino_GetMonth( void )
char Controllino_GetYear( void )
char Controllino_GetHour( void )
char Controllino_GetMinute( void )
char Controllino_GetSecond( void )
char Controllino_PrintTimeAndDate( void )
Controllino_SetAlarm(unsigned char aHour, unsigned char aMinute)
Controllino_ClearAlarm( void )
Please note that RS485 interface is present only in MAXI and MEGA variants.
char Controllino_RS485Init( Baudrate )
Controllino_RS485RxEnable()
Controllino_RS485TxEnable()
General requirements
CONTROLLINO library
CONTROLLINO boards hardware definition
1. Automated installation through Arduino Board Manager gets 403 Forbidden in Arduino IDE for OSX
Answer: This issue was reported for Arduino IDE 1.6.11. In older versions - e.g. 1.6.8 it worked fine. With the latest Arduino IDE version (1.8.1) it also works fine.
2. AnalogRead always returns 806 instead of 1023
Question: A0 should read 0 and 1023 (its connected to D0 pin), but instead it reads 0 and 806. Is there anything wrong with the voltage reference or am I missing something? Btw, power supply is 24 volts.
Answer: This is caused by the fact that CONTROLLINO actually doesn't have maximum of 24V. The maximum for 24V setting is close to 30V. So, value 1023 will be returned when you would get close to 30V power supply. See our example AnalogInputs.
3. Digital 20 - Digital 23 mapping
Question: Pins Digital 20 - Digital 23 seem not to be implemented to use with digitalWrite, from Arduino lib. Is it possible to use those pins with your library? I understand, that these pins don't have an according alias on arduino, but still. I would really like to somehow circumvent using this syntax in order to set Digital 20.
PORTD = B11110111
Answer: It is correct. Our library does not support these digital outputs as we have tried to do not touch Arduino Core functionality. But it may be a point for further releases... I am afraid that you have to use this "PORTD" way to control these pins. Please check example sketch PortManipulation in the Arduino IDE for more details.
UPDATE - should be fixed with BSP version 3.0.0. - all CONTROLLINO pins have Arduino number now!
4. CONTROLLINO boards not showing with arduino IDE 1.6.12
Question: Loading the Controllino Library into the Arduino 1.6.12 IDE does not show up the Controllino boards on the board types list.
Answer: You also need to install the "CONTROLLINO Hardware" by the Boards Manager.
5. How to burn bootloader
Question: Is it possible to burn bootloader in Controllino? I want to add possibility for OTA updates by Ethernet.
Answer: Yes, it is possible. We are fully compatible with Arduino! All ICSP signals are available at the X1 pinheader connector of your CONTROLLINO. See https://www.controllino.com/downloads/#datasheets for more details. You just need ICSP programmer and six wires to handle that.
6. Unable to locate (obsolete) hardware description files on GitHub
Question: My Arduino IDE gives me following error message: "Error downloading ....githubusercontent.com/Controllino/ControllinoHardware/master/package_ControllinoHardware_index.json". Is it unable to locate hardware description files?
Answer: Our GitHub repository has been moved to a new location, therefore this path is no longer valid. Please, follow our new Installation guide.
7. Pin header SPI bus communication is not working properly (MAXI, MEGA)
Question: I am not using RTC and/or Ethernet built in CONTROLLINO MAXI/MEGA. I am trying to use SPI bus available at pinheader, but it sometimes work and sometimes not. Is there any conflict with RTC chip and Etherent chip connected to the same SPI bus, even if I am not using them?
Answer: When SS pins PJ2 (RTC) and PJ3 (Wiznet) are not properly handled, it may happen that the floating pin is recognized as a valid chip select signal and the RTC chip or Wiznet chip is accidentally connected to SPI bus - MISO signal.
Call this function prior to usage of the SPI bus:
Controllino_RTC_init();
8. CONTROLLINO MINI A6, A7 inputs
Question: It is not possible to read digital value of the A6 and A7 inputs on CONTROLLINO MINI.
Answer: These pins are analogue inputs only and it is not possible to read their digital status, because of the microprocessor architecture. The only chance is to read out their analogue value and distinguish by some threshold value.
9. CONTROLLINO MAXI Ethernet.localIP() always returns 255.255.255.255
Issue: I bought a Controllino MAXI and I had difficulties connecting through Ethernet. Ethernet.localIP() always returned 255.255.255.255.
Solution: The problem was due to the fact that Arduino IDE linked the standard Ethernet library and not Controllino's one (it appeared in the compilation logs of Arduino IDE). Under ArchLinux, I manually replaced /Arduino/libraries/Ethernet by Controllino's Ethernet folder (/.arduino15/packages/CONTROLLINO_Boards/hardware/avr/2.0.1/libraries/Ethernet/src) and it worked.
UPDATE - should be fixed with BSP version 3.0.0. - CONTROLLINO uses standard Arduino Ethernet library now!
10. There is not possible to upload a new sketch to CONTROLLINO anymore
Issue: The CONTROLLINO works fine, but after some time (and successfully uploaded sketches), it seems to be bricked. It is not possible to upload any sketch and Arduino IDE reports some kind of avrdude: verification error, or avrdude: stk500_recv(): programmer is not responding.
Solution: The problem is not related to CONTROLLINO platform only. It seems to be a general weakness of Arduino IDE, avrdude and original bootloader. It is still not clear what exactly happens, but it seems that after upload of a corrupted binary the microcontroller skips the bootloader when reset during operation.
Please, try following steps:
11. Ethernet issues with PlatformIO
Issue: Right now ethernet works for me out of the box in Arduino IDE, but I'd like to use PlatformIO and the compilation fails - the compiler does not see Ethernet.h file.
Solution: Tell the PlatformIO all dependencies to the external libraries used by your project.
Try following steps:
$ pio update
platformio.ini
extend the line lib_deps in this way lib_deps = Ethernet@^2.0.0, SPI
Then Ethernet examples should work!
See docs https://docs.platformio.org/en/latest/librarymanager/quickstart.html#project-dependencies for more details!
12. Internal pull-up for input pins does not work
Issue: The following line of code fails to raise the voltage level of the pin to high:
pinMode(pin, INPUT_PULLUP);
Solution: Attach sufficiently small external pull-up resistors to all inputs requiring pull-up mode.
Suggested pull-up resistors:
Explanation: CONTROLLINO boards contain additional pull-down resistors:
See issue #26 for details.
13. Is it possible to upload a new sketch to CONTROLLINO OTA (Over The Air) so via Ethernet
Issue: It is needed to upload the new sketch to CONTROLLINO over the network (Ethernet)
Solution: There are two mainstream solutions for the Arduino OTA remote update
Data transfer is done in sketch context
There is a library that supports ArduinoIDE and is in Library Manager. See: https://github.com/jandrassy/ArduinoOTA. There are some requirements, which has to be met for seamless use of this library:
Data transfer is done in bootloader context
There are several libraries for Arduino boards that implement a TFTP server.
See: https://github.com/per1234/Ariadne-Bootloader
https://github.com/loathingKernel/ariadne-bootloader
https://github.com/codebndr/Ariadne-Bootloader
Also for all these libraries, there are some requirements, which has to be met for seamless use:
Both of these solutions depend on communication via Local Area Network so, if an update over the internet is needed, there has to be some kind of Gateway, which will do the update itself. See:
There is also another option. Use solution 1, but implement a periodical check of some HTTP server (Please note, that CONTROLLINO hardware is not capable of SSL/TLS encryption, so no HTTPS is possible). In a case of a new FW available it downloads it to the second partition and resets the device. Then the modified OptiBoot bootloader is needed to flash binary file from second partition.
:exclamation:Special bootloaders mentioned above do NOT work with CONTROLLINO HW out of the box.
14. Support in Arduino IDE 2.0, Arduino CLI and IDE running on MAC OS 10.15 and newer
Issue: Compilation error in some environments.
Solution: Use of appropriate versions of gcc tools.
Since 28 June 2021, the tools dependencies in the HW package definition has been changed. The new installation of the Board support package should be working even on Arduino IDE 2.0, Arduino CLI and IDE under MAC OS. If you still encounter a "Compilation Error" please try to reinstall Board support package.