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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Radio_Control_In.h Source File

Radio_Control_In.h

00001 #include "mbed.h"
00002 #ifndef MBED_JONS_RADIO_CONTROL_IN_H
00003 #define MBED_JONS_RADIO_CONTROL_IN_H
00004 #include    "brushless_motor.h"
00005 extern  const   uint32_t    MOTOR_HANDBRAKE, MOTOR_FORWARD, MOTOR_REVERSE, MOTOR_REGENBRAKE;
00006 
00007 /**class   RControl_In
00008     Jon Freeman
00009     Jan 2019
00010 
00011     Checks for __-__ duration 800-2200us
00012     Checks repetition rate in range 5-25ms
00013 */
00014 class   RControl_In         //  Class to Read servo style pwm input _____-_____
00015 {
00016     InterruptIn pulse_in;
00017     Timer   t;
00018     int32_t pulse_width_us, period_us, pulse_count, tmp;
00019     uint32_t state, chan_mode, stick_sense;               //  New Dec 2019
00020     double  norm, V, I, stick_deviation, stick_deviation_old;          //  New Dec 2019
00021     double  lost_chan_return_value, brake_segment, effort, stick_attack;
00022     double  range_offset;
00023     void    RadC_rise ();
00024     void    RadC_fall ();
00025 public:
00026     RControl_In   (PinName inp) : pulse_in(inp)   {    //  Constructor
00027         pulse_in.mode   (PullDown);
00028         pulse_in.rise(callback(this, &RControl_In::RadC_rise));     // Attach handler to the rising interruptIn edge
00029         pulse_in.fall(callback(this, &RControl_In::RadC_fall));     // Attach handler to the falling interruptIn edge
00030         pulse_width_us = period_us = pulse_count = stick_sense = tmp = 0;
00031         state = MOTOR_REGENBRAKE;   //  New Dec 2019
00032         norm = V = I = stick_deviation = stick_deviation_old = 0.0;          //  New Dec 2019
00033         lost_chan_return_value = 0.0;
00034         range_offset = 0.0;
00035         stick_attack = 0.5;
00036     }   ;
00037     bool        validate_rx ()  ;   //  Informs whether signal being rx'd
00038     void        set_lost_chan_return_value  (double)  ; //  set what 'normalised' returns when no signal
00039     void        set_offset  (signed char, char, char);  //  signed char offs, char brake_pcent, char attack
00040     void        set_chanmode    (char, char);   //  1 Disable, Uni, Bi;    2 norm/rev
00041     uint32_t    get_chanmode    ()  ;
00042     uint32_t    pulsecount  ()  ;   //  will count up at frame rate when radio control all working well
00043     uint32_t    pulsewidth  ()  ;   //  
00044     uint32_t    period      ()  ;   //  checked for believable repetition rate
00045     bool        read    (struct  RC_stick_info &)  ;
00046     bool        energise    (struct  RC_stick_info &, struct brushless_motor &)  ;
00047 }   ;
00048 
00049 #endif