Running uLisp on a PLC such as the Arduino Opta


#1

Out of interest, what’s the attraction of the Opta? Apart from including four relays it seems to have a limited set of I/O lines compared to other boards, and I’m surprised it doesn’t include a CAN bus port, which seems ideal for industrial applications.


Porting uLisp to STM32H747XI
#2

Hi,

Assuming that the Opta works as expected, then it looks like a great platform for educational purposes at a low cost. You can make use of materials from How to Design Programs, which can be easily translated into uLisp. Once you’re familiar with the basic principles of program design and microcontrollers, you can use the same hardware to learn ST. Of course, learning ST isn’t just for fun; it can open doors to job opportunities.

Now, here’s an idea for possible low-cost industrial automation educational pipeline: HtdP --> uLisp --> ST

From my humble point of view, you will learn better to design programs for a PLC if you follow that pileline than with the classical curricula.

Economic Rationality / Alternatives:

From the perspective of students in South America or Africa, accessible platforms for learning ST on a budget can be limited. Let’s take a look at some options:

  • Eaton Easy E4: Priced at around +/- 170 EUR + 50 EUR for runtime software. It lacks WiFi and the option to run ST and Arduino in parallel, making the total cost of ownership higher. Still a good starter option, though.

  • Raspberry Pi-based solutions: Different brands are available, starting at around +/- 250 EUR + 50 EUR for Codesys Runtime. Availability and total cost of ownership can be concerns here.

  • Modicon M172: Priced at around 400 EUR. Yes, it has more powerfull features like CAN bus, but as a newbie, that might not be a primary concern.

  • Wago Compact 100: 595 EUR … great hardware, linux based. However … too expensive.

  • Siemens S7-1200: The 800-pound gorilla. It’s an excellent piece of hardware with options like io-link, but it’s simply too expensive.

  • Others like Controllino, Logo!, FA-DUINO-12RA, Industrino: As far as I know, they don’t support ST.

In conclusion, if this setup works (especially if uLisp runs and the ST compiler and support are good), it could create a low-cost pipeline to learn a valuable tool for a ton of people!

Disclaimer: I don’t own any shares in Arduino or Finder, hehehe.

Best Regards,


#3

There seem to be some cheap PLCs available from AliExpress based on the STM32F103, which might be ideal for student use:

Repurposing a PLC clone for use with Arduino

The STM32F103 was supported by an earlier version of uLisp, and it shouldn’t be difficult to update that to the latest version:

uLisp - STM32 boards


#4

Hello,

Thanks a lot for providing the information. I have checked the FX series manual, but it seems that Structure Text is not supported.

However, it makes total sense to look for an alternative. Upon reviewing the OpenPLC docs, I found that it supports several open platforms like the STM32F411CE (Black pill), RP2040, and ESP32. I also found an ESP32 “controller” that should be able to run uLisp!

Lastly, I came across a book documenting OpenPLC, which I plan to explore further and replicate the experiments.

If I am able to use the ESP32 based controller, that would be quite a good starting point at a really low price while getting the HtdP --> uLisp --> ST pipeline.

Best Regards,


#5

Yes, I can’t help feeling that the STM32H747XI is major overkill for a PLC. The Arduino Opta provides 4 outputs and 8 inputs, but the STM32H747XI provides 168 I/O ports. And does a PLC really need dual cores at 480MHz/240MHz? The ESP32 sounds ideal.


#6

Hello,

You are right, but maybe it would be useful to have such a CPU if in the future they plan to add more PLC modules. Then probably you will need that I/O ports capacity. For example with the Eaton Easy E4 you are able add additional Analog or Digital Inputs via attachable modules:

image

Coming back to uLisp, I came across something interesting. You can run Arduino Sketch in one core and interact with the PLC via variable settings that the PLC’s real-time runtime (running the ST code) can read and process in the second core. This potentially allows you to run uLisp in parallel with the PLC runtime!

An advantage of this approach is that you can use Arduino libraries for cloud connection and communication with the external world. For instance, you could use an MQTT topic to update a relay, eliminating the need for an expensive industrial gateway router (which typically costs around €150 or more). Thus, the total cost of ownership is quite good.

Best Regards


#7

An alternative option would be to make your own PLC with a Raspberry Pi Pico and the Waveshare Relay Module:

The Raspberry Pi Pico has good uLisp support.

See: Industrial 8-Channel Relay Module for Raspberry Pi Pico


#8

Hello,

Thanks for sharing.

I liked that one, but unfortunately, they didn’t add any Digital or Analog Input.

image

On the other hand I am testing this one:

Will share more details if I am able to run OpenPLC + ulisp (Arduino Nano Shield mit Atmel/Microchip ATmega328)

Even though it is not a ‘real’ PLC, you can still simulate the classical training scenarios like input/output, analog, and so on.

And the best part is that you can build one yourself. Here’s an example for the ESP8266.