This controller is based on a pair of custom boards that I designed, had manufactured, and assembled. The main board uses an Arduino MEGA2560 Pro and an ESP32. The MEGA2560 runs the machine and the ESP32 acts as a WiFi modem that the controller uses to send MQTT messages.

The top section of this controller is the mains entry, a 12VDC power supply and a 5VDC power supply. The next section down is the PLC that does all the work and a 24VDC power supply that I added later but didn’t have room for in the power section above.

On the bottom the left section is analog inputs, the middle section is digital inputs, and the right hand section is digital outputs, mostly using solid state relays.

The box at the bottom of the right section is a driver for a motorized ball valve that I’m planning to use to replace the air solenoid on the vacuum releaser I will eventually replace the vacuum solenoid as well.

The code on the MEGA2560 is written in Bascom AVR, a compiled AVR BASIC. I’m moving away from BASCOM to Great Cow BASIC because the guy who wrote Bascom AVR had a hissy fit when I found a problem in one of the libraries and asked too many question. He cancelled my license and banned me from the forums. Don’t use BASCOM AVR, the guy is a dick.

Great Cow BASIC is cross platform and supports AVRs, PICs, and LGTs (Chinese knockoffs of the AVR chips.)

The code for the PLC is around 8,000 lines.

The code for the ESP32 is written in C++.

  • Aralakh@lemmy.ca
    link
    fedilink
    arrow-up
    2
    ·
    8 days ago

    Whoa yeah, this so fascinating, thanks for sharing! Didn’t realize there’d be so much coding involved.

    • Maple Engineer@lemmy.worldOPM
      link
      fedilink
      arrow-up
      3
      ·
      8 days ago

      The code that actually runs the system is less than half of the total code. There is a LOT of communication involved. I have a pair of 9" tablets above my desk in my office so that I can monitor and control the machine room.

      I plan to separate the control of the machine from the HMI and communication functions. The MEGA2560 will continue to run the machine but the HMI and communication functions will be taken over by the ESP32.