ARDX circuit 3 conflict with circuit 5

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
kashken
 
Posts: 36
Joined: Sat May 14, 2011 10:30 pm

Re: ARDX circuit 3 conflict with circuit 5

Post by kashken »

At this web page:

http://forums.adafruit.com/viewtopic.php?f=31&t=22684

under motor shield discussions, I found:
--------------------------------------------------------------------------------------
Re: Inconsistency in motor-shield-component-list and the corresponding png schematic

Postby adafruit_support » Mon Aug 29, 2011 11:23 am
The shield design has been refined somewhat from the 1.0 schematic. Capacitor values and locations have been been adjusted to provide more effective filtering of noise from the motors. The 0.1uF in parallel to the 100uF on pin 16 is to provide better high-frequency filtering of VCC for the logic part of the IC.
----------------------------------------------------------------------------------------
"...more effective filtering of noise from the motors."

Aha! This seems to represent what I thought. Now, if I can just get someone to point out where that filtering needs to go in circuit 3.

User avatar
chuckm
 
Posts: 159
Joined: Thu Dec 24, 2009 3:31 am

Re: ARDX circuit 3 conflict with circuit 5

Post by chuckm »

Just sort of an FYI, you can use an inductor to connect the motor ground from the Arduino ground. Sort of like:

Code: Select all

 
  |         L1       |
  +-----()()()()-----+
  |                  |
GND           GND (motor)
This gives you a common DC ground but isolates cross conduction of AC signals based on the inductance of the coil.
--Chuck

User avatar
chuckm
 
Posts: 159
Joined: Thu Dec 24, 2009 3:31 am

Re: ARDX circuit 3 conflict with circuit 5

Post by chuckm »

kashken wrote: "...more effective filtering of noise from the motors."

Aha! This seems to represent what I thought. Now, if I can just get someone to point out where that filtering needs to go in circuit 3.
Motor noise is complex. Brushed DC motor noise is even more so. Basically the typical DC motor has a brushes which contact that rotor (which is wound with copper wire) they 'switch' the connection as the motor goes around to keep the rotor's magnetic field out of phase with the stators (usually static) magnetic field. Each time the brushes switch contacts, they are briefly disconnected from anything and the motor is open circuit. If you look at this on an oscilloscope you will see these periodic spikes which are proportional to rotational velocity.

Many guides will say "put a capacitor across the motor terminals to reduce 'brush noise'". The idea being that the capacitor would appear as a short circuit to the high frequency noise being created by the brushes making and breaking contact. The downside is that if the motor is rotating at different velocities, the capacitor you choose will be better at some frequencies and not at others. This noise will find its way on to the power line if you aren't careful to provide some level of 'snubbing' near the motor.

The other source of problems is using pulse width modulation. In this technique to turn the power on and off, varying the duty cycle, to simulate adjusting the voltage being delivered to the motor. This 'works' in part because the motor as an inductive device 'smooths out' sudden changes in current flow (analagous to a capacitor which smooths out sudden changes in voltage). This combines with another interesting property of DC motors, which is that if you spin them they generate a voltage. This voltage is opposite in sign to the voltage needed to drive them the same direction.

Anyway, when you turn the power 'off' during the off part of the duty cycle, these effects conspire in the following way, the voltage flowing through the motor suddenly 'goes negative' because it is acting like a generator, and two the current that had been flowing through ground suddenly goes away. If there is any inductance in the wires providing power to the motor, the ground lead will suddenly have a voltage on it as the magnetic field of that inductance collapses. It may not be much (it will be proportional to the current flow) but it will 'raise' the level of ground with respect to the rest of the circuit. This is called 'ground bounce' and the inductor across the grounds in my other message is there to prevent it from propagating to the digital side.

Given all this, the way to your answer your question is thusly;

If you are driving the motor with a PWM signal it is important that three things are true;
  • The source impedence of the power supply is low enough to provide the nececssary current.
  • The mechanical brush noise is shunted near the motor itself.
  • The wiring between the motor and the power supply should have minimal inductance.
The first one can be achieved by adding a large filter capacitor to the 'front' end of the power supply. You can calculate the current you might draw and the amount of voltage drop you can tolerate and multiply them to get the amount of charge you need to supply that current. Since one ampere of current is 1 columb for one second, if you needed say 1 amp over 45uS then that would be .000045 C of charge. Since charge is capacitance * V, if you can tolerate 1/2 volt drop, you divide the charge by 1/2 (same as multiplying it by 2) and you find that 85 uF of capacitance will carry you. These are just made up numbers to illustrate the thinking, you should figure out how much current your motor is drawing.

The brush noise can be shunted near the motor by using capacitors (remember they resist a sudden change of voltage) and you can use a capacitor connected to ground from each terminal and one across the terminals. The trick here is that you do not want to use a value that would conduct significant current at your PWM frequency, so if you're doing PWM at 1Khz you can use fairly large capacitors but if you PWM at 10Khz you have to make your capacitors suitably smaller or they will become an extra load on the motor driver.

The last one is one that trips up lots of hobbiests because the wireless breadboards have a lot of inductance in them. Use heavier guage wire, running in parallel without any twists. Use an isolation inductor. Keep your wires short. All good techniques to minimize the inductance around the power lines.

Good luck, low noise circuit design is part science and part art. Everything you learn will be valuable later.
--Chuck

User avatar
kashken
 
Posts: 36
Joined: Sat May 14, 2011 10:30 pm

Re: ARDX circuit 3 conflict with circuit 5

Post by kashken »

Chuck:

Thank you for your very well presented response. For a non-electrical engineer, it is very enlightening.

My expectations were not far off. That is, something is needed in ciruit 3 to eliminate, minimize, or control the motor noise. I will try one or two capacitors to see what result is achieved.

At this point I do re-iterate my observation from the motor shield discussion. Something was put in place on the motor shield to address motor noise. I can view the motor shield circuit diagram and to some degree, draw that conclusion. It probably isn't perfect, but it is likely better that what I am experiencing with the ARDX circuit 5 versus circuit 3 considerations. I expect that if I acquire a motor shield and run my motor off of that, and then attach a separate breadboard to run circuit 5, it should work without flashing the LEDs when the motor runs. I have been told that the motor shield running in conjunction with a breadboard attached to the same Arduino, should play nice with the circuit(s) on the breadboard.

I would like to get an indication of which components from the motor shield I should adapt to my implementation of circuit 3 to get an equivalent result. While I have a practical implementation in mind, it is also a learning experience for me, and to that end, the feedback received here is valuable.

User avatar
kashken
 
Posts: 36
Joined: Sat May 14, 2011 10:30 pm

Re: ARDX circuit 3 conflict with circuit 5

Post by kashken »

A quick update:

ARDX circuit 3 comes with a 220 uF capacitor to be used in case the running motor causes the Arduino to reset. It is optional on the breadboard.

I took that capacitor and inserted it in various places (across the VCC/GND on the power rail) throughout the circuit 5 and circuit 3 configuration, to no avail.

Then, I placed it directly on the soldered joints of the motor (where the power lead wires are connected). THAT WORKED! The flashing LEDs stopped flashing. So, an earlier comment about correcting motor noise problems, that it must be done at the motor, is appropriate. So, now to look for motors with noise compensation built-in (or built on).

AdaFruit might want to consider some offerings in that area.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: ARDX circuit 3 conflict with circuit 5

Post by adafruit »

we have never seen any kind of motor with 'build in noise compensation'

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: ARDX circuit 3 conflict with circuit 5

Post by adafruit_support_bill »

we have never seen any kind of motor with 'build in noise compensation'
They are generally not off-the-shelf items, but OEMs can get motors with noise-suppression caps installed. Used to see a lot going into medical instrumentation. They have largely been replaced by brushless DC motors these days but are still used. I pulled one out of a consumer blood-pressure tester a few months ago.

User avatar
chuckm
 
Posts: 159
Joined: Thu Dec 24, 2009 3:31 am

Re: ARDX circuit 3 conflict with circuit 5

Post by chuckm »

I'm with the Adafruit folks on the noise issue. Given the variability of how noise can find its way into a circuit when motors are involved it will rarely be the case where the motor manufacturer will be able to create a noise suppression circuit without know where the motor is going.

That said, if you look at a hobby servo, (say you're trying to convert one to full rotation) you can see how the manufacturer minimized noise based on their circuit. They have the benefit of the entire package (driver + motor) so they can do that, but if you bought the same motor the servo builder used in their servo, you would not find the bypass capacitors installed on it which were in the servo.

Perhaps your issue could be addressed by a discussion of the sources of noise and mitigation strategies in the tutorials. Sadly, in 'real' mechatronics it is impossible create 'cookie cutter' solutions when you're blending electronics, motors, and the real world.

--Chuck

User avatar
kashken
 
Posts: 36
Joined: Sat May 14, 2011 10:30 pm

Re: ARDX circuit 3 conflict with circuit 5

Post by kashken »

In one of my earlier posts, I asked for additional information about the AdaFruit motor shield (how does it handle the motor generated noise; no specific feedback received). While researching this, several posts, including AdaFruit forums and arduino.cc forums, indicated that motor noise must be mitigated or it will get back to the Arduino and could affect its behavior. Mention was made of "decoupling" to address the noise issue (something not yet achieved due to the common ground requirement).

At this web site:

http://itp.nyu.edu/physcomp (Physical Computing at ITP)

I came across the following tutorial:

http://itp.nyu.edu/physcomp/Labs/DCMotorControl (DC Motor Control Using an H-bridge)

This was very enlightening.

At this website:

http://www.freeduino.org (World Famous Index of Arduino & Freeduino Knowledge)

I came across several useful topics, including the following for driving a motor with the L293D H-bridge:

http://luckylarry.co.uk/arduino-project ... l293d-chip

The World Famous index has several good motor references, and Lucky Larry has a couple of good items as well, all worth a read if this topic is of interest.

Now perhaps I have too much information and need to make a decision of which approach to take. The H-bridge (presumably an L293D though others might also work) seems to provide much of what I had expected to find, including multiple motors, varying speed of the motor, changing direction of rotation, independent power supply for the motors (which does not have to be regulated but must match the motor requirements), and seemingly, isolation of the motor noise.

I plan to build one of these circuits and determine if this new configuration will address the flashing LED problem that I have experienced with circuit 5 when it runs in conjunction with a motor circuit.

A lesson learned: Throughout all of this, I have learned much. In particular, I found out that when the Arduino board is powered by a 9 volt battery through the barrel jack, the board pulls out a regulated 5 volts for everything, AND provides that power supply level out through the Vin pin (next to the A0 pin). I had not come across this before. So I did try that approach to power my separate breadboard but the common ground still produces the same result of flashing LEDs for my circuit 5 layout. However, installing a "decoupling" capacitor did reduce the level of flashing, although I cannot say conclusively that this is a solution.

User avatar
kashken
 
Posts: 36
Joined: Sat May 14, 2011 10:30 pm

Re: ARDX circuit 3 conflict with circuit 5

Post by kashken »

One additional note:

The book, Arduino Cookbook from O'Reilly (by Margolis) also covers the H-bridge in chapter 8.

Circuit 5, here I come.

User avatar
kashken
 
Posts: 36
Joined: Sat May 14, 2011 10:30 pm

Re: ARDX circuit 3 conflict with circuit 5

Post by kashken »

Continuing...

I have implemented a circuit using an L293D H-bridge for driving a motor. That breadboard circuit is based on one by LuckyLarry, and is in agreement with what I found in the Arduino cookbook. However, the problem is the same. When the controlling Arduino has a common ground that includes a breadboard with Circuit 5, when the motor is running, the LEDs flash (either direction full speed rotation). I have also included decoupling capacitors across the motor leads to ground.

I did determine that the quality of the motor may also be involved. When the motor simply rests on my desktop or a stack of paper, it does vibrate when running and the LEDs flash. But, if I pick the motor up with my fingers, the flashing subsides though it does not go away completely (my fingers serve as an absorbing cushion for the vibration). If I use my finger and introduce load to the motor by touching the rotating shaft, the flashing returns.

Next step is to try a higher quality motor. Suggestions please? (existing motor came with the ARDX kit, has a big letter J on it)

User avatar
kashken
 
Posts: 36
Joined: Sat May 14, 2011 10:30 pm

Re: ARDX circuit 3 conflict with circuit 5

Post by kashken »

Out of frustration with this project, I took one other step that I didn't think was necessary.

That step was to implement a sketch that not only exercised the L293D circuit, but as an aside, also initialized the circuit 5 chip (the shift register) so it had status and/or a state of operation to maintain (rather than some unknown un-initialized configuration).

With that in place, my L293D configuration runs as expected AND the LEDs no longer flash based on the condition of the running motor. Further, when the circuit 5 portion of the sketch is operational, the LEDs behave as expected. And, I used no de-coupling.

Lesson learned: if you have connected pins, they should be initialized so they have a known state, even if you don't plan to use them (or, physically disconnect them). If you run across something unexpected, there is a reason for it. Now I know the reason for the flashing LEDs. With the pins in a known state, the shift register is not responding to random noise.

On the way to this point, I managed to build a regulated 5 volt power supply, run circuit 3 from a separate breadboard, power that motor circuit with the separate power supply, put together a motor driver circuit breadboard, learn about motor noise, unintended consequences of putting circuits together, use common ground for successful operation, and the small motor with my ARDX kit probably is a pretty decent device after all.

My thanks to everyone for their feedback and help.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”