Author Topic: Software/Controller development questions/advice.  (Read 1905 times)

0 Members and 1 Guest are viewing this topic.

Offline gonzalitoTopic starter

  • Newbie
  • Posts: 6
  • Country: ar
Software/Controller development questions/advice.
« on: September 06, 2019, 05:05:11 pm »
Hello everyone,

my name is Gonzalo Moreno, I´m a mechanical engineer and I´m from Argentina. I find myself developing a milk delivery kart for calves in dairy farms, and I'm trying to improve what I already have. What I already have is a fully working Milk Kart. I'm using a Unitronics PLC for the logic and everything is working as expected.

But, my goal is now to develop a software which should be integrated to the kart. Many things are to be defined, but i would like advices for the following:

         - I need some kind of electronics, flexible enough that should be used as base for the software I plan to grow in the future, and also work as controller (or PLC) for the rest of the electric components.

Is a raspberry pi suited for something like this? Also I´m no programmer so everything will be later on passed to someone that cana ctually develop it.

Gonzalo.
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: Software/Controller development questions/advice.
« Reply #1 on: September 06, 2019, 07:05:27 pm »
Welcome to the forum.

Quote
I need some kind of electronics, flexible enough that should be used as base for the software I plan to grow in the future, and also work as controller (or PLC) for the rest of the electric components.

Is a raspberry pi suited for something like this? Also I´m no programmer so everything will be later on passed to someone that cana ctually develop it.
Rasberry pi - no and yes.
No - it is a cheap desktop type computer. Not really suited to embedded systems.
Yes - Some people/companies have developed products around it but they have dedicated electronics engineers to do the design work.
In your situation, you need to develop lots of electronics to interface the bare raspberry pi with the cart.
I think you may be better sticking to the PLC. Far easier to find components and interface to them
 

Offline DaJMasta

  • Super Contributor
  • ***
  • Posts: 2328
  • Country: us
    • medpants.com
Re: Software/Controller development questions/advice.
« Reply #2 on: September 06, 2019, 10:11:22 pm »
In addition to being rated as a consumer product, a lot of the emphasis of the Pi is graphics and UI capability - what you'd expect from a normal desktop computer - which probably isn't that relevant to your application, so you can probably find something that's more durable (temperature range, environmental seal, shock resistance, reliability features) and that uses less power with similar or better computational or control capability because it doesn't have the extra graphics processing parts.

I don't know a lot about the specifics of what's available, though, so I can't help you much there.

Out of curiosity, what doe s milk kart do?  Is this a vehicle of some kind, or maybe a fixed distribution system?  Knowing more about the thing you're replacing will probably help find recommendations for replacements.
 

Offline gonzalitoTopic starter

  • Newbie
  • Posts: 6
  • Country: ar
Re: Software/Controller development questions/advice.
« Reply #3 on: September 09, 2019, 06:55:01 pm »
Thanks for the replies guys.

We are already using a Unitronics PLC with HMI, but what we are trying to achieve is to make the machine smarter, since our idea is to develop a software for which the kart will be the main tool for gathering information.
After the routine is done, the information gathered should be transmitted for analysis to a pc or an android app, or whatever. What I am trying to do iis something flexible hardware wise, so that if it doesn´t work one way i might some other way.

All electronics and electric parts are concealed inside a cabinet, protected from water. Vibrations might be strong though.


 

Offline TomS_

  • Frequent Contributor
  • **
  • Posts: 847
  • Country: gb
Re: Software/Controller development questions/advice.
« Reply #4 on: September 09, 2019, 07:59:38 pm »
My two cents ....

What limitations doses the PLC have that will stop you from advancing your design? Perhaps the PLC is just fine, but only needs some help from e.g. a microcontroller to achieve some more complicated sequences or functionality.

Rather than looking to replace your existing setup, try to decide what you need it to do and then determine if it is still suitable for the task.

Perhaps it only needs a capable microcontroller, rather than a full system like a Raspberry Pi, which introduces complexities and limitations of its own (e.g. Linux administration, not real time).

Which ever way you go, write loads of documentation - in the code, user manuals, troubleshooting guides, etc. Who ever is going to come along after you will thank you for it.
 

Offline gonzalitoTopic starter

  • Newbie
  • Posts: 6
  • Country: ar
Re: Software/Controller development questions/advice.
« Reply #5 on: September 11, 2019, 06:09:57 pm »
Well the things that concerned me about the plc is that i need to add an rfid reader, and then save data to a specified profile. This profile data (several profiles) has to be later on syncronized in a web server.


And then database data should be retrieved via app or whatever for viewing/analysis. AFter analysis some data might be erased and other loaded, so another sync should happen, to keep everything updated.
I dont think a PLC is suitable for what I´m intending.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4101
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Software/Controller development questions/advice.
« Reply #6 on: September 11, 2019, 06:59:00 pm »
PLC's come in many shapes and forms. If you do not require realtime safety controls, you might even be able to get away with any embedded pc and a Wago fieldbus IO rack.
With embedded PC I mean things like an industrial computer, from IBASE for example.

Many PLC's offer database connections, vision systems, barcodes or other serial port inputs. Reading an RFID is not impossible for a modern PLC.
An Unitronics PLC at least has an ethernet plug, that means it should be able to do modbus, some FTP, and maybe some SQL out of the box.
It is also extendable by many different external IO modules.

Looks like you already own what you need.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9918
  • Country: us
Re: Software/Controller development questions/advice.
« Reply #7 on: September 12, 2019, 12:57:38 am »
You need to better define your project.  It may be that a Raspberry Pi (which includes WiFi) is the ideal platform for 'management' functions while some kind of uC could handle the mechanics.

In any event, before considering the controller, how many inputs, what kind of inputs, how many outputs, what kind of outputs?  How are you going to get along without the HMI (VERY useful peripheral).  There are touchscreens that will talk to uCs and the Pi.  I might keep the PLC for the mechanical functions it already controls.  It would be neat if the PLC could communicate over serial to the Pi - most have modules for this but they tend to be pricey.

General purpose IO is not the Pi's strong suit.  It has pins but either they perform some trivial function or you have to write device drivers and only the tip top professionals want to venture into that.  And you can't get real-time performance from Linux so you really don't want it involved with the control loops.

The Pi will talk to HDMI but I haven't investigated Touch Screens very much.  They are available:

https://www.adafruit.com/product/2718

Again, I don't know how many GPIOs you need but there are many uCs with lots of pins.  If there aren't enough pins, add another uC.  Let the Pi be the boss and communicate to the peripheral uCs using UART, I2C or SPI which is already available on the Pi and trivial on the uCs.  I would look into the PSoC chips - they have a lot of IO and very advanced features.  The development environment is fun to use and there are a LOT of videos.  Look into www.cypress.com/psoc101

That new Pi 4 with 4GB of RAM is a really fast machine (and it needs fan cooling, it's available) so it should easily be able to handle databases and management for the cart.  Along with WiFi, of course!  Very handy...

In short, partition your project.

ETA:  Google for 'usb rfid reader raspberry pi' - it's been done.
« Last Edit: September 12, 2019, 01:07:35 am by rstofer »
 

Offline gonzalitoTopic starter

  • Newbie
  • Posts: 6
  • Country: ar
Re: Software/Controller development questions/advice.
« Reply #8 on: September 12, 2019, 01:35:48 pm »
PLC's come in many shapes and forms. If you do not require realtime safety controls, you might even be able to get away with any embedded pc and a Wago fieldbus IO rack.
With embedded PC I mean things like an industrial computer, from IBASE for example.

Many PLC's offer database connections, vision systems, barcodes or other serial port inputs. Reading an RFID is not impossible for a modern PLC.
An Unitronics PLC at least has an ethernet plug, that means it should be able to do modbus, some FTP, and maybe some SQL out of the box.
It is also extendable by many different external IO modules.

Looks like you already own what you need.

For a basic machine this PLC is more than enough, there are a couple of this to review but it works perfectly. I´ll add a video ina  while.
But we need more..

You need to better define your project.  It may be that a Raspberry Pi (which includes WiFi) is the ideal platform for 'management' functions while some kind of uC could handle the mechanics.

In any event, before considering the controller, how many inputs, what kind of inputs, how many outputs, what kind of outputs?  How are you going to get along without the HMI (VERY useful peripheral).  There are touchscreens that will talk to uCs and the Pi.  I might keep the PLC for the mechanical functions it already controls.  It would be neat if the PLC could communicate over serial to the Pi - most have modules for this but they tend to be pricey.

General purpose IO is not the Pi's strong suit.  It has pins but either they perform some trivial function or you have to write device drivers and only the tip top professionals want to venture into that.  And you can't get real-time performance from Linux so you really don't want it involved with the control loops.

The Pi will talk to HDMI but I haven't investigated Touch Screens very much.  They are available:

https://www.adafruit.com/product/2718

Again, I don't know how many GPIOs you need but there are many uCs with lots of pins.  If there aren't enough pins, add another uC.  Let the Pi be the boss and communicate to the peripheral uCs using UART, I2C or SPI which is already available on the Pi and trivial on the uCs.  I would look into the PSoC chips - they have a lot of IO and very advanced features.  The development environment is fun to use and there are a LOT of videos.  Look into www.cypress.com/psoc101

That new Pi 4 with 4GB of RAM is a really fast machine (and it needs fan cooling, it's available) so it should easily be able to handle databases and management for the cart.  Along with WiFi, of course!  Very handy...

In short, partition your project.

ETA:  Google for 'usb rfid reader raspberry pi' - it's been done.

That was pretty much the idea I had. To use the raspberry for HMI interfacing/controlling, and also for the logics to happen (throttle, dosing, temp controlling, timings, alarms, etc), and also use a plc or breakout board of some kind, so that the outputs of the pi can interface with the peripherals (motor, pump, RFID reader) while attaining some other capabilities like wifi, for communicating when on stand by.

The pi i was looking to was the 3B+, which has 30 GPIO usable i think. Right now our PLC has 12 inputs and 10D+2A outputs. So in terms of interfacing the pi might be more powerful.

But thats why I came here for advice. I´m a mechanical engineer and I don´t have an assertive idea about system/electronics selection in this cases.

EDITED:
Added video of the prototype.


« Last Edit: September 12, 2019, 02:47:41 pm by gonzalito »
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4101
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Software/Controller development questions/advice.
« Reply #9 on: September 12, 2019, 02:16:59 pm »
How many units will you be building, and how long will you be providing support?
I don't think raspberry pi's are the right solution for control systems like this.
The pi B+ is from 2014, and I can't buy them anywhere anymore. I suppose you need at least 10 years of service on machinery, which means you'd have to stock years worth of replacements.
PLC's don't suffer this, they have a known EOL date.

PLC's also don't suffer from defective SD cards every few months.
 

Offline gonzalitoTopic starter

  • Newbie
  • Posts: 6
  • Country: ar
Re: Software/Controller development questions/advice.
« Reply #10 on: September 12, 2019, 02:49:39 pm »
SD card might be an issue in the long run.
I added a video of the machine we are prototyping. This has all the main features we want, but we need it to be smarter, so that was why I was wondering about the raspberry.

We are now intending to make this thing smarter so we can go out and sell at least 5 in the short term..
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9918
  • Country: us
Re: Software/Controller development questions/advice.
« Reply #11 on: September 12, 2019, 02:57:33 pm »
PLC's also don't suffer from defective SD cards every few months.

This is a SERIOUS problem with Linux and particularly on the Pi and similar platforms.  Any loss of power without a previous shutdown command will very probably break the file system.  Data WILL be lost, blocks will be unlinked.  It's a mess!  This is pretty easy to control on a desktop or laptop where power is never just shut off.  It is not so easy to control in an embedded environment.

I have a couple of Pi 4 systems, one of which I like to think is important, so I bought a small UPS to keep it alive for a few hours should we experience a power outage.  If I'm home, I'll simply do the shutdown procedure.  In any event, all of the important files are saved on my NAS box.

Keep backup images of the SD card!

There must be a way to avoid this but I'm not up to speed on Linux file systems.

I wonder if a tablet computer would make a good HMI.  Cypress makes a very powerful PSoC6 uC with BLE that could be linked via bluetooth to a cell phone or tablet.

Here's a link to the PSoC6 videos:

https://www.cypress.com/training/psoc-6-101-chapter-1-getting-started-psoc-6-mcus
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9918
  • Country: us
Re: Software/Controller development questions/advice.
« Reply #12 on: September 12, 2019, 03:01:03 pm »
Re: the video, is that HMI weatherproof?   That may be hard to replicate.  Leaving the PLC in place is probably the best option.  All that stuff works.  Add a Pi for the management but leave the low level controls as is.  Except for cost, of course!
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15029
  • Country: fr
Re: Software/Controller development questions/advice.
« Reply #13 on: September 12, 2019, 03:12:27 pm »
PLC's also don't suffer from defective SD cards every few months.

This is a SERIOUS problem with Linux and particularly on the Pi and similar platforms.  Any loss of power without a previous shutdown command will very probably break the file system.

Nah. Fortunately, reasonable journalling filesystems have been standard on Linux for a long time now.
If you're on ext4, the probability of breaking the FS after a power loss (or any hard shutdown/reset of the system) is very low. I've never experienced any major issue with that.
Sure the very last written files occuring just before or while the power loss occurs may be only partially written or not at all, but it won't usually break the FS itself.

Now some SD cards' controllers are very lousy actually, and may themselves make their content corrupted in case of sudden power loss, but it's not related to the FS. Never experienced a single "break" of an EXT4 system on any HDD.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf