Project

C-BISCUIT: Schematic Design for the RCB—Microcontroller, Motor Controller

September 21, 2016 by Robert Keim

In this article we’ll take a close look at two sections of the custom-designed control board for the C-BISCUIT demo bot.

In this article we’ll take a close look at two sections of the custom-designed control board for the C-BISCUIT demo bot.

The C-BISCUIT Series

  1. C-BISCUIT: A Robotics Platform for the Hacker and Hobbyist
  2. C-BISCUIT: Design Choices and Justification
  3. C-BISCUIT Power: 5V 3A Buck Regulator for Wandboard
  4. C-BISCUIT Power: Crowbar Protection Circuit for 5V Regulator
  5. C-BISCUIT: The Brains of the Operation
  6. C-BISCUIT Power: Assembly and Testing of Regulator and Crowbar Circuits
  7. C-BISCUIT: Monitoring Your Robot’s Health
  8. C-BISCUIT: Robot System Architecture
  9. C-BISCUIT: Schematic Design for the RCB—Microcontroller, Motor Controller
  10. C-BISCUIT: Schematic Design for the RCB—Power, Stepper
  11. C-BISCUIT: Layout and Assembly for the Robot Control Board
  12. C-BISCUIT: System Integration and Testing

Refresher and Intro

In the previous C-BISCUIT article (Robot System Architecture), I discussed the updated and refined system architecture for the robot that will be used to test and demonstrate the C-BISCUIT platform. One of the essential components in this architecture is the Robot Control Board (RCB), which is a custom-designed PCB that must be able to do the following:

  • transmit data to and receive data from the Wandboard
  • generate drive signals for the two brushed DC motors that move the Tri-Track robot chassis
  • provide a regulated 5 V supply for the Wandboard and a regulated 3.3 V supply for logic-level circuitry on the RCB
  • monitor the battery-pack voltage and take action to prevent excessive discharge

The central component on the RCB is an EFM8UB2 microcontroller from Silicon Labs. This 48-pin device is compact and affordable yet very capable; it is responsible for initiating, performing, or supervising almost everything that happens on the board. The following diagram conveys the architecture of the RCB:

 

 

This is consistent with the general approach that I use with just about any board that I design: Commands come in through a serial communication link and are executed by a microcontroller that governs all of the board’s functionality. The same serial link can be used to transmit operational feedback or relevant data that has been collected. In the case of the RCB, the microcontroller can communicate with a standard PC for testing and debugging or with the Wandboard.

Note that the above diagram omits details that we’ll see when we take a closer look at the various sections of the design. The diagram also does not show two stepper-motor driver ICs that are not needed for the current robot system; they were included in the RCB because we might want to incorporate stepper-motor functionality into future versions of this robot or into new projects.

A Microcontroller That Controls Motor Controllers

The following schematic excerpt shows the EFM8 and related circuitry:

 

Click to enlarge

 

You may have noticed in the block diagram that the EFM8 appears to be powered by 5 V from the DC/DC converter. Actually, though, the EFM8 has an integrated linear regulator that accepts 5 V input and generates 3.3 V for its own use and for external circuitry. J2 is a three-pin header that allows the user to power the EFM8 from the DC/DC converter or from the 5 V provided by a USB connection. The latter arrangement is handy for initial testing and debugging because the EFM8 can function even if the battery is disconnected or the DC/DC converter is not operational.

The microcontroller has an integrated oscillator that is fairly accurate, but I chose to include an external oscillator (U8) in case higher frequency precision is needed. The LTC6930 is a “silicon oscillator”—this rather vague term refers to an oscillator IC that does not require a piezoelectric element. There are certain benefits associated with these devices; you can read more about silicon oscillators here.

The remaining components are the following:

  • J5: a header that allows us to debug and program the microcontroller using a Silicon Labs USB Debug Adapter
  • LED1: three general-purpose LEDs (red, green, and blue) in one package
  • FB1: a ferrite bead that helps to suppress power-supply noise
  • D1 and D2: ESD-protection diodes for the USB signals
  • J1: a USB Micro-B connector that allows the EFM8 to communicate with a USB host device
  • C3 and C4: output capacitors for the EFM8’s internal voltage reference
  • Various filter/bypass caps for the power rails

Help from the Experts: The MAX14870

The next schematic excerpt shows a DC-motor-drive IC and related components.

 

Click to enlarge

 

The board includes two of these circuits because the Tri-Track chassis has two tank-style tracks, with one motor for each track. We need to be able to control the two motors independently so that we can turn the robot by changing the speed of one track relative to the speed of the other track.

I like designing my own circuits, but I also enjoy reaping the benefits provided by highly skilled IC designers. Part of engineering humility is accepting the fact that the experts at Maxim can design a motor controller that far surpasses whatever I might come up with. So, here we have the MAX14870, a highly integrated, small-form-factor, user-friendly device that requires few external components and only three control signals.

The control interface is straightforward:

  • The nEN pin must be driven low to enable the motor drive outputs.
  • The logic level at the DIR pin controls the motor’s direction of rotation.
  • Drive voltage is applied to the motor whenever the PWM pin is logic high. As the name of the pin implies, the speed of the motor can be controlled by applying a pulse-width-modulated signal to the PWM pin.
  • An overcurrent condition or thermal shutdown will drive the nFAULT pin to logic low. This allows a microcontroller to be notified when something is going wrong with the motor-control situation. It’s an open-drain output, so multiple nFAULT pins can be connected together (though with this arrangement there is no way to determine which particular chip is generating the fault condition).

Sensing Current: V = IR

Let’s take a minute to understand what’s going on with the sense resistor, R1. The motor is driven by allowing current to flow from the 12 V supply, through one of the high-side FETs, through the motor’s coil, through one of the low-side FETs, and finally out to the COM pins. That current needs to make its way to the ground node, but we don’t have to connect the COM pins directly to ground. If we put a small resistor between the COM pins and ground, the voltage at the COM node will be proportional to the current flowing through the motor’s coil. In other words, this current-sense resistor allows us to monitor the motor-drive current.

 

Click to enlarge

 

By including the sense resistor and connecting the COM node to the MAX14870’s SNS pin, we are enabling the internal-current-regulation functionality. The MAX14870 wants the voltage at the SNS pin to stay below 100 mV; if this voltage starts to get too high, the motor-drive current is interrupted as needed to keep the SNS voltage below 100 mV. Thus, the maximum motor-drive current is given by the following equation:

 

$$I_{MAX}=\frac{100\ mV}{R_{SENSE}}$$

 

The C-BISCUIT motor-control circuit has a 0.068 Ω sense resistor; this means that the motor-drive current is limited to about 1.47 A. The datasheet for the Tri-Track motors indicates that the starting current is about 1.5 A, so 1.47 A is a conservative limit that still allows the motor to start up normally. But considering that I have no prior experience with this motor or the MAX14870, I would not be surprised to find that 0.068 Ω is not the optimal value for RSENSE.

An important thing to keep in mind is that this sense resistor dissipates some serious power. This is an easy place to make a nontrivial mistake because low-voltage designers often don’t need to think carefully about resistor power ratings. Even though starting current is higher than steady-state current, just to be on the safe side we’ll assume that this resistor might be subject to 1.5 A for a long period of time. That translates to

 

$$P_{MAX}=(1.5\ A)^2\times0.068\ \Omega=0.153\ W$$

 

I like a factor-of-two safety margin, so the resistor’s power rating should be at least 1/4 W. I chose a 1/2 W part because that gives me additional confidence that the resistor won’t burn as a result of designer error.

If you don’t need automatic current regulation, you can disable this feature simply by connecting the SNS pin to ground, which (obviously) ensures that the voltage at SNS will never exceed 100 mV. The MAX14870 still has its generic overcurrent protection, but that doesn’t kick in until the current flowing through one of the motor drive lines is greater than about 6 A for longer than 1 µs.

Motor Current—The EFM8 Ought to Know

Since I decided to include a sense resistor for automatic current regulation, I might as well throw in a few extra components that allow the EFM8 microcontroller to gather information regarding how much current the motors require under various operating conditions. That’s what the op-amp circuit is for—it’s just a gain-of-ten noninverting amplifier that serves as an interface circuit between the voltage across RSENSE and the EFM8’s ADC circuitry.

 

Click to enlarge

 

This motor-current data could even be transmitted to a PC via the Wandboard’s Wi-Fi to enable real-time remote monitoring.

One Big Cap and Three Small Ones

The 1 µF and 0.1 µF caps are typical power-supply bypass components. But why the huge cap? Well, driving a DC motor means we’re dealing with large transient currents, and we want to make sure we have a nearby source of readily available charge for those currents. Maybe 100 µF (for each motor-drive IC) is more than we need for this application, but it’s not easy to determine the optimal value, and in this case it’s better to have a little too much capacitance rather than not quite enough.

Conclusion

We’ve covered two major portions of the C-BISCUIT Robot Control Board—the EFM8 microcontroller and the driver circuit for the brushed DC motors. In the next article we’ll continue our tour through the RCB schematic.

Next Article in Series:

3 Comments
  • C
    chrisbaron December 02, 2016

    <sarc> Yes yes let’s keep that awesome 80’s tech 8051 CPU going!  and we can control ONE WHOLE AMP of current with that MAX chip - you can practically run a toy car with that!  But I’m suspicious of these fancy pants surface mounted parts and that newfangled FLASH memory.  Give me a bunch of DIP sockets and a good ole UV EPROM.  Now that is some some solid tech. </sarc>

    Like. Reply
    • D
      DanielETEC January 22, 2018
      This is just one subsystem of a larger ROS (quad ARM SBC) controlled robot design. A useful exercise, even if you would pick a different microcontroller here, or needed a higher current motor driver. If you actually bothered to look at his PCB design, you would note the surface mount components. You do realize (I doubt you do), the 8051 lives on in modern parts, as it has so much industry history, sort of like being x86 compatible for PCs. I don't care for it myself, but realize there is lots of code base somone is using. You must not have read the series of articles- but why read something before commenting on it? Now that is some solid, well though out, criticism!
      Like. Reply
    • D
      DanielETEC January 22, 2018
      Oops, looks like you should study up on reading data sheets also- that "MAX chip" is rated 3A continuous....the author is sizing the current sensing to his motors.
      Like. Reply