yonush
Hi, I have finally created a repo for the PLC based off the Pico and OpenPLC. It took a while but ti is now uploaded. This is a PLC we use for teaching on our undergrad Automation and embedded systems course. We designed the board based on the OpenPLC but it works just fine if you prefer to use CircuitPython, MicroPython or even C/C++ and assembly if you're brave.
 
Note it is not a 24V tolerant PLC, only 12V, given that it was intended for teaching and some home automation. We are working on a 24V version but there is no urgency for it.
 
Schematics (in Kicad), BoM and gerbers are all available.
Reply 1 0
Grz
Hello Yonush,
 
Very good work.
 
Just a remark, why don't you put a freewheel diode in parallel with each relay coil? and also why there are no optocouplers on the inputs?
 
Best regard.
 
Pierre
 
 
 
type-photocopleur.jpg
 
 
montage-relais-DRL1.jpg
Reply 0 0
yonush
Hi, The original intent of the picoPLC was for the classroom and the highest voltage they would be 3.3-5V. So making it 12V tolerant and limiting the input current was enough for the classroom devices. We are looking at optos for the rev3 design, for those that want to use it in a more industrial situation, and keeping the rev2 for the classroom.
 
The ULN2003F takes care of the freewheeling diode for us.
[203128%2F9064618%2Fmceclip0]
Reply 1 0
Grz
Hello Yonush,
 
Very good for the ULN2003F, it does the job.
 
I also saw the serial port output on the card.
 
Do you know how to use it with OpenPLC please with a function block?
 
Thanks in advance for your answer.
 
Best regard.
Pierre
Reply 0 0
Desire
Dear Yonush!
I am addressing my question to you, as I see you are an active member of the community using RP Pico. Again, I'm asking for your advice.
My previously written program using the well-functioning PWM function (RGB LED control) does not work for the Editor's current Pico version [4.2.0]. At 32000 PWM numbers, the Duty is 2%. It varies, but only between 0-2%. In online testing, increasing the number content above 3200 causes an error. As if the PWM were only 15 bits. There is something wrong with the PWM management. Experience, idea?
I also have a working Pico based hardware:
- 8 dig. input (24V),
- 3 relay outputs (AC 230V/2A),
- 3 RGB LED outputs (12V/2A),
- 2 FET outputs (24V/5A),
- DC motor (12V/2A).
In case of need, I will be happy to publish it.
Desire
Reply 0 0
yonush
I am assuming you have the latest version of OpenPLC that includes the following in the rp2040pico.cpp from the editor\arduino\src\hal folder
void hardwareInit()
{
    // set the analog input resolution to 12bit
    analogReadResolution(12);
    // set the analog output resolution to 16bit
    analogWriteResolution(16);
...
This means it should accept a resolution above 32765 (15bit). The only other thing I can think of is either of the following Arduino functions missing from the rp2040pico.cpp file.
analogWriteRange(uint32_t range)
analogWriteFreq(uint32_t frequency)
where we include analogWriteRange(65536) (and analogWriteFreq with desired frequency but I have not explored this yet). I would need to do some further testing. If you have a sample project I can do some testing. it certainly warrants further testing because this would impact all RP2040/RP2350 boards and maybe the Arduino Nano Connect board which I cannot test as I don't have this board.
Reply 0 0
thiagoralves
It seems that the new version has issues with the analog inputs on some boards. Look at this post from another user: https://openplc.discussion.community/post/pico-2-rp2350-compatible-13511830?pid=1341192002
Reply 0 0
yonush
Morning, I saw that yesterday. Its strange though because the only change was the inclusion of the analogReadResolution(12) because the default is 10bit and the RP2040/RP2350 are 12bit. If you don’t specify the range and resolution of the PWM signal, it will use an 8-bit resolution with a maximum range of 255 (100% duty cycle). The analogWriteResolution is used to set the PWM to 16bit - this was not added in the change but I think it needs to be added. Both the RP2040 and RP2350 share the same .cpp file as they are the same as far as IO goes. As I said in an earlier post, the analogWriteRange and analogWriteFreq may need adding but I have not tested those.
 
I will be doing some testing today to confirm the analog settings.
Reply 0 0
thiagoralves
I don't use Pico boards much, so I will leave that to you guys that play with it more frequently. There is another user that also posted something similar: https://openplc.discussion.community/post/rp2040-pwm-fault-13521468
Reply 0 0
yonush
Reply 0 0
CANADUINO
Did you have a chance to look at our RP2040 PLC-100 module? It is an interesting solution for classroom projects:
Reply 0 0
yonush
Thanks for the link but we already have an open source solution that we created and have had a number of them assembled for our lab. You can find the details of the picoPLC on my GitHub page https://github.com/yonush/PicoPLC.
Reply 0 0
CANADUINO
Interesting project. Our product was designed with educational and practical use in mind, and we have way more commercial customers and hobbyists buying these modules than educational customers.
Reply 0 0
FreaktheBear
Hi, I have finally created a repo for the PLC based off the Pico and OpenPLC. It took a while but ti is now uploaded. This is a PLC we use for teaching on our undergrad Automation and embedded systems course. We designed the board based on the OpenPLC but it works just fine if you prefer to use CircuitPython, MicroPython or even C/C++ and assembly if you're brave.
 
Note it is not a 24V tolerant PLC, only 12V, given that it was intended for teaching and some home automation. We are working on a 24V version but there is no urgency for it.
 
Schematics (in Kicad), BoM and gerbers are all available.
Good stuff Yonush!
Reply 0 0
Reply