Power bridges to report temperatures and current

Posted on September 11, 2014

0


Njay: Hi. Right now this is what I’ve got for the I²C registers…
eI2cReg_Command         = 0,    // RW  command
 
 // Status: b0~b3: heartbeat, b4:over-current
eI2cReg_Status          = 1,    //  R  status
 
 // Speed: speed/direction:  b7: direction; b0~6: Speed
eI2cReg_Speed           = 2,    // RW  speed
 
 // raw diode reading
eI2cReg_HBridgeTemp     = 3,    //  R  controller temperature
 
 // raw diode reading
eI2cReg_MotorTemp       = 4,    //  R  motor temperature
 
 // Motor driving current (I), x10 in A
//  I = MotorCurrent / 10
eI2cReg_MotorCurrent    = 5,    //  R  motor current
 
 // Controller’s power supply voltage (Vcc), minus 10V x10
//  Vcc = HBridgeVcc / 10 + 10
eI2cReg_HBridgeVcc      = 6,    //  R  controller Vcc
// Firmware revision
 eI2cReg_SwRevision      = 7,    //  R  sw revision
The temperature measurements are just the direct ADC readings from the sensing diodes. The values will be inversely proportional to the temperature, to be checked empirically. At this point I’m not doing anything with them, I’ll leave that to you.
The speed register takes either 0 or between 10 and 117 (below 10 is 0, and above 117 is 117); these limitations were introduced by the new software-implemented PWM. This could be optimized, if we needed to extract a little more precision.
The new current measurement scheme turned out alright, see the description in the latest commits. I’ve still got some stuff to do.
The “Command” register is special, you write to it to make something special happen:
// Turn off all the FETs and reinitialize the uC pins
eCmd_Reset = 0,
// Get the internal chip’s Vref (used by the ADC), stored in EEPROM
eCmd_GetVref = 3,
//// Available only when the code is compile without DISABLE_EEPROM_WRITE:
// Defines the i2c address and store in EEPROM
// Param: register MotorCurrent = address
eCmd_SetI2cAddr = 1,
// Define the ADC Vref value and store in EEPROM
// Param: register MotorCurrent = Vref * 10
eCmd_SetVref = 2, //// Available only when the code is compiled with ENABLE_DOUBLE_PULSE: // Do a “double pulse” test
// Param: register Speed = length of 1st pulse, in us
// Param: register MotorCurrent = length of pause, in us
eCmd_DoDoublePulseTest = 4,

At the top of main.c there’s a series of #defines to control what is compiled in.
Mostly ready to ship! 🙂
Tomorrow I’m running another longer test like I did with the first bridge (hope I don’t burn anything).
This damned second bridge still gave me 2 hours of debug effort. I thought I had changed the filter cap on the current measuring shunt from the original 10nF to 100nF on the first bridge like in the schematics, but it turns out the first bridge still had 10nF. In this one, with 100nF, I couldn’t get a reading of current; the larger cap filtered it out. So I changed it all back to 10nF to get the current readings.
There is still one wire connection left to do, the temperature sensors for the heat sinks, between the add-on board and the micro-controller board. It turns out we didn’t need the add-on expansion to get the temperature of the motor, I’d already provided a port for that on the base board. You just have to solder a 2-pin header and wire there a sensor diode.
I’ll call you tomorrow to arrange delivery.
(to be continued…)Lisbon_MMF_logos_Banner_big
Advertisements
Tagged: