Author Topic: µPLC module V2.0  (Read 7004 times)

0 Members and 1 Guest are viewing this topic.

Offline conducteurTopic starter

  • Regular Contributor
  • *
  • Posts: 121
  • Country: be
µPLC module V2.0
« on: November 20, 2014, 12:38:53 pm »

This is what i call my "µPLC". It's a pcb for a 40 pin dip PIC, with programmer header, buttons, (external) pull up resistors, dip switches, led's, I/O connectors, LM35 analog temperature sensor, place for a 16*2 lcd interface, 7805 psu... It has the capability of using the B and D port with an ULN 2803. One of these ULN2803 can drive relay's on a relay card that connects trough a header...

I use it for my model train layout to control things without the need to design specific hardware (just like a real PLC, but with a microcontroller). Just connect everything to it, write software for the PIC and it does what it needs to do.




Now i want to design V2.0:
Things that need improvement:

1)The 2 ULN2803 chips have their own connector, but the I/O ports on the µC to drive these ULN2803 have their own connector, so i can use them as GPIO to. (the connecter at the top connects to portb, while the connecter at the upper right corner, is also connected to port B, with the ULN 2803). Is there a simple and cheap way to "merge" these so i can save space on the pcb for other things?  (Open collector outputs with the ULN driver, and GPIO on the same connector?)

2)There is a 16 characters *2 lines HD44780 LCD interface on the board, but it is not my intention to mount it directly on this pcb. I want to mount this lcd on a front panel or something like that, and need a better interface connector. Any suggestions for this one?

3)I learned to program microcontrollers at school using flowcode and the formula flowcode buggy. Now i use JAL and C to do that. To program the pic on the buggy, i did'nt use a programmer like my pickit 2. How is this possible? Can i add that functionality to my board?

4) I hope nr1 here is possible so i can add other connectors on the pcb. (for Loconet, USB) and other capabilities, but i want to keep the board size the same or smaller...

5)maybe i replace the 7805 with MC 34063? Certainly, I need a better connector for the "power". No i use these Wago lever clamp connectors for everything...

6)any suggestions? Questions? Shoot!








« Last Edit: November 20, 2014, 02:03:53 pm by conducteur »
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: I/O port for µPLC module
« Reply #1 on: November 20, 2014, 01:32:18 pm »
Nice idea, diy plc. Since plc's are usually expensive.
1) Start saving PCB space by using SMD components. I would not recommend bare chip connection to a cable. Think of ESD and all of those other bad things around.
2) An IDC ribbon cable and an LCD that is already fitted with one of those.
3) I do not how pic's are programmed, but I usually include a small 10pin connector for jtag/swd for my nxp/st chips. (Samtec FTSH-105 shrouded)
4) You must have SPI (Serial Perihperal Interface) on that pic, so you can add extra peripherals, such as CAN, Ethernet, GPIO or Memories.
5) Replace the 7805 for an Recom R-78C-1.0, or equivalent. It does cost you a few €, but it will save you the effort of designing your own SMPS. I like the Phoenix MSTBVA type of connectors, multiple brands sell compatible parts.

6) Take a look at ITS4142 and equivalent high side drivers. They might save you bunch of relays.
 

Offline conducteurTopic starter

  • Regular Contributor
  • *
  • Posts: 121
  • Country: be
Re: µPLC module V2.0
« Reply #2 on: November 20, 2014, 07:16:07 pm »
I don't know if SMD is a great improvement in this. An important factor in the design here is the circumference of the board, where the connectors are. I don't think i can get smaller connectors that still do what i want... So if i can "merge" those two connectors (I/O connector and open collector output connector), then i have free space for other connectors...

(and i'm not a big fan for smd in hobby projects, i have a couple resistors and simple things on the board, but want to avoid things like an IC. If that IC is faulty, then you have a problem, not easy to remove. Like them more in a socket in Dip... )
« Last Edit: November 20, 2014, 07:29:51 pm by conducteur »
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: µPLC module V2.0
« Reply #3 on: November 20, 2014, 08:51:54 pm »
There are quite a few mcu-based PLC implementations, including commercial versions based on, among others, STM32.

I tend to think it is quite difficult to do so on mcu, with performance comparable to a real PLC.
================================
https://dannyelectronics.wordpress.com/
 

Offline conducteurTopic starter

  • Regular Contributor
  • *
  • Posts: 121
  • Country: be
Re: µPLC module V2.0
« Reply #4 on: November 20, 2014, 10:07:07 pm »
It's not my intention to recreate the performance of a real PLC.

I searched on the internet for existing projects.
These are some two boards that i found:
1) http://www.mikroe.com/picplc16/ (to expensive, one of the goals was to make something that is cheaper than a siemens logo)
2)An arduino  (the connectors on that board are not adequate for my projects)
3)There's a I/O shield for Arduino (with better connectors, and relays) --> total cost arduino & shield was about 40 -50 euro + i had to learn the arduino language if i had chosen that option
4)other boards not worth mentioning...

My module is more like the arduino & shield for PIC controllers with better connectors and a few more possibilities. It's not made  to replace a PLC...
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: µPLC module V2.0
« Reply #5 on: November 21, 2014, 06:34:51 am »
Quote
If that IC is faulty, then you have a problem, not easy to remove
I've yet to encounter a faulty chip. The chance is more likely I will kill it myself while debugging or stress testing a project.
Removing is very easy, hot air, wait... pick up chip.
I recently removed a dc-dc using itself as heater. When you kill the chip (accidental 12V on feedback pin) it will turn into a heater. Very helpful.  |O

Using IC's such as SOIC saves you a lot, while keeping soldering difficulty low. if you do not like smd at all (or it is your first time) I wouldn't recommend LQFP100.

Quote
I tend to think it is quite difficult to do so on mcu, with performance comparable to a real PLC.
Not sure about that. All PLC's I've seen were quite slow. But very reliable (rock solid firmware).
 

Offline poorchava

  • Super Contributor
  • ***
  • Posts: 1672
  • Country: pl
  • Troll Cave Electronics!
Re: µPLC module V2.0
« Reply #6 on: November 21, 2014, 07:01:38 am »
I'd recommend replacing output stages with something more robust. The best around are smart load switches/ output stages designed for automotive industry. They are immune to overtemperature, short circuit, highly resistant to wrong polarisation and overvoltage. BTSxxx and ITSxxx series. IRF and ST also produce similar stuff from what I know, but I've never used them.

Switch mode power supply is always a good idea unless you have some very sensitive analog stuff onboard (and even then problems can be worked around). MC34063 is very simple to use and calculate stuff for, but there's an even simpler way: http://dics.voicecontrol.ro/tutorials/mc34063/. I've used it multiple times and it simply works (I tend to add more output capacitance and sometimes an output LC filter though). If MC34063 is not what you'd want, there is loads of different SMPS chips, which are way simpler to use than MC34063. Look at APEC, Alpha&Omega semi. Obviously there is also TI and LT but their chips are usually pricier (but then again - you get calculator software, which produces very good initial designs)
I love the smell of FR4 in the morning!
 

Offline conducteurTopic starter

  • Regular Contributor
  • *
  • Posts: 121
  • Country: be
Re: µPLC module V2.0
« Reply #7 on: November 21, 2014, 01:49:21 pm »
I'd recommend replacing output stages with something more robust. The best around are smart load switches/ output stages designed for automotive industry. They are immune to overtemperature, short circuit, highly resistant to wrong polarisation and overvoltage. BTSxxx and ITSxxx series. IRF and ST also produce similar stuff from what I know, but I've never used them.

These  things produce a 0/5V at the output, if i understand what you mean? I hope there's something that can act as an I/O port and as ULN2803 in one, this will save a connector on the board. Then I have free space at the edge of my board for other connectors... (for USB, Loconet, plug pack connector...)
« Last Edit: November 21, 2014, 02:31:57 pm by conducteur »
 

Offline poorchava

  • Super Contributor
  • ***
  • Posts: 1672
  • Country: pl
  • Troll Cave Electronics!
Re: µPLC module V2.0
« Reply #8 on: November 21, 2014, 02:08:07 pm »
No, they take logical signals (0-3.3, 0-5 or something) and use them to switch on and off some higher voltage.
I love the smell of FR4 in the morning!
 

Offline conducteurTopic starter

  • Regular Contributor
  • *
  • Posts: 121
  • Country: be
Re: µPLC module V2.0
« Reply #9 on: November 21, 2014, 11:49:33 pm »
Yeah, if that's the only thing they to, i don't know if i want to use them in my design... My current solution with uln2803 works fine, but the problem is that i need a dedicated connector for that IC, and that takes space at the edge of the pcb...
 

Offline conducteurTopic starter

  • Regular Contributor
  • *
  • Posts: 121
  • Country: be
Re: µPLC module V2.0
« Reply #10 on: November 22, 2014, 10:42:15 am »
Just want to know if it's possible to "merge" those two connectors... nobody here who can help me further?
 

Offline conducteurTopic starter

  • Regular Contributor
  • *
  • Posts: 121
  • Country: be
Re: µPLC module V2.0
« Reply #11 on: November 23, 2014, 03:06:43 pm »
Why is it so hard to get a decent answer here? I want to improve my own project and make v2.0. People start screamin' that i can't make a plc with a 8bit mcu. That's not my intention! After all, I don't have a decent answer to my questions! Hope we can stay on-topic. It's just a pcb with a mcu on and some connectors and other parts. I call it uplc, because it's some standard hardware for me. But i'ts not a real plc!!!

Jeroen: can you place a link here for such a serial LCD?

I want to reduce the number of connectors on the pcb, without losing functionality. PORTB and D have each 2 connectors. One for GPIO and another one for the ULN2803. I don't think it's impossible to "merge" them together in some way...
« Last Edit: November 23, 2014, 03:14:24 pm by conducteur »
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: µPLC module V2.0
« Reply #12 on: November 23, 2014, 08:09:03 pm »
Sure, here is an example:http://elkom-serwis.com.pl/av-display/2032--blackline-lcd-2x16-h-dlw-wkk-h36mm-16x2-led-cyrylica.html
While searching I also found these kits: http://www.elektrovadi.com/LCD-Adapter,PR-55.html
You can always make your own, I see you know how to design PCB's.

Quote
People start screamin' that i can't make a plc with a 8bit mcu
I'm sure the majority of PLC's currently in operation is based on trusted 8-bit architectures.

You want to directly connect the microcontroller pins to a board to wire connector. I strongly advise against. Use either your ULN buffers, those output drivers, optocouplers or relays.
As you said, improve the current design, why not get rid of this major weakness. Bidirectional is a bit more difficult (that is what want, right?), but shouldn't be impossible if you stay in low voltage DC.
 

Offline jeremy

  • Super Contributor
  • ***
  • Posts: 1079
  • Country: au
Re: µPLC module V2.0
« Reply #13 on: November 23, 2014, 10:28:38 pm »
I have used modules like this in the past with no issues: http://www.aliexpress.com/item/IC-I2C-TWI-1602-Serial-Blue-Backlight-LCD-Display-For-Arduino/1866169037.html . Only needs 4 wires so it's easy to mount elsewhere and to put a little molex KK on the board.

I can't think of a good way to solve your problem with the dual purpose port, other than adding more interface logic. Perhaps if you are running out of space, you can transition to IDC cables for the relay cards (even 2mm pitch ones or smaller) with vertical boxed headers as they don't need to have the headers on the edge of the board. See attached pic.
 

Offline conducteurTopic starter

  • Regular Contributor
  • *
  • Posts: 121
  • Country: be
Re: µPLC module V2.0
« Reply #14 on: November 23, 2014, 11:44:37 pm »
Thanks for the replies! I've replaced the 7805 with an MC34063. Have the 1N5819 as diode (peak 0.7A calculated). Is the position for this components (inductor, diode) critical?
 

Offline jeremy

  • Super Contributor
  • ***
  • Posts: 1079
  • Country: au
Re: µPLC module V2.0
« Reply #15 on: November 24, 2014, 07:29:50 am »
Thanks for the replies! I've replaced the 7805 with an MC34063. Have the 1N5819 as diode (peak 0.7A calculated). Is the position for this components (inductor, diode) critical?

A little. Just make sure the track lengths are short, and keep them to a single layer only (no vias). Otherwise should be fine. If there is a recommended layout in the datasheet, try to stick to that as best you can.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: µPLC module V2.0
« Reply #16 on: November 24, 2014, 08:20:59 am »
Typical pcb guidelines apply.
All traces carrying high frequency currents, such as Cin to Vin, L to Cout and SW to L, should be as short/wide as possible.
 

Offline poorchava

  • Super Contributor
  • ***
  • Posts: 1672
  • Country: pl
  • Troll Cave Electronics!
Re: µPLC module V2.0
« Reply #17 on: November 26, 2014, 03:16:08 pm »
Inductor is not very critical,  but it is important.  You need to calculate the appropriate value from the formulas given in datasheet or using an online calculator.  You can usually change for example from 68uH to 100uH if you need to (power comes usually have tolerance of 20% anyway). In general bigger inductance and bigger capacitance = lower output ripple but bigger size and component price. Higher frequency requires smaller components,  but can sometimes be a pain in the ass because of EMC.
I love the smell of FR4 in the morning!
 

Offline martinjaymckee

  • Contributor
  • Posts: 16
Re: µPLC module V2.0
« Reply #18 on: November 30, 2014, 03:57:30 am »
I know you said that you don't like SMD, but the way I would combine the open-collector outputs with GPIO pins is by using something like the Maxim MAX14756, which is a high-voltage ( 70v maximum ) quad analog switch.  The switch could connect or disconnect the GPIO pins to the outputs.  Some protection circuitry ( series resistor and TVS, for instance ) on the downstream side of the switch would further protect the microcontroller pin.  The two downsides I see are that there is a single enable pin per output and that the analog switch will need to be powered by the highest voltage level that it is expected to withstand ( I'm not sure that the board has that available in the current version ).  Another possible disadvantage of the `14756 is that it is only available in a tssop ( SMD ) package.  I rather like working with tssop ( now that I'm used to them ), but they're not the place to start anyhow with SMD soldering.  There is, however, the MAX 4664 that is available in DIP and works up to 36v.  The other issue -- use of so many control pins -- could be handled, pretty easily, with a serial to parallel converter of some description.

Another approach would be to replace the analog switches with relays, again, to simply disconnect the GPIOs from the outputs when the open-collector mode is being used.  The advantage of a relay, of course, is that it doesn't need to be driven with the maximum line voltage.  The disadvantages are the further requirement to drive the coil and the space that many relays would take.  Digikey lists a COTO 9000 series relay that only needs 10mA to drive the coils, which isn't bad.  Using solid state relays would likely solve the issue entirely, though.  In any case, SSRs are likely to be available in a smaller size as well.

Off the top of my head, these are the ideas I come up with, but there must be others ( and much better ).  I do wonder what a minimal discrete solution might look like -- but that would take me quite some time to figure out ( I'm a programmer by trade... electronic engineering is just a tenacious hobby ).

Martin Jay McKee
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf