Is there a way to get the v5 smart motor working with an Arduino? I understand it uses RS485 so the comms shouldn’t be an issue, but I can’t find any official or unofficial specs for the actual protocol. I’m interested in using it for a personal project and don’t want to spend the $275 for the v5 brain for something simple. I could of course reverse engineer it myself, but that would be a challenge without buying a brain.
This thread has some relevant information, but I don’t think it provides a clear answer to your question.
It will definitely be easier (and cheaper) to use 393 motors with an Arduino, if all you need is a motor readily compatible with other VEX EDR parts.
If you’re serious about getting the motor to work with Arduino, I can share some of my notes about the motor communication (unless the motor protocol has changed significantly over time).
The biggest hurdle you’d have to overcome is the link layer speed though. The motor uses RS485, but the baud rate is 25MHz/16 (1.5625 Mbit/s). That’s a rate that would be extremely hard to get from the typical Arduino clock (neither 8MHz nor 16MHz base clock rate of AVR based Arduinos help here, maybe some Cortex-based variants would be better or at least offer fractional clock divisors).
Once you have the link layer speed sorted out, the protocol is relatively simple, though it might be a little demanding timing-wise. A motor and the brain exchange fixed-form 16B messages, with the motor initiating the exchange. Every 5ms or so, the motor sends a 16B status message, and expects the brain to acknowledge it (by 16B ack or 16B command) in like 200us. (I think the motor would be more lenient, just the V5 brain answers that fast).
The status message looks like this:
Sample: 76 19 10 00 49 01 00 00 6B FD A0 F9 20 00 12 A5 off len val type 0 1 0x76 message code 1 1 temp temperature in degrees celsius (30, 35, ...) 2 2 current u16, mA flowing into the motor 4 4 ticks s32, absolute position in ticks (1800 ticks/rotation) 8 8 speed s16, current speed, ticks/s 10 2 voltage s16, mV on the motor 12 2 flags some other flags? 14 2 CRC u16 message CRC
The basic motor control, set the speed (using internal PID), would look like:
56 02 B8 0B 00 00 00 00 00 00 01 00 01 00 CC CC 56: Set motor command 02: velocity PID 0BB8: velocity (ticks/s) (3000 = 100rpm) 00000000: no target 00: no PWM 00 01 - unknown 00 01 - brake mode 00 CCCC - CRC
The motor can be commanded in different modes (free-running PWM, position PID, …) and can also be configured, these are different messages, but the format is similar.
For one-off project, I am not sure it would be worth it to invest into implementing full V5 support (except for the learning/experience value). For some form of more wide-spread usage (public library, usage in a classroom/club, …), it would be worth to get V5 brain, at least to be able to analyze and debug the protocol with direct hands-on and native protocol implementation.
Either way, the protocol is VEX private, it was never published AFAIK, and as such, could be changed by VEX at any time (the brain has, and routinely uses a means of motor firmware update, so it is relatively cheap and safe for VEX to roll a protocol update).