MB2HAL with VFD and Arduino

More
20 May 2024 16:22 #301014 by Domsku
Hello,
I used MB2HAL to communicate with my VFD for a long time already. I use a USB to RS485 converter on my PC and a 2-wire cable to the VFD.

Now I added an arduino to to the same line. The arduino is used to switch cooling and a vacuum cleaner on and off with M7 and M8 commands.

Everything works well, as long as the configuration takes care of one of both. I have a test configuration, which only talks to the arduino wich works fine, and the VFD also works on its own. But as soon as I combine both in one configuration, the problems are starting. I have attached two screenshots. The first one is the initial state. No errors, no problems.
When I then let the Spindle rotate, the increase of the spindle speed and the feedback has a delay of a couple of seconds and in the Halshow window you can see that the arduino has en error - see second screenshot. As soon as I stop the spindle, the error is gone.
With the spindle running, the M7/M8/M9 command don't reach the arduino. So, when I call M7 with the spindle running, my vacuum cleaner starts working just after I stopped the spindle.

Does anyone know, where the mistake is hidden? In the attachment, you can find the relevant configuration files.

Thanks for your help
Dominik
 

Please Log in or Create an account to join the conversation.

More
21 May 2024 11:04 - 21 May 2024 11:27 #301073 by Domsku
Replied by Domsku on topic MB2HAL with VFD and Arduino
...today I changed my setup and connected the Arduino to a separate USB to RS485-adapter. The VFD is now connected to ttyUSB0 and the Arduino to ttyUSB1. This solved the problem that the VFD is reacting with a delay, Also, it is now possible to start the cooling while the spindle is running. However, the Arduino still has a delay and some errors occur.

By the way, I'm running LinuxCNC 2.9.2  .
Last edit: 21 May 2024 11:27 by Domsku.

Please Log in or Create an account to join the conversation.

More
22 May 2024 06:59 - 22 May 2024 07:02 #301136 by jimmyrig
if you can change things on the sindle (rpm, direction, etc) without turning the spindle on.....and your arduino works perfectly. Then when you turn the spindle on nothing works or works poorly, you likely have an emi issue not a software one.

lookup emi protection for more details but in general. shielded wires grounded on one end only. avoid running wires parallel, when they need to cross cross at 90 degrees, ferrite chokes, use different power supplies. make sure no ground loops (computers are often grounded), etc

In general that's why arduinos are rare in the industrial world. not because they cant work, but because hardening them against emi is much harder and more time consuming than a board designed to work in those enviroments. e.g. mesa, plc's, etc 
Last edit: 22 May 2024 07:02 by jimmyrig.
The following user(s) said Thank You: tommylight, Domsku

Please Log in or Create an account to join the conversation.

More
22 May 2024 15:45 #301152 by Domsku
Replied by Domsku on topic MB2HAL with VFD and Arduino
...guess you were right. Actually I used shielded wires (from an old network cable) but didn't ground them. Now, I connected them to the housing of the PC and added a ferrite choke on each end of the wire. At first, it didn't change anything. Then I played around with my VFD to start the spindle manually. With this, it worked ... put everything back to modbus ... and it still works :-)

I think, I better not try to understand this. EMI is somehow voodoo to me and ruined already a few of my projects.

Many thanks for your advice!

Please Log in or Create an account to join the conversation.

More
23 May 2024 03:18 #301179 by jimmyrig
Glad it worked out!

Please Log in or Create an account to join the conversation.

More
23 Jun 2024 09:29 #303627 by Domsku
Replied by Domsku on topic MB2HAL with VFD and Arduino
The two pictures show my final solution for grounding the shield of the wire. I used copper tape with conductive adhesive to connect the USB plug of the adaptor to the shield of the wire. It's easily done and works well :-)
 
 
Attachments:
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

Time to create page: 0.333 seconds
Powered by Kunena Forum