The L298N H-bridge motor controller module basics

Get an L298N module at Amazon

Oh boy, was I confused about this module at first! I found a fair amount of bits and pieces about it, but could not find the complete info that I was looking for. So I decided to create this tutorial for others who want to understand it better. I’m not an expert, but I have figured it out well enough to make what I think is a very clear and complete basic ‘primer’ on this device. Whether it’s right for your project is up to you to determine, but here’s info about the module itself, and especially about the mysterious jumpers (at least they were the biggest mystery to me).

You can see the data sheet on the ST website here: http://www.st.com/en/motor-drivers/l298.html .

You could just purchase the chip and component parts and wire up your own parts, but this complete module is probably cheaper than the combined parts, and it’s certainly more convenient. As of January, 2017, the modules are selling on ebay for under $2.00! At this price they’re from China of course, but you can purchase them at higher prices in the United States if you can’t wait for the long shipping times from China.

I’ve read in forums that the L298 chip is about 15 or 20 years old, so there are better(?) chips available now. People seem to like the Pololu A4988 https://www.pololu.com/product/1182 .  Stepper motor current limiting is apparently one of the big improvements, but none of the current-limiting chips come in this neat module format that I’m aware of. So this L298N module is fun and handy, certainly great for testing and little projects, but be careful if you need current-limiting features when driving stepper motors.

You can see the Input (IN) pins clearly, and here is a photo of the enable pins with me removing the jumper block. Click the photo to see a larger version.

L298N Truth Table

Get an L298N module at Amazon


Get fun motors with robot wheels.
A tremendous buy!



Get an L298N module at Amazon

Arduino Nano Prep

You can get quite a variety of Arduinos. My favorite is the Nano. Here’s how I get them ready for my projects.

Here’s a source for breadboards on Amazon: http://Amazon: http://amzn.to/2CHpeLK

You can get a set of 3 Arduino Nanos here: http://amzn.to/2mbrbsG .  You’re going to want more than one for more projects, and you’ll probably accidentally destroy one or two of them by connecting the wrong wires, applying too high of voltage, etc.

You can’t beat the price of these Chinese clones, but know that you will need to solder the headers on,  and you may need to download a driver for these Chinese clone boards. See how I do that in my video here: http://mechatronicsworkshop.com/index.php/2017/12/14/arduino-nano-prep/

You can purchase clones with the headers already soldered on if you search for them. Be careful buying clones — these appear to come from a warehouse in the U.S. so shipping is quite fast to the U.S.  But be careful that you don’t buy them from  a supplier who ships from China unless you or ok waiting for three to four weeks to get them delivered.

If you want to pay more and have the headers soldered on and no need to download a driver, go to the Arduino.cc site and purchase the original boards there.

O-ring Drive Belts vs Rubber Bands

For a long time I considered ‘o-ring’ to be the proper terminology for a drive belt in little DIY (do it yourself) animatronic projects. But when trying to purchase some o-ring drive belts, I discovered that the term ‘o-ring’ by itself is technically wrong. O-rings are for sealing things (like valves).

Better terminology when using them to drive things (transfer power from one location to another) is ‘o-ring drive belt’, or even ‘urethane belt’, which most o-ring drive belts are made from. (Rubber bands are made from, well, rubber). (So if you’re searching Google or YouTube for information on o-ring drive belts, you’ll have much better results using the full term instead of just searching for o-rings).

Rubber bands are for holding things together.

Rubber bands do not make great o-ring drive belt replacements, but they can work OK in simple applications.

How to quickly tell the difference between o-rings and rubber bands: O-ring cross-sections are typically round and they stretch some, but not as much or as easily as rubber bands. Rubber bands typically have rectangular cross sections and stretch easily.

Imagine that you have a little hobby toy your are playing with and you are trying to rotate a shaft that is located a few inches away from your drive motor.

If you use a rubber band as the drive belt, the rubber band can ‘store’ energy as it stretches, and then it will finally transfer the power (rotate the shaft) after it has stretched to a certain point. This can make for a very uneven rotation, or it might just slip on the drive or driven shaft before ‘giving up’ its energy and result in complete failure to rotate the shaft at all.

The o-ring drive belt doesn’t stretch like the rubber band so rotation is much smoother. It also maintains its integrity much, much longer than rubber bands, which loose their strength and elasticity fairly soon.

White rubber band, black o-ring shown below.

 

Here’s a little video I made to show the difference in drive smoothness:

Here’s a page with some good information: http://www.applerubber.com/seal-design-guide/special-elastomer-applications/drive-belt.cfm

And here: http://www.durabelt.com/rubber-band-belts.php

 

Ways to Lift Lids (as in opening coffin lids for Halloween props)

I thought I would offer some ideas on different ways to open box lids. My main motivation has been finding a good way for lifting the lid of small Halloween coffin props, but the techniques can be used for many other applications as well.

I love to play around making these things as a hobby, but I need to make smaller versions of these because I don’t have enough room for full-sized ones. Here’s an example of a nice full-sized one by MrTmartindale on YouTube.

Seeing as I was recently playing around with pulleys I thought I would start with probably the most basic way to lift a lid — with a string!

open2a            open3a

There are a lot of potential problems with this arrangement:

It’s visible.

You need to reverse the polarity on the motor for up and down directions.

It takes up a lot of space.

It needs a lot of parts: string, string pulley, pulley support, motor, motor pulley, motor mount, and some way to reverse the motor direction.

More ideas and videos coming soon…

Playing with Pulleys

Today I’m starting to experiment using pulleys. They’re not used all that much in animatronics. I’m guessing it’s because they’re not as strong, predictable, or reliable as gears. But sometimes they can be useful. I see them a lot on the outside of gearboxes like this one, where the inside is chock full of gears (click photos to open larger versions in a new window):

geartrain_3285-15

I’m guessing this is the case when they don’t have room inside a standard  gearbox (if there is such a thing in animatronic toys) and when speed, direction, or power transfer are not critical. Although, I wonder why they just don’t re-design the gearbox to accommodate this arrangement with gears? I have come across two toys where the drive belt has broken and rendered the toy’s animations useless.

Now these little gearboxes are tremendous to use in small animatronics, but it’s not possible for most of us to design our own gearboxes on this small of a scale. So pulleys are one way to drive our own hobby animatronics.

Enter my beginning learning design!

hobby motor and pulley

The first thing I had to do was get myself a little hobby motor. They are easy to find in just about any animated toy. They are pretty generic can usually run on anything from 1-1/2 to 6 volts DC or so. The problem with using just the motor is that they spin way too fast (around 10,000 RPM), and they have no power. Gears, or pulleys, are used to slow down the rotation and increase power.

To be continued

Using Arduino Nano and a relay to fire a solenoid

In my previous post I talked about using a motor, a cam, and a switch to fire a solenoid. That just wasn’t going to work because it was too hard to get the right pace of the solenoid firing. The motor voltage changed its speed, and it was too difficult to adjust the cam shape and to fire the solenoid properly.

In this post I’m showing how I used the Arduino Nano to control the firing rate of the solenoid instead of a rotating cam. With the Arduino, it’s a 30-second program change to adjust the rate of the solenoid firing as opposed to the ridiculously difficult process with motor and cams.

The video below shows the solenoid firing once per second by using the default settings in the sample ‘Blink’ program that is included with the Arduino. Then I made a simple program change in the Arduino to speed up the solenoid. This is soooo much easier than cams and motors!

Some motor and switch mounting ideas

Trying to find a way to mount things like motors, solenoids and switches is often a big challenge. Trying to find the right bracket, the right screws, and the right locations for those items in your experimental projects can be tough.

So I thought I’d show a few tips and tricks that I use.

First, my goal: I was trying to set up a little solenoid to bang against a miniature box to make a ‘chattering’ effect for a mini ‘monster in a box’ project, kind of like this Halloween monster in a box video (fast forward to about 1 min, 25 seconds to see the box chatter).

I started by experimenting with a little hobby motor. It wasn’t powerful enough to attach a cam straight away to rattle the box on its own so I had to find gears or levers, or something, to get some mechanical advantage.

The box in the video uses a cam attached to an electric drill, but I wanted something much smaller for my little project.

I started out using a cam to trigger a micro switch, which would energize a solenoid in rapid succession. (See my next post to see the solenoid fire.)

Instead of trying to find the right size and shape of a motor mount for my initial testing of things, I just used hot glue to secure some little blocks of wood to my test base (a 12″ square piece of press board). Then I put a little dab of hot glue on the motor and on the micro switch to secure them to the proper height of wood blocks.

Click on the photos to see larger versions.

50b-2

Using blocks of wood is a fantastically simple way to make the right heights and locations. I was able to put away my box of sheet metal, tin snips, and other miscellaneous hard-to-use metal mounting hardware!

You can see my little blue cam that I also used hot glue for. I glued it to the motor shaft for a temporary attachment. Hitting the switch with the first cam — the brown pointy one you can see laying there — didn’t keep the switch activated long enough to fire the solenoid properly so I made the blue cam that kept the switch activated for about 5 times as long.The hot glue made it very easy to swap cams and re-glue.

The motor rotates at 300 to 600 RPM depending on the voltage applied (3 to 6 volts). That was way too fast with either cam, so I had to find another solution (see my post about using the Arduino instead of a motor). But the mounting techniques of wood blocks and hot glue have been a big headache-reliever for me over trying to find or fabricate metal mounts.

50-1

 

 

Save

Save

Save

Save

Save

Save

Save

Save

Save

Save