Writing OpenPLC drivers using PSM - DS18B20 on Raspberry Pi

Поделиться
HTML-код
  • Опубликовано: 17 сен 2024
  • How can you read temperature on a Raspberry Pi with no analog inputs? Today you will learn how to use OpenPLC's Python SubModule (PSM) to easily write hardware drivers to interface unsupported sensors with OpenPLC. On this video you will see a step-by-step example application adding support for the DS18B20 digital temperature sensor on a Raspberry Pi. Other sensors and hardware peripherals can be added using the same principles with PSM.
    Enabling 1-Wire on the Pi 03:22
    Wiring 04:15
    Testing on terminal 05:25
    Testing on Python 08:15
    Enable PSM driver 10:52
    Writing PSM code 12:40
    Creating test project 19:12
    Testing 22:45

Комментарии • 44

  • @mbunds
    @mbunds 6 месяцев назад +1

    Thanks Thiago!
    After finally escaping from a two-year long sidetrack into cybersecurity, I used this tutorial to get the PSM OpenPLC runtime peer-to-peer started.
    Now, an OpenPLC runtime instance can connect to other OpenPLC runtime "peers", read their coils, discretes, input and holding registers, and update the variables within the "client" instance of an OpenPLC runtime!
    The primitive code I have entered into the PSM can connect to multiple peers (my "heaviest" OpenPLC runtime client connects to 13 peers), and reads of discrete inputs and coils are successful, but that's only for a single PLC so far.
    The PSM "peer-to-peer" code is still too rough to release, but as soon as I get connection monitoring, read cycle throttling, and exception handling fleshed out a little better, I'll post it in the OpenPLC "projects" forum.

  • @roboticaGrupo3
    @roboticaGrupo3 6 месяцев назад +3

    I am so proud of you Thiago! You are superb! I always metion you as my best intern ever!

    • @openplc
      @openplc  6 месяцев назад

      Thank you Djim! It was a pleasure working with you guys way back then

  • @yevsya
    @yevsya Год назад +4

    On Windows 10, the editor does not start. If there are non-English folder names in the folder path.
    Make the choice of install rather than default no choice.

    • @openplc
      @openplc  Год назад +2

      I’ll work at fixing this bug

  • @PauloRobertoOliveiraValim
    @PauloRobertoOliveiraValim Год назад +2

    Hi Thiago, congratulations for your work!!

  • @mail87523
    @mail87523 Год назад +2

    What a great project !!!
    How to use socket CAN with openplc on raspberry pi ???

    • @openplc
      @openplc  Год назад

      OpenPLC does not support CAN bus yet.

  • @wasafali-ij2fq
    @wasafali-ij2fq Год назад +2

    sir tell us please how can we get pulse output in openplc for running stepper or servo motor
    thanks

    • @openplc
      @openplc  Год назад

      Stepper and servo motors require a more precise timing, and that can be tricky to achieve with just ladder logic. You can use PWM capable outputs (for the boards that have them) with OpenPLC. OpenPLC treats them as 16-bit analog outputs, where the PWM duty-cycle is directly proportional to the analog value you place on them (0 to 65535)

  • @boardsdiscovery5803
    @boardsdiscovery5803 Год назад +2

    Very well explained! At the moment the problem is to have one raspberry 3 at hand.... It works on raspberry 4? I think yes because it seem OpenPlc runtime was written in python....

    • @openplc
      @openplc  Год назад +3

      OpenPLC works with any Raspberry Pi, from the very first model to Pi 4

  • @SlyerFox666
    @SlyerFox666 Год назад +3

    Hi and thanks for all the great video tutorials they are very useful. Can I ask if there is a way to view the status of registers/ memory allocations in Open PLC ?

    • @openplc
      @openplc  Год назад +4

      If you’re using the Linux/Windows runtime then you can simply click on Monitoring to see the current status of all located variables. For the micro runtime (runtime running on microcontrollers) you will have to use a Modbus tool like Radzio Modbus to read the registers

    • @SlyerFox666
      @SlyerFox666 Год назад +2

      @@openplc Very Much Appreciated 👍

  • @caloginelaurent3493
    @caloginelaurent3493 Год назад +2

    Hello very good job , it's possible give me some program to test openplc on raspberry and esp 32,thanks !

    • @openplc
      @openplc  Год назад

      You can find examples on the OpenPLC Project website in the Documentation section

  • @DuroLabs85
    @DuroLabs85 Год назад +1

    Hi, I am using arduino nano clones which have the CH340G usb chipset and seems like openPLC doesn't upload the code I don't get any blink on pin13 the upload window does say that the upload is done but when uploading the pin13 the inbuilt led blinks for a few milli seconds and the rx tx leds don't light up and yes I have selected the correct pin %QX0.3 for nano and the correct com port too seems like the program only resets the arduino nano when uploading doesn't actually upload the program. This is only problem for the clone nano's I have tried it on Uno (original), Arduino Micro, and esp32 all of them works but not the clone which uses CH340g can you please add support for the ch340g too.

    • @openplc
      @openplc  6 месяцев назад +1

      Most likely you will have to update the Arduino bootloader on your clone board

  • @mouadbenjdi7792
    @mouadbenjdi7792 Год назад +2

    Hi
    Thanks alot for this greet project and thank you for making it open source.
    I want to use an ESP32 with open plc but it seems like open plc can't interact with it is there anyway i can connect it?
    Thanks in advance

    • @openplc
      @openplc  Год назад

      Just select "ESP32" from the upload window as your target board and you will be good to go.

  • @wisdom09
    @wisdom09 Год назад +2

    Hello sir your videos are great..can you please give tutorial to connect LCD to ARDUINO by plc programming to display counter value.

    • @kennyking6325
      @kennyking6325 Год назад +1

      Friends, I am also interested in lcd readouts. With scadaBR a $67 chrome book could replace all push buttons and lcd screen? Which is a good price point, if your machine can physically support it

    • @openplc
      @openplc  Год назад

      OpenPLC Runtime does not support connecting to an LCD directly like that. You will need a proper SCADA solution like ScadaBR or FUXA

  • @wasafali-ij2fq
    @wasafali-ij2fq Год назад +2

    Sir I want to download OPENPLC editor but I am unable to download and install it because after installation it opens as s pycarm project
    please make a video on how to download and install it
    please
    and best of luck

    • @openplc
      @openplc  Год назад

      That's one of the first videos I made: ruclips.net/video/QcP2dZATJ8Q/видео.html

  • @kennyking6325
    @kennyking6325 Год назад +1

    Friends,
    Am I wrong that python brings us away from ladder logic which I like? Can you still program with ladder logic? Is this just a work around for miss compatible hardware?

    • @openplc
      @openplc  Год назад

      Not exactly. PSM was not intended to be used as a logic programming tool. The logic must still be written in PLC languages. PSM should only be used to write the code for the hardware interface (I/Os)

  • @wei1224hf
    @wei1224hf Год назад

    is there any demo shows OPEN PLC works with servr motor ? EtherCAT servo motor.

  • @boardsdiscovery5803
    @boardsdiscovery5803 Год назад +2

    The platform is wery well written. The only big problem for me is the installation in my school where we don't have the access as root. I managed to start The editor struggling with windows but for the run time i have a very big problem. Do you have some workarounds to solve the problem? Thanks

    • @openplc
      @openplc  Год назад +3

      The editor is a portable application. You can copy OpenPLC_Editor folder from one computer to another and it will run. No need for admin access and no need to go through full installation process. For the Runtime, running without admin is tricky. The Runtime on Windows relies on Cygwin. So if you can manage to install a portable version of Cygwin, you should then be able to install OpenPLC Runtime following the manual installation procedure

    • @boardsdiscovery5803
      @boardsdiscovery5803 Год назад +2

      I'm thinking in alternative to install a Linux machine configured in a virtual box. But at the moment i'm not so sure It Will work...

    • @openplc
      @openplc  Год назад +3

      @@boardsdiscovery5803 You can definitely use a VirtualBox VM with OpenPLC Runtime. I would recommend keeping the Editor on Windows as it requires a GUI to run. I did exactly that when I built the SCADA Security Lab at UAH. A clean Debian VM with no desktop environment works best as it is super lightweight. OpenPLC Runtime doesn't need any GUI to run. The good thing about this approach is that you can replicate the VM multiple times to have a virtual environment with multiple PLCs. Each VM with OpenPLC Runtime installed behaves as an individual PLC.

    • @boardsdiscovery5803
      @boardsdiscovery5803 Год назад +1

      @@openplc is a server! :) I had not tought about that! Great guy! Thanks!

  • @Minimum718XX
    @Minimum718XX Год назад

    Thanks for the great video!
    What if I want to use more than one DS18B20 sensor?

    • @openplc
      @openplc  6 месяцев назад

      Use the block with 2 or more outputs

  • @B105CAFE
    @B105CAFE 11 месяцев назад

    Hello Thiago!
    Will there be a continuation of such useful work???

    • @openplc
      @openplc  6 месяцев назад

      I might add a couple more videos soon :)

  • @olegchernetsov3206
    @olegchernetsov3206 Год назад +1

    How to connect a temperature sensor to the Arduino

    • @openplc
      @openplc  Год назад

      You can use one of the DS18B20 blocks for that

  • @user-fu3mm4le1q
    @user-fu3mm4le1q Год назад

    Hello Thiago!
    How are You? Congrats for Your work!!
    We are an electronics industry in Brazil and would like to discuss a project with you. How can we get in touch?

  • @farzad2panahi
    @farzad2panahi 11 месяцев назад

    `sudo pip3` breaks my heart

  • @kumarsaurabh3936
    @kumarsaurabh3936 10 месяцев назад

    Which company making open plc products

    • @openplc
      @openplc  6 месяцев назад

      Automation Direct P1AM, Controllino and Arduino (Opta) are a few examples. There are other non-official ones added by the community as well