Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 19:43 29 Mar 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Relais controlled  via Serial RS232

     Page 3 of 3    
Author Message
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1584
Posted: 12:30am 18 Jul 2021
Copy link to clipboard 
Print this post

  Mixtel90 said  Cheaper on wire to switch it in software and use another pin.

And to use RS485 rather than RS422. And don't forget to use a CRC for security.

Bill
Keep safe. Live long and prosper.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5648
Posted: 08:43am 18 Jul 2021
Copy link to clipboard 
Print this post

Sod CRC - I tried reading up on it the other day and it fried a couple of brain cells. It's too hard for me if you want compatibility with anyone else.  ;)
If you're *really* lucky you'll get ACK, NAK and a checksum. :)

If you're *really really* lucky I might even use something other than plain ASCII text too!

RS485, definitely. I did consider playing with CANbus at one time.
Edited 2021-07-18 18:45 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1584
Posted: 09:48am 18 Jul 2021
Copy link to clipboard 
Print this post

Using a CRC is not difficult. Look up MODBUS CRC or Xmodem CRC in fruit of the shed. You don't have to use the MODBUS or Xmodem protocols to use the CRC. Just tack it on to the end of the message and check it when received. Easy peasy.

If the risk of operating the wrong device is no problem to you then don't bother but in my former line of work it could cost lives and/or do untold damage. It would be embarrassing in a commercial product too.

Bill
Keep safe. Live long and prosper.
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 11:09am 18 Jul 2021
Copy link to clipboard 
Print this post

For master/slave, a simple checksum is all that's required. If not, then you have electrical issues that need to be corrected.

The vast majority of industrial CNC machinery and other motion-control applications, use quadrature encoders for feedback. These also use differential line transmitters/receivers and all these do is transmit 5v pulses to be counted by the controller. Any corruption here could result in destroyed machinery and possibly, personal injury.

And what about SPI?


 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1584
Posted: 12:18pm 18 Jul 2021
Copy link to clipboard 
Print this post

  Quote  For master/slave, a simple checksum is all that's required. If not, then you have electrical issues that need to be corrected.

No self respecting SCADA system would use a simple checksum. Sometimes electrical issues are beyond your control, high voltage switching and lightening for instance. Proper earthing and shielding will help as will secure communications.

SPI, I2C and TTL rs232 should really only be used within a PCB or a shielded case. I know people use these for external communications and get away with it but it's not for me.

My father used to tell me 'If a job is worth doing it's worth doing well'

Sorry for the sermon, if you thing 'near enough is good enough' then go for it.

Bill
Keep safe. Live long and prosper.
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3422
Posted: 12:31pm 18 Jul 2021
Copy link to clipboard 
Print this post

We are having a nice discussion on the best implementation, but have lost the thread starter, who is probably scared away by the comments.
I am just as guilty....
PicomiteVGA PETSCII ROBOTS
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1584
Posted: 12:52pm 18 Jul 2021
Copy link to clipboard 
Print this post

You're right Volhout, sorry for my rant it's not really fitting for the original post. It's neatly built and it would be interesting to know a little more, like what he uses it for and how.

Bill
Keep safe. Live long and prosper.
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 01:01pm 18 Jul 2021
Copy link to clipboard 
Print this post

  Volhout said  We are having a nice discussion on the best implementation, but have lost the thread starter, who is probably scared away by the comments.
I am just as guilty....


Well he did state that he was a hobbyist. I would have learned a heck of a lot quicker had these discussion groups existed back in the day.  
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 02:30pm 18 Jul 2021
Copy link to clipboard 
Print this post

"Networked Modular Control"

Been around for 22 years. I have strings of these things, commanded by E-100s.
Never had C/S error yet @230KBaud (overkill, BTW)

However, the device has a couple of serious limitations for my application so I have recreated and expanded the functionality, using a PIC32MX170 (albeit not using MMBasic).

I really like the NMC protocol (see attached datasheet) and have adopted it as my new standard.

Craig
picsrvsc.pdf
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5648
Posted: 03:57pm 18 Jul 2021
Copy link to clipboard 
Print this post

CRC is excellent - I'm not knocking it. However, if you are the type of person who would trust heavy rotating machinery to a RP2040 - especially at the present stage of its development - then I doubt if the extra security of CRC is really worth the hassle over just using parity bits TBH. They are both very bad ideas.

It's unlikely that most hobbyists will do much that's more dangerous than switching a light on (and the biggest risk is probably that they'll use a 30vDC rated relay to switch 240vAC) so I think there's plenty of justification for keeping things as simple as reasonably possible, initially anyway.

There's no real reason not to use i2c over most domestic distances and forget having to use drivers etc. It works well enough if you only need a single talker and avoid running the wiring in electrically noisy environments. You can also use logic level UARTs for multi-drop if there aren't too many stations.

SPI is great - especially if you can daisy chain devices. *Very* fast. Not a lot of use for off-board communication really though.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 05:28pm 18 Jul 2021
Copy link to clipboard 
Print this post

Sure but as per the example I already presented; as I type this, there are millions of CNC machines delivering hundreds of thousands of encoder counts/second to CPUs, using the exact same electrical components and with zero error checking....are they smashing themselves to pieces? No!

Some engineers get too hung up on something that they have been told or read about.
 
     Page 3 of 3    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024