PWM and GPIO and Drivers/Differences and Use Cases?

Okay and Hey There,

It seems I am misreading or mislabeling what is needed.

Does it matter which peripheral I use, GPIO or PWM, for making my motors work?

Does it matter what chip selection is made when I discover the difference in making motors work?

For instance, I have seen both PWM and GPIO work for making motors act up. I have seen other peripherals like UART or i2c work also. But, I am demanding attention be paid to GPIO or PWM in this case…

So, would it be determined that GPIO works and PWM works but only with specific sets of chips selected and specific hardware or is that a myth?

Seth

P.S. I am starting a conversation on the subject. If you handle motors quite often, please do reply. I would like to know different use cases and when to use either one more than the other (GPIO vs. PWM).

Don’t understand the context “making motors actup”. Are you refering to a specific problem?

When controlling a brushless or brushed permanent magment motor, pulse width modulation can be used to control the average DC. By varying the duty cycle (pulse width) you are changing the average DC applied to the motor. The means to do this on the Beaglebone can be with timers and GPIO, or using the EHRPWM’s. These devices can be controlled via Linux OS sysfs interface with overlays. These overlays are setup to use pins P9_14, P9_16, P8_19, and P8_13. The device path is /dev/bone/pwm/1/a, /dev/bone/pwm/1/b, /dev/bone/pwm/2/a, and /dev/bone/pwm/2/b respectively.

The typical frequency for average DC control is 20Khz. This frequency is out of the audible range .

For RC servo control the EHRPWM’s can be used their frequency is set at 50 Hz. with a pulse width of 1-2ms. The servo that is being controlled knows how interpret the information.

1 Like

For an example on how to use the EHRPWM’s on the Beaglebone Black, see the Git repository

Works’ with my BBB with the latest Debian image. No quarantees.

1 Like

I understand some of what you are describing…

act up is just slang or lazy for RPM.

I was unaware of the frequency of an average DC control. So, does it seem normal to handle chips in a way that is leaning towards PWM over GPIO?

I will look over the PWMClass_BBB repo. but I think I am misguiding you on what I actually am trying to get across.

What set of transistor logic would I need to understand to handle an off-board chip selection of PWM over GPIO?

For instance, there is a missing link. I can perform and do things in the beagleboard.org world but not completely with Buildroot and/or a fresh install of Linux.

It is like all the books I read were geared towards children and learning curves. So, I got fed up, bored, and pretended I was smart. I am not so smart (I think).

So anyway, is there some type of transistor logic in the, say L293D, that attempts to allow for PWM usage over GPIO? And this could be a vice versa scenario. It is PWM over GPIO? Or, it is GPIO over PWM?

I know they both can be incorporated in specific hardware but what is this hardware? Let me start with the L293D. It can be controlled via GPIO for a bipolar motor.

Anyway, I hope this makes more sense now. I am performing catch up work and trying to tie pieces together where I am not fully educated in the subject matter.

I have seen source code, the docs.beagleboard.org pages, and there is even a nice portion dedicated to Motors in the docs pages (my favorite subject that gives me the most strain).

Anyway, if you have more time to boast about your understandings, please direct them at me while I am putting pieces together slowly.

I did type up a very long versioning of this “letter” to the editor(s) but I have discarded it and left it with this one instead.

I read about adder logic in gates and other technologies but there is a good portion that I missed that I have not quite placed.

  1. https://www.allaboutcircuits.com/textbook/digital/chpt-3/cmos-gate-circuitry/
  2. Binary Adder with Logic Gates - GeeksforGeeks

So, because I have no real hardware, assuming since I really do not know now, to test. For now for basic logic without getting down to bare technology, I am relying on chips to handle this building of hardware and their internal components are not always a given.

Example One: I read datasheets. I get data from the mfg. TRM and/or datasheets.

Example Two: Within the circuit, so-said selected chip, are some characteristics of what, where, and how but why is not always available. And who has no value since it is actual hardware being discussed (not human).

  • What: What are my values? L293D datasheets state …

Update

Scratch what I am saying. I need to put the pieces together. It seems that, like with the L293D from ti, I am oblivious to the logic within the chip and it is a given. I just understood something from typing a ton of garbage that people may or may not read.

The logic is not for action. The logic is so one can understand what is transpiring within the chip that is being used.

I am eating my own words as I type. Yay.

For instance:

I am silly to use random drivers with no data. If something happens and I do not know why it happened, I really do not learn in this aspect to my conclusive journey. Again, sorry for my antics. I was using hidden data willingly and not liking it. Unlike the L293D, obviously, from ti, not all companies are pushing the agenda of Open Source hardware rightfully.

This is something I am slowly piecing together now.

Update

Thank you for trying with me. Without conclusive data, I am as dumb as I want to be now.

Seth

The problem was with me. I was attempting to push the driver to beyond.

So, it is like this really.

L293D only supports 2A max per channel and that is peak current. 600mA is more like what I can gather…

So, no matter what motors I use, they are all too large and powerful for this driver.

I can juice it to beyond oblivion and still nothing. This was my error in judgment.

I should attempt smaller motors like beforehand when I was learning more. This way, 6v motors have some oomph behind them and the driver is not exceeding output if the EMF backlashes.

Because, like we all know when we learned or was learning, chips only last so long as is…

If I was to push a 3A motor on a L293D with 12v at a random amperage, silly occurs. Lesson learned. Time for more Linux. Oh and outside of these learning tidbits, I knew the entire time. I wanted to get a functioning Bipolar Stepper Motor to behave with random chips that are not suited for such a task.

Seth

P.S. I have been using the ULN2003N from ti also. That is mostly for Unipolar motors which I do not come in contact with currently or ever.

ULN2004A and/or ULQ2004A, both of which I do not carry or have in stock, is what needs to be used for CMOS high inductive loads but it seats at 2.5A per channel.

Argh is the feeling.

Okay. I think I am getting this now.

An Amplifying Feedback Circuit is what one may need to handle amplification. With this AFC (Amplifying Feedback Circuit), one basically gets two resistors and an Op-Amp.

But I was also shown a way to handle that specific circuit after the Alternating Current Generators that is sometimes pushed to the Positive Side of the Op-Amp.

I need to use a Direct Current Generators theory here…

AC is better, less heat loss but it is of a higher voltage. I have DC motors. So, a DC Generators theory here would work for me. Is that called a varistor?

No, it is not. It must have a name or is the Generator a circuit of itself (as usual)?

I know you really like to do these interfaces yourself and learn how they work, but if you’re willing to skip over the grubby implementation details, there are a ton of motor driver boards out there for any kind of motor, for just a couple of bucks.

A very quick google search turned up, for example, a BTS7960 based board that can drive motors up to 27V and 43A with just a gpio connection (if you want full speed) or PWM (if you want speed control). There are many other similar boards.

Gotcha and A-Okay…this is my fault. I see and no quarrels from me.

I just would like to reserve that a generator for DC applications is maybe not the first build I need to take under my belt.

I have used a TLE 5206-2 full H-Bridge, so I can have Bi-Directional motor control. This type of configuration is typically used with velocity or position controlled servos. This part can operate 5A continuous and 6A peak and voltages up to 40V. The 2 inputs are In1 and In2. To I use 74HCT00 Nand gates connected to the inputs. The nand gates are connected to one PWM input from the BBB. Another input is connected to a BBB GPIO pin for directional control. The logic, using the directional input routes the PWM signal accordingly. This device operates on 5V and is suitable for being driven with the 3.3V signals from the BBB.

The LM395D can be configured into a full H bridge for Bi-directional also also since their are 4 in a package.

You could also drive both devices with one EHRPWM with “a and b” signals. You can set the “b” to 0 pulse width, and control the pulse_width “a” from 0 to “PERIOD”, forward. With the “a” set to 0 and controlling the “b” signal for reverse direction.

The LM395D can be used for a stepper motor. Stepper motors use 3 phases that have to be sequenced. In those cases 3 GPIO output pins would be used for a simple unipolar drive.

1 Like

All DC motors have a back EMF (generator). The back EMF simply determines the speed the motor will run at for a given PWM Duty cycle. The inductance of the motor averages, lo-pass filter, the 20KHz signal. The reason for PWM vs. a linear amplifier is heat since the driving transistors are either on or off. Hence the source resistance is very low and 80% of the energy is sent to the motor. Example a 24V motor with a 50% PWM signal with the 24V bridge voltage would be 12V to the motor. The speed

Velocity = 12V*Kemf - Im x Rm – Load current Im and Motor resistance RM, Torque is Kt x Im.

1 Like

I can look on TI’s website for full H-Bridge drivers. I found some but they are of lower amperage allowance.

Hence, why I went with Toshiba. I know @bbbpaul would rather me not start from scratch on this effort and I can take in his best wishes for me and development.

@klindsayjr , thank you for understanding and helping. I can always use some encouragement in processes with building.

It seems if I want larger switching and linear amperage allowances, I will need to do other things first to make sure I fully grasp the subject matter. Right?

For now, I was trying to drive 4A and 3.5A motors with 3.3v and 600mA at 12v. I see why @bbbpaul states what he states regarding me and my building. I hate fighting in public but if I really want to build things, I might have to stick it to @bbbpaul and say something vile.

Until then, everything is kosher and collective. I just, here is some insight, do not want to be the person who does nothing with the hardware I can collect or already have now.

update

for instance, I wanted to build a machine and use a board I have on hand to get going. This would be a long process with little or no support. So, finances are a thing and then there is figuring out everything myself.

Glad to help My background is Electrical Engineering with experience in Feedback control systems. I have uploaded a Motor Control example using the PRU’s on the BBB to github. All my software starts out with Eclipse and Cross Compiled for the Beaglebone. The PRU software use TI’s Code Composer Studio. Being retired I still play around with these devices. I can attach a copy of the schematic I have used for the TLE5206-2 if you would like.

1 Like

No issue. No vile stuff from me.

@klindsayjr , I appreciate you taking time out to make me understand more. I do not need the source code. I appreciate you sharing earlier with the PWM repo you made.

@bbbpaul , I was not acting like destroying myself or anyone else with peripheral access from a beagleboard.org board. It seemed odd to me that you made the leap of directing me so quickly.

I am not upset. It was just odd but I can understand why and for what reasoning you have to make me understand to leave it to professionals.

Speaking of professionals, guys and gals…

  1. If nothing new is being made (older tech and newer alike) to handle what is already available (peripheral access), why can I not try to make something available?
  2. Is it because I can do things with my life and I should follow some protocol I have not seen yet?

I am far from a rebel in the technology field. I am not an up and comer or a person that sits still waiting all day for things to happen. I like to play too!

Seth

P.S. I love the postscript and yes, there is even a post-postscript I have seen a couple of times. It could have been a joke or someone being silly. Anyway, I do appreciate the valuable data you both have shared for me to take in. I am inputting it. I will try to take it but I am alive still and moving around.

What Beaglebone are you using? I wasn’t exposed to Linux until I got a Beaglebone Black. I used a book written by Derek Molloy to learn from. At my old age I love to breadboard stuff and share the results, it gives me purpose.

BBB and BeagleY-AI. Oh and @bbbpaul , sorry for the hoopla. I get overwhelmed and express it for some reason. Blah!

It’s fine, dont worry about it.

I wasnt trying to tell you what to do. We all have our own way of doing things.

1 Like

Thank you. I was getting out of line and for no good cause.