B4R Question Controllino Maxi

Johan Schoeman

Expert
Licensed User
Longtime User
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
The Arduino compiler is compatible with Controllino
Since B4R uses the Arduino compiler I assume it is perfectly compatible.
It's my guess
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
That's true. If it is compatible with Arduino IDE then it is probably compatible with B4R as well.
You will need to find and use the constants values from their header file. It shouldn't be difficult.
Should I add them to rCore.h?
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
For the pins? No. You just need to find the correct numbers and use them.
Received it today (Controllino Mega) and initial test are working with B4R. Need to figure out the use of some of the Dx pins that are past #49. Relais outputs seems to be working too (click click with a timer). Playtime will start on Saturday. Have shut it down for now - literally spent 15 minutes with it just to see if it like @Erel 's B4R and it indeed does so!
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Converted our anilox washer at work by replacing the 20 odd year old SMC PLC (dead) with the Controllino Mega and programmed the latter with B4R. What a pleasure to see it controlling the anilox washer through all its processing stages. Have done it for a 1/3 rd (33%) of the nearest quote we received. Took us about 3 hours to rip out the SMC, install the Controllino, rewire, and do the version 1 code. As the original system was based on 24V control it was very easy to replace the SMC with the 24V compatible Controllino Mega. And still heaps of inputs and outputs available to do whatever else we would like to add to the original anilox washer.

I can strongly reccomend the Controllino "PLC's" - easy to program with B4R.
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Wow great...
Can you share some pics of project and some example?
Will do so and upload a video too once we have tidied up the wiring and added the additional status indicators that were not included in the original 2005 anilox washer.

But for what it might be worth:
Reading multiple 24vdc proxies
Running a 12vdc motor forward and reverse based on the status of 2 of the proxies
Running a 3 phase AC motor by controlling a solenoid of a 3 phase contactor
Switching multiple solenoid valves to control a high pressure 3 phase water pump and pneumatic solenoid valves.

All done with various timers that each control a portion of the total wash cycle.

It has an onboard RTC but not needed for this project. Still trying to figure out how to read/write to the RTC as B4R IDE does not recognize CONTROLLINO_MEGA as a board (using inline C) but nevertheless allows you to program it as if it is an Arduiono Mega board. The processor is an Arduino Mega processor.
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Wow great...
Can you share some pics of project and some example?
OK - some pics and the code attached. Wiring a bit of a spider web directly after we got it working and before we tidied up the wiring. It is really working very well. There are 5 pneumatic solenoid valves that are also controlled (out of picture as it is below the anilox washer) to switch compressed air to a pneumatic pump, a small pneumatic cylinder to lock the lid of the anilox washer, a pneumatic draining valve, and a "drying" valve.

Also 3 x 24V DC proximity switches being monitored. One for the lid being closed and the other 2 to control the direction of the DC motor that moves the rinsing and drying slider from home to end position and back to home (once for rinsing and once for drying).

For the 3 phase AC motor (being used to rotate the anilox inside the washer during the entire washing cycle) I only control the solenoid of the contactor.

For the DC motor I control the 24V via 2 x Relay outputs to run it forward and reverse (24V wired as common between the 2 x relay outputs)

Have attached the code for the Controllino Mega Anilox Washer project

It is a very nice little "PLC" and can be programmed with B4R as it will see it as a ATMega 2560. There are lots of functionality that I have not had a chance to explore as it was critical to get the washer back into operation.

If you go to Flexowash on the web - that is where this anilox washer is from but ours is now 19 years old.

So, I have ordered another Controllino Mega that I can play around with and explore at my leisure. Should have it by Monday or Tuesday next week


20240319_103254.jpg


20240319_103259.jpg



Original Electrical drawings of the washer that we have replace the SMC controller with the Controllino Mega (including an integrated pneumatic valve controller that the SMC controller communicated with). Installed separate solenoid valves that are now also controlled with the Controllino Mega.

1711015628401.png


1711015784551.png


1711015872019.png
 

Attachments

  • AniloxWasherV1ResettingSlider.zip
    6.2 KB · Views: 100
Last edited:
Upvote 0
Brilliant great job and milestone for PLC automation with B4R. :)
I was thinking of such idea as Controllino since a couple of years and Controllino came out first.
Just wanted to make B4R use as efficient with code blocks or libraries, performing such as optimized PLC routines. Thanks a lot for great sharing.
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Brilliant great job and milestone for PLC automation with B4R. :)
I was thinking of such idea as Controllino since a couple of years and Controllino came out first.
Just wanted to make B4R use as efficient with code blocks or libraries, performing such as optimized PLC routines. Thanks a lot for great sharing.
Yip - very happy with the end result especially so by making use of pure B4R. A relative simple project but nevertheless proved that Conrtollino can be used with B4R and saved a 20 year old machine.
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
My first Controllino Mega now installed in the Flexowash Anilox washer at work - had no time to play around with it as we had to get the anilox washer back into operation. So, I bought another one for myself so that I can explore a lot more of the functionality that is comes with. Received it earlier today and first exercise was to see it I can set and read the onboard Real Time Clock. Sample code below with inline C (importing the Controllino library). Works like a charm! No wiring required as the RTC is an integral part of the Controllino Mega.

Controllino Mega RTC:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 300
#End Region
'Ctrl+Click to open the C code folder: ide://run?File=%WINDIR%\System32\explorer.exe&Args=%PROJECT%\Objects\Src

Sub Process_Globals
   
    Public Serial1 As Serial
    Dim aDay , aWeekDay, aMonth, aYear, aHour, aMinute, aSecond As Byte

    Dim t As Timer
   

End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
   
    t.Initialize("t_tick", 1000)
   
    Delay(1000)
   
    aDay = 25
    aWeekDay = 1
    aMonth = 2
    aYear = 24
    aHour = 18
    aMinute = 9
    aSecond = 0

    RunNative("initialize", Null)
    RunNative("setTimeAndDate", Null)
   
    t.Enabled = True

   
End Sub

Sub t_tick
   
    RunNative("getDay", Null)
    RunNative("getWeekDay", Null)
    RunNative("getMonth", Null)
    RunNative("getYear", Null)
    RunNative("getHour", Null)
    RunNative("getMinute", Null)
    RunNative("getSecond", Null)
   
    Delay(1000)
   
    Log("aDay = " + aDay)
    Log("aWeekday = " + aWeekDay)
    Log("aMonth = " + aMonth)
    Log("aYear = " + aYear)
    Log("aHour = " + aHour)
    Log("aMinute = " + aMinute)
    Log("aSecond = " + aSecond)
    Log(" ")
   
End Sub


#if C

#include <Controllino.h>

void initialize (B4R::Object* o) {
   Controllino_RTC_init();
}

void setTimeAndDate(B4R::Object* o) {
    Serial.println(b4r_main::_aday);
    Controllino_SetTimeDate(b4r_main::_aday, b4r_main::_aweekday, b4r_main::_amonth, b4r_main::_ayear, b4r_main::_ahour, b4r_main::_aminute, b4r_main::_asecond);
}

void getDay(B4R::Object* o) {
    b4r_main::_aday = Controllino_GetDay();
}  

void getWeekDay(B4R::Object* o) {
    b4r_main::_aweekday = Controllino_GetWeekDay();
}  

void getMonth(B4R::Object* o) {
    b4r_main::_amonth = Controllino_GetMonth();
}  

void getYear(B4R::Object* o) {
    b4r_main::_ayear = Controllino_GetYear();
}  

void getHour(B4R::Object* o) {
    b4r_main::_ahour = Controllino_GetHour();
}  

void getMinute(B4R::Object* o) {
    b4r_main::_aminute = Controllino_GetMinute();
}  

void getSecond(B4R::Object* o) {
    b4r_main::_asecond = Controllino_GetSecond();
}  

#End If
 
Last edited:
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
A first "basic" wrap for the Controllino. Can set the Date and Time of the onboard RTC and then read from the RTC via the attached B4R library. Still lots to explore....

Using rControllino_RTC to set and read from the onboard RTC:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 300
#End Region
'Ctrl+Click to open the C code folder: ide://run?File=%WINDIR%\System32\explorer.exe&Args=%PROJECT%\Objects\Src

Sub Process_Globals
    
    Public Serial1 As Serial
    Dim aDay , aWeekDay, aMonth, aYear, aHour, aMinute, aSecond As Byte

    Dim t As Timer
    
    Dim cont_rtc As CONTROLLINO
    

End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    
    cont_rtc.Init
    
    t.Initialize("t_tick", 1000)
    
    Delay(1000)
    
    aDay = 25
    aWeekDay = 1
    aMonth = 2
    aYear = 24
    aHour = 18
    aMinute = 26
    aSecond = 0
    
    Delay(1000)
    
    cont_rtc.SetTimeDate(aDay, aWeekDay, aMonth, aYear, aHour, aMinute, aSecond)

    t.Enabled = True

    
End Sub

Sub t_tick
    

    aDay = cont_rtc.GetDay
    aWeekDay = cont_rtc.GetWeekDay
    aMonth = cont_rtc.GetMonth
    aYear = cont_rtc.GetYear
    aHour = cont_rtc.GetHour
    aMinute = cont_rtc.GetMinute
    aSecond = cont_rtc.GetSecond
    
    Log("aDay = " + aDay)
    Log("aWeekday = " + aWeekDay)
    Log("aMonth = " + aMonth)
    Log("aYear = " + aYear)
    Log("aHour = " + aHour)
    Log("aMinute = " + aMinute)
    Log("aSecond = " + aSecond)
    Log(" ")
    
End Sub
 

Attachments

  • rControllino_RTC.zip
    9.6 KB · Views: 76
Upvote 0
Thanks Johan for making and sharing useful advancement lead by your curiosity.
As an Electronics Tech Person and Microcontroller and PLC Programmer, I would like to suggest you some basic things to implement in library or make a general library with basic things.

So as a first suggestion there should be a debounce time function for inputs with settable time when initialized PinMode as Input same like we use to set MODE_INPUT_PULLUP resistors.
Maybe @Erel can make this function in rCore. The purpose of this is to NOT blocking code execution while checking debounce time in Pin_State_Change sub. I hope I had explained well, my wish. Thanks.
 
Upvote 0
Top