![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Dual Brushless Motor ESC, 10-62V, up to 50A per motor. Motors ganged or independent, multiple control input methods, cycle-by-cycle current limit, speed mode and torque mode control. Motors tiny to kW. Speed limit and other parameters easily set in firmware. As used in 'The Brushless Brutalist' locomotive - www.jons-workshop.com. See also Model Engineer magazine June-October 2019.
Dependencies: mbed BufferedSerial Servo PCT2075 FastPWM
Update 17th August 2020 Radio control inputs completed
Revision 17:cc9b854295d6, committed 2020-08-16
- Comitter:
- JonFreeman
- Date:
- Sun Aug 16 14:13:19 2020 +0000
- Parent:
- 16:d1e4b9ad3b8b
- Commit message:
- August 2020. Checked Radio Control input ops.
Changed in this revision
diff -r d1e4b9ad3b8b -r cc9b854295d6 24LC64_eeprom.cpp --- a/24LC64_eeprom.cpp Tue Jun 09 09:20:19 2020 +0000 +++ b/24LC64_eeprom.cpp Sun Aug 16 14:13:19 2020 +0000 @@ -385,7 +385,7 @@ if (i2c.write(addr_wr) == ACK) i2cfree = true; else - wait_ms (1); + wait_us (1000); // June 2020 changed from wait_ms as now deprecated } return i2cfree; }
diff -r d1e4b9ad3b8b -r cc9b854295d6 brushless_motor.cpp --- a/brushless_motor.cpp Tue Jun 09 09:20:19 2020 +0000 +++ b/brushless_motor.cpp Sun Aug 16 14:13:19 2020 +0000 @@ -20,7 +20,7 @@ : Motor_I(iadc), maxV(pwv,PWM_PRESECALER_DEFAULT), maxI(pwi,PWM_PRESECALER_DEFAULT), H1(px), H2(py), H3(pz), OP(pn, port_bit_mask) // Constructor */ brushless_motor::brushless_motor (PinName iadc, PinName pwv, PinName pwi, - const uint16_t * lutptr, PinName px, PinName py, PinName pz, PortName pn, uint16_t port_bit_mask, uint32_t rnum) + const uint16_t * lutptr, PinName px, PinName py, PinName pz, PortName pn, const uint16_t port_bit_mask, const uint32_t rnum) : Motor_I(iadc), maxV(pwv,PWM_PRESECALER_DEFAULT), maxI(pwi,PWM_PRESECALER_DEFAULT), H1(px), H2(py), H3(pz), OP(pn, port_bit_mask) // Constructor { // Constructor OP = 0;
diff -r d1e4b9ad3b8b -r cc9b854295d6 brushless_motor.h --- a/brushless_motor.h Tue Jun 09 09:20:19 2020 +0000 +++ b/brushless_motor.h Sun Aug 16 14:13:19 2020 +0000 @@ -38,7 +38,7 @@ double dRPM, dMPH; // brushless_motor () {} ; // can not use this with exotic elements PortOut, FastPWM etc - brushless_motor (PinName iadc, PinName pwv, PinName pwi, const uint16_t *, PinName h1, PinName h2, PinName h3, PortName, uint16_t, uint32_t) ; // Constructor + brushless_motor (PinName iadc, PinName pwv, PinName pwi, const uint16_t *, PinName h1, PinName h2, PinName h3, PortName, const uint16_t, const uint32_t) ; // Constructor bool poles (uint32_t) ; // Set number of motor poles - 4, 6, or 8 void set_V_limit (double) ; // Sets max motor voltage void set_I_limit (double) ; // Sets max motor current
diff -r d1e4b9ad3b8b -r cc9b854295d6 cli_BLS_nortos.cpp --- a/cli_BLS_nortos.cpp Tue Jun 09 09:20:19 2020 +0000 +++ b/cli_BLS_nortos.cpp Sun Aug 16 14:13:19 2020 +0000 @@ -28,7 +28,7 @@ extern error_handling_Jan_2019 ESC_Error ; // Provides array usable to store error codes. extern int WatchDog; // from main extern bool WatchDogEnable; // from main -extern bool read_temperature (float & t) ; // from main March 2020 +//extern bool read_temperature (float & t) ; // from main March 2020 extern brushless_motor MotorA, MotorB; // Controlling two motors together or individually extern const char * get_version () ; // Need this as extern const char can not be made to work. This returns & const_version_string @@ -202,7 +202,7 @@ * void temperature_cmd (struct parameters & a) { * Few boards have temperature sensor fitted. Now only supports LM75B i2c sensor */ -void read_temperature_cmd (struct parameters & a) { +/*void read_temperature_cmd (struct parameters & a) { float t = -99.25; if (a.respond) { a.com->printf ("tem%c ", user_settings.rd(BOARD_ID)); @@ -211,7 +211,7 @@ else a.com->printf ("Temp sensor not fitted\r\n"); } -} +}*/ /** *void rpm_cmd (struct parameters & a) // to report e.g. RPM 1000 1000 ; speed for both motors @@ -364,6 +364,12 @@ a.com->printf ("who%c\r%s", user_settings.rd(BOARD_ID), a.source == SOURCE_PC ? "\n" : ""); } +extern void rcins_report () ; +void qrc_cmd (struct parameters & a) // report RC1 and RC2 input condition and activity +{ + rcins_report (); +} + /** *void rcin_pccmd (struct parameters & a) * @@ -450,7 +456,7 @@ {"?v", "Report system bus voltage", sysV_report}, {"?i", "Report motor both currents", sysI_report}, {"who", "search for connected units, e.g. 3who returs 'who3' if found", who_cmd}, - {"tem", "report temperature", read_temperature_cmd}, +// {"tem", "report temperature", read_temperature_cmd}, {"mph", "read loco speed miles per hour", mph_cmd}, {"?s", "read loco speed miles per hour", mph_cmd}, // Shorter-hand added 17th May 2020 // {"ssl", "set speed limit e.g. 10.7", ssl_cmd}, // NEW July 2019 @@ -479,17 +485,18 @@ {"?v", "Report system bus voltage", sysV_report}, {"?i", "Report motor both currents", sysI_report}, {"?w", "show WatchDog timer contents", wd_report}, + {"kd", "kick the dog, reloads WatchDog", kd_cmd}, {"who", "search for connected units, e.g. 3who returs 'who3' if found", who_cmd}, {"us", "read or set user settings in eeprom", user_settings_cmd}, // Big change Jan 2019 {"ssl", "set speed limit e.g. 10.7", ssl_cmd}, // NEW July 2019 ONLY HERE FOR TEST, normal use is from Touch Screen only. {"sbe", "set brake effectiveness 5 to 90 percent", brake_eff_set_cmd}, // NEW May 2020 // {"erase", "set eeprom contents to all 0xff", erase_cmd}, - {"tem", "report temperature", read_temperature_cmd}, // Reports -50 when sensor not fitted - {"kd", "kick the dog, reloads WatchDog", kd_cmd}, +// {"tem", "report temperature", read_temperature_cmd}, // Reports -50 when sensor not fitted {"ver", "Version", ver_cmd}, {"rpm", "read motor pair speeds", rpm_cmd}, - {"mph", "read loco speed miles per hour", mph_cmd}, +// {"mph", "read loco speed miles per hour", mph_cmd}, {"?s", "read loco speed miles per hour", mph_cmd}, + {"?rc", "report RC1 and RC2 input condition and activity", qrc_cmd}, // {"rvi", "read most recent values sent to pwms", rvi_cmd}, // {"rdi", "read motor currents and power voltage", rdi_cmd}, // {"bc", "bogie constants - wheel dia, motor pinion, wheel gear", bogie_constants_report_cmd},
diff -r d1e4b9ad3b8b -r cc9b854295d6 main.cpp --- a/main.cpp Tue Jun 09 09:20:19 2020 +0000 +++ b/main.cpp Sun Aug 16 14:13:19 2020 +0000 @@ -202,13 +202,13 @@ return "1.0.y2020.m05.d21\0"; // Version string, readable using 'ver' serial command } -bool read_temperature (float & t) { +/*bool read_temperature (float & t) { // pc.printf ("test param temp = %7.3f\r\n", t); if (!temp_sensor_exists) return false; t = temp_sensor; return true; -} +}*/ void setVI_A (double v, double i) { @@ -448,6 +448,11 @@ RC_chan_2.set_chanmode (user_settings.rd(RCIN2), user_settings.rd(RCIN2REVERSE)) ; } +void rcins_report () { + pc.printf ("RC1 pulsewidth %d, period %d, pulsecount %d\r\n", RC_chan_1.pulsewidth(), RC_chan_1.period(), RC_chan_1.pulsecount()); + pc.printf ("RC2 pulsewidth %d, period %d, pulsecount %d\r\n", RC_chan_2.pulsewidth(), RC_chan_2.period(), RC_chan_2.pulsecount()); + pc.printf ("\r\n"); +} int main() // Programme entry point {