AB PLC RTC syncing from a Raspberry pi or Arduino possible?

TimD

Lifetime Supporting Member
Join Date
Aug 2007
Location
New Hampshire
Posts
235
Hello,

I have been getting more and more requests for Real Time Clock (RTC) sensitive automation from my clients.

I know that there is a Modbus RTU/TCP time module available from ProSoft/Appian.

My clients are not going to buy this module for each and every site, so I thought maybe I could try something using Python and an SBC.

I know how to set up a Raspberry pi and sync it's clock to NTP or GPS. I even have a "GPS Hat" with RTC battery. Arduino would probably be more stable, and I could figure that out too.

I was thinking, geez, Maybe I could run a modbus server (slave hopefully, so a PLC can poll it) and maybe have registers for DD:MM:YY:HH:MM:SS.

Anyone have experience trying this crazy solution?

Thanks!
 
I love Raspberry Pi's. I don't allow one on my site. Because then I'm dependent on a one man band (usually) to get support for it.

I tend to buy GPS NTP time servers and point my servers to it. Luckily the clock on the ControlLogix I have isn't drifting. However, I can see why this is now a necessity with PLC based alarms.

Have a read through this:

https://rockwellautomation.custhelp.com/app/answers/answer_view/a_id/115421

And the following link:

https://rockwellautomation.custhelp.com/app/answers/answer_view/a_id/493378

For example logic to connect to an NTP server and update the clock.

I use this time server on my network:

https://www.veracityglobal.com/products/networked-video-integration-devices/timenet-pro.aspx

I've used Galleon as well, but for your budget it's out of reach I imagine. Can't remember how much I paid for that one, but it wasn't silly money.
 
How precise do your clocks need to be ?

Are you using motion control on your systems, which can get disrupted when the controller clock changes a large amount ?

What's your budget ?

When Internet connectivity is available, it makes sense to use good old NTP, even though it's not built directly into the Logix OS.

There are also NTP servers available that get their time signal from various sources including GPS. Google led me to this compact little Hopf 6890 unit.

If someone told me "here's a Raspberry Pi, a $40 GPS Hat and an antenna, you need to have it working Monday" I would use PyLogix to write the data to the ControlLogix and be done in time to watch Gonzaga play in the next tournament round.
 
I'm sorry, were you going to stay out of rabbit holes today ? You didn't know amateur timekeeping was a thing ?

Maybe you feel that GPS is fine, and you don't need to try to do this with an Arduino and an AM radio antenna ? You don't want to add this capability to a PLC-2/30 or a MicroLogix 1000 ?


http://leapsecond.com/
 
Thanks for the responses. I had to step away the rest of the day.

The TimeNet module looks great. I would be able to do Compact/Control Logix syncs, but my Micros would probably need to talk Modbus over serial or IP to parse the data.

There is no time constraint to doing this project, nor is there extreme precision accuracy regarding motion or safety. Within a few minutes is fine, as long as the time doesn't drift all over.

The main points of contention are:

1. Data Logging timestamp needs to be within a minute of two of real-time.
2. Permit limits allow our pre-treated water to drain into the municipal sanitary sewer at different flow rates for "day" and "night" times. Again, within a few minutes is acceptable.
3. Auto setting the PLC (usually AB) and HMI (Mix of AB/RedLion/CMORE) clocks after the switch to daylight savings and standard time.

For now, I manually sync the PLC and HMI clocks to my NTP-based clock on my laptop every cycle of ST/DST. It's kind of a chore, two Sundays a year. However, each site is asking me more questions as to why the clock is off by 6 minutes sometimes and I tell them to spend $3k on the (now) ProSoft module! o_O

Tim
 
I looked at pylogix, unfortunately, most of my sites use Micrologix, so I am thinking Modbus would be the way to go with those.
 
That MarCom unit looks extremely affordable and simple. Thanks for posting about it an I look forward to your notes !
 
Okay, now I'm down the rabbit trail.

I just ordered a 60 kHz AM radio receiver that outputs the legacy atomic clock 1-bit-per-second encoded time from the WWVB transmitter in Colorado, to see if I could do this with nothing but one DC discrete input on any PLC.

The modern (since 2012) Bit Phase Shift Key receivers for WWVB are much more sensitive and reliable, but they generally do all the decoding onboard and provide an I2C interface, so I'd have to come up with some other microcontroller-based way to talk to a PLC, even if it was just to repeat the legacy BCD time code to a DC discrete input.
 
Hi Ken,


Just saw a similar clock at a "hamfest" yesterday but didn't look for a pulse/square wave output... that's a neat idea!
 
Last edited:
OK, for serial Modbus, my issue is solved!

I have the F&F MB-GPS-1 transmitter communicating with my ML1400 just fine. GPS Clock is set to UTC, and I just use an offset in the PLC for whatever time zone I need. If you use this transmitter, you need to know that the address table is in HEX, and not base-10! That threw me off.

Daylight Saving time (I'm still a fan of it, living up north) is also automated, as it happens on the same Sunday in March and November. I just count the Day of Week, and week number during those two months in ladder logic.

For TCP connections, you would add a serial to IP converter, or use the suggested NTP equipment also posted by @cardosocea in this thread.

Thanks everyone for suggestions, Cheers! 🍺

Here is Modbus Poll in action:

Screenshot 2023-03-31 100827.png
 
Tim, that is excellent ! Thank you for sharing your results.

Since it's a MicroLogix 1400, of course you've got Modbus RTU master built into either serial port. And if you had to install a MBTCP/RTU bridge and had a MicroLogix 1400 Series B you could use the Modbus TCP features over Ethernet.

Is this control panel indoors or out ? How did you mount that module ?
 
Ken,

The GPS unit is in it's own weatherproof box, roughly the dimensions of three card decks stacked together, in other words, it's tiny! It is powered by 9-24 VDC and runs off of an 8-bit ST Micro controller.

You just leave it outside and the 4-wire cable runs through a gland. It mounts via two screws to however you want.

GPS signal reception is strong, I left it on my desk about 10ft from a window and it locked within 30 seconds.

I was not aware that Series B 1400's were the only model capable of Modbus over TCP. I have a series A on the bench, and a series B with a busted Port 0, so I'm going to try TCP on that one once I get a converter.

Thanks,

Tim
 
Last edited:

Similar Topics

I was troubleshooting a customer's machine today, and I came across a couple of questions that I need your thoughts on. 1. At the end of the...
Replies
11
Views
3,533
HI all, I have a CP1L PLC programmed with Omron CX-one and I need to adjust the internal real time clock externally, i.e get my PLC code to set...
Replies
1
Views
1,635
Hello everyone and thank you for your assistance before hand. I have a request from a customer that wants to run a conveyor for only 15 to 30...
Replies
13
Views
2,058
Hello all Please i need your help Im usin a PLC FX3U Mitsubishi and I want to reset a few register at a specific time, for example at 10 pm...
Replies
1
Views
3,667
I see from reading that it is/may be possible to set the RTC in a Premium PLC by setting %SW words and that this is somehow controlled by toggling...
Replies
3
Views
4,277
Back
Top Bottom