Powering a BLDC Motor and Two Servo Motors

For this week, I am creating basic individual circuits for each of the actuation mechanisms in my ornithopter. This includes a brushless dc outrunner (BLDC) motor for the wing actuation, as well as two servo motors for actuating the tail direction.

Fortunately, we have one example board for each problem, which I am going over as a starting point. The board for this week tries to integrate both of these. The final project version will add a module for the communication (BLE with NRF52 or BC381), and maybe use some extra input, although this is not planned at this stage.

Actuating a BLDC Motor

The two main new components for the dc motor are the

Beyond the two new components, this board also uses much larger traces for VBB and GND so as to allow large amount of energy / current through.

Actuating Two Servo Motors

Fortunately (again), this example board uses allows control for two distinct servo motors, which exactly what my bird will need (as degrees of freedoms of the tail). The only new component is the use of a different voltage regulator, namely

After considering the similarity with the first board, I asked on Gitlab a question regarding the difference between the two regulators. I was puzzled by the fact that this two-servo board does not use the higher input voltage, and does everything with the data and power lines of the microcontroller. The voltage regulator is different and so I thought it might be where the difference happens.

And I was in the right direction. The answers to my question (thanks Jake!) pointed me to the fact that servos tend to use a lot of current. This servo board uses a regulator that has a tenfold output current (1A versus 100mA for the dc motor board). The voltage itself is not so critical as most of the logic is done using the amount of time the signal is on (e.g. via PWM), and the power is drawn through the current. Pololu has a very nice introduction to servos that describes notably:

The other minor difference is the capacitor used between ground and 5V power. The reason for such a higher capacitor (22uF) seems to come from the large current possibly drawn by the servo motors.

Resistors and capacitors

Seeing these many capacitors and the recurrent resistor between ground and reset got me to ask the TAs about their purposes. In the previous USB week, I learned about the usage of capacitors around crystals and the different crystal circuits. Here, I learned about the reset functionality (which had already been mentioned in class, but not in depth) and its associated 10k resistor, and the capacitors between ground and power.

The 10k resistor between reset and VCC is called Reset Pullup Resistor. As explained there, its goal is to ensure that the reset line stays high and noise does not accidentally draw it low. When going low and then back high, the micro-controller is reset, which is used for programming the device. Without the resistor, the voltage fluctuations could have the reset line go low for a short time, which would trigger an undesired reset. The recommended pull-up resistor is 4.7kOhms. The ATTiny44A datasheet says it should be at least 10kOhms for debugWIRE to work on it, and the ideal range is 30k to 60kOhms (interestingly most of the class designs are below that range, so it's not critical).

The capacitors between power and ground are often called Bypass Capacitors (or Decoupling Capacitor). In our boards, the main function of these is to filter noise coming from other devices and maintain the VCC voltage during fluctuations. This is especially important with large current being drawn by output devices such as the servo motors, which lead to voltage drop, and in turn could lead to disfunction of the micro-controller that does the logic if the voltage drops too low. One common value is 0.1uF, and it should be placed as close as poosible to the device requiring the stabilized power (i.e. the IC / ATTiny in our case). The reason for having multiple in parallel seems to be that higher-value capacitors will not be as effective at dealing with high frequency current drawn by the chip. The exact values are dependent on the characteristic noise that comes from the devices.

First attempt at a board

I started by re-creating the same board as the DC board with Eagle. No special problem here.

I then decided to create a hybrid board instead of replicating separately the servo board. The changes involve using a higher capacitor (I used the one from the servo board, i.e. 22uF instead of 1uF), the higher-amperage voltage regulator of the servo board, a resonator for the clock, as well as an extra 6-pin header to allow two different servo motors to be driven by PA6 and PA7 respectively. Here, a problem arose with the regulator. The outputs didn't seem to match the ones from the example board, and I force-tried to make it look similar, which ended up being a bad idea. The schematics doesn't really make sense regarding the inputs/outputs of the regulator. This is because I tried to match the board pin ordering of the example board that has ground in the middle pin and the opposite one.

As it turns out, this is wrong! The original pinout from the datasheet is correct. Maybe the original example was using a different component!
Note: trust the datasheet more.

Cutting was fine. Populating was also easy. I am starting to get faster at it. Population done in less than an hour.

The debugging was quite interesting because by doing this inversion, only the regulator suffered. Pathologically, I smelled something very quickly. No visual smoke, but it was clear that something was wrong. I used a FLIR camera to visualize the problem (although I could tell from the heat of the regulator just by approaching my hand). Most of the board is at room temperature (~25-30 deg C), whereas the regulator goes to ~150 deg C, so basically I am sinking the current into it and letting it burn. It probably broke instantly the first time and is just in a broken state for now.

I thus decided to be more reasonable and believe in the datasheet (and accept that the example board was either wrong or, more likely, using a different component). I corrected the schematics (which now made more sense with the pinout), and also added an extra USB pad to draw power for the programming (I don't like using the headers for that).

Power cables

I created my own cables for connecting power from the adjustable volt/current power supplies using banana plugs. The molex ends never got correct contact, so I ended up replacing these ends with female jumper cables that I'd merge with the rest of the cable with solder and heat-shrink wrap.

At this point, I tested one of the servos that was available in the stock as well as my two micro-servos from Hobby-Express (4 dollars, 4 grams per servo!). Unfortunately, when full of joy and manipulating the middle one, I think I broke an internal gear. It does not work anymore, but the other one (on the left) does work well.


I also tried to run the dc motor but without success at this point. Surprisingly, I tried to run it on the power supply directly, and while it works with the power in one setting, it does not in the reverse setting. The back of the motor shows a "+" sign which may mean that it only supports one direction? In practice, I don't the direction doesn't matter for my bird. The only requirement is to be able to change the speed, which seems to be modulated with the amount of voltage (which may be modulated through the H-Bridge using PWM). I have to check whether this is a problem with the motor or the h-bridge itself.

Gavin mentioned using a switched-mode power supply although the power is going to come from batteries, so I will probably eventually need to use a higher amperage voltage regulator to allow more current through, or use individual power regulators for each component. More improtantly, I'll also have to figure out the battery.