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

Committer:
JonFreeman
Date:
Sun Sep 29 16:34:37 2019 +0000
Revision:
13:ef7a06fa11de
Parent:
12:d1d21a2941ef
Child:
16:d1e4b9ad3b8b
Stable code as at end of 2019 running season

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JonFreeman 11:bfb73f083009 1 #include "mbed.h"
JonFreeman 11:bfb73f083009 2 #ifndef MBED_JONS_RADIO_CONTROL_IN_H
JonFreeman 11:bfb73f083009 3 #define MBED_JONS_RADIO_CONTROL_IN_H
JonFreeman 11:bfb73f083009 4
JonFreeman 11:bfb73f083009 5 /**class RControl_In
JonFreeman 11:bfb73f083009 6 Jon Freeman
JonFreeman 11:bfb73f083009 7 Jan 2019
JonFreeman 11:bfb73f083009 8
JonFreeman 11:bfb73f083009 9 Checks for __-__ duration 800-2200us
JonFreeman 11:bfb73f083009 10 Checks repetition rate in range 5-25ms
JonFreeman 11:bfb73f083009 11 */
JonFreeman 11:bfb73f083009 12 class RControl_In // Class to Read servo style pwm input _____-_____
JonFreeman 11:bfb73f083009 13 {
JonFreeman 11:bfb73f083009 14 InterruptIn pulse_in;
JonFreeman 11:bfb73f083009 15 Timer t;
JonFreeman 11:bfb73f083009 16 int32_t pulse_width_us, period_us, pulse_count;
JonFreeman 11:bfb73f083009 17 double lost_chan_return_value;
JonFreeman 11:bfb73f083009 18 void RadC_rise ();
JonFreeman 11:bfb73f083009 19 void RadC_fall ();
JonFreeman 11:bfb73f083009 20 public:
JonFreeman 11:bfb73f083009 21 // RControl_In () ; // Default Constructor
JonFreeman 11:bfb73f083009 22 RControl_In (PinName inp) : pulse_in(inp) { // Default Constructor
JonFreeman 11:bfb73f083009 23 pulse_in.mode (PullDown);
JonFreeman 11:bfb73f083009 24 pulse_in.rise(callback(this, &RControl_In::RadC_rise)); // Attach handler to the rising interruptIn edge
JonFreeman 11:bfb73f083009 25 pulse_in.fall(callback(this, &RControl_In::RadC_fall)); // Attach handler to the falling interruptIn edge
JonFreeman 11:bfb73f083009 26 pulse_width_us = period_us = pulse_count = 0;
JonFreeman 11:bfb73f083009 27 lost_chan_return_value = 0.0;
JonFreeman 11:bfb73f083009 28 } ;
JonFreeman 11:bfb73f083009 29 bool validate_rx () ; // Informs whether signal being rx'd
JonFreeman 12:d1d21a2941ef 30 void reset () ;
JonFreeman 11:bfb73f083009 31 void set_lost_chan_return_value (double) ; // set what 'normalised' returns when no signal
JonFreeman 11:bfb73f083009 32 uint32_t pulsecount () ; // will count up at frame rate when radio control all working well
JonFreeman 11:bfb73f083009 33 uint32_t pulsewidth () ;
JonFreeman 11:bfb73f083009 34 uint32_t period () ;
JonFreeman 11:bfb73f083009 35 double normalised (); // Returns 0.0 <= p <= 1.0 or something else when rc not active
JonFreeman 11:bfb73f083009 36 } ;
JonFreeman 11:bfb73f083009 37
JonFreeman 11:bfb73f083009 38 #endif