It's not my month

A project log for R8-D8 - a distant relative of R2-D2

a 12cm radius, 3d printed R2-D2 with some motors, servos and blinky stuff that follows lines, persons or just drives around via bluetooth

davedarkodavedarko 02/10/2015 at 23:1716 Comments

So I was motivated to work on the L293D perfboard, and the motors were running for a bit, but then came, what frustrated me on the #Locomatrix - 3D POV - a different approach so much - the arduino browned out when the motors moved, even on my supposed to be strong PSU. Without a scope I can hardly tell if it is not working because of the noise of the motors, I will have to throw in some capacitors and hope I can reduce all that. Maybe I'll add a 5V gold-cap and a diode to the arduino, so I have some power left over that can't be stolen from the motors. There isn't a front wheel on R8 yet, so it wasn't that spectacular to film.


davedarko wrote 02/11/2015 at 17:13 point - I may add something like this to the motors as well, cause it's cheap.

  Are you sure? yes | no

davedarko wrote 02/17/2015 at 22:48 point

turns out that there are already 3 caps on the motor on an extra pcb.

  Are you sure? yes | no

esot.eric wrote 02/18/2015 at 08:42 point

You're still having issues with this?

I noticed your locomatrix also uses similar motors... I heard somewhere that this type of motor is especially noisy. I don't know what makes them particularly different than others. But if you look at the DC motors used in something like an inkjet-printer, VCR, or audio-cassette player, there's a definite but hard-to-explain difference in appearance. I think the motors you're using are often called "hobby motors" (but what the others are called, I don't know, usually just "DC Motors"?). You usually find hobby motors in toy-cars, etc... Both types have brushes, they both have windings on the rotor... Maybe it has something with the spin-speed? "Hobby motors" generally spin at 10000+ RPM and usually run at pretty low voltages (e.g. 3-6), but the other type generally spin at *much* slower speeds at full-voltage (e.g. 6-24V), and are often *used* at even slower-speeds, and are often used with encoders or other form of speed/position control.

 Hobby-motors usually have brushes that are little more than springy-metal strips that only *tangentially* touch the winding-contacts wrapped around the shaft, whereas the other type usually have carbon(?) brushes that partially *wrap around* the winding-contacts. 

Why am I explaining all this...? Because now I'm curious. I honestly haven't thought too much about what makes these two motors *different* other than manufacture-quality... and why that would make one more noisy than the other.

So, thinking about the brushes and winding-contacts... maybe it's to do with the springy-metal and single-point of contact... it's possible they're quite (electrically) noisy, like the electrical-bounce on a pushbutton. Except, this "pushbutton" is *constantly* moving, so *constantly* in the "bounce"-state. Combine that with inductance, and you might just get a *constantly* noisy signal... those voltage-spikes that are generated by cutting the power to an inductor may happen several times while the "brush" bounces on each winding. At 10000RPM, this bouncing/voltage-spiking could be happening at thousands of Hz...

So that's one idea

The other is that the "brush" might only ever make contact with one winding-contact at a time (and possibly not make contact *at all* if it's touching the shaft *between* winding-contacts), since it only makes physical-contact at a single (tangential) point... Whereas, with a carbon-brush motor, the brush wraps around the winding-contact-shaft, so will make contact with *two* winding-contacts *briefly* as it turns, and never *no* contact...

So, as the "hobby" motor spins, (even ignoring the "bounce" issue discussed earlier) it might be generating huge voltage-spikes each time the brush moves from one winding-contact to the next... so at, e.g. 10000RPM, and three winding-contacts around the shaft and two brushes, that'd be, what...? 60000 makes/breaks per minute, 1000 per second... which actually doesn't seem like that much, considering motors are often driven with 20KHz PWM... EXCEPT: with PWM on a carbon-brush motor, the brush is still in contact with the winding, which means the winding's voltage-spike *is* being fed into the ("clamping"?) diodes, which thus limits the voltage-spike. Whereas the bouncy contact-no-contact hobby-motor may not have *anywhere* for the voltage-spike to go (when the brushes aren't making contact), so may generate thousands of volts at thousands of Hz... Some of those voltage-spikes might jump across thin-air (as an actual spark) to the brush, and some may not...

Your MCU might not be browning-out, it may be picking up huge noise-spikes *through the air*. Those'd definitely couple into the Clock system, etc...

I think that's it. Then again, if you saw my X-Y-Oscilloscoping theorizing, I could be *entirely* off-base ;)

IF that's it... First, do your decoupling-capacitors, that's always a good idea... Second: Try shielding that motor... maybe wrap it in aluminum foil, covering the air-holes (not long-term, just as a test!), and try to cover up that plastic base, as well... Connect that foil to ground... If you have high-speed signals in and out of the MCU, try shielding those wires individually (I've used old WIFI coaxial wire for clock signals). Try putting the digital circuitry in its own separate shielded-box... Or, heck, just start by holding a bare 'scope-probe near the motor...


  Are you sure? yes | no

davedarko wrote 02/18/2015 at 09:33 point

I've added the "adafruit" caps and now nothing moves anymore. "Probing" it with a LED shows that the outputs of the arduino and the motor chip do work and the motors are still running. I really think that it is not my month ;) 

  Are you sure? yes | no

esot.eric wrote 02/18/2015 at 11:14 point

Must be the month... my project kinda went TU as well.

  Are you sure? yes | no

davedarko wrote 02/18/2015 at 11:34 point

o.O when did that one-liner became an essay :D help a foreigner out, what's TU? I'm not sure if the L293D is not already broken. Well at some point I will start debugging it by throwing more LEDs at it, to see the signals on all sides. R2-D2 is a blinking robot from the times that brought us disco, so why not ;) I've extended the L293D board I've designed with some power-status LEDs and disconnected the motor and VCC power lines. I will rethink the power setup soon and hope I can hack the boards I've already ordered. My 'flying wires' board is probably not the best setup, anyway. From what I've read - the motors can be a big antenna sending signals in the MHz ranges. But I think it really has something to do with the build quality, since a DC motor is a DC motor is a DC motor, and the hobby once are probably cheaply winded, alternating in diameter and oxidized copper splinters etc. 

  Are you sure? yes | no

esot.eric wrote 02/18/2015 at 20:49 point

TU = "Tits Up" which, if I understand correctly, is kinda like laying dead on its back.

I was thinking about it some more and think "hobby motors" are actually slightly different in the way they're designed, as well... I think the windings might be offset differently from the brushes. So, when the brush breaks contact with the winding is probably slightly before the winding is most-strongly attracted to the magnet. If the winding continued to make contact, the motor would be tempted to act like a stepper-motor, and stay in that position. But, since the other type of motor makes contact with *two* windings simultaneously (briefly), I imagine they could be positioned differently... One winding might pass its strongest point while still being powered, because another winding is now powered to push it forward... So, then, this might explain why the non-hobby-motors are slower, but also more powerful at low-speeds.

Which, again, brings us to the *noise* issue, the motor winding loses contact when the magnet is *strongly* coupled with the windings, which means it's even *more* likely to generate huge voltage-spikes. Again, these are voltage-spikes/impulses, not a specific frequency-range. It's like a spark-gap radio-jammer (small-scale EMP!): See the last paragraph of the History section in:

You've run into this problem twice, now, similar motors, different projects... Your "flying wires" may have something to do with picking up that noise... But maybe you should consider that a good thing, like a tool... You've built test-equipment for detecting how well DC-Motor shielding works. :)

  Are you sure? yes | no

davedarko wrote 02/18/2015 at 23:18 point

Thanks for the clarification on that :D I don't want to test shielding, I just want to make motors turn :( :( :( I'm gonna test the boards with a new L293D and two separate power supplies - if that doesn't work, I'm gonna become a DC motor guru. But not today or in the near future. It really worries me on the other hand, that I have no clue. 

  Are you sure? yes | no

esot.eric wrote 02/19/2015 at 00:12 point

Dude, I've been making motors spin for 10+ years, different speeds and positioning via PWM and encoders, and you see I can barely guess... If you just want to make motors turn, you might want to invest in some better motors. Seriously, in all that I've done, I haven't run into problems as severe as those allegedly generated from these cheap motors..

I'm getting all my old stuff outta storage this week, maybe I'll try to throw one in a circuit and see what happens.

I'd suggest: Before you get new driver-chips: just power-up a motor, straight off the power-supply (not going through an H-bridge, or controlled by the MCU)... Then run a separate MCU circuit doing something else, like blinking an LED, or outputting data to a serial-port... see if it resets. Then you know it's nothing to do with the L293D, and it's a really easy test ;)

  Are you sure? yes | no

davedarko wrote 02/19/2015 at 00:22 point

a good plan :) but I still have 2-3 of those chips in a box, I'm kind of a "maybe needs one some day, buys 3-5 the same day" guy, when it comes to electronics. The motors were from a toy robot that was kind of pricey at that point and they made the toy thing work... anyway, I like to test the stuff by changing and testing every part of it. I haven't tried it that way yet, thanks!

  Are you sure? yes | no

davedarko wrote 02/10/2015 at 23:32 point

Interesting link about de-coupling

  Are you sure? yes | no

esot.eric wrote 02/11/2015 at 11:05 point

Looks like a handy link... I'mma revisit that.

I remember having some issues like this on a project long ago... I can't recall the ultimate outcome. For the most-part my motors' power-supplies are separate from my circuitry; e.g. separate 5V and 12V outputs, rather than a single 12V output with a 5V regulator attached. Thanks for the reminder if/when I try using the same supply (e.g. a battery). Capacitors/decoupling definitely seems like a good way to go.

  Are you sure? yes | no

davedarko wrote 02/11/2015 at 12:19 point

Yeah, who would have known that it gets more complicated with less power supplies. Meh :( I'm borrowing the capacitor setup of adafruit for the boards now.

  Are you sure? yes | no

esot.eric wrote 02/11/2015 at 16:30 point

Heh, their decoupling is pretty simple, just capacitors... I was imagining needing inductors and such, after that earlier link. You might also try to keep a "star topology" for the power, in this case. I'm having a hard time phrasing it, but: E.G. if you only have one power-input to the PCB, have the motor-drivers' power-supplies (and GND) connected *only* at the power-input, don't connect ICs to this wire/trace... Connect the ICs' Power/GND to this same power-input connector via a *separate* wire/trace. (these two wires are physically/electrically connected, but only connect to each other *at the input from the power-supply*)

  Are you sure? yes | no

davedarko wrote 02/11/2015 at 17:06 point

i think that makes sense in my head, thank you :)

  Are you sure? yes | no