denisg76 / epos4-arduino Goto Github PK
View Code? Open in Web Editor NEWSend commands to Maxon Epos controller
Send commands to Maxon Epos controller
In the example, the section that moves the motor writes
0x1000 rpm per second max acceleration
0x1000 rpm per second max acceleration
0x1000 rpm target motor speed
The comment each time says that this is 1000rpm.
Problem: This is misleading and potentially somewhat dangerous
What happens is that 1000 Hex is written and the motor is spun up to 4096rpm (decimal).
It is also accelerating and decelerating at 4096rpm per second.
I would recommend that
a) Code: for an initial proof of motor movement, a much lower speed and acceleration would be chosen. So change 0x1000 to 0x20 everywhere and change the comment to indicate that this is 81rpm in decimal.
b) Environment: Make sure everything is safe - your motor's axis should be physically disconnected from external machinery.
There is a somewhat nasty problem related to the
if (SerialEpcos.available() > 0)
loop, This is the loop that processes incoming serial data.
It's a long loop, but is is efficiently using the switch case statements.
Serial communications between Arduino and EPOS4 run at 9600 baud = 9600 bit per sec. Start+8data+1stop bit take 10/9600 of a second, roughly one millisec.
Problem: One can imagine this loop completes within one millisec, especially on the more powerful Arduino models. If at that time the next byte is still coming in through the serial port, SerialEpcos.available will be zero and read will fail.
Proposed solution1: Quick & dirty solution would be to add delay(1); somewhere inside the loop. That fixes the problem at 9600 bps, assuming the EPOS4 is sending characters one immediately after the other.
Alternative workaround would be to increase the baudrate in communications between Arduino & EPOS4.
Proposed solution2: Add an additional timeout per character, dependent on baudrate.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.