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
Diff: STM3_ESC.h
- Revision:
- 14:acaa1add097b
- Parent:
- 13:ef7a06fa11de
- Child:
- 16:d1e4b9ad3b8b
--- a/STM3_ESC.h Sun Sep 29 16:34:37 2019 +0000
+++ b/STM3_ESC.h Sat Nov 30 16:34:58 2019 +0000
@@ -1,11 +1,16 @@
+/*
+ STM3_ESC Electronic Speed Controller board, drives Two Brushless Motors, full Four Quadrant Control.
+ Jon Freeman B. Eng Hons
+ 2015 - 2019
+*/
#include "mbed.h"
#ifndef MBED_DUALBLS_H
#define MBED_DUALBLS_H
-//#define USING_DC_MOTORS // Uncomment this to play with Dinosaur DC motors
+//#define USING_DC_MOTORS // Uncomment this to play with Dinosaur DC motors - WARNING deprecated feature
-//#define TEMP_SENSOR_ENABLE //
+//#define TEMP_SENSOR_ENABLE // - WARNING deprecated feature, sensor chosen imposed heavy burden on cpu, future looks to simpler analogue type
#include "BufferedSerial.h"
const int MOTOR_HANDBRAKE = 0,
@@ -35,7 +40,7 @@
enum {MOTADIR, MOTBDIR, MOTAPOLES, MOTBPOLES, ISHUNTA, ISHUNTB, SVO1, SVO2, RCIN1, RCIN2,
COMM_SRC, BOARD_ID, TOP_SPEED, WHEELDIA, MOTPIN, WHEELGEAR,
- FUT1, FUT2, FUT3, FUT4, FUT5} ; //
+ FUT1, FUT2, FUT3, FUT4, FUT5} ; // These represent address offsets in 24LC64 rom user settable firmware settings
enum {
FAULT_0,
@@ -50,7 +55,7 @@
FAULT_UNRECOGNISED_STATE,
FAULT_MAX,
NUMOF_REPORTABLE_TS_ERRORS
- } ;
+ } ; // List of fault numbers currently dealt with by error handler
class error_handling_Jan_2019
{
@@ -72,7 +77,7 @@
const int MAX_PARAMS = 20;
const int MAX_CMD_LEN = 220;
-struct parameters {
+struct parameters { // Used in serial comms with pc and other controller (e.g. touch-screen)
struct kb_command const * command_list;
BufferedSerial * com; // pc or com2
int32_t position_in_list, numof_dbls, target_unit, source, numof_menu_items;
@@ -80,7 +85,7 @@
bool respond, resp_always;
} ;
-class cli_2019 {
+class cli_2019 { // cli Command Line Interpreter, two off, 1 for pc comms, other touch-screen controller comms
struct kb_command const * commandlist ;
int clindex;
char cmdline[MAX_CMD_LEN + 8];
@@ -106,6 +111,8 @@
class eeprom_settings {
I2C i2c;
uint32_t errors;
+ uint32_t i2c_device_count;
+ uint32_t i2c_device_list[12]; // max 12 i2c devices
char settings [36];
bool rd_24LC64 (int start_addr, char * dest, int length) ;
bool wr_24LC64 (int start_addr, char * dest, int length) ;
@@ -113,6 +120,7 @@
bool ack_poll () ;
public:
eeprom_settings (PinName sda, PinName scl); // Constructor
+ bool do_we_have_i2c (uint32_t x) ;
char rd (uint32_t) ; // Read one setup char value from private buffer 'settings'
bool wr (char, uint32_t) ; // Write one setup char value to private buffer 'settings'
bool save () ; // Write 'settings' buffer to EEPROM